casacore
Loading...
Searching...
No Matches
LattRegionHolder.h
Go to the documentation of this file.
1//# LattRegionHolder.h: Class to hold a region of interest in an image
2//# Copyright (C) 1999,2001
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_LATTREGIONHOLDER_H
27#define LATTICES_LATTREGIONHOLDER_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/lattices/LRegions/LatticeRegion.h>
32
33namespace casacore { //# NAMESPACE CASACORE - BEGIN
34
35//# Forward Declarations
36class CoordinateSystem;
37class IPosition;
38class LCRegion;
39class LCSlicer;
40class WCRegion;
41class String;
42class TableRecord;
43
44
45// <summary>
46// Class to hold a region of interest in an image.
47// </summary>
48
49// <use visibility=export>
50
51// <reviewed reviewer="" date="" tests="">
52// </reviewed>
53
54// <prerequisite>
55// <li> <linkto class=LCSlicer>LCSlicer</linkto>
56// <li> <linkto class=WCRegion>LCRegion</linkto>
57// </prerequisite>
58
59// <synopsis>
60// The only purpose of LattRegionHolder is to have a single object for
61// the various kinds of regions. It can hold a
62// <linkto class=LCRegion>LCRegion</linkto>, and
63// <linkto class=LCSlicer>LCSlicer</linkto>.
64// </synopsis>
65
66// <example>
67// <srcblock>
68// </srcblock>
69// </example>
70
71// <motivation>
72// It was felt that making an abstract base class LatticeRegion for
73// LCRegion and WCRegion would create undesirable dependencies of
74// module Lattices on module Coordinates. E.g. it would be impossible
75// to have a function toWCRegion.
76// Therefore the container class LattRegionHolder is chosen, from which
77// the container <linkto class=ImageRegion>ImageRegion</linkto> is derived.
78// </motivation>
79
80//# <todo asof="1997/11/11">
81//# <li>
82//# </todo>
83
84
86{
87public:
88 // Construct from a region based on lattice coordinates.
90
91 // Construct from a slicer based on lattice coordinates.
93
94 // Similar constructors as above, but using a pointer.
95 // It takes over the pointer, so the user should not delete the
96 // object. It is deleted by the LattRegionHolder destructor.
97 // <group>
100 // </group>
101
102 // Copy constructor (copy semantics).
104
106
107 // Assignment (copy semantics).
109
110 // Clone the object.
111 virtual LattRegionHolder* clone() const;
112
113 // Comparison
114 // <group>
115 virtual Bool operator==(const LattRegionHolder& other) const;
116 Bool operator!=(const LattRegionHolder& other) const;
117 // </group>
118
119 // Test if the underlying region is an LCRegion, etc.
120 // <group>
121 Bool isLCRegion() const;
122 Bool isLCSlicer() const;
123 virtual Bool isWCRegion() const;
124 // </group>
125
126 // Get the region as a pointer to a LCRegion, LCSlicer, or WCRegion.
127 // An exception is thrown if the region is not the correct type.
128 // Functions <src>isWCRegion()</src>, etc. can be used to test the type.
129 // <group>
130 const LCRegion* asLCRegionPtr() const;
131 const LCSlicer* asLCSlicerPtr() const;
132 virtual const WCRegion* asWCRegionPtr() const;
133 // </group>
134
135 // Get the dimensionality.
136 uInt ndim() const;
137
138 // Convert to a LatticeRegion using the given shape.
140
141 // Convert to a LatticeRegion using the given coordinate system
142 // (with reference pixel) and shape.
143 // It will also make the region complete (absolute and non-fractional).
145 const IPosition& shape) const;
146
147 // Form a compound from this and the other region.
148 // <group>
149 virtual LattRegionHolder* makeUnion (const LattRegionHolder& other) const;
151 (const LattRegionHolder& other) const;
153 (const LattRegionHolder& other) const;
155 // </group>
156
157protected:
158 // Construct for the given dimensionality (for derived classes).
160
161private:
165};
166
167
169{
170 return (itsLC != 0);
171}
173{
174 return (itsSlicer != 0);
175}
177{
178 return (! operator== (other));
179}
181{
182 return itsNdim;
183}
184
185
186
187} //# NAMESPACE CASACORE - END
188
189#endif
LattRegionHolder(const LCRegion &)
Construct from a region based on lattice coordinates.
const LCSlicer * asLCSlicerPtr() const
virtual LattRegionHolder * makeUnion(const LattRegionHolder &other) const
Form a compound from this and the other region.
virtual Bool isWCRegion() const
virtual LatticeRegion toLatticeRegion(const CoordinateSystem &cSys, const IPosition &shape) const
Convert to a LatticeRegion using the given coordinate system (with reference pixel) and shape.
virtual LattRegionHolder * makeComplement() const
virtual Bool operator==(const LattRegionHolder &other) const
Comparison.
LattRegionHolder(const LCSlicer &)
Construct from a slicer based on lattice coordinates.
virtual const WCRegion * asWCRegionPtr() const
virtual LattRegionHolder * makeDifference(const LattRegionHolder &other) const
Bool operator!=(const LattRegionHolder &other) const
uInt ndim() const
Get the dimensionality.
LatticeRegion toLatticeRegion(const IPosition &shape) const
Convert to a LatticeRegion using the given shape.
virtual LattRegionHolder * makeIntersection(const LattRegionHolder &other) const
Bool isLCRegion() const
Test if the underlying region is an LCRegion, etc.
LattRegionHolder(LCRegion *)
Similar constructors as above, but using a pointer.
LattRegionHolder(uInt ndim)
Construct for the given dimensionality (for derived classes).
LattRegionHolder(const LattRegionHolder &other)
Copy constructor (copy semantics).
LattRegionHolder & operator=(const LattRegionHolder &other)
Assignment (copy semantics).
const LCRegion * asLCRegionPtr() const
Get the region as a pointer to a LCRegion, LCSlicer, or WCRegion.
virtual LattRegionHolder * clone() const
Clone the object.
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape.
Definition ExprNode.h:1991
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40