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
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/casa/Arrays/AxesMapping.h>
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36//# Forward Declarations
37template<class T> class MaskedLattice;
38
39
40// <summary>
41// Abstract base class for interpolator used by CurvedLattice2D.
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=CurvedLattice2D>CurvedLattice2D</linkto>
52// </prerequisite>
53
54// <etymology>
55// The CL in CLInterpolator2D means CurvedLattice.
56// The 2D means that interpolation in 2 dimensions needs to be done.
57// </etymology>
58
59// <synopsis>
60// CurvedLattice2D needs lattice data which are not on exact grid points.
61// Therefore some interpolation scheme is needed. The abstract base class
62// CLInterpolation2D makes it possible for CurvedLattice2D to use any
63// interpolation scheme.
64// Currently the only derived class is
65// <linkto class=CLIPNearest2D>CLIPNearest2D</linkto>
66// <br>
67// Apart from interpolating and returning data, a derived class also has to
68// return a mask. For instance, in a possible derived class using
69// 4-point interpolation, the interpolation scheme has to take the
70// image mask into account, and make a mask for its output data (say that
71// the output point is masked off if its 4 input points are masked off).
72//
73// This base class has some data members defining the lattice and the
74// lattice axes to be interpolated. When these data members are set,
75// the virtual function <src>preset</src> is called. A derived class
76// can implement this function to do some precalculations, etc..
77// </synopsis>
78
79// <motivation>
80// This class makes it possible to hide the interpolation to be used
81// from the CurvedLattice2D class.
82// </motivation>
83
84
85template<class T>
87{
88public:
89
92
94
95 // Let a derived class make a copy of itself.
96 virtual CLInterpolator2D<T>* clone() const = 0;
97
98 // Set the internals to the values of the CurvedLattice using it.
99 // Note that only a copy of the lattice pointer is made.
100 // Thereafter the virtual function preset() is called to give a derived
101 // class the opportunity to do some initial work.
102 void set (MaskedLattice<T>* lattice,
103 const AxesMapping& axesMap,
104 uInt axis1, uInt axis2, uInt curveAxis);
105
106 // Get the data 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 getData (Array<T>& buffer,
110 const Vector<Float>& x,
111 const Vector<Float>& y,
112 const Slicer& section) = 0;
113
114 // Get the mask for the given pixel points (on axis1 and axis2) and
115 // the chunk in the other axes as given by the section.
116 // The Slicer is fixed and the buffer has the correct shape.
117 virtual void getMask (Array<Bool>& buffer,
118 const Vector<Float>& x,
119 const Vector<Float>& y,
120 const Slicer& section) = 0;
121
122protected:
123 // Copy constructor can only be used by derived classes.
125
126 // Assignment can only be used by derived classes.
128
129 // Let a derived class do some initial work after set is called.
130 // The default implementation does nothing.
131 virtual void preset();
132
133
139 Bool itsIsRef; // True = lattice returns array reference
140};
141
142
143
144} //# NAMESPACE CASACORE - END
145
146#ifndef CASACORE_NO_AUTO_TEMPLATES
147#include <casacore/lattices/LatticeMath/CLInterpolator2D.tcc>
148#endif //# CASACORE_NO_AUTO_TEMPLATES
149#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
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40