00001 //# Histogram2dDD.h: 2d histogram DisplayData 00002 //# Copyright (C) 2000,2001,2002 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id$ 00027 00028 #ifndef TRIALDISPLAY_HISTOGRAM2DDD_H 00029 #define TRIALDISPLAY_HISTOGRAM2DDD_H 00030 00031 #include <casa/aips.h> 00032 #include <lattices/Lattices/Lattice.h> 00033 #include <lattices/Lattices/MaskedLattice.h> 00034 #include <display/DisplayDatas/ActiveCaching2dDD.h> 00035 00036 namespace casa { //# NAMESPACE CASA - BEGIN 00037 00038 template <class T> class ImageInterface; 00039 template <class T> class LatticeStatistics; 00040 template <class T> class LatticeHistograms; 00041 class Histogram2dDM; 00042 00043 // <summary> 00044 // A DisplayData to draw histograms 00045 // </summary> 00046 // 00047 // <use visibility=export> 00048 // 00049 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00050 // </reviewed> 00051 // 00052 // <prerequisite> 00053 // <li> DisplayData 00054 // <li> CachingDisplayData 00055 // <li> ActiveCaching2dDD 00056 // </prerequisite> 00057 // 00058 // <etymology> 00059 // </etymology> 00060 // <synopsis> 00061 // 00062 // </synopsis> 00063 00064 class Histogram2dDD : public ActiveCaching2dDD { 00065 00066 public: 00067 00068 // Constructor taking a pointer to an already constructed 00069 // ImageInterface. 00070 Histogram2dDD(const ImageInterface<Float> *image); 00071 00072 // Constructor taking a pointer to an already constructed Table, 00073 // and a String indicating a column name. 00074 //Histogram2dDD(const Table *table, const String column); 00075 00076 // Constructor taking a pointer to an Array. 00077 //Histogram2dDD(const Array<Float> *array); 00078 00079 // Destructor. 00080 virtual ~Histogram2dDD(); 00081 00082 // Return the data unit. 00083 virtual const Unit dataUnit(); 00084 00085 // Format the histogram value at the given world position. 00086 virtual String showValue(const Vector<Double> &world); 00087 00088 // Install the default options for this DisplayData. 00089 virtual void setDefaultOptions(); 00090 00091 // Apply options stored in <src>rec</src> to the DisplayData. A 00092 // return value of <src>True</src> means a refresh is needed. 00093 // <src>recOut</src> contains any fields which were implicitly 00094 // changed as a result of the call to this function. 00095 virtual Bool setOptions(Record &rec, Record &recOut); 00096 00097 // Retrieve the current and default options and parameter types. 00098 virtual Record getOptions( bool scrub=false ) const; 00099 00100 // Return the type of this DisplayData. 00101 virtual Display::DisplayDataType classType() { 00102 return Display::CanvasAnnotation; 00103 } 00104 00105 // Create a new AxesDisplayMethod for drawing on the given 00106 // WorldCanvas when the AttributeBuffers are suitably matched to the 00107 // current state of this DisplayData and of the WorldCanvas/Holder. 00108 // The tag is a unique number used to identify the age of the newly 00109 // constructed CachingDisplayMethod. 00110 virtual CachingDisplayMethod *newDisplayMethod(WorldCanvas *worldCanvas, 00111 AttributeBuffer *wchAttributes, 00112 AttributeBuffer *ddAttributes, 00113 CachingDisplayData *dd); 00114 00115 // Return the current options of this DisplayData as an 00116 // AttributeBuffer. 00117 virtual AttributeBuffer optionsAsAttributes(); 00118 00119 // Provide read-only access to the Lattice. 00120 const Lattice<Float> &lattice() const { 00121 return *itsMaskedLattice; 00122 } 00123 00124 // Provide read-only access to the MaskedLattce. 00125 const MaskedLattice<Float> &maskedLattice() const { 00126 return *itsMaskedLattice; 00127 } 00128 00129 protected: 00130 00131 // (Required) default constructor. 00132 Histogram2dDD(); 00133 00134 // (Required) copy constructor. 00135 Histogram2dDD(const Histogram2dDD &other); 00136 00137 // (Required) copy assignment. 00138 void operator=(const Histogram2dDD &other); 00139 00140 private: 00141 00142 friend class Histogram2dDM; 00143 00144 // The base image cloned at construction. 00145 ImageInterface<Float> *itsBaseImage; 00146 00147 // The masked lattice, effectively referencing one of itsBaseImage, 00148 // ... 00149 MaskedLattice<Float> *itsMaskedLattice; 00150 00151 // Object to use for calculating statistics. 00152 LatticeStatistics<Float> *itsLatticeStatistics; 00153 00154 // Object ot use for calculating histograms. 00155 LatticeHistograms<Float> *itsLatticeHistograms; 00156 00157 }; 00158 00159 00160 } //# NAMESPACE CASA - END 00161 00162 #endif