casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WCExtension.h
Go to the documentation of this file.
1 //# WCExtension.h: Make the extension an image region
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 IMAGES_WCEXTENSION_H
29 #define IMAGES_WCEXTENSION_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 //# Forward declarations
39 class WCBox;
40 
41 
42 // <summary>
43 // Make the extension of an image region.
44 // </summary>
45 
46 // <use visibility=export>
47 
48 // <reviewed reviewer="" date="" tests="">
49 // </reviewed>
50 
51 // <prerequisite>
52 // <li> <linkto class=WCCompound>WCCompound</linkto>
53 // </prerequisite>
54 
55 // <synopsis>
56 // The WCExtension class is a specialization of class
57 // <linkto class=WCCompound>WCCompound</linkto>.
58 // It makes it possible to extend a region along straight lines to
59 // other dimensions. It is also possible to extend existing axes with
60 // length 1, i.e. to stretch such axes.
61 // E.g. a circle in the RA,DEC plane can be extended to
62 // a cylinder in a RA,DEC,FREQ cube. It is possible to extend over
63 // more than one dimension. One can also limit the extension range
64 // E.g. in the forementioned example the circle can be extended
65 // for a given range of frequencies only.
66 // <br>The extension axes and ranges have to be given as a
67 // <linkto class=WCBox>WCBox</linkto> object. The axes which are part
68 // of the box and the region are the axes to be stretched. Box axes
69 // which are not part of the region are the extension axes.
70 // <p>
71 // Note that regions get automatically extended when a region is used
72 // for a higher dimensioned image. The extension is done for all
73 // unknown axes (for their entire length).
74 // </synopsis>
75 
76 // <example>
77 // <srcblock>
78 // </srcblock>
79 // </example>
80 
81 //# <todo asof="1997/11/11">
82 //# <li>
83 //# </todo>
84 
85 
86 class WCExtension: public WCCompound
87 {
88 public:
89  // Construct the extension of an image region using the axes
90  // and blc,trc given in the extendBox.
91  // The axes in region and box have to be disjoint.
92  WCExtension (const ImageRegion& region, const WCBox& extendBox);
93 
94  // Copy constructor (copy semantics).
95  WCExtension (const WCExtension& other);
96 
97  virtual ~WCExtension();
98 
99  // Assignment (copy semantics).
100  WCExtension& operator= (const WCExtension& other);
101 
102  // Comparison
103  virtual Bool operator== (const WCRegion& other) const;
104 
105  // Make a copy of the derived object.
106  virtual WCRegion* cloneRegion() const;
107 
108  // Get the class name (to store in the record).
109  static String className();
110 
111  // Get the region type. Returns className()
112  virtual String type() const;
113 
114  // Convert the (derived) object to a record.
115  virtual TableRecord toRecord (const String& tableName) const;
116 
117  // Convert correct object from a record.
118  static WCExtension* fromRecord (const TableRecord&,
119  const String& tableName);
120 
121 protected:
122  // WCExtension can extend a region if WCBox can do so.
123  virtual Bool canExtend() const;
124 
125  // Convert to an LCRegion using the given coordinate system and shape.
126  // pixelAxesMap(i) gives the pixel axis in cSys of axes <src>i</src>
127  // in the axesDesc.
128  virtual LCRegion* doToLCRegion (const CoordinateSystem& cSys,
129  const IPosition& shape,
130  const IPosition& pixelAxesMap,
131  const IPosition& outOrder) const;
132 
133 private:
134  // Construct from multiple regions given as a Block.
135  // When <src>takeOver</src> is True, the destructor will delete the
136  // given regions. Otherwise a copy of the regions is made.
138 
139  // Find the axes to be extended and stretched.
140  // The extend axes are the axis numbers in the box.
141  // For the stretch axes both box and region axes are returned.
142  void findAxes (IPosition& extendBoxAxes, IPosition& stretchBoxAxes,
143  IPosition& stretchRegionAxes) const;
144 };
145 
146 
147 
148 } //# NAMESPACE CASACORE - END
149 
150 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
virtual String type() const
Get the region type.
virtual WCRegion * cloneRegion() const
Make a copy of the derived object.
WCExtension(const ImageRegion &region, const WCBox &extendBox)
Construct the extension of an image region using the axes and blc,trc given in the extendBox...
Make the extension of an image region.
Definition: WCExtension.h:86
static WCExtension * fromRecord(const TableRecord &, const String &tableName)
Convert correct object from a record.
const PtrBlock< const WCRegion * > & regions() const
Get the contributing regions.
Definition: WCCompound.h:156
static String className()
Get the class name (to store in the record).
Base class for compound WCRegion objects.
Definition: WCCompound.h:84
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual Bool operator==(const WCRegion &other) const
Comparison.
virtual LCRegion * doToLCRegion(const CoordinateSystem &cSys, const IPosition &shape, const IPosition &pixelAxesMap, const IPosition &outOrder) const
Convert to an LCRegion using the given coordinate system and shape.
void findAxes(IPosition &extendBoxAxes, IPosition &stretchBoxAxes, IPosition &stretchRegionAxes) const
Find the axes to be extended and stretched.
virtual Bool canExtend() const
WCExtension can extend a region if WCBox can do so.
A drop-in replacement for Block&lt;T*&gt;.
Definition: WProjectFT.h:54
virtual TableRecord toRecord(const String &tableName) const
Convert the (derived) object to a record.
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
Definition: ExprNode.h:1944
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:182
WCExtension & operator=(const WCExtension &other)
Assignment (copy semantics).
Class to hold a region of interest in an image.
Definition: ImageRegion.h:86
Base class to define world coordinate regions of interest in an image.
Definition: WCRegion.h:95
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Class to define a world coordinate box region of interest in an image.
Definition: WCBox.h:292
Interconvert pixel and world coordinates.
Abstract base class to define a region of interest in lattice coordinates.
Definition: LCRegion.h:87
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42