casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
WCUnion.h
Go to the documentation of this file.
00001 //# WCUnion.h: Make the union of 2 or more image regions
00002 //# Copyright (C) 1998
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: WCUnion.h 20615 2009-06-09 02:16:01Z Malte.Marquarding $
00027 
00028 #ifndef IMAGES_WCUNION_H
00029 #define IMAGES_WCUNION_H
00030 
00031 //# Includes
00032 #include <images/Regions/WCCompound.h>
00033 
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 // <summary>
00038 // Make the union of 2 or more image regions.
00039 // </summary>
00040 
00041 // <use visibility=export>
00042 
00043 // <reviewed reviewer="" date="" tests="">
00044 // </reviewed>
00045 
00046 // <prerequisite>
00047 //   <li> <linkto class=WCCompound>WCCompound</linkto>
00048 // </prerequisite>
00049 
00050 // <synopsis> 
00051 // The WCUnion class is a specialization of class
00052 // <linkto class=WCCompound>WCCompound</linkto>.
00053 // It makes it possible to take the union of 2 or more image regions.
00054 // Note that only world coordinate regions can be used in a compound,
00055 // thus an LCSlicer object is not allowed in a union.
00056 // <p>
00057 // The union of regions is the collection of the pixels masked-on
00058 // in any region.
00059 // Note that the bounding box of a union is determined by the outermost
00060 // pixels. It means that if regions are very far apart, the bounding
00061 // box of the union is very large and therefore inefficient.
00062 // <p>
00063 // The regions in a union can have different axes and dimensionalities.
00064 // The axes and dimensionality of a union are determined by the
00065 // collection of all different axes in its regions. Each individual region
00066 // will be auto-extended along the axes not being part of the region.
00067 // E.g. one can define a WCBox with axis RA and another WCBox with
00068 // axis DEC. The union will be 2-dim with axes RA and DEC. The first
00069 // box will be auto-extended to cover the DEC axis, which results
00070 // in a 2-dim box with its DEC axis the length of the image's DEC axis.
00071 // Similarly the second box will be auto-extended to cover the RA axis.
00072 // </synopsis> 
00073 
00074 // <example>
00075 // <srcblock>
00076 // </srcblock>
00077 // </example>
00078 
00079 //# <todo asof="1997/11/11">
00080 //# <li>
00081 //# </todo>
00082 
00083 
00084 class WCUnion: public WCCompound
00085 {
00086 public:
00087     // Construct the union of one or more image regions.
00088     // The image regions have to contain WCRegion objects, otherwise an
00089     // exception is thrown.
00090     // <group>
00091     WCUnion (const ImageRegion& region1, const ImageRegion& region2);
00092     WCUnion (const ImageRegion* region1,
00093              const ImageRegion* region2 = 0,
00094              const ImageRegion* region3 = 0,
00095              const ImageRegion* region4 = 0,
00096              const ImageRegion* region5 = 0,
00097              const ImageRegion* region6 = 0,
00098              const ImageRegion* region7 = 0,
00099              const ImageRegion* region8 = 0,
00100              const ImageRegion* region9 = 0,
00101              const ImageRegion* region10 = 0);
00102     WCUnion (const PtrBlock<const ImageRegion*>& regions);
00103     // </group>
00104 
00105     // Construct from multiple regions given as a Block.
00106     // When <src>takeOver</src> is True, the destructor will delete the
00107     // given regions. Otherwise a copy of the regions is made.
00108     WCUnion (Bool takeOver, const PtrBlock<const WCRegion*>& regions);
00109 
00110     // Copy constructor (copy semantics).
00111     WCUnion (const WCUnion& other);
00112 
00113     virtual ~WCUnion();
00114 
00115     // Assignment (copy semantics).
00116     WCUnion& operator= (const WCUnion& other);
00117 
00118     // Comparison
00119     virtual Bool operator== (const WCRegion& other) const;
00120 
00121     // Make a copy of the derived object.
00122     virtual WCRegion* cloneRegion() const;
00123 
00124     // Get the class name (to store in the record).
00125     static String className();
00126 
00127     // Get the region type.  Returns className()
00128     virtual String type() const;
00129 
00130     // Convert the (derived) object to a record.
00131     virtual TableRecord toRecord (const String& tableName) const;
00132 
00133     // Convert correct object from a record.
00134     static WCUnion* fromRecord (const TableRecord&,
00135                                 const String& tableName);
00136 
00137 protected:
00138     // Convert to an LCRegion using the given coordinate system and shape.
00139     // pixelAxesMap(i) gives the pixel axis in cSys of axes <src>i</src>
00140     // in the axesDesc.
00141     virtual LCRegion* doToLCRegion (const CoordinateSystem& cSys,
00142                                     const IPosition& shape,
00143                                     const IPosition& pixelAxesMap,
00144                                     const IPosition& outOrder) const;
00145 };
00146 
00147 
00148 
00149 } //# NAMESPACE CASA - END
00150 
00151 #endif