casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LatticeAsMarker.h
Go to the documentation of this file.
1 //# LatticeAsMarker.h: Class to display a lattice as markers
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002
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_LATTICEASMARKER_H
29 #define TRIALDISPLAY_LATTICEASMARKER_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 LatticePADMMarker;
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 // From casacore::Lattice and Marker (shape)
67 // </etymology>
68 //
69 // <synopsis>
70 // The purpose of this class is to draw pixels as markers such as squares
71 // where the size of the marker reflects the pixel value.
72 // Presently only squares are available. Positive values
73 // get solid squares, negative values open squares.
74 //
75 // At construction, any axes in the data can be mapped to the X and Y
76 // axes of the display device (see the <linkto
77 // class="PrincipalAxesDD">PrincipalAxesDD</linkto> class). For data
78 // with more than two dimensions, a third axis in the dataset can be
79 // selected for generating a sequence of maps along: this is known
80 // as the "movie" axis. Animation (see the <linkto
81 // class="Animator">Animator</linkto> class) will cause different
82 // slices of the data to be selected from along this axis. After
83 // construction, the axis settings of a LatticeAsMarker object can be
84 // modified at a later stage.
85 //
86 //# </synopsis>
87 //
88 // <example>
89 // A LatticeAsMarker object could be constructed and used as follows:
90 // <srcblock>
91 // casacore::PagedImage<casacore::Complex> *pimage = new casacore::PagedImage<casacore::Complex>(casacore::String("test.im"));
92 // DisplayData *dd;
93 // casacore::uInt ndim = pimage->ndim();
94 // if (ndim < 2) {
95 // throw(casacore::AipsError(casacore::String("Image has less than two dimensions")));
96 // } else if (ndim == 2) {
97 // dd = (DisplayData *)(new LatticeAsMarker<casacore::Complex>(pimage, 0, 1));
98 // } else {
99 // casacore::IPosition fixedPos(ndim);
100 // fixedPos = 0;
101 // dd = (DisplayData *)(new LatticeAsMarker<casacore::Complex>(pimage, 0, 1, 2,fixedPos));
102 // }
103 // // wcHolder is an existing WorldCanvasHolder *...
104 // wcHolder->addDisplayData(ddata);
105 // wcHolder->refresh();
106 // </srcblock>
107 // </example>
108 //
109 // <motivation>
110 // Displaying 2-dimensional slices of a lattice-based data volume is
111 // a standard display requirement for astronomical data visualization
112 // and presentation.
113 // </motivation>
114 //
115 // <templating arg=T>
116 // </templating>
117 //
118 // <thrown>
119 // </thrown>
120 //
121 // <todo asof="2001/11/15">
122 // We need a comprehensive set of marker shapes defined by
123 // an enum and implemented on the pixel canvas with native
124 // DL functions.
125 // </todo>
126 
127  template <class T> class LatticeAsMarker : public LatticePADisplayData<T> {
128 
129  public:
130  // casacore::Array-based constructors: >2d and 2d. xAxis and yAxis specify
131  // which axis in the array (0-based) should be mapped to X and Y
132  // on the display device: ie. 2-d slices of the data to be displayed
133  // have these axes. mAxis specifies the "movie" axis, which is the axis
134  // along which different slices are taken. fixedPos is an IPosition
135  // having the same length as the number of dimensions in the array,
136  // and indicate the fixed axis values for axes in the data that are
137  // not specified as xAxis, yAxis or mAxis.
138  // <group>
140  const casacore::uInt yAxis, const casacore::uInt mAxis,
141  const casacore::IPosition fixedPos);
143  const casacore::uInt yAxis);
144  // </group>
145 
146  // Image-based constructors: >2d and 2d. xAxis and yAxis specify
147  // which axis in the image (0-based) should be mapped to X and Y
148  // on the display device: ie. 2-d slices of the data to be displayed
149  // have these axes. mAxis specifies the "movie" axis, which is the axis
150  // along which different slices are taken. fixedPos is an IPosition
151  // having the same length as the number of dimensions in the image,
152  // and indicate the fixed axis values for axes in the data that are
153  // not specified as xAxis, yAxis or mAxis.
154  // <group>
155  LatticeAsMarker(std::shared_ptr<casacore::ImageInterface<T> > image, const casacore::uInt xAxis,
156  const casacore::uInt yAxis, const casacore::uInt mAxis,
157  const casacore::IPosition fixedPos);
158  LatticeAsMarker(std::shared_ptr<casacore::ImageInterface<T> > image, const casacore::uInt xAxis,
159  const casacore::uInt yAxis);
160  // </group>
161 
162  // Destructor
163  virtual ~LatticeAsMarker();
164 
165  // Create the various elements in the sequence of displayable
166  // maps. This is called upon construction as well as whenever
167  // the display and/or movie axes are changed via a call to
168  // PrincipalAxesDD::setAxes.
169  //virtual void setupElements(casacore::IPosition fixedPos = casacore::IPosition(2));
170  virtual void setupElements();
171 
172  // install the default options for display
173  virtual void setDefaultOptions();
174 
175  // Apply the options stored in the provided casacore::Record to the
176  // LatticeAsMarker object. If the return value is true, then
177  // some options have changed, and a refresh is needed to update
178  // the display.
180 
181  // Retrieve the currently set options, and their types, default
182  // values, and any help text associated with each parameter. This
183  // information can be used to generate form-type graphical user
184  // interfaces or command-line interfaces to set the options with
185  // prompts.
186  virtual casacore::Record getOptions( bool scrub=false ) const;
187 
188  // Return the DisplayData type; used by the WorldCanvasHolder to
189  // determine the order of drawing.
191  return Display::Vector;
192  }
193 
194  // class name
195  virtual casacore::String className() const {
196  return casacore::String("LatticeAsMarker");
197  }
198 
199 
200  private:
201  casacore::Float itsScale; // Amplitude scale factor
202  casacore::Float itsLineWidth; // Line width of vectors
203  casacore::Int itsIncX; // Increment in X (pixels)
204  casacore::Int itsIncY; // Increment in Y (pixels)
205  casacore::String itsColor; // Color of vectors
206  casacore::String itsMarker; // Marker shape (should use an enum when we have some more)
207 //
208  friend class LatticePADMMarker<T>;
209 
210  //# Make parent members known.
211  public:
219  protected:
222  };
223 
224 
225 } //# NAMESPACE CASA - END
226 
227 #ifndef AIPS_NO_TEMPLATE_SRC
228 #include <display/DisplayDatas/LatticeAsMarker.tcc>
229 #endif //# AIPS_NO_TEMPLATE_SRC
230 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
Class to draw a single vector map of a slice from an AIPS++ Lattice.
int Int
Definition: aipstype.h:50
virtual ~LatticeAsMarker()
Destructor.
virtual Display::DisplayDataType classType()
Return the DisplayData type; used by the WorldCanvasHolder to determine the order of drawing...
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
DisplayDataType
WorldCanvasHolder - what type of DisplayData is this, need to know for drawing order.
Definition: DisplayEnums.h:355
virtual casacore::String className() const
class name
virtual void setDefaultOptions()
install the default options for display
casacore::String itsMarker
virtual casacore::Bool setOptions(casacore::Record &rec, casacore::Record &recOut)
Apply the options stored in the provided casacore::Record to the LatticeAsMarker object.
LatticeAsMarker(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.
casacore::String itsColor
A base class for astronomical images.
virtual casacore::Record getOptions(bool scrub=false) const
Retrieve the currently set options, and their types, default values, and any help text associated wit...
casacore::Float itsScale
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
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
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 itsLineWidth
Class to manage the drawing of vector maps of slices from AIPS++ Lattices.
virtual void setupElements()
Create the various elements in the sequence of displayable maps.
unsigned int uInt
Definition: aipstype.h:51
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42