casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: 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 LATTICES_LCCONCATENATION_H
29 #define LATTICES_LCCONCATENATION_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
35 
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 // <summary>
40 // Combine multiple LCRegion's into a new dimension.
41 // </summary>
42 
43 // <use visibility=export>
44 
45 // <reviewed reviewer="" date="" tests="">
46 // </reviewed>
47 
48 // <prerequisite>
49 // <li> <linkto class=LCRegion>LCRegion</linkto>
50 // </prerequisite>
51 
52 // <synopsis>
53 // The LCConcatenation class is a specialization of class
54 // <linkto class=LCRegion>LCRegion</linkto>.
55 // It makes it possible to combine multiple LCRegion's and to add a
56 // dimension on them. The range (beginning and end) in that new
57 // dimension have to be specified using an
58 // <linkto class=LCBox>LCBox</linkto> object.
59 // When the LCBox is complete, it will be checked if the given number
60 // of regions matches the length of the given range (so it could only
61 // be done after the makeComplete call).
62 // Using a fractional box does not make much sense, because it results
63 // in a varying length range when used with varying shaped lattices.
64 // However, one can use it if wanted.
65 // <br>
66 // LCConcatenation can be seen as a mixture of the classes
67 // <linkto class=LCUnion>LCUnion</linkto> and
68 // <linkto class=LCExtension>LCExtension</linkto>. Like LCUnion it
69 // combines regions and like LCExtension it increases the dimensionality
70 // for the new region (be it with only 1).
71 // <br>
72 // E.g. One can define a different polygon in the RA-DEC plane of each
73 // channel. LCConcatenation makes it possible to combine the polygons
74 // to one 3D region in the RA-DEC-Freq cube.
75 // </synopsis>
76 
77 // <example>
78 // This example combines <src>n</src> (relative) circles
79 // given in the x-z plane along the y-axis.
80 // In this example the regions used are circles with the same centers,
81 // but it is also possible to combine differently shaped regions.
82 // Note that LCConcatenation takes over the pointers to the individual regions,
83 // so they do not need to be deleted (the LCConcatenation destructor does it).
84 // <srcblock>
85 // IPosition center (2,10,20);
86 // PtrBlock<LCRegion*> cirPtr(n);
87 // for (i=0; i<n; i++) {
88 // // Each circle has a different radius.
89 // cirPtr(i) = new LCEllipsoid cir1 (center, 1 + i%(n/2));
90 // }
91 // // Construct the concatenation for a range (given as a relative box).
92 // // Extend along the y-axis (axis numbers start counting at 0!).
93 // // Take over the region pointers.
94 // LCConcatenation region (True, cirPtr, 1, LCBox(n/2-n, n/2-1));
95 // </srcblock>
96 // </example>
97 
98 //# <todo asof="1997/11/11">
99 //# <li>
100 //# </todo>
101 
103 {
104 public:
105  LCConcatenation();
106 
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  // The default range is the entire axis.
112  // <group>
114  Int extendAxis);
115  LCConcatenation (Bool takeOver, const PtrBlock<const LCRegion*>& regions,
116  Int extendAxis, const LCBox& extendRange);
117  // </group>
118 
119  // Copy constructor (copy semantics).
120  LCConcatenation (const LCConcatenation& other);
121 
122  virtual ~LCConcatenation();
123 
124  // Assignment (copy semantics).
126 
127  // Comparison
128  virtual Bool operator== (const LCRegion& other) const;
129 
130  // Make a copy of the derived object.
131  virtual LCRegion* cloneRegion() const;
132 
133  // Get the extend axis.
134  Int extendAxis() const;
135 
136  // Get the extend box.
137  const LCBox& extendBox() const;
138 
139  // Get the class name (to store in the record).
140  static String className();
141 
142  // Get the region type. Returns the class name.
143  virtual String type() const;
144 
145  // Convert the (derived) object to a record.
146  virtual TableRecord toRecord (const String& tableName) const;
147 
148  // Convert correct object from a record.
149  static LCConcatenation* fromRecord (const TableRecord&,
150  const String& tableName);
151 
152 protected:
153  // Construct another LCRegion (for e.g. another lattice) by moving
154  // this one. It recalculates the bounding box and mask.
155  // A positive translation value indicates "to right".
156  virtual LCRegion* doTranslate (const Vector<Float>& translateVector,
157  const IPosition& newLatticeShape) const;
158 
159  // Do the actual getting of the mask.
160  virtual void multiGetSlice (Array<Bool>& buffer, const Slicer& section);
161 
162  // This function is needed here because the niceCursorShape of the
163  // contributing region does not make any sense (other dimensionality).
164  virtual IPosition doNiceCursorShape (uInt maxPixels) const;
165 
166 private:
167  // Fill the object.
168  // <group>
169  void fillRegionAxes();
170  void fill();
171  // </group>
172 
176 };
177 
178 
180 {
181  return itsExtendAxis;
182 }
183 inline const LCBox& LCConcatenation::extendBox() const
184 {
185  return itsExtendBox;
186 }
187 
188 
189 
190 } //# NAMESPACE CASACORE - END
191 
192 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:118
virtual IPosition doNiceCursorShape(uInt maxPixels) const
This function is needed here because the niceCursorShape of the contributing region does not make any...
int Int
Definition: aipstype.h:50
const LCBox & extendBox() const
Get the extend box.
Class to define a rectangular box of interest.
Definition: LCBox.h:67
virtual TableRecord toRecord(const String &tableName) const
Convert the (derived) object to a record.
virtual void multiGetSlice(Array< Bool > &buffer, const Slicer &section)
Do the actual getting of the mask.
virtual String type() const
Get the region type.
LCConcatenation & operator=(const LCConcatenation &other)
Assignment (copy semantics).
static String className()
Get the class name (to store in the record).
virtual LCRegion * cloneRegion() const
Make a copy of the derived object.
void fillRegionAxes()
Fill the object.
static LCConcatenation * fromRecord(const TableRecord &, const String &tableName)
Convert correct object from a record.
const PtrBlock< const LCRegion * > & regions() const
Get the contributing regions.
Int extendAxis() const
Get the extend axis.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Combine multiple LCRegion&#39;s into a new dimension.
A drop-in replacement for Block&lt;T*&gt;.
Definition: Block.h:814
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:185
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:288
virtual Bool operator==(const LCRegion &other) const
Comparison.
String: the storage and methods of handling collections of characters.
Definition: String.h:225
Make the intersection of 2 or more regions.
Definition: LCRegionMulti.h:76
virtual LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Construct another LCRegion (for e.g.
unsigned int uInt
Definition: aipstype.h:51
Abstract base class to define a region of interest in lattice coordinates.
Definition: LCRegion.h:87