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
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/casa/Arrays/Vector.h>
33#include <casacore/casa/iosstrfwd.h>
34
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38//# Forward Declarations
39template <class T> class MaskedLattice;
40class IPosition;
41class Interpolate2D;
42class PixelCurve1D;
43class String;
44
45// <summary>
46// Extract a 1-D slice from a Lattice
47// </summary>
48// <use visibility=export>
49// <reviewed reviewer="" date="yyyy/mm/dd" tests="test/tLatticeSlice1D" demos="">
50// </reviewed>
51// <prerequisite>
52// <li> <linkto class=MaskedLattice>MaskedLattice</linkto>
53// </prerequisite>
54
55// <etymology>
56// </etymology>
57
58// <synopsis>
59// This class extracts an interpolated 1-D slice from a Lattice
60// with a range of interpolation schemes available. The slice must lie in
61// the plane of two cardinal axes.
62// </synopsis>
63//
64// <note role=tip>
65// </note>
66//
67// <example>
68// <srcBlock>
69// IPosition shape(2, 20, 30); // Create MaskedLattice
70// ArrayLattice<Float> arrLat(shape);
71// SubLattice<Float> subLat(arrLat);
72// LatticeSlice1D<Float> slicer(subLat);
73//
74// IPosition blc(2); blc = 0; // Extract slice between corners
75// IPosition trc(shape-1);
76// Vector<Float> data;
77// Vector<Bool> mask;
78// slicer.getSlice (data, mask, blc, trc);
79// </srcBlock>
80// </example>
81
82// <motivation>
83// Users often want to see cross-cuts through their data.
84// </motivation>
85
86// <todo asof="2004/04/16">
87// <li> Handle curves not in cardinal axis plane
88// <li> Derive from MaskedLattice ?
89// </todo>
90
91
92template <class T> class LatticeSlice1D
93{
94public:
95
96// Interpolation method
98
99// Default constructor - object useless
101
102// Constructor
104
105// Copy constructor (reference semantics)
107
108// Destructor
109 virtual ~LatticeSlice1D ();
110
111// Assignment operator (reference semantics)
113
114// Get 1-D slice. PixelCurve1D supplies the locus of the slice in
115// the plane specified by axis0 and axis1. The pixel coordinate for
116// the rest of the lattice is specified in <src>coord</src>.
118 const PixelCurve1D& curve, uInt axis0, uInt axis1,
119 const IPosition& coord);
120
121// Get 1-D slice between blc & trc. These start and end points must be
122// in a cardinal plane of the lattice. If nPts is 0 it is set automatically to
123// the length of the slice.
125 const IPosition& blc, const IPosition& trc, uInt nPts=0);
126
127// Get the (x,y) pixel coordinates from the last slice and the distance along
128// the slice in pixels.. Also recover the axes of the slice plane
129 void getPosition (uInt& axis0, uInt& axis1, Vector<Float>& x,
130 Vector<Float>& y, Vector<Float>& distance) const;
131
132// Recover interpolation method
134
135 static Method stringToMethod (const String& method);
136
137private:
138// Check the suppliec curve is valid.
139 void checkCurve (IPosition& blc, IPosition& trc,
140 const IPosition& coord, const PixelCurve1D& curve);
141// Find the slice plane.
142 void findPlane (const IPosition& blc,
143 const IPosition& trc);
144// Get the interpolated slice
146 const PixelCurve1D& curve,
147 const IPosition& blc, const IPosition& trc);
148// Make Interpolator
150
151//
160};
161
162
163} //# NAMESPACE CASACORE - END
164
165#ifndef CASACORE_NO_AUTO_TEMPLATES
166#include <casacore/lattices/LatticeMath/LatticeSlice1D.tcc>
167#endif //# CASACORE_NO_AUTO_TEMPLATES
168#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:223
this file contains all the compiler specific defines
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.