casacore
Loading...
Searching...
No Matches
LCRegionMulti.h
Go to the documentation of this file.
1//# LCRegionMulti.h: Make the intersection of 2 or more regions
2//# Copyright (C) 1998,1999
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_LCREGIONMULTI_H
27#define LATTICES_LCREGIONMULTI_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/lattices/LRegions/LCRegion.h>
32#include <casacore/casa/Arrays/IPosition.h>
33#include <casacore/casa/Containers/Block.h>
34
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38// <summary>
39// Make the intersection of 2 or more regions.
40// </summary>
41
42// <use visibility=export>
43
44// <reviewed reviewer="" date="" tests="">
45// </reviewed>
46
47// <prerequisite>
48// <li> <linkto class=LCRegion>LCRegion</linkto>
49// </prerequisite>
50
51// <synopsis>
52// The LCRegionMulti class is a specialization of class
53// <linkto class=LCRegion>LCRegion</linkto>.
54// It makes it possible to extend a LCRegion along straight lines to
55// other dimensions. E.g. a circle in the xy-plane can be extended to
56// a cylinder in the xyz-space.
57// includes the intersection border.
58// It can only be used for a lattice of any dimensionality as long as the
59// dimensionality of the (hyper-)intersection matches the dimensionality of
60// the lattice.
61// <p>
62// The center of the intersection must be inside the lattice
63// </synopsis>
64
65// <example>
66// <srcblock>
67// </srcblock>
68// </example>
69
70// <todo asof="1997/11/11">
71// <li>
72// </todo>
73
75{
76public:
78
79 // Construct from 2 regions.
80 LCRegionMulti (const LCRegion& region1, const LCRegion& region2);
81
82 // Construct from multiple regions.
83 LCRegionMulti (Bool takeOver, const LCRegion* region1,
84 const LCRegion* region2 = 0,
85 const LCRegion* region3 = 0,
86 const LCRegion* region4 = 0,
87 const LCRegion* region5 = 0,
88 const LCRegion* region6 = 0,
89 const LCRegion* region7 = 0,
90 const LCRegion* region8 = 0,
91 const LCRegion* region9 = 0,
92 const LCRegion* region10 = 0);
93
94 // Construct from multiple regions given as a Block.
95 // When <src>takeOver</src> is True, the destructor will delete the
96 // given regions. Otherwise a copy of the regions is made.
98
99 // Copy constructor (copy semantics).
101
102 virtual ~LCRegionMulti();
103
104 // Assignment (copy semantics).
106
107 // Comparison
108 virtual Bool operator== (const LCRegion& other) const;
109
110 // Does the region have a mask?
111 virtual Bool hasMask() const;
112
113protected:
114 // Store the contributing regions in a record.
115 TableRecord makeRecord (const String& tableName) const;
116
117 // Retrieve the contributing objects from the record.
119 const TableRecord&,
120 const String& tableName);
121
122 // Translate all regions.
124 const Vector<Float>& translateVector,
125 const IPosition& newLatticeShape) const;
126
127 // Determine if all regions have mask (used by LCIntersection).
129
130 // Find which area of the section and region are needed.
131 // False is returned if no part of the region is included in the section.
132 Bool findAreas (IPosition& bufStart, IPosition& bufEnd,
133 IPosition& regStart, IPosition& regEnd,
134 const Slicer& section, uInt regNr) const;
135
136 // Get the contributing regions.
137 const PtrBlock<const LCRegion*>& regions() const;
138
139protected:
140 // Construct from lattice shape and region pointer, which is
141 // taken over.
142 // Primarily meant for LCExtension.
144
145 // Do the actual getting of an array of values.
146 virtual Bool doGetSlice (Array<Bool>& buffer, const Slicer& section);
147
148 // Get the values from the class derived from Multi.
149 // It is called when there is a mask. Note that it is not sure
150 // whether the buffer has the correct size.
151 virtual void multiGetSlice (Array<Bool>& buffer,
152 const Slicer& section) = 0;
153
154 // Get the best cursor shape.
155 virtual IPosition doNiceCursorShape (uInt maxPixels) const;
156
157private:
158 // Check if the regions are correct.
159 // If needed, make a copy of the region objects.
160 void init (Bool takeOver);
161
162 //# >=0 means this region has a mask.
163 //# Its value gives the region with the biggest mask.
166};
167
168
170{
171 return itsRegions;
172}
173
174
175
176} //# NAMESPACE CASACORE - END
177
178#endif
LCRegionMulti & operator=(const LCRegionMulti &other)
Assignment (copy semantics).
void fillHasMask()
Determine if all regions have mask (used by LCIntersection).
virtual void multiGetSlice(Array< Bool > &buffer, const Slicer &section)=0
Get the values from the class derived from Multi.
virtual Bool hasMask() const
Does the region have a mask?
const PtrBlock< const LCRegion * > & regions() const
Get the contributing regions.
Bool findAreas(IPosition &bufStart, IPosition &bufEnd, IPosition &regStart, IPosition &regEnd, const Slicer &section, uInt regNr) const
Find which area of the section and region are needed.
PtrBlock< const LCRegion * > itsRegions
LCRegionMulti(const LCRegionMulti &other)
Copy constructor (copy semantics).
TableRecord makeRecord(const String &tableName) const
Store the contributing regions in a record.
static void unmakeRecord(PtrBlock< const LCRegion * > &, const TableRecord &, const String &tableName)
Retrieve the contributing objects from the record.
virtual Bool doGetSlice(Array< Bool > &buffer, const Slicer &section)
Do the actual getting of an array of values.
virtual IPosition doNiceCursorShape(uInt maxPixels) const
Get the best cursor shape.
void multiTranslate(PtrBlock< const LCRegion * > &, const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Translate all regions.
LCRegionMulti(Bool takeOver, const PtrBlock< const LCRegion * > &regions)
Construct from multiple regions given as a Block.
virtual Bool operator==(const LCRegion &other) const
Comparison
LCRegionMulti(Bool takeOver, const LCRegion *region1, const LCRegion *region2=0, const LCRegion *region3=0, const LCRegion *region4=0, const LCRegion *region5=0, const LCRegion *region6=0, const LCRegion *region7=0, const LCRegion *region8=0, const LCRegion *region9=0, const LCRegion *region10=0)
Construct from multiple regions.
void init(Bool takeOver)
Check if the regions are correct.
LCRegionMulti(const LCRegion &region1, const LCRegion &region2)
Construct from 2 regions.
LCRegionMulti(const LCRegion *region, const IPosition &latticeShape)
Construct from lattice shape and region pointer, which is taken over.
const IPosition & latticeShape() const
Give the full lattice shape.
Definition LCRegion.h:229
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