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
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// <summary>
38// Make the intersection of 2 or more regions.
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 LCRegionMulti class is a specialization of class
52// <linkto class=LCRegion>LCRegion</linkto>.
53// It makes it possible to extend a LCRegion along straight lines to
54// other dimensions. E.g. a circle in the xy-plane can be extended to
55// a cylinder in the xyz-space.
56// includes the intersection border.
57// It can only be used for a lattice of any dimensionality as long as the
58// dimensionality of the (hyper-)intersection matches the dimensionality of
59// the lattice.
60// <p>
61// The center of the intersection must be inside the lattice
62// </synopsis>
63
64// <example>
65// <srcblock>
66// </srcblock>
67// </example>
68
69// <todo asof="1997/11/11">
70// <li>
71// </todo>
72
73class LCRegionMulti : public LCRegion {
74 public:
76
77 // Construct from 2 regions.
78 LCRegionMulti(const LCRegion& region1, const LCRegion& region2);
79
80 // Construct from multiple regions.
81 LCRegionMulti(Bool takeOver, const LCRegion* region1, const LCRegion* region2 = 0,
82 const LCRegion* region3 = 0, const LCRegion* region4 = 0,
83 const LCRegion* region5 = 0, const LCRegion* region6 = 0,
84 const LCRegion* region7 = 0, const LCRegion* region8 = 0,
85 const LCRegion* region9 = 0, const LCRegion* region10 = 0);
86
87 // Construct from multiple regions given as a Block.
88 // When <src>takeOver</src> is True, the destructor will delete the
89 // given regions. Otherwise a copy of the regions is made.
91
92 // Copy constructor (copy semantics).
94
95 virtual ~LCRegionMulti();
96
97 // Assignment (copy semantics).
99
100 // Does the region have a mask?
101 Bool hasMask() const override;
102
103 protected:
104 // Comparison
105 Bool equals(const LCRegion& other) const override;
106
107 // Store the contributing regions in a record.
108 TableRecord makeRecord(const String& tableName) const;
109
110 // Retrieve the contributing objects from the record.
111 static void unmakeRecord(Block<const LCRegion*>&, const TableRecord&, const String& tableName);
112
113 // Translate all regions.
115 const IPosition& newLatticeShape) const;
116
117 // Determine if all regions have mask (used by LCIntersection).
119
120 // Find which area of the section and region are needed.
121 // False is returned if no part of the region is included in the section.
122 Bool findAreas(IPosition& bufStart, IPosition& bufEnd, IPosition& regStart, IPosition& regEnd,
123 const Slicer& section, uInt regNr) const;
124
125 // Get the contributing regions.
126 const Block<const LCRegion*>& regions() const;
127
128 protected:
129 // Construct from lattice shape and region pointer, which is
130 // taken over.
131 // Primarily meant for LCExtension.
133
134 // Do the actual getting of an array of values.
135 Bool doGetSlice(Array<Bool>& buffer, const Slicer& section) override;
136
137 // Get the values from the class derived from Multi.
138 // It is called when there is a mask. Note that it is not sure
139 // whether the buffer has the correct size.
140 virtual void multiGetSlice(Array<Bool>& buffer, const Slicer& section) = 0;
141
142 // Get the best cursor shape.
143 IPosition doNiceCursorShape(uInt maxPixels) const override;
144
145 private:
146 // Check if the regions are correct.
147 // If needed, make a copy of the region objects.
148 void init(Bool takeOver);
149
150 // # >=0 means this region has a mask.
151 // # Its value gives the region with the biggest mask.
154};
155
157
158} // namespace casacore
159
160#endif
void multiTranslate(Block< const LCRegion * > &, const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Translate all regions.
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.
Block< const LCRegion * > itsRegions
const Block< const LCRegion * > & regions() const
Get the contributing regions.
static void unmakeRecord(Block< const LCRegion * > &, const TableRecord &, const String &tableName)
Retrieve the contributing objects from the record.
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.
IPosition doNiceCursorShape(uInt maxPixels) const override
Get the best cursor shape.
LCRegionMulti(const LCRegionMulti &other)
Copy constructor (copy semantics).
Bool hasMask() const override
Does the region have a mask?
TableRecord makeRecord(const String &tableName) const
Store the contributing regions in a record.
Bool equals(const LCRegion &other) const override
Comparison.
Bool doGetSlice(Array< Bool > &buffer, const Slicer &section) override
Do the actual getting of an array of values.
LCRegionMulti(Bool takeOver, const Block< const LCRegion * > &regions)
Construct from multiple regions given as a Block.
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:211
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