casacore
Loading...
Searching...
No Matches
CLInterpolator2D.h
Go to the documentation of this file.
1// # CLInterpolator2D.h: Abstract base class for interpolator used by CurvedLattice2D
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_CLINTERPOLATOR2D_H
27#define LATTICES_CLINTERPOLATOR2D_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/AxesMapping.h>
32
33namespace casacore { // # NAMESPACE CASACORE - BEGIN
34
35// # Forward Declarations
36template <class T>
37class MaskedLattice;
38
39// <summary>
40// Abstract base class for interpolator used by CurvedLattice2D.
41// </summary>
42
43// <use visibility=local>
44
45// <reviewed reviewer="" date="" tests="tCurvedLattice2D.cc">
46// </reviewed>
47
48// <prerequisite>
49// # Classes you should understand before using this one.
50// <li> <linkto class=CurvedLattice2D>CurvedLattice2D</linkto>
51// </prerequisite>
52
53// <etymology>
54// The CL in CLInterpolator2D means CurvedLattice.
55// The 2D means that interpolation in 2 dimensions needs to be done.
56// </etymology>
57
58// <synopsis>
59// CurvedLattice2D needs lattice data which are not on exact grid points.
60// Therefore some interpolation scheme is needed. The abstract base class
61// CLInterpolation2D makes it possible for CurvedLattice2D to use any
62// interpolation scheme.
63// Currently the only derived class is
64// <linkto class=CLIPNearest2D>CLIPNearest2D</linkto>
65// <br>
66// Apart from interpolating and returning data, a derived class also has to
67// return a mask. For instance, in a possible derived class using
68// 4-point interpolation, the interpolation scheme has to take the
69// image mask into account, and make a mask for its output data (say that
70// the output point is masked off if its 4 input points are masked off).
71//
72// This base class has some data members defining the lattice and the
73// lattice axes to be interpolated. When these data members are set,
74// the virtual function <src>preset</src> is called. A derived class
75// can implement this function to do some precalculations, etc..
76// </synopsis>
77
78// <motivation>
79// This class makes it possible to hide the interpolation to be used
80// from the CurvedLattice2D class.
81// </motivation>
82
83template <class T>
85 public:
87
89
90 // Let a derived class make a copy of itself.
91 virtual CLInterpolator2D<T>* clone() const = 0;
92
93 // Set the internals to the values of the CurvedLattice using it.
94 // Note that only a copy of the lattice pointer is made.
95 // Thereafter the virtual function preset() is called to give a derived
96 // class the opportunity to do some initial work.
97 void set(MaskedLattice<T>* lattice, const AxesMapping& axesMap, uInt axis1, uInt axis2,
98 uInt curveAxis);
99
100 // Get the data for the given pixel points (on axis1 and axis2) and
101 // the chunk in the other axes as given by the section.
102 // The Slicer is fixed and the buffer has the correct shape.
103 virtual void getData(Array<T>& buffer, const Vector<Float>& x, const Vector<Float>& y,
104 const Slicer& section) = 0;
105
106 // Get the mask for the given pixel points (on axis1 and axis2) and
107 // the chunk in the other axes as given by the section.
108 // The Slicer is fixed and the buffer has the correct shape.
109 virtual void getMask(Array<Bool>& buffer, const Vector<Float>& x, const Vector<Float>& y,
110 const Slicer& section) = 0;
111
112 protected:
113 // Copy constructor can only be used by derived classes.
115
116 // Assignment can only be used by derived classes.
118
119 // Let a derived class do some initial work after set is called.
120 // The default implementation does nothing.
121 virtual void preset();
122
128 Bool itsIsRef; // True = lattice returns array reference
129};
130
131} // namespace casacore
132
133#ifndef CASACORE_NO_AUTO_TEMPLATES
134#include <casacore/lattices/LatticeMath/CLInterpolator2D.tcc>
135#endif // # CASACORE_NO_AUTO_TEMPLATES
136#endif
virtual void getMask(Array< Bool > &buffer, const Vector< Float > &x, const Vector< Float > &y, const Slicer &section)=0
Get the mask for the given pixel points (on axis1 and axis2) and the chunk in the other axes as given...
virtual void preset()
Let a derived class do some initial work after set is called.
CLInterpolator2D(const CLInterpolator2D< T > &)
Copy constructor can only be used by derived classes.
CLInterpolator2D & operator=(const CLInterpolator2D< T > &)
Assignment can only be used by derived classes.
virtual void getData(Array< T > &buffer, const Vector< Float > &x, const Vector< Float > &y, const Slicer &section)=0
Get the data for the given pixel points (on axis1 and axis2) and the chunk in the other axes as given...
virtual CLInterpolator2D< T > * clone() const =0
Let a derived class make a copy of itself.
void set(MaskedLattice< T > *lattice, const AxesMapping &axesMap, uInt axis1, uInt axis2, uInt curveAxis)
Set the internals to the values of the CurvedLattice using it.
MaskedLattice< T > * itsLatticePtr
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40