casa
$Rev:20696$
|
00001 //# LatticeAsMarker.h: Class to display a lattice as markers 00002 //# Copyright (C) 1996,1997,1998,1999,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_LATTICEASMARKER_H 00029 #define TRIALDISPLAY_LATTICEASMARKER_H 00030 00031 //# aips includes: 00032 #include <casa/aips.h> 00033 #include <casa/Quanta/Unit.h> 00034 00035 //# trial includes: 00036 #include <images/Images/ImageInterface.h> 00037 00038 //# display library includes: 00039 #include <display/DisplayDatas/LatticePADD.h> 00040 00041 namespace casa { //# NAMESPACE CASA - BEGIN 00042 00043 //# forwards: 00044 template <class T> class Array; 00045 class IPosition; 00046 class Record; 00047 template <class T> class LatticePADMMarker; 00048 00049 // <summary>Class to manage the drawing of vector maps of slices from AIPS++ Lattices</summary> 00050 // 00051 // <use visibility=export> 00052 // 00053 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00054 // </reviewed> 00055 // 00056 // <prerequisite> 00057 // <li> <linkto class="LatticePADisplayData">LatticePADisplayData</linkto> 00058 // <li> <linkto class="DisplayData">DisplayData</linkto> 00059 // </prerequisite> 00060 // 00061 // <etymology> 00062 // From Lattice and Marker (shape) 00063 // </etymology> 00064 // 00065 // <synopsis> 00066 // The purpose of this class is to draw pixels as markers such as squares 00067 // where the size of the marker reflects the pixel value. 00068 // Presently only squares are available. Positive values 00069 // get solid squares, negative values open squares. 00070 // 00071 // At construction, any axes in the data can be mapped to the X and Y 00072 // axes of the display device (see the <linkto 00073 // class="PrincipalAxesDD">PrincipalAxesDD</linkto> class). For data 00074 // with more than two dimensions, a third axis in the dataset can be 00075 // selected for generating a sequence of maps along: this is known 00076 // as the "movie" axis. Animation (see the <linkto 00077 // class="Animator">Animator</linkto> class) will cause different 00078 // slices of the data to be selected from along this axis. After 00079 // construction, the axis settings of a LatticeAsMarker object can be 00080 // modified at a later stage. 00081 // 00082 //# </synopsis> 00083 // 00084 // <example> 00085 // A LatticeAsMarker object could be constructed and used as follows: 00086 // <srcblock> 00087 // PagedImage<Complex> *pimage = new PagedImage<Complex>(String("test.im")); 00088 // DisplayData *dd; 00089 // uInt ndim = pimage->ndim(); 00090 // if (ndim < 2) { 00091 // throw(AipsError(String("Image has less than two dimensions"))); 00092 // } else if (ndim == 2) { 00093 // dd = (DisplayData *)(new LatticeAsMarker<Complex>(pimage, 0, 1)); 00094 // } else { 00095 // IPosition fixedPos(ndim); 00096 // fixedPos = 0; 00097 // dd = (DisplayData *)(new LatticeAsMarker<Complex>(pimage, 0, 1, 2,fixedPos)); 00098 // } 00099 // // wcHolder is an existing WorldCanvasHolder *... 00100 // wcHolder->addDisplayData(ddata); 00101 // wcHolder->refresh(); 00102 // </srcblock> 00103 // </example> 00104 // 00105 // <motivation> 00106 // Displaying 2-dimensional slices of a lattice-based data volume is 00107 // a standard display requirement for astronomical data visualization 00108 // and presentation. 00109 // </motivation> 00110 // 00111 // <templating arg=T> 00112 // </templating> 00113 // 00114 // <thrown> 00115 // </thrown> 00116 // 00117 // <todo asof="2001/11/15"> 00118 // We need a comprehensive set of marker shapes defined by 00119 // an enum and implemented on the pixel canvas with native 00120 // DL functions. 00121 // </todo> 00122 00123 template <class T> class LatticeAsMarker : public LatticePADisplayData<T> { 00124 00125 public: 00126 // Array-based constructors: >2d and 2d. xAxis and yAxis specify 00127 // which axis in the array (0-based) should be mapped to X and Y 00128 // on the display device: ie. 2-d slices of the data to be displayed 00129 // have these axes. mAxis specifies the "movie" axis, which is the axis 00130 // along which different slices are taken. fixedPos is an IPosition 00131 // having the same length as the number of dimensions in the array, 00132 // and indicate the fixed axis values for axes in the data that are 00133 // not specified as xAxis, yAxis or mAxis. 00134 // <group> 00135 LatticeAsMarker(Array<T>* array, const uInt xAxis, 00136 const uInt yAxis, const uInt mAxis, 00137 const IPosition fixedPos); 00138 LatticeAsMarker(Array<T>* array, const uInt xAxis, 00139 const uInt yAxis); 00140 // </group> 00141 00142 // Image-based constructors: >2d and 2d. xAxis and yAxis specify 00143 // which axis in the image (0-based) should be mapped to X and Y 00144 // on the display device: ie. 2-d slices of the data to be displayed 00145 // have these axes. mAxis specifies the "movie" axis, which is the axis 00146 // along which different slices are taken. fixedPos is an IPosition 00147 // having the same length as the number of dimensions in the image, 00148 // and indicate the fixed axis values for axes in the data that are 00149 // not specified as xAxis, yAxis or mAxis. 00150 // <group> 00151 LatticeAsMarker(ImageInterface<T>* image, const uInt xAxis, 00152 const uInt yAxis, const uInt mAxis, 00153 const IPosition fixedPos); 00154 LatticeAsMarker(ImageInterface<T>* image, const uInt xAxis, 00155 const uInt yAxis); 00156 // </group> 00157 00158 // Destructor 00159 virtual ~LatticeAsMarker(); 00160 00161 // Create the various elements in the sequence of displayable 00162 // maps. This is called upon construction as well as whenever 00163 // the display and/or movie axes are changed via a call to 00164 // PrincipalAxesDD::setAxes. 00165 //virtual void setupElements(IPosition fixedPos = IPosition(2)); 00166 virtual void setupElements(); 00167 00168 // install the default options for display 00169 virtual void setDefaultOptions(); 00170 00171 // Apply the options stored in the provided Record to the 00172 // LatticeAsMarker object. If the return value is True, then 00173 // some options have changed, and a refresh is needed to update 00174 // the display. 00175 virtual Bool setOptions(Record& rec, Record& recOut); 00176 00177 // Retrieve the currently set options, and their types, default 00178 // values, and any help text associated with each parameter. This 00179 // information can be used to generate form-type graphical user 00180 // interfaces or command-line interfaces to set the options with 00181 // prompts. 00182 virtual Record getOptions(); 00183 00184 // Return the DisplayData type; used by the WorldCanvasHolder to 00185 // determine the order of drawing. 00186 virtual Display::DisplayDataType classType() { return Display::Vector;} 00187 00188 // class name 00189 virtual String className() { return String("LatticeAsMarker");} 00190 00191 00192 private: 00193 Float itsScale; // Amplitude scale factor 00194 Float itsLineWidth; // Line width of vectors 00195 Int itsIncX; // Increment in X (pixels) 00196 Int itsIncY; // Increment in Y (pixels) 00197 String itsColor; // Color of vectors 00198 String itsMarker; // Marker shape (should use an enum when we have some more) 00199 // 00200 friend class LatticePADMMarker<T>; 00201 00202 //# Make parent members known. 00203 public: 00204 using LatticePADisplayData<T>::nelements; 00205 using LatticePADisplayData<T>::nPixelAxes; 00206 using LatticePADisplayData<T>::fixedPosition; 00207 using LatticePADisplayData<T>::displayAxes; 00208 using LatticePADisplayData<T>::dataShape; 00209 using LatticePADisplayData<T>::getMinAndMax; 00210 using LatticePADisplayData<T>::readOptionRecord; 00211 protected: 00212 using LatticePADisplayData<T>::setNumImages; 00213 using LatticePADisplayData<T>::DDelement; 00214 }; 00215 00216 00217 } //# NAMESPACE CASA - END 00218 00219 #ifndef AIPS_NO_TEMPLATE_SRC 00220 #include <display/DisplayDatas/LatticeAsMarker.tcc> 00221 #endif //# AIPS_NO_TEMPLATE_SRC 00222 #endif