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