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
37class IPosition;
38class LCRegion;
39class LCSlicer;
40class WCRegion;
41class String;
42class TableRecord;
43
44// <summary>
45// Class to hold a region of interest in an image.
46// </summary>
47
48// <use visibility=export>
49
50// <reviewed reviewer="" date="" tests="">
51// </reviewed>
52
53// <prerequisite>
54// <li> <linkto class=LCSlicer>LCSlicer</linkto>
55// <li> <linkto class=WCRegion>LCRegion</linkto>
56// </prerequisite>
57
58// <synopsis>
59// The only purpose of LattRegionHolder is to have a single object for
60// the various kinds of regions. It can hold a
61// <linkto class=LCRegion>LCRegion</linkto>, and
62// <linkto class=LCSlicer>LCSlicer</linkto>.
63// </synopsis>
64
65// <example>
66// <srcblock>
67// </srcblock>
68// </example>
69
70// <motivation>
71// It was felt that making an abstract base class LatticeRegion for
72// LCRegion and WCRegion would create undesirable dependencies of
73// module Lattices on module Coordinates. E.g. it would be impossible
74// to have a function toWCRegion.
75// Therefore the container class LattRegionHolder is chosen, from which
76// the container <linkto class=ImageRegion>ImageRegion</linkto> is derived.
77// </motivation>
78
79// # <todo asof="1997/11/11">
80// # <li>
81// # </todo>
82
84 public:
85 // Construct from a region based on lattice coordinates.
87
88 // Construct from a slicer based on lattice coordinates.
90
91 // Similar constructors as above, but using a pointer.
92 // It takes over the pointer, so the user should not delete the
93 // object. It is deleted by the LattRegionHolder destructor.
94 // <group>
97 // </group>
98
99 // Copy constructor (copy semantics).
101
103
104 // Assignment (copy semantics).
106
107 // Clone the object.
108 virtual LattRegionHolder* clone() const;
109
110 // Comparison
111 // <group>
112 virtual Bool operator==(const LattRegionHolder& other) const;
113 Bool operator!=(const LattRegionHolder& other) const;
114 // </group>
115
116 // Test if the underlying region is an LCRegion, etc.
117 // <group>
118 Bool isLCRegion() const;
119 Bool isLCSlicer() const;
120 virtual Bool isWCRegion() const;
121 // </group>
122
123 // Get the region as a pointer to a LCRegion, LCSlicer, or WCRegion.
124 // An exception is thrown if the region is not the correct type.
125 // Functions <src>isWCRegion()</src>, etc. can be used to test the type.
126 // <group>
127 const LCRegion* asLCRegionPtr() const;
128 const LCSlicer* asLCSlicerPtr() const;
129 virtual const WCRegion* asWCRegionPtr() const;
130 // </group>
131
132 // Get the dimensionality.
133 uInt ndim() const;
134
135 // Convert to a LatticeRegion using the given shape.
137
138 // Convert to a LatticeRegion using the given coordinate system
139 // (with reference pixel) and shape.
140 // It will also make the region complete (absolute and non-fractional).
142
143 // Form a compound from this and the other region.
144 // <group>
145 virtual LattRegionHolder* makeUnion(const LattRegionHolder& other) const;
149 // </group>
150
151 protected:
152 // Construct for the given dimensionality (for derived classes).
154
155 private:
159};
160
161inline Bool LattRegionHolder::isLCRegion() const { return (itsLC != 0); }
162inline Bool LattRegionHolder::isLCSlicer() const { return (itsSlicer != 0); }
164 return (!operator==(other));
165}
166inline uInt LattRegionHolder::ndim() const { return itsNdim; }
167
168} // namespace casacore
169
170#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.
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
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40