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