casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LatticeAsVector.h
Go to the documentation of this file.
1 //# LatticeAsVector.h: Class to display data as a vector map
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef TRIALDISPLAY_LATTICEASVECTOR_H
29 #define TRIALDISPLAY_LATTICEASVECTOR_H
30 
31 //# aips includes:
32 #include <casa/aips.h>
33 #include <casa/Quanta/Unit.h>
34 
35 //# trial includes:
37 
38 //# display library includes:
40 
41 namespace casacore{
42 
43  template <class T> class Array;
44  class IPosition;
45  class Record;
46 }
47 
48 namespace casa { //# NAMESPACE CASA - BEGIN
49 
50 //# forwards:
51  template <class T> class LatticePADMVector;
52 
53 // <summary>Class to manage the drawing of vector maps of slices from AIPS++ Lattices</summary>
54 //
55 // <use visibility=export>
56 //
57 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
58 // </reviewed>
59 //
60 // <prerequisite>
61 // <li> <linkto class="LatticePADisplayData">LatticePADisplayData</linkto>
62 // <li> <linkto class="DisplayData">DisplayData</linkto>
63 // </prerequisite>
64 //
65 // <etymology>
66 // The purpose of this class is to draw vectors maps of data that
67 // is lattice-based.
68 // </etymology>
69 //
70 // <synopsis>
71 // This class should be used to display vector maps---i.e.
72 // lines with an amplitude and position angle
73 // for two-dimensional slices of data extracted from AIPS++ Lattices or
74 // Arrays having two or more dimensions. The data source can be Complex
75 // or Float. If casacore::Complex, then both the amplitude and position angle
76 // can be extracted. If casacore::Float, the data represents the position angle
77 // (degrees) and an amplitude of unity is assumed.
78 // I
79 //
80 // At construction, any axes in the data can be mapped to the X and Y
81 // axes of the display device (see the <linkto
82 // class="PrincipalAxesDD">PrincipalAxesDD</linkto> class). For data
83 // with more than two dimensions, a third axis in the dataset can be
84 // selected for generating a sequence of maps along: this is known
85 // as the "movie" axis. Animation (see the <linkto
86 // class="Animator">Animator</linkto> class) will cause different
87 // slices of the data to be selected from along this axis. After
88 // construction, the axis settings of a LatticeAsVector object can be
89 // modified at a later stage.
90 //
91 //# </synopsis>
92 //
93 // <example>
94 // A LatticeAsVector object could be constructed and used as follows:
95 // <srcblock>
96 // casacore::PagedImage<casacore::Complex> *pimage = new casacore::PagedImage<casacore::Complex>(casacore::String("test.im"));
97 // DisplayData *dd;
98 // casacore::uInt ndim = pimage->ndim();
99 // if (ndim < 2) {
100 // throw(casacore::AipsError(casacore::String("Image has less than two dimensions")));
101 // } else if (ndim == 2) {
102 // dd = (DisplayData *)(new LatticeAsVector<casacore::Complex>(pimage, 0, 1));
103 // } else {
104 // casacore::IPosition fixedPos(ndim);
105 // fixedPos = 0;
106 // dd = (DisplayData *)(new LatticeAsVector<casacore::Complex>(pimage, 0, 1, 2,fixedPos));
107 // }
108 // // wcHolder is an existing WorldCanvasHolder *...
109 // wcHolder->addDisplayData(ddata);
110 // wcHolder->refresh();
111 // </srcblock>
112 // </example>
113 //
114 // <motivation>
115 // Displaying 2-dimensional slices of a lattice-based data volume is
116 // a standard display requirement for astronomical data visualization
117 // and presentation.
118 // </motivation>
119 //
120 // <templating arg=T>
121 // </templating>
122 //
123 // <thrown>
124 // </thrown>
125 //
126 // <todo asof="2000/12/16">
127 // </todo>
128 
129  template <class T> class LatticeAsVector : public LatticePADisplayData<T> {
130 
131  public:
132  // casacore::Array-based constructors: >2d and 2d. xAxis and yAxis specify
133  // which axis in the array (0-based) should be mapped to X and Y
134  // on the display device: ie. 2-d slices of the data to be displayed
135  // have these axes. mAxis specifies the "movie" axis, which is the axis
136  // along which different slices are taken. fixedPos is an IPosition
137  // having the same length as the number of dimensions in the array,
138  // and indicate the fixed axis values for axes in the data that are
139  // not specified as xAxis, yAxis or mAxis.
140  // <group>
142  const casacore::uInt yAxis, const casacore::uInt mAxis,
143  const casacore::IPosition fixedPos);
145  const casacore::uInt yAxis);
146  // </group>
147 
148  // Image-based constructors: >2d and 2d. xAxis and yAxis specify
149  // which axis in the image (0-based) should be mapped to X and Y
150  // on the display device: ie. 2-d slices of the data to be displayed
151  // have these axes. mAxis specifies the "movie" axis, which is the axis
152  // along which different slices are taken. fixedPos is an IPosition
153  // having the same length as the number of dimensions in the image,
154  // and indicate the fixed axis values for axes in the data that are
155  // not specified as xAxis, yAxis or mAxis.
156  // <group>
157  LatticeAsVector(std::shared_ptr<casacore::ImageInterface<T> > image, const casacore::uInt xAxis,
158  const casacore::uInt yAxis, const casacore::uInt mAxis,
159  const casacore::IPosition fixedPos);
160  LatticeAsVector(std::shared_ptr<casacore::ImageInterface<T> > image, const casacore::uInt xAxis,
161  const casacore::uInt yAxis);
162  // </group>
163 
164  // Destructor
165  virtual ~LatticeAsVector();
166 
167  // Create the various elements in the sequence of displayable
168  // maps. This is called upon construction as well as whenever
169  // the display and/or movie axes are changed via a call to
170  // PrincipalAxesDD::setAxes.
171  //virtual void setupElements(casacore::IPosition fixedPos = casacore::IPosition(2));
172  virtual void setupElements();
173 
174  // install the default options for display
175  virtual void setDefaultOptions();
176 
177  // Apply the options stored in the provided casacore::Record to the
178  // LatticeAsVector object. If the return value is true, then
179  // some options have changed, and a refresh is needed to update
180  // the display.
182 
183  // Retrieve the currently set options, and their types, default
184  // values, and any help text associated with each parameter. This
185  // information can be used to generate form-type graphical user
186  // interfaces or command-line interfaces to set the options with
187  // prompts.
188  virtual casacore::Record getOptions( bool scrub=false ) const;
189 
190  // Return the DisplayData type; used by the WorldCanvasHolder to
191  // determine the order of drawing.
193  return Display::Vector;
194  }
195 
196  // class name
197  virtual casacore::String className() const {
198  return casacore::String("LatticeAsVector");
199  }
200 
201  // Value of the casacore::Lattice at a position--used by showValue(). Overrides
202  // base version to take user-controlled addition to phase angle into account.
203  virtual /*const*/ T dataValue(casacore::IPosition pos);
204 
205  private:
206 
208 //
209  casacore::Float itsScale; // Amplitude scale factor
210  casacore::Float itsLineWidth; // Line width of vectors
211  casacore::Int itsIncX; // Increment in X (pixels)
212  casacore::Int itsIncY; // Increment in Y (pixels)
213  casacore::Bool itsArrow; // Do vectors have arrow head ?
214  casacore::Float itsBarb; // Arrow head shape
215  casacore::String itsColor; // Color of vectors
216  casacore::Float itsRotation; // Add extra rotation
217  casacore::String itsPhaseType; // phase handling type (normal/polarimetric)
218  casacore::Bool itsDebias; // Debias amplitude ?
219  casacore::Float itsVar; // Variance of noise for debiasing
220  casacore::Unit itsUnits; // Image brightness units
221  casacore::Bool itsConstAmp; // SHow as constant amplitude
222 //
223  friend class LatticePADMVector<T>;
224 
225  //# Make parent members known.
226  public:
234  protected:
238  };
239 
240 
241 //# Define template specializations.
244 
245 
246 
247 } //# NAMESPACE CASA - END
248 
249 #ifndef AIPS_NO_TEMPLATE_SRC
250 #include <display/DisplayDatas/LatticeAsVector.tcc>
251 //#include <display/DisplayDatas/LatticeAsVector2.tcc>
252 #endif //# AIPS_NO_TEMPLATE_SRC
253 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
int Int
Definition: aipstype.h:50
virtual void setupElements()
Create the various elements in the sequence of displayable maps.
Class to manage the drawing of vector maps of slices from AIPS++ Lattices.
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Definition: ExprNode.h:1886
casacore::String itsPhaseType
DisplayDataType
WorldCanvasHolder - what type of DisplayData is this, need to know for drawing order.
Definition: DisplayEnums.h:355
casacore::Bool itsConstAmp
virtual casacore::Record getOptions(bool scrub=false) const
Retrieve the currently set options, and their types, default values, and any help text associated wit...
virtual casacore::Bool setOptions(casacore::Record &rec, casacore::Record &recOut)
Apply the options stored in the provided casacore::Record to the LatticeAsVector object.
casacore::String itsColor
virtual casacore::String className() const
class name
virtual ~LatticeAsVector()
Destructor.
casacore::Bool itsArrow
casacore::Float getVariance()
Class to draw a single vector map of a slice from an AIPS++ Lattice.
defines physical units
Definition: Unit.h:189
virtual T dataValue(casacore::IPosition pos)
Value of the casacore::Lattice at a position–used by showValue().
A base class for astronomical images.
casacore::Unit itsUnits
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Float itsBarb
float Float
Definition: aipstype.h:54
Partial implementation of PrincipalAxesDD for casacore::Lattice-based data.
template &lt;class T, class U&gt; class vector;
Definition: MSFlagger.h:37
virtual Display::DisplayDataType classType()
Return the DisplayData type; used by the WorldCanvasHolder to determine the order of drawing...
casacore::Bool itsDebias
casacore::Float itsRotation
casacore::Float itsVar
casacore::Vector data - can go next
Definition: DisplayEnums.h:359
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Float itsScale
LatticeAsVector(casacore::Array< T > *array, const casacore::uInt xAxis, const casacore::uInt yAxis, const casacore::uInt mAxis, const casacore::IPosition fixedPos)
casacore::Array-based constructors: &gt;2d and 2d.
virtual void setDefaultOptions()
install the default options for display
unsigned int uInt
Definition: aipstype.h:51
casacore::Float itsLineWidth
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42