casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LatticePADMRaster.h
Go to the documentation of this file.
1 //# LatticePADMRaster.h: drawing axis bound lattice elements as rasters
2 //# Copyright (C) 1996,1997,1998,1999,2000,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_LATTICEPADMRASTER_H
29 #define TRIALDISPLAY_LATTICEPADMRASTER_H
30 
31 //# aips includes:
32 #include <casa/aips.h>
33 
34 //# display library includes:
36 
37 namespace casacore{
38 
39  class IPosition;
40  template <class T> class Vector;
41  template <class T> class Matrix;
42 }
43 
44 namespace casa { //# NAMESPACE CASA - BEGIN
45 
46 //# forwards:
47  template <class T> class LatticePADisplayData;
48  class WorldCanvas;
49 
50 // <summary>
51 // Class to draw a raster image of a slice of an AIPS++ Lattice.
52 // </summary>
53 //
54 // <use visibility=local>
55 //
56 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
57 // </reviewed>
58 //
59 // <prerequisite>
60 // <li> <linkto class="LatticeAsRaster">LatticeAsRaster</linkto>
61 // </prerequisite>
62 //
63 // <etymology>
64 // The purpose of this class is to draw "raster" images of data that
65 // is "lattice"-based. The "PADM" refers to PrincipalAxesDisplayMethod,
66 // meaning that one or more instances of this class are used to actually
67 // draw slices of a casacore::Lattice along its main axes.
68 // </etymology>
69 //
70 // <synopsis>
71 // This is a helper class for the LatticeAsRaster class. One or more
72 // instances of this class are created by a single LatticeAsRaster
73 // object, each being responsible for drawing a different slice of the
74 // data.
75 // </synopsis>
76 //
77 // <example>
78 // This class should only be used by the LatticeAsRaster class to
79 // setup a number of views of an AIPS++ Image or Array. As such, this
80 // example simply outlines how this class is used by LatticeAsRaster,
81 // in, for example, a support function for a constructor:
82 // <srcblock>
83 // template <class T>
84 // void LatticeAsRaster<T>::setupElements(casacore::IPosition fixedPos) {
85 // if (nPixelAxes > 2) {
86 // nImages = dataLattice()->shape()(zAxisNum);
87 // DDelement.resize(nImages);
88 // for (casacore::uInt index = 0; index < nImages; index++) {
89 // fixedPos(zAxisNum) = index;
90 // DDelement[index] = (LatticePADisplayMethod<T> *)new
91 // LatticePADMRaster<T>(dataLattice(), xAxisNum, yAxisNum,
92 // zAxisNum, fixedPos, this);
93 // }
94 // } else {
95 // nImages = 1;
96 // DDelement.resize(nImages);
97 // DDelement[0] = (LatticePADisplayMethod<T> *)new
98 // LatticePADMRaster<T>(dataLattice(), xAxisNum, yAxisNum, this);
99 // }
100 // }
101 // </srcblock>
102 // </example>
103 //
104 // <motivation>
105 // Displaying 2-dimensional slices of a lattice-based data volume is
106 // a standard display requirement for astronomical data visualization
107 // and presentation.
108 // </motivation>
109 //
110 // <templating arg=T>
111 // </templating>
112 //
113 // <thrown>
114 // </thrown>
115 //
116 // <todo asof="yyyy/mm/dd">
117 // </todo>
118 
119  template <class T> class LatticePADMRaster : public LatticePADisplayMethod<T> {
120 
121  public:
122 
123  // Constructors: >2d and 2d. xAxis and yAxis specify which axis in
124  // the casacore::Lattice (0-based) should be mapped to X and Y on the display
125  // device: ie. 2-d slices of the data to be displayed have these as
126  // axes. mAxis specifies the "movie" axis, which is the axis along
127  // which different slices are taken. fixedPos is an IPosition
128  // having the same length as the number of dimensions in the array,
129  // and indicates the fixed axis values for axes in the data that are
130  // not specified as xAxis or yAxis: indeed, <src>fixedPos(mAxis)</src>
131  // indicates which pixel value along the movie axis that this
132  // particular object looks after.
133  // <group>
134  LatticePADMRaster(const casacore::uInt xAxis,
135  const casacore::uInt yAxis, const casacore::uInt mAxis,
136  const casacore::IPosition fixedPos,
137  LatticePADisplayData<T> *arDat);
138  LatticePADMRaster(const casacore::uInt xAxis,
139  const casacore::uInt yAxis, LatticePADisplayData<T> *arDat);
140  // </group>
141 
142  // Destructor
143  virtual ~LatticePADMRaster();
144 
145  // Invoke (much more rapid) redraw of previous color-index rendering if
146  // applicable (i.e., only during colormap 'fiddling' -- ColorTableChange
147  // refresh). Return value indicates success.
149 
150  // Actually draw on the display device. The WorldCanvasHolder will
151  // tell the LatticeAsRaster that it should now draw, which will in
152  // turn determine which of its one or more LatticePADMRaster objects
153  // should draw by matching the movie value on the WorldCanvas. The
154  // raster is drawn from world coordinate blc to trc.
155  virtual casacore::uInt dataDrawSelf(WorldCanvas *wCanvas,
158  const casacore::IPosition &start,
159  const casacore::IPosition &shape,
161  const casacore::Bool usePixelEdges = false);
162 
163  //# Make parent members known.
164  protected:
165  using LatticePADisplayMethod<T>::parentDisplayData;
166  private:
167  bool initializeColorMatrix( LatticeAsRaster<T>* lar,
168  const casacore::IPosition &start,
169  const casacore::IPosition &shape,
171  casacore::Matrix<T>& datMatrix,
172  casacore::Matrix<casacore::Bool>& maskMatrix) const;
173  };
174 
175 
176 } //# NAMESPACE CASA - END
177 
178 #ifndef AIPS_NO_TEMPLATE_SRC
179 #include <display/DisplayDatas/LatticePADMRaster.tcc>
180 #endif //# AIPS_NO_TEMPLATE_SRC
181 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
std::vector< double > Vector
Definition: ds9context.h:24
casacore::IPosition start
Some data members which all display elements along principal axes will play around with: ...
bool initializeColorMatrix(LatticeAsRaster< T > *lar, const casacore::IPosition &start, const casacore::IPosition &shape, const casacore::IPosition &stride, casacore::Matrix< T > &datMatrix, casacore::Matrix< casacore::Bool > &maskMatrix) const
casacore::IPosition stride
A 2-D Specialization of the Array class.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual ~LatticePADMRaster()
Destructor.
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
Definition: ExprNode.h:1944
LatticePADMRaster(const casacore::uInt xAxis, const casacore::uInt yAxis, const casacore::uInt mAxis, const casacore::IPosition fixedPos, LatticePADisplayData< T > *arDat)
Constructors: &gt;2d and 2d.
RefreshReason
Callback reasons for PCRefreshEvent and WCRefreshEvent.
Definition: DisplayEnums.h:267
virtual casacore::Bool dataRedrawSelf(WorldCanvas *, Display::RefreshReason)
Invoke (much more rapid) redraw of previous color-index rendering if applicable (i.e., only during colormap &#39;fiddling&#39; – ColorTableChange refresh).
virtual casacore::uInt dataDrawSelf(WorldCanvas *wCanvas, const casacore::Vector< casacore::Double > &blc, const casacore::Vector< casacore::Double > &trc, const casacore::IPosition &start, const casacore::IPosition &shape, const casacore::IPosition &stride, const casacore::Bool usePixelEdges=false)
Actually draw on the display device.
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