casacore
Loading...
Searching...
No Matches
CurvedLattice2D.h
Go to the documentation of this file.
1// # CurvedLattice2D.h: A lattice crosscut based on a curve in a plane
2// # Copyright (C) 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 receied 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: casa-feedback@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#ifndef LATTICES_CURVEDLATTICE2D_H
27#define LATTICES_CURVEDLATTICE2D_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/lattices/Lattices/MaskedLattice.h>
32#include <casacore/lattices/Lattices/PixelCurve1D.h>
33#include <casacore/lattices/LatticeMath/CLInterpolator2D.h>
34#include <casacore/casa/Arrays/AxesMapping.h>
35
36namespace casacore { // # NAMESPACE CASACORE - BEGIN
37
38// # Forward Declarations
39
40// <summary>
41// A lattice crosscut based on a curve in a plane.
42// </summary>
43
44// <use visibility=local>
45
46// <reviewed reviewer="" date="" tests="tCurvedLattice2D.cc">
47// </reviewed>
48
49// <prerequisite>
50// # Classes you should understand before using this one.
51// <li> <linkto class=PixelCurve1D>PixelCurve1D</linkto>
52// <li> <linkto class=CLInterpolator2D>CLInterpolator2D</linkto>
53// </prerequisite>
54
55// <synopsis>
56// Class CurvedImage2D can be used to make a crosscut through an image
57// with a dimensionality >= 2.
58// The crosscut is based on a curve defined by a
59// <linkto class=PixelCurve1D>PixelCurve1D</linkto> object. The curve
60// can be any 1-dim function (e.g. straight line, spline)
61// supported by the Functionals module. The curve must be in one of the
62// main planes of the image as defined by the axes arguments in the
63// constructor.
64// <br>See class <linkto class=CurvedImage2D>CurvedImage2D</linkto> for
65// a more detailed description.
66// </synopsis>
67
68// <example>
69// See example in <linkto class=CurvedImage2D>CurvedImage2D</linkto>.
70// </example>
71
72// <motivation>
73// Users like to view arbitrary image crosscuts.
74// </motivation>
75
76template <class T>
77class CurvedLattice2D : public MaskedLattice<T> {
78 public:
79 // Default constructor
81
82 // Take a curved slice from the given MaskedLattice. For example, define
83 // a spline in the RA-DEC plane and extend it in the FREQ direction.
84 // The result is a 2D lattice with axes FREQ and 'spline'.
85 // <br>
86 // The <linkto class=PixelCurve1D>PixelCurve1D</linkto> object defines
87 // the curve in one of the planes of the lattice. The arguments axis1
88 // and axis2 define the plane the curve is in.
89 // The <linkto class=CLInterpolator2D>CLInterpolator2D</linkto> object
90 // defines the interpolation scheme for pixels that are not on grid points.
91 // An example is CLIPNearest2D which takes the nearest neighbour.
92 // The dimensionality of the CurvedLattice2D is one less than the
93 // dimensionality of the given lattice. Two axes (axis1 and axis2) are
94 // replaced by the new axis representing the curve. The argument
95 // curveAxis defines the axis number of the new axis. It defaults to the
96 // last axis.
97 // An exception is thrown if the dimensionality of the input lattice is < 2
98 // or if the given axes numbers are too high.
100 uInt axis1, uInt axis2, Int curveAxis = -1);
101
102 // Copy constructor (reference semantics)
104
105 // Destructor, does nothing
107
108 // Assignment (reference semantics)
110
111 // Make a copy of the object (reference semantics).
112 virtual MaskedLattice<T>* cloneML() const;
113
114 // Is the lattice masked?
115 // It is if its parent lattice is masked.
116 virtual Bool isMasked() const;
117
118 // Is the lattice paged to disk?
119 virtual Bool isPaged() const;
120
121 // The lattice is not writable.
122 virtual Bool isWritable() const;
123
124 // Handle ocking of the lattice which is delegated to its parent.
125 // <br>It is strongly recommended to use class
126 // <linkto class=LatticeLocker>LatticeLocker</linkto> to
127 // handle lattice locking. It also contains a more detailed
128 // explanation of the locking process.
129 // <group>
130 virtual Bool lock(FileLocker::LockType, uInt nattempts);
131 virtual void unlock();
133 // </group>
134
135 // Resynchronize the Lattice object with the lattice file.
136 // This function is only useful if no read-locking is used, ie.
137 // if the table lock option is UserNoReadLocking or AutoNoReadLocking.
138 // In that cases the table system does not acquire a read-lock, thus
139 // does not synchronize itself automatically.
140 virtual void resync();
141
142 // Flush the data.
143 virtual void flush();
144
145 // Close the Lattice temporarily (if it is paged to disk).
146 // It'll be reopened automatically when needed or when
147 // <src>reopen</src> is called explicitly.
148 virtual void tempClose();
149
150 // If needed, reopen a temporarily closed Lattice.
151 virtual void reopen();
152
153 // Get a pointer the region/mask object.
154 // It returns 0.
155 virtual const LatticeRegion* getRegionPtr() const;
156
157 // Returns the shape of the lattice.
158 virtual IPosition shape() const;
159
160 // Return the name of the parent lattice.
161 virtual String name(Bool stripPath = False) const;
162
163 // This function returns the recommended maximum number of pixels to
164 // include in the cursor of an iterator.
165 virtual uInt advisedMaxPixels() const;
166
167 // Check class internals - used for debugging. Should always return True
168 virtual Bool ok() const;
169
170 // Do the actual getting of an array of values.
171 virtual Bool doGetSlice(Array<T>& buffer, const Slicer& section);
172
173 // Do the actual getting of an array of values.
174 virtual void doPutSlice(const Array<T>& sourceBuffer, const IPosition& where,
175 const IPosition& stride);
176
177 // Get a section of the mask.
178 virtual Bool doGetMaskSlice(Array<Bool>& buffer, const Slicer& section);
179
180 // Get the best cursor shape.
181 virtual IPosition doNiceCursorShape(uInt maxPixels) const;
182
183 private:
184 // Make the AxesMapping object to map input to output axes.
185 void makeMapping(uInt axis1, uInt axis2, Int curveAxis);
186
194};
195
196} // namespace casacore
197
198#ifndef CASACORE_NO_AUTO_TEMPLATES
199#include <casacore/lattices/Lattices/CurvedLattice2D.tcc>
200#endif // # CASACORE_NO_AUTO_TEMPLATES
201#endif
virtual Bool isMasked() const
Is the lattice masked?
virtual Bool doGetMaskSlice(Array< Bool > &buffer, const Slicer &section)
Get a section of the mask.
CurvedLattice2D< T > & operator=(const CurvedLattice2D< T > &other)
Assignment (reference semantics).
virtual void resync()
Resynchronize the Lattice object with the lattice file.
virtual Bool hasLock(FileLocker::LockType) const
virtual uInt advisedMaxPixels() const
This function returns the recommended maximum number of pixels to include in the cursor of an iterato...
CurvedLattice2D(const CurvedLattice2D< T > &other)
Copy constructor (reference semantics).
CurvedLattice2D()
Default constructor.
MaskedLattice< T > * itsLatticePtr
virtual IPosition doNiceCursorShape(uInt maxPixels) const
Get the best cursor shape.
virtual MaskedLattice< T > * cloneML() const
Make a copy of the object (reference semantics).
virtual Bool isWritable() const
The lattice is not writable.
virtual ~CurvedLattice2D()
Destructor, does nothing.
virtual void flush()
Flush the data.
void makeMapping(uInt axis1, uInt axis2, Int curveAxis)
Make the AxesMapping object to map input to output axes.
virtual Bool ok() const
Check class internals - used for debugging.
CurvedLattice2D(const MaskedLattice< T > &, const CLInterpolator2D< T > &, const PixelCurve1D &, uInt axis1, uInt axis2, Int curveAxis=-1)
Take a curved slice from the given MaskedLattice.
virtual void doPutSlice(const Array< T > &sourceBuffer, const IPosition &where, const IPosition &stride)
Do the actual getting of an array of values.
virtual void tempClose()
Close the Lattice temporarily (if it is paged to disk).
virtual Bool lock(FileLocker::LockType, uInt nattempts)
Handle ocking of the lattice which is delegated to its parent.
CLInterpolator2D< T > * itsInterpolator
virtual Bool doGetSlice(Array< T > &buffer, const Slicer &section)
Do the actual getting of an array of values.
virtual String name(Bool stripPath=False) const
Return the name of the parent lattice.
virtual void reopen()
If needed, reopen a temporarily closed Lattice.
virtual Bool isPaged() const
Is the lattice paged to disk?
virtual const LatticeRegion * getRegionPtr() const
Get a pointer the region/mask object.
virtual IPosition shape() const
Returns the shape of the lattice.
LockType
Define the possible lock types.
Definition FileLocker.h:89
MaskedLattice()
Default constructor.
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
unsigned int uInt
Definition aipstype.h:49
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40