casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Histogram2dDD.h
Go to the documentation of this file.
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();
00099 
00100   // Return the type of this DisplayData.
00101   virtual Display::DisplayDataType classType()
00102     { return Display::CanvasAnnotation; }
00103   
00104   // Create a new AxesDisplayMethod for drawing on the given
00105   // WorldCanvas when the AttributeBuffers are suitably matched to the
00106   // current state of this DisplayData and of the WorldCanvas/Holder.
00107   // The tag is a unique number used to identify the age of the newly
00108   // constructed CachingDisplayMethod.
00109   virtual CachingDisplayMethod *newDisplayMethod(WorldCanvas *worldCanvas,
00110                                          AttributeBuffer *wchAttributes,
00111                                          AttributeBuffer *ddAttributes,
00112                                          CachingDisplayData *dd);
00113  
00114   // Return the current options of this DisplayData as an
00115   // AttributeBuffer.
00116   virtual AttributeBuffer optionsAsAttributes();
00117 
00118   // Provide read-only access to the Lattice.
00119   const Lattice<Float> &lattice() const 
00120     { return *itsMaskedLattice; }
00121 
00122   // Provide read-only access to the MaskedLattce.
00123   const MaskedLattice<Float> &maskedLattice() const
00124     { return *itsMaskedLattice; }
00125 
00126  protected:
00127 
00128   // (Required) default constructor.
00129   Histogram2dDD();
00130 
00131   // (Required) copy constructor.
00132   Histogram2dDD(const Histogram2dDD &other);
00133 
00134   // (Required) copy assignment.
00135   void operator=(const Histogram2dDD &other);
00136 
00137  private:
00138 
00139   friend class Histogram2dDM;
00140 
00141   // The base image cloned at construction.
00142   ImageInterface<Float> *itsBaseImage;
00143 
00144   // The masked lattice, effectively referencing one of itsBaseImage,
00145   // ...
00146   MaskedLattice<Float> *itsMaskedLattice;
00147 
00148   // Object to use for calculating statistics.
00149   LatticeStatistics<Float> *itsLatticeStatistics;
00150 
00151   // Object ot use for calculating histograms.
00152   LatticeHistograms<Float> *itsLatticeHistograms;
00153 
00154 };
00155 
00156 
00157 } //# NAMESPACE CASA - END
00158 
00159 #endif