casacore
Loading...
Searching...
No Matches
WCConcatenation.h
Go to the documentation of this file.
1// # WCConcatenation.h: Combine multiple ImageRegion's into a new dimension
2// # Copyright (C) 1998
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 IMAGES_WCCONCATENATION_H
27#define IMAGES_WCCONCATENATION_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/images/Regions/WCCompound.h>
32#include <casacore/images/Regions/WCBox.h>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36// <summary>
37// Combine multiple ImageRegion's into a new dimension.
38// </summary>
39
40// <use visibility=export>
41
42// <reviewed reviewer="" date="" tests="">
43// </reviewed>
44
45// <prerequisite>
46// <li> <linkto class=WCCompound>WCCompound</linkto>
47// </prerequisite>
48
49// <synopsis>
50// The WCConcatenation class is a specialization of class
51// <linkto class=WCCompound>WCCompound</linkto>.
52// It makes it possible to combine multiple regions and to add a
53// dimension on them. The axis and the range (beginning and end)
54// of that new dimension have to be specified using an
55// <linkto class=WCBox>WCBox</linkto> object.
56// That axes should not be an axis in the given regions.
57// <p>
58// WCConcatenation can be seen as a mixture of the classes
59// <linkto class=WCUnion>WCUnion</linkto> and
60// <linkto class=WCExtension>WCExtension</linkto>. Like WCUnion it
61// combines regions and like WCExtension it increases the dimensionality
62// for the new region (be it with only 1).
63// <br>
64// Unlike WCUnion the axes have to be the same in all regions,
65// because creating a WCConcatenation means combining similar regions.
66// <p>
67// E.g. One can define a different polygon in the RA-DEC plane of each
68// channel. WCConcatenation makes it possible to combine the polygons
69// to one 3D region in the RA-DEC-Freq cube.
70// </synopsis>
71
72// <example>
73// This example combines <src>n</src> (relative) circles
74// given in the RA,DEC plane along the FREQ-axis.
75// In this example the regions used are circles with the same centers,
76// but it is also possible to combine differently shaped regions.
77// Note that WCConcatenation takes over the pointers to the individual regions,
78// so they do not need to be deleted (the WCConcatenation destructor does it).
79// <srcblock>
80// IPosition center (2,10,20);
81// Block<ImageRegion*> cirPtr(n);
82// for (i=0; i<n; i++) {
83// // Each circle has a different radius.
84// cirPtr(i) = new WCEllipsoid cir1 (center, 1 + i%(n/2));
85// }
86// // Construct the concatenation for a range (given as a box in fractions).
87// // Extend along the FREQ-axis (the 2nd axis in the given cSys)..
88// // Take over the region pointers.
89// Vector<Quantity> blc(1);
90// Vector<Quantity> trc(1);
91// blc(0) = Quantity (0.25, "frac");
92// trc(0) = Quantity (0.75, "frac");
93// WCConcatenation region (True, cirPtr, WCBox(blc, trc, cSys, IPosition(1,2));
94// </srcblock>
95// This example is artificial in the sense that WCEllipsoid does not
96// exist yet and the WCBox constructor looks a bit different.
97// One should probably also do a bit more trouble to find out if FREQ
98// is indeed the 2nd axis in the coordinate system.
99// </example>
100
101// # <todo asof="1997/11/11">
102// # <li>
103// # </todo>
104
106 public:
107 // Combine the given regions.
108 // When <src>takeOver</src> is True, the destructor will delete the
109 // given regions. Otherwise a copy of the regions is made.
110 // The extend range has to be given as a 1-dimensional box.
111 // <group>
113 WCConcatenation(Bool takeOver, const Block<const WCRegion*>& regions, const WCBox& extendRange);
114 // </group>
115
116 // Copy constructor (copy semantics).
118
120
121 // Assignment (copy semantics).
123
124 // Comparison
125 virtual Bool operator==(const WCRegion& other) const;
126
127 // Make a copy of the derived object.
128 virtual WCRegion* cloneRegion() const;
129
130 // Get the class name (to store in the record).
132
133 // Get the region type. Returns className()
134 virtual String type() const;
135
136 // Convert the (derived) object to a record.
137 virtual TableRecord toRecord(const String& tableName) const;
138
139 // Convert correct object from a record.
140 static WCConcatenation* fromRecord(const TableRecord&, const String& tableName);
141
142 protected:
143 // Convert to an LCRegion using the given coordinate system and shape.
144 // pixelAxesMap(i) gives the pixel axis in cSys of axes <src>i</src>
145 // in the axesDesc.
147 const IPosition& pixelAxesMap, const IPosition& outOrder) const;
148
149 private:
150 // Do a check and fill the remainder of the object.
151 void fill();
152
153 // # Variables
155};
156
157} // namespace casacore
158
159#endif
String: the storage and methods of handling collections of characters.
Definition String.h:355
const Block< const WCRegion * > & regions() const
Get the contributing regions.
Definition WCCompound.h:141
WCCompound(const ImageRegion &region1, const ImageRegion &region2)
Construct from one or more image regions.
static WCConcatenation * fromRecord(const TableRecord &, const String &tableName)
Convert correct object from a record.
static String className()
Get the class name (to store in the record).
virtual Bool operator==(const WCRegion &other) const
Comparison.
virtual WCRegion * cloneRegion() const
Make a copy of the derived object.
void fill()
Do a check and fill the remainder of the object.
virtual TableRecord toRecord(const String &tableName) const
Convert the (derived) object to a record.
WCConcatenation(const Block< const ImageRegion * > &regions, const WCBox &extendRange)
Combine the given regions.
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.
virtual String type() const
Get the region type.
WCConcatenation(Bool takeOver, const Block< const WCRegion * > &regions, const WCBox &extendRange)
WCConcatenation(const WCConcatenation &other)
Copy constructor (copy semantics).
WCConcatenation & operator=(const WCConcatenation &other)
Assignment (copy semantics).
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40