casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WCCompound.h
Go to the documentation of this file.
1 //# WCCompound.h: Base class for compound WCRegion objects
2 //# Copyright (C) 1998,1999,2003
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_WCCOMPOUND_H
29 #define IMAGES_WCCOMPOUND_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 //# Forward Declarations
40 class ImageRegion;
41 class LCRegion;
42 class CoordinateSystem;
43 class RecordInterface;
44 class TableRecord;
45 class String;
46 
47 
48 // <summary>
49 // Base class for compound WCRegion objects.
50 // </summary>
51 
52 // <use visibility=local>
53 
54 // <reviewed reviewer="" date="" tests="">
55 // </reviewed>
56 
57 // <prerequisite>
58 // <li> <linkto class=WCRegion>WCRegion</linkto>
59 // </prerequisite>
60 
61 // <synopsis>
62 // WCCompound is the base class for world coordinate regions.
63 // It defines the functionality simply as conversion to an LCRegion.
64 // This is because you need an LCRegion to be able to access the
65 // pixels in a Lattice.
66 
67 // The conversion functions should be flexible in that the
68 // supplied CoordinateSystem does not have to be the same
69 // as that with which the derived class was constructed.
70 // This means that you can apply a WCCompound from one image
71 // to another, provided that operation has some meaning.
72 // </synopsis>
73 
74 // <example>
75 // <srcblock>
76 // </srcblock>
77 // </example>
78 
79 //# <todo asof="1997/11/11">
80 //# <li>
81 //# </todo>
82 
83 
84 class WCCompound : public WCRegion
85 {
86 public:
87  // Construct from one or more image regions.
88  // The image regions have to contain WCRegion objects, otherwise an
89  // exception is thrown.
90  // <group>
91  WCCompound (const ImageRegion& region1, const ImageRegion& region2);
92  WCCompound (const ImageRegion* region1,
93  const ImageRegion* region2 = 0,
94  const ImageRegion* region3 = 0,
95  const ImageRegion* region4 = 0,
96  const ImageRegion* region5 = 0,
97  const ImageRegion* region6 = 0,
98  const ImageRegion* region7 = 0,
99  const ImageRegion* region8 = 0,
100  const ImageRegion* region9 = 0,
101  const ImageRegion* region10 = 0);
103  // </group>
104 
105  // Construct from multiple regions given as a Block.
106  // When <src>takeOver</src> is True, the destructor will delete the
107  // given regions. Otherwise a copy of the regions is made.
108  WCCompound (Bool takeOver, const PtrBlock<const WCRegion*>& regions);
109 
110  // Copy constructor (copy semantics).
111  WCCompound (const WCCompound& other);
112 
113  virtual ~WCCompound();
114 
115  // Comparison
116  virtual Bool operator==(const WCRegion& other) const;
117 
118  // Get the contributing regions.
119  const PtrBlock<const WCRegion*>& regions() const;
120 
121 protected:
122  // Assignment (copy semantics) makes only sense for a derived class.
123  WCCompound& operator= (const WCCompound& other);
124 
125  // Convert each WCRegion to an LCRegion.
126  // The axes argument tells which axes to use from the coordinate
127  // system and shape.
129  const CoordinateSystem& cSys,
130  const IPosition& shape,
131  const IPosition& pixelAxesMap,
132  const IPosition& extendAxes) const;
133 
134  // Store the contributing regions in a record.
135  TableRecord makeRecord (const String& tableName) const;
136 
137  // Retrieve the contributing objects from the record.
139  const TableRecord&,
140  const String& tableName);
141 
142 private:
143  // Check if the ImageRegion's contain WCRegion's and extract them.
145 
146  // Check if the regions are correct.
147  // If needed, make a copy of the region objects.
148  void init (Bool takeOver);
149 
150  //# Member variables.
153 };
154 
155 
157 {
158  return itsRegions;
159 }
160 
161 
162 
163 } //# NAMESPACE CASACORE - END
164 
165 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:118
static void unmakeRecord(PtrBlock< const WCRegion * > &, const TableRecord &, const String &tableName)
Retrieve the contributing objects from the record.
PtrBlock< const WCRegion * > itsRegions
Definition: WCCompound.h:151
void multiToLCRegion(PtrBlock< const LCRegion * > &regions, const CoordinateSystem &cSys, const IPosition &shape, const IPosition &pixelAxesMap, const IPosition &extendAxes) const
Convert each WCRegion to an LCRegion.
const PtrBlock< const WCRegion * > & regions() const
Get the contributing regions.
Definition: WCCompound.h:156
void makeWCRegion(const PtrBlock< const ImageRegion * > &)
Check if the ImageRegion&#39;s contain WCRegion&#39;s and extract them.
WCCompound(const ImageRegion &region1, const ImageRegion &region2)
Construct from one or more image regions.
void init(Bool takeOver)
Check if the regions are correct.
Base class for compound WCRegion objects.
Definition: WCCompound.h:84
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual Bool operator==(const WCRegion &other) const
Comparison.
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
simple 1-D array
Definition: Allocator.h:210
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
WCCompound & operator=(const WCCompound &other)
Assignment (copy semantics) makes only sense for a derived class.
Block< IPosition > itsAxesUsed
Definition: WCCompound.h:152
Interconvert pixel and world coordinates.
TableRecord makeRecord(const String &tableName) const
Store the contributing regions in a record.