casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WCUnion.h
Go to the documentation of this file.
1 //# WCUnion.h: Make the union of 2 or more image regions
2 //# Copyright (C) 1998
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: aips2-request@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 //# $Id$
27 
28 #ifndef IMAGES_WCUNION_H
29 #define IMAGES_WCUNION_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
34 
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 // <summary>
39 // Make the union of 2 or more image regions.
40 // </summary>
41 
42 // <use visibility=export>
43 
44 // <reviewed reviewer="" date="" tests="">
45 // </reviewed>
46 
47 // <prerequisite>
48 // <li> <linkto class=WCCompound>WCCompound</linkto>
49 // </prerequisite>
50 
51 // <synopsis>
52 // The WCUnion class is a specialization of class
53 // <linkto class=WCCompound>WCCompound</linkto>.
54 // It makes it possible to take the union of 2 or more image regions.
55 // Note that only world coordinate regions can be used in a compound,
56 // thus an LCSlicer object is not allowed in a union.
57 // <p>
58 // The union of regions is the collection of the pixels masked-on
59 // in any region.
60 // Note that the bounding box of a union is determined by the outermost
61 // pixels. It means that if regions are very far apart, the bounding
62 // box of the union is very large and therefore inefficient.
63 // <p>
64 // The regions in a union can have different axes and dimensionalities.
65 // The axes and dimensionality of a union are determined by the
66 // collection of all different axes in its regions. Each individual region
67 // will be auto-extended along the axes not being part of the region.
68 // E.g. one can define a WCBox with axis RA and another WCBox with
69 // axis DEC. The union will be 2-dim with axes RA and DEC. The first
70 // box will be auto-extended to cover the DEC axis, which results
71 // in a 2-dim box with its DEC axis the length of the image's DEC axis.
72 // Similarly the second box will be auto-extended to cover the RA axis.
73 // </synopsis>
74 
75 // <example>
76 // <srcblock>
77 // </srcblock>
78 // </example>
79 
80 //# <todo asof="1997/11/11">
81 //# <li>
82 //# </todo>
83 
84 
85 class WCUnion: public WCCompound
86 {
87 public:
88  // Construct the union of one or more image regions.
89  // The image regions have to contain WCRegion objects, otherwise an
90  // exception is thrown.
91  // <group>
92  WCUnion (const ImageRegion& region1, const ImageRegion& region2);
93  WCUnion (const ImageRegion* region1,
94  const ImageRegion* region2 = 0,
95  const ImageRegion* region3 = 0,
96  const ImageRegion* region4 = 0,
97  const ImageRegion* region5 = 0,
98  const ImageRegion* region6 = 0,
99  const ImageRegion* region7 = 0,
100  const ImageRegion* region8 = 0,
101  const ImageRegion* region9 = 0,
102  const ImageRegion* region10 = 0);
104  // </group>
105 
106  // Construct from multiple regions given as a Block.
107  // When <src>takeOver</src> is True, the destructor will delete the
108  // given regions. Otherwise a copy of the regions is made.
109  WCUnion (Bool takeOver, const PtrBlock<const WCRegion*>& regions);
110 
111  // Copy constructor (copy semantics).
112  WCUnion (const WCUnion& other);
113 
114  virtual ~WCUnion();
115 
116  // Assignment (copy semantics).
117  WCUnion& operator= (const WCUnion& other);
118 
119  // Comparison
120  virtual Bool operator== (const WCRegion& other) const;
121 
122  // Make a copy of the derived object.
123  virtual WCRegion* cloneRegion() const;
124 
125  // Get the class name (to store in the record).
126  static String className();
127 
128  // Get the region type. Returns className()
129  virtual String type() const;
130 
131  // Convert the (derived) object to a record.
132  virtual TableRecord toRecord (const String& tableName) const;
133 
134  // Convert correct object from a record.
135  static WCUnion* fromRecord (const TableRecord&,
136  const String& tableName);
137 
138 protected:
139  // Convert to an LCRegion using the given coordinate system and shape.
140  // pixelAxesMap(i) gives the pixel axis in cSys of axes <src>i</src>
141  // in the axesDesc.
142  virtual LCRegion* doToLCRegion (const CoordinateSystem& cSys,
143  const IPosition& shape,
144  const IPosition& pixelAxesMap,
145  const IPosition& outOrder) const;
146 };
147 
148 
149 
150 } //# NAMESPACE CASACORE - END
151 
152 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:118
static WCUnion * fromRecord(const TableRecord &, const String &tableName)
Convert correct object from a record.
virtual WCRegion * cloneRegion() const
Make a copy of the derived object.
virtual Bool operator==(const WCRegion &other) const
Comparison.
const PtrBlock< const WCRegion * > & regions() const
Get the contributing regions.
Definition: WCCompound.h:156
virtual LCRegion * doToLCRegion(const CoordinateSystem &cSys, const IPosition &shape, const IPosition &pixelAxesMap, const IPosition &outOrder) const
Convert to an LCRegion using the given coordinate system and shape.
virtual String type() const
Get the region type.
virtual ~WCUnion()
WCUnion(const ImageRegion &region1, const ImageRegion &region2)
Construct the union of one or more image regions.
WCUnion & operator=(const WCUnion &other)
Assignment (copy semantics).
virtual TableRecord toRecord(const String &tableName) const
Convert the (derived) object to a record.
Base class for compound WCRegion objects.
Definition: WCCompound.h:84
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
A drop-in replacement for Block&lt;T*&gt;.
Definition: Block.h:814
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
Definition: ExprNode.h:1987
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:185
Class to hold a region of interest in an image.
Definition: ImageRegion.h:86
Base class to define world coordinate regions of interest in an image.
Definition: WCRegion.h:95
String: the storage and methods of handling collections of characters.
Definition: String.h:225
Make the union of 2 or more image regions.
Definition: WCUnion.h:85
Interconvert pixel and world coordinates.
Abstract base class to define a region of interest in lattice coordinates.
Definition: LCRegion.h:87
static String className()
Get the class name (to store in the record).