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