casacore
LCExtension.h
Go to the documentation of this file.
1 //# LCExtension.h: Extend an LCRegion along straight lines to other dimensions
2 //# Copyright (C) 1998,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_LCEXTENSION_H
29 #define LATTICES_LCEXTENSION_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 // Extend an LCRegion along straight lines to other dimensions
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 LCExtension class is a specialization of class
54 // <linkto class=LCRegion>LCRegion</linkto>.
55 // It makes it possible to extend a LCRegion along straight lines to
56 // other dimensions. E.g. a circle in the xy-plane can be extended 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-)extension 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> Extend along (slanted) cone lines
70 // </todo>
71 
73 {
74 public:
76 
77  // Extend the given region along axes as given by <src>extendAxes</src>
78  // from the bottom left corner (blc) to the top right corner (trc)
79  // as given by <src>extendBox</src>.
80  // Every kind of box (absolute, relative, fractional, unspecified)
81  // can be used to define the extension blc and trc.
82  // The sum of the dimensionality of the region and the extend box
83  // make up the dimensionality of the LCExtension region.
84  // Similarly the lattice shapes in region and box are combined.
85  // <br>
86  // The second version takes over the pointer when the switch is true.
87  // <group>
89  const IPosition& extendAxes,
90  const LCBox& extendBox);
91  LCExtension (Bool takeOver,
92  const LCRegion* region,
93  const IPosition& extendAxes,
94  const LCBox& extendBox);
95  // </group>
96 
97  // Copy constructor (copy semantics).
98  LCExtension (const LCExtension& other);
99 
100  virtual ~LCExtension();
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 extend axes.
115  const IPosition& extendAxes() const;
116 
117  // Get the extend box.
118  const LCBox& extendBox() 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  // <group>
151  void fill (const IPosition& stretchAxes, const LCBox& stretchBox);
152  // </group>
153 
157 };
158 
159 
160 inline const LCRegion& LCExtension::region() const
161 {
162  return *(regions()[0]);
163 }
164 inline const IPosition& LCExtension::extendAxes() const
165 {
166  return itsExtendAxes;
167 }
168 inline const LCBox& LCExtension::extendBox() const
169 {
170  return itsExtendBox;
171 }
172 
173 
174 
175 } //# NAMESPACE CASACORE - END
176 
177 #endif
virtual Bool operator==(const LCRegion &other) const
Comparison.
virtual IPosition doNiceCursorShape(uInt maxPixels) const
This function is needed here because the niceCursorShape of the contributing region does not make any...
virtual void multiGetSlice(Array< Bool > &buffer, const Slicer &section)
Do the actual getting of the mask.
LCExtension(const LCRegion &region, const IPosition &extendAxes, const LCBox &extendBox)
Extend the given region along axes as given by extendAxes from the bottom left corner (blc) to the to...
virtual LCRegion * cloneRegion() const
Make a copy of the derived object.
LCExtension(Bool takeOver, const LCRegion *region, const IPosition &extendAxes, const LCBox &extendBox)
LCExtension & operator=(const LCExtension &other)
Assignment (copy semantics).
virtual TableRecord toRecord(const String &tableName) const
Convert the (derived) object to a record.
LCExtension(const LCExtension &other)
Copy constructor (copy semantics).
const LCRegion & region() const
Get the original region.
Definition: LCExtension.h:160
void fillRegionAxes()
Fill the object.
static String className()
Get the class name (to store in the record).
const LCBox & extendBox() const
Get the extend box.
Definition: LCExtension.h:168
virtual String type() const
Get the region type.
virtual LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Construct another LCRegion (for e.g.
static LCExtension * fromRecord(const TableRecord &, const String &tableName)
Convert correct object from a record.
const IPosition & extendAxes() const
Get the extend axes.
Definition: LCExtension.h:164
void fill(const IPosition &stretchAxes, const LCBox &stretchBox)
const PtrBlock< const LCRegion * > & regions() const
Get the contributing regions.
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