casacore
Loading...
Searching...
No Matches
LCConcatenation.h
Go to the documentation of this file.
1//# LCConcatenation.h: Combine multiple LCRegion'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 LATTICES_LCCONCATENATION_H
27#define LATTICES_LCCONCATENATION_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/lattices/LRegions/LCRegionMulti.h>
32#include <casacore/lattices/LRegions/LCBox.h>
33
34
35namespace casacore { //# NAMESPACE CASACORE - BEGIN
36
37// <summary>
38// Combine multiple LCRegion'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=LCRegion>LCRegion</linkto>
48// </prerequisite>
49
50// <synopsis>
51// The LCConcatenation class is a specialization of class
52// <linkto class=LCRegion>LCRegion</linkto>.
53// It makes it possible to combine multiple LCRegion's and to add a
54// dimension on them. The range (beginning and end) in that new
55// dimension have to be specified using an
56// <linkto class=LCBox>LCBox</linkto> object.
57// When the LCBox is complete, it will be checked if the given number
58// of regions matches the length of the given range (so it could only
59// be done after the makeComplete call).
60// Using a fractional box does not make much sense, because it results
61// in a varying length range when used with varying shaped lattices.
62// However, one can use it if wanted.
63// <br>
64// LCConcatenation can be seen as a mixture of the classes
65// <linkto class=LCUnion>LCUnion</linkto> and
66// <linkto class=LCExtension>LCExtension</linkto>. Like LCUnion it
67// combines regions and like LCExtension it increases the dimensionality
68// for the new region (be it with only 1).
69// <br>
70// E.g. One can define a different polygon in the RA-DEC plane of each
71// channel. LCConcatenation makes it possible to combine the polygons
72// to one 3D region in the RA-DEC-Freq cube.
73// </synopsis>
74
75// <example>
76// This example combines <src>n</src> (relative) circles
77// given in the x-z plane along the y-axis.
78// In this example the regions used are circles with the same centers,
79// but it is also possible to combine differently shaped regions.
80// Note that LCConcatenation takes over the pointers to the individual regions,
81// so they do not need to be deleted (the LCConcatenation destructor does it).
82// <srcblock>
83// IPosition center (2,10,20);
84// PtrBlock<LCRegion*> cirPtr(n);
85// for (i=0; i<n; i++) {
86// // Each circle has a different radius.
87// cirPtr(i) = new LCEllipsoid cir1 (center, 1 + i%(n/2));
88// }
89// // Construct the concatenation for a range (given as a relative box).
90// // Extend along the y-axis (axis numbers start counting at 0!).
91// // Take over the region pointers.
92// LCConcatenation region (True, cirPtr, 1, LCBox(n/2-n, n/2-1));
93// </srcblock>
94// </example>
95
96//# <todo asof="1997/11/11">
97//# <li>
98//# </todo>
99
101{
102public:
104
105 // Combine the given regions.
106 // When <src>takeOver</src> is True, the destructor will delete the
107 // given regions. Otherwise a copy of the regions is made.
108 // The extend range has to be given as a 1-dimensional box.
109 // The default range is the entire axis.
110 // <group>
114 Int extendAxis, const LCBox& extendRange);
115 // </group>
116
117 // Copy constructor (copy semantics).
119
121
122 // Assignment (copy semantics).
124
125 // Comparison
126 virtual Bool operator== (const LCRegion& other) const;
127
128 // Make a copy of the derived object.
129 virtual LCRegion* cloneRegion() const;
130
131 // Get the extend axis.
132 Int extendAxis() const;
133
134 // Get the extend box.
135 const LCBox& extendBox() const;
136
137 // Get the class name (to store in the record).
139
140 // Get the region type. Returns the class name.
141 virtual String type() const;
142
143 // Convert the (derived) object to a record.
144 virtual TableRecord toRecord (const String& tableName) const;
145
146 // Convert correct object from a record.
148 const String& tableName);
149
150protected:
151 // Construct another LCRegion (for e.g. another lattice) by moving
152 // this one. It recalculates the bounding box and mask.
153 // A positive translation value indicates "to right".
154 virtual LCRegion* doTranslate (const Vector<Float>& translateVector,
155 const IPosition& newLatticeShape) const;
156
157 // Do the actual getting of the mask.
158 virtual void multiGetSlice (Array<Bool>& buffer, const Slicer& section);
159
160 // This function is needed here because the niceCursorShape of the
161 // contributing region does not make any sense (other dimensionality).
162 virtual IPosition doNiceCursorShape (uInt maxPixels) const;
163
164private:
165 // Fill the object.
166 // <group>
168 void fill();
169 // </group>
170
174};
175
176
178{
179 return itsExtendAxis;
180}
182{
183 return itsExtendBox;
184}
185
186
187
188} //# NAMESPACE CASACORE - END
189
190#endif
Int extendAxis() const
Get the extend axis.
static LCConcatenation * fromRecord(const TableRecord &, const String &tableName)
Convert correct object from a record.
virtual TableRecord toRecord(const String &tableName) const
Convert the (derived) object to a record.
LCConcatenation(Bool takeOver, const PtrBlock< const LCRegion * > &regions, Int extendAxis, const LCBox &extendRange)
virtual IPosition doNiceCursorShape(uInt maxPixels) const
This function is needed here because the niceCursorShape of the contributing region does not make any...
LCConcatenation(const LCConcatenation &other)
Copy constructor (copy semantics).
virtual LCRegion * cloneRegion() const
Make a copy of the derived object.
LCConcatenation & operator=(const LCConcatenation &other)
Assignment (copy semantics).
static String className()
Get the class name (to store in the record).
virtual String type() const
Get the region type.
void fillRegionAxes()
Fill the object.
const LCBox & extendBox() const
Get the extend box.
virtual void multiGetSlice(Array< Bool > &buffer, const Slicer &section)
Do the actual getting of the mask.
virtual Bool operator==(const LCRegion &other) const
Comparison.
LCConcatenation(Bool takeOver, const PtrBlock< const LCRegion * > &regions, Int extendAxis)
Combine the given regions.
virtual LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Construct another LCRegion (for e.g.
const PtrBlock< const LCRegion * > & regions() const
Get the contributing regions.
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
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40