casacore
Loading...
Searching...
No Matches
LELRegion.h
Go to the documentation of this file.
1// # LELRegion.h: Class to hold a region as a LEL node
2// # Copyright (C) 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_LELREGION_H
27#define LATTICES_LELREGION_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/lattices/LEL/LELInterface.h>
32#include <casacore/lattices/LRegions/LatticeRegion.h>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36// # Forward Declarations
38
39// <summary>
40// Class to hold a region as a LEL node
41// </summary>
42
43// <use visibility=local>
44
45// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
46// </reviewed>
47
48// <prerequisite>
49// <li> <linkto class="Lattice"> Lattice</linkto>
50// <li> <linkto class="LatticeExpr"> LatticeExpr</linkto>
51// <li> <linkto class="LatticeExprNode"> LatticeExprNode</linkto>
52// <li> <linkto class="LELInterface"> LELInterface</linkto>
53// </prerequisite>
54
55// <etymology>
56// This derived LEL letter class handles regions.
57// </etymology>
58
59// <synopsis>
60// This LEL letter class is derived from LELInterface. It
61// is used to construct LEL objects from regions.
62// The internal region is an <linkto class=ImageRegion>ImageRegion</linkto>
63// object, thus the region can be of any type.
64// With operator [] a region is applied to an image (expression).
65// At that stage possible world coordinates are converted to lattice
66// coordinates.
67// <p>
68// The attributes of a LELRegion object define an empty shape,
69// because in general the shape of a region is only known after
70// it is applied to an image.
71// <p>
72// A description of the implementation details of the LEL classes can
73// be found in
74// <a href="../notes/216.html">Note 216</a>
75// </synopsis>
76
77// <motivation>
78// We needed to be able to handle regions in a LEL expression.
79// </motivation>
80
81// # <todo asof="1998/01/21">
82// # </todo>
83
84class LELRegion : public LELInterface<Bool> {
85 public:
86 // Constructor.
88
89 // Constructor. It takes over the pointer.
91
92 // Destructor.
94
95 // Get a pointer to the region object.
96 const LattRegionHolder& region() const { return *region_p; }
97
98 // Getting region data cannot be done (throws an exception).
99 virtual void eval(LELArray<Bool>&, const Slicer&) const;
100
101 // Getting region data cannot be done (throws an exception).
102 virtual LELScalar<Bool> getScalar() const;
103
104 // Do further preparations (e.g. optimization) on the expression.
106
107 // Get class name
108 virtual String className() const;
109
110 // Form a compound from the regions.
111 // <group>
112 static LELRegion* makeUnion(const LELInterface<Bool>& left, const LELInterface<Bool>& right);
114 const LELInterface<Bool>& right);
117 // </group>
118
119 private:
120 // Get the LattRegionHolder after checking that the expression is a region.
121 static const LattRegionHolder& region(const LELInterface<Bool>& expr);
122
123 // Check if both regions have the same type (pixel or world) and if
124 // no LCSlicer type of region is used.
125 static void checkTypes(const LattRegionHolder& left, const LattRegionHolder& right);
126
127 // Member variables.
129};
130
131// <summary>
132// Class to convert a region to a boolean node
133// </summary>
134
135// <use visibility=local>
136
137// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
138// </reviewed>
139
140// <prerequisite>
141// <li> <linkto class="LELRegion"> Lattice</linkto>
142// <li> <linkto class="LatticeExprNode"> LatticeExprNode</linkto>
143// <li> <linkto class="LELInterface"> LELInterface</linkto>
144// </prerequisite>
145
146// <etymology>
147// This derived LEL letter class handles a region as a boolean lattice.
148// </etymology>
149
150// <synopsis>
151// This class makes it possible to handle a region as a true
152// boolean lattice without the need to apply the region to an image.
153// It means that it is only possible if the region has absolute
154// lattice coordinates.
155// <p>
156// A description of the implementation details of the LEL classes can
157// be found in
158// <a href="../notes/216.html">Note 216</a>
159// </synopsis>
160
161// <motivation>
162// It is useful to be able to handle a mask as a boolean lattice.
163// </motivation>
164
165// # <todo asof="1998/01/21">
166// # </todo>
167
168class LELRegionAsBool : public LELInterface<Bool> {
169 public:
170 // Constructor.
172
173 // Destructor.
175
176 // Get region data.
177 virtual void eval(LELArray<Bool>& result, const Slicer& section) const;
178
179 // Getting region data as a scalar cannot be done (throws an exception).
180 virtual LELScalar<Bool> getScalar() const;
181
182 // Do further preparations (e.g. optimization) on the expression.
184
185 // Get class name
186 virtual String className() const;
187
188 private:
189 // Member variables.
191};
192
193} // namespace casacore
194
195#endif
LatticeRegion region_p
Member variables.
Definition LELRegion.h:190
virtual void eval(LELArray< Bool > &result, const Slicer &section) const
Get region data.
virtual Bool prepareScalarExpr()
Do further preparations (e.g.
~LELRegionAsBool()
Destructor.
LELRegionAsBool(const LELRegion &region)
Constructor.
virtual LELScalar< Bool > getScalar() const
Getting region data as a scalar cannot be done (throws an exception).
virtual String className() const
Get class name.
static LELRegion * makeComplement(const LELInterface< Bool > &expr)
~LELRegion()
Destructor.
const LattRegionHolder & region() const
Get a pointer to the region object.
Definition LELRegion.h:96
virtual String className() const
Get class name.
static LELRegion * makeDifference(const LELInterface< Bool > &left, const LELInterface< Bool > &right)
virtual LELScalar< Bool > getScalar() const
Getting region data cannot be done (throws an exception).
LattRegionHolder * region_p
Member variables.
Definition LELRegion.h:128
static const LattRegionHolder & region(const LELInterface< Bool > &expr)
Get the LattRegionHolder after checking that the expression is a region.
virtual Bool prepareScalarExpr()
Do further preparations (e.g.
static LELRegion * makeUnion(const LELInterface< Bool > &left, const LELInterface< Bool > &right)
Form a compound from the regions.
virtual void eval(LELArray< Bool > &, const Slicer &) const
Getting region data cannot be done (throws an exception).
static LELRegion * makeIntersection(const LELInterface< Bool > &left, const LELInterface< Bool > &right)
LELRegion(LattRegionHolder *region)
Constructor.
static void checkTypes(const LattRegionHolder &left, const LattRegionHolder &right)
Check if both regions have the same type (pixel or world) and if no LCSlicer type of region is used.
LELRegion(const LattRegionHolder &region)
Constructor.
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
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40