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