casacore
Loading...
Searching...
No Matches
LatticeSlice1D.h
Go to the documentation of this file.
1// # LatticeSlice1D.h: 1-D slice from a Lattice
2// # Copyright (C) 1996,1997,1998,1999,2000,2001,2002,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 received 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_LATTICESLICE1D_H
27#define LATTICES_LATTICESLICE1D_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/Vector.h>
32#include <casacore/casa/iosstrfwd.h>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36// # Forward Declarations
37template <class T>
38class MaskedLattice;
39class IPosition;
40class Interpolate2D;
41class PixelCurve1D;
42class String;
43
44// <summary>
45// Extract a 1-D slice from a Lattice
46// </summary>
47// <use visibility=export>
48// <reviewed reviewer="" date="yyyy/mm/dd" tests="test/tLatticeSlice1D" demos="">
49// </reviewed>
50// <prerequisite>
51// <li> <linkto class=MaskedLattice>MaskedLattice</linkto>
52// </prerequisite>
53
54// <etymology>
55// </etymology>
56
57// <synopsis>
58// This class extracts an interpolated 1-D slice from a Lattice
59// with a range of interpolation schemes available. The slice must lie in
60// the plane of two cardinal axes.
61// </synopsis>
62//
63// <note role=tip>
64// </note>
65//
66// <example>
67// <srcBlock>
68// IPosition shape(2, 20, 30); // Create MaskedLattice
69// ArrayLattice<Float> arrLat(shape);
70// SubLattice<Float> subLat(arrLat);
71// LatticeSlice1D<Float> slicer(subLat);
72//
73// IPosition blc(2); blc = 0; // Extract slice between corners
74// IPosition trc(shape-1);
75// Vector<Float> data;
76// Vector<Bool> mask;
77// slicer.getSlice (data, mask, blc, trc);
78// </srcBlock>
79// </example>
80
81// <motivation>
82// Users often want to see cross-cuts through their data.
83// </motivation>
84
85// <todo asof="2004/04/16">
86// <li> Handle curves not in cardinal axis plane
87// <li> Derive from MaskedLattice ?
88// </todo>
89
90template <class T>
92 public:
93 // Interpolation method
94 enum Method { NEAREST = 0, LINEAR = 1, CUBIC = 2, N_TYPES };
95
96 // Default constructor - object useless
98
99 // Constructor
100 LatticeSlice1D(const MaskedLattice<T>& lattice, Method method = LINEAR);
101
102 // Copy constructor (reference semantics)
104
105 // Destructor
107
108 // Assignment operator (reference semantics)
110
111 // Get 1-D slice. PixelCurve1D supplies the locus of the slice in
112 // the plane specified by axis0 and axis1. The pixel coordinate for
113 // the rest of the lattice is specified in <src>coord</src>.
114 void getSlice(Vector<T>& data, Vector<Bool>& mask, const PixelCurve1D& curve, uInt axis0,
115 uInt axis1, const IPosition& coord);
116
117 // Get 1-D slice between blc & trc. These start and end points must be
118 // in a cardinal plane of the lattice. If nPts is 0 it is set automatically to
119 // the length of the slice.
120 void getSlice(Vector<T>& data, Vector<Bool>& mask, const IPosition& blc, const IPosition& trc,
121 uInt nPts = 0);
122
123 // Get the (x,y) pixel coordinates from the last slice and the distance along
124 // the slice in pixels.. Also recover the axes of the slice plane
125 void getPosition(uInt& axis0, uInt& axis1, Vector<Float>& x, Vector<Float>& y,
126 Vector<Float>& distance) const;
127
128 // Recover interpolation method
130
131 static Method stringToMethod(const String& method);
132
133 private:
134 // Check the suppliec curve is valid.
135 void checkCurve(IPosition& blc, IPosition& trc, const IPosition& coord,
136 const PixelCurve1D& curve);
137 // Find the slice plane.
138 void findPlane(const IPosition& blc, const IPosition& trc);
139 // Get the interpolated slice
141 const IPosition& blc, const IPosition& trc);
142 // Make Interpolator
144
145 //
154};
155
156} // namespace casacore
157
158#ifndef CASACORE_NO_AUTO_TEMPLATES
159#include <casacore/lattices/LatticeMath/LatticeSlice1D.tcc>
160#endif // # CASACORE_NO_AUTO_TEMPLATES
161#endif
LatticeSlice1D(const MaskedLattice< T > &lattice, Method method=LINEAR)
Constructor.
LatticeSlice1D()
Default constructor - object useless.
void checkCurve(IPosition &blc, IPosition &trc, const IPosition &coord, const PixelCurve1D &curve)
Check the suppliec curve is valid.
void getSlice(Vector< T > &data, Vector< Bool > &mask, const PixelCurve1D &curve, uInt axis0, uInt axis1, const IPosition &coord)
Get 1-D slice.
virtual ~LatticeSlice1D()
Destructor.
void getSlice(Vector< T > &data, Vector< Bool > &mask, const IPosition &blc, const IPosition &trc, uInt nPts=0)
Get 1-D slice between blc & trc.
Method
Interpolation method.
LatticeSlice1D(const LatticeSlice1D< T > &other)
Copy constructor (reference semantics).
LatticeSlice1D< T > & operator=(const LatticeSlice1D< T > &other)
Assignment operator (reference semantics).
Interpolate2D * itsInterpPtr
void getPosition(uInt &axis0, uInt &axis1, Vector< Float > &x, Vector< Float > &y, Vector< Float > &distance) const
Get the (x,y) pixel coordinates from the last slice and the distance along the slice in pixels.
Method interpolationMethod() const
Recover interpolation method.
MaskedLattice< T > * itsLatticePtr
void doGetSlice(Vector< T > &data, Vector< Bool > &mask, const PixelCurve1D &curve, const IPosition &blc, const IPosition &trc)
Get the interpolated slice.
static Method stringToMethod(const String &method)
void findPlane(const IPosition &blc, const IPosition &trc)
Find the slice plane.
void makeInterpolator(Method method)
Make Interpolator.
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.