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