casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: 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_CLINTERPOLATOR2D_H
29 #define LATTICES_CLINTERPOLATOR2D_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 //# Forward Declarations
39 template<class T> class MaskedLattice;
40 
41 
42 // <summary>
43 // Abstract base class for interpolator used by CurvedLattice2D.
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=CurvedLattice2D>CurvedLattice2D</linkto>
54 // </prerequisite>
55 
56 // <etymology>
57 // The CL in CLInterpolator2D means CurvedLattice.
58 // The 2D means that interpolation in 2 dimensions needs to be done.
59 // </etymology>
60 
61 // <synopsis>
62 // CurvedLattice2D needs lattice data which are not on exact grid points.
63 // Therefore some interpolation scheme is needed. The abstract base class
64 // CLInterpolation2D makes it possible for CurvedLattice2D to use any
65 // interpolation scheme.
66 // Currently the only derived class is
67 // <linkto class=CLIPNearest2D>CLIPNearest2D</linkto>
68 // <br>
69 // Apart from interpolating and returning data, a derived class also has to
70 // return a mask. For instance, in a possible derived class using
71 // 4-point interpolation, the interpolation scheme has to take the
72 // image mask into account, and make a mask for its output data (say that
73 // the output point is masked off if its 4 input points are masked off).
74 //
75 // This base class has some data members defining the lattice and the
76 // lattice axes to be interpolated. When these data members are set,
77 // the virtual function <src>preset</src> is called. A derived class
78 // can implement this function to do some precalculations, etc..
79 // </synopsis>
80 
81 // <motivation>
82 // This class makes it possible to hide the interpolation to be used
83 // from the CurvedLattice2D class.
84 // </motivation>
85 
86 
87 template<class T>
89 {
90 public:
91 
93  : itsLatticePtr(0) {;}
94 
95  virtual ~CLInterpolator2D();
96 
97  // Let a derived class make a copy of itself.
98  virtual CLInterpolator2D<T>* clone() const = 0;
99 
100  // Set the internals to the values of the CurvedLattice using it.
101  // Note that only a copy of the lattice pointer is made.
102  // Thereafter the virtual function preset() is called to give a derived
103  // class the opportunity to do some initial work.
104  void set (MaskedLattice<T>* lattice,
105  const AxesMapping& axesMap,
106  uInt axis1, uInt axis2, uInt curveAxis);
107 
108  // Get the data for the given pixel points (on axis1 and axis2) and
109  // the chunk in the other axes as given by the section.
110  // The Slicer is fixed and the buffer has the correct shape.
111  virtual void getData (Array<T>& buffer,
112  const Vector<Float>& x,
113  const Vector<Float>& y,
114  const Slicer& section) = 0;
115 
116  // Get the mask for the given pixel points (on axis1 and axis2) and
117  // the chunk in the other axes as given by the section.
118  // The Slicer is fixed and the buffer has the correct shape.
119  virtual void getMask (Array<Bool>& buffer,
120  const Vector<Float>& x,
121  const Vector<Float>& y,
122  const Slicer& section) = 0;
123 
124 protected:
125  // Copy constructor can only be used by derived classes.
127 
128  // Assignment can only be used by derived classes.
130 
131  // Let a derived class do some initial work after set is called.
132  // The default implementation does nothing.
133  virtual void preset();
134 
135 
141  Bool itsIsRef; // True = lattice returns array reference
142 };
143 
144 
145 
146 } //# NAMESPACE CASACORE - END
147 
148 #ifndef CASACORE_NO_AUTO_TEMPLATES
149 #include <casacore/lattices/LatticeMath/CLInterpolator2D.tcc>
150 #endif //# CASACORE_NO_AUTO_TEMPLATES
151 #endif
virtual CLInterpolator2D< T > * clone() const =0
Let a derived class make a copy of itself.
virtual void preset()
Let a derived class do some initial work after set is called.
Abstract base class for interpolator used by CurvedLattice2D.
A templated, abstract base class for array-like objects with masks.
Info about mapping array axes to another order.
Definition: AxesMapping.h:87
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
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.
template &lt;class T, class U&gt; class vector;
Definition: MSFlagger.h:37
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:289
MaskedLattice< T > * itsLatticePtr
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 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...
unsigned int uInt
Definition: aipstype.h:51
CLInterpolator2D & operator=(const CLInterpolator2D< T > &)
Assignment can only be used by derived classes.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42