casacore
LCStretch.h
Go to the documentation of this file.
1 //# LCStretch.h: Stretch length 1 axes in an LCRegion along straight lines
2 //# Copyright (C) 2001
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: 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_LCSTRETCH_H
29 #define LATTICES_LCSTRETCH_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/lattices/LRegions/LCRegionMulti.h>
34 #include <casacore/lattices/LRegions/LCBox.h>
35 
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 // <summary>
40 // Stretch length 1 axes in an LCRegion along straight lines
41 // </summary>
42 
43 // <use visibility=export>
44 
45 // <reviewed reviewer="" date="" tests="">
46 // </reviewed>
47 
48 // <prerequisite>
49 // <li> <linkto class=LCRegion>LCRegion</linkto>
50 // </prerequisite>
51 
52 // <synopsis>
53 // The LCStretch class is a specialization of class
54 // <linkto class=LCRegion>LCRegion</linkto>.
55 // It makes it possible to stretch a LCRegion along straight lines to
56 // other dimensions. E.g. a circle in the xy-plane can be stretched to
57 // a cylinder in the xyz-space.
58 // It can be used for a lattice of any dimensionality as long as the
59 // dimensionality of the (hyper-)stretch matches the dimensionality of
60 // the lattice.
61 // </synopsis>
62 
63 // <example>
64 // <srcblock>
65 // </srcblock>
66 // </example>
67 
68 // <todo asof="1997/11/11">
69 // <li> Stretch along (slanted) cone lines
70 // </todo>
71 
72 class LCStretch: public LCRegionMulti
73 {
74 public:
76 
77  // Stretch the given region along axes as given by <src>stretchAxes</src>
78  // from the bottom left corner (blc) to the top right corner (trc)
79  // as given by <src>stretchBox</src>.
80  // The axes to be stretched need to have length 1 in the original region.
81  // Every kind of box (absolute, relative, fractional, unspecified)
82  // can be used to define the stretch blc and trc.
83  // The dimensionality of the LCStretch region is the same as the
84  // dimensionality of the original region.
85  // <br>
86  // The second version takes over the pointer when the switch is true.
87  // <group>
89  const IPosition& stretchAxes,
90  const LCBox& stretchBox);
91  LCStretch (Bool takeOver,
92  const LCRegion* region,
93  const IPosition& stretchAxes,
94  const LCBox& stretchBox);
95  // </group>
96 
97  // Copy constructor (copy semantics).
98  LCStretch (const LCStretch& other);
99 
100  virtual ~LCStretch();
101 
102  // Assignment (copy semantics).
104 
105  // Comparison
106  virtual Bool operator== (const LCRegion& other) const;
107 
108  // Make a copy of the derived object.
109  virtual LCRegion* cloneRegion() const;
110 
111  // Get the original region.
112  const LCRegion& region() const;
113 
114  // Get the stretch axes.
115  const IPosition& stretchAxes() const;
116 
117  // Get the stretch box.
118  const LCBox& stretchBox() const;
119 
120  // Get the class name (to store in the record).
121  static String className();
122 
123  // Get the region type. Returns the class name.
124  virtual String type() const;
125 
126  // Convert the (derived) object to a record.
127  virtual TableRecord toRecord (const String& tableName) const;
128 
129  // Convert correct object from a record.
131  const String& tableName);
132 
133 protected:
134  // Construct another LCRegion (for e.g. another lattice) by moving
135  // this one. It recalculates the bounding box and mask.
136  // A positive translation value indicates "to right".
137  virtual LCRegion* doTranslate (const Vector<Float>& translateVector,
138  const IPosition& newLatticeShape) const;
139 
140  // Do the actual getting of the mask.
141  virtual void multiGetSlice (Array<Bool>& buffer, const Slicer& section);
142 
143  // This function is needed here because the niceCursorShape of the
144  // contributing region does not make any sense (other dimensionality).
145  virtual IPosition doNiceCursorShape (uInt maxPixels) const;
146 
147 private:
148  // Fill the object.
149  void fill (const IPosition& stretchAxes, const LCBox& stretchBox);
150 
151 
154 };
155 
156 
157 inline const LCRegion& LCStretch::region() const
158 {
159  return *(regions()[0]);
160 }
161 inline const IPosition& LCStretch::stretchAxes() const
162 {
163  return itsStretchAxes;
164 }
165 inline const LCBox& LCStretch::stretchBox() const
166 {
167  return itsStretchBox;
168 }
169 
170 
171 
172 } //# NAMESPACE CASACORE - END
173 
174 #endif
const PtrBlock< const LCRegion * > & regions() const
Get the contributing regions.
const LCBox & stretchBox() const
Get the stretch box.
Definition: LCStretch.h:165
virtual String type() const
Get the region type.
virtual LCRegion * cloneRegion() const
Make a copy of the derived object.
virtual LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Construct another LCRegion (for e.g.
static LCStretch * fromRecord(const TableRecord &, const String &tableName)
Convert correct object from a record.
const LCRegion & region() const
Get the original region.
Definition: LCStretch.h:157
void fill(const IPosition &stretchAxes, const LCBox &stretchBox)
Fill the object.
virtual Bool operator==(const LCRegion &other) const
Comparison.
virtual void multiGetSlice(Array< Bool > &buffer, const Slicer &section)
Do the actual getting of the mask.
LCStretch(const LCStretch &other)
Copy constructor (copy semantics).
LCStretch(Bool takeOver, const LCRegion *region, const IPosition &stretchAxes, const LCBox &stretchBox)
LCStretch & operator=(const LCStretch &other)
Assignment (copy semantics).
virtual TableRecord toRecord(const String &tableName) const
Convert the (derived) object to a record.
LCStretch(const LCRegion &region, const IPosition &stretchAxes, const LCBox &stretchBox)
Stretch the given region along axes as given by stretchAxes from the bottom left corner (blc) to the ...
static String className()
Get the class name (to store in the record).
IPosition itsStretchAxes
Definition: LCStretch.h:152
const IPosition & stretchAxes() const
Get the stretch axes.
Definition: LCStretch.h:161
virtual IPosition doNiceCursorShape(uInt maxPixels) const
This function is needed here because the niceCursorShape of the contributing region does not make any...
String: the storage and methods of handling collections of characters.
Definition: String.h:225
this file contains all the compiler specific defines
Definition: mainpage.dox:28
unsigned int uInt
Definition: aipstype.h:51
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42