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$
00027 
00028 #ifndef IMAGES_WCUNION_H
00029 #define IMAGES_WCUNION_H
00030 
00031 //# Includes
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/images/Regions/WCCompound.h>
00034 
00035 
00036 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00037 
00038 // <summary>
00039 // Make the union of 2 or more image regions.
00040 // </summary>
00041 
00042 // <use visibility=export>
00043 
00044 // <reviewed reviewer="" date="" tests="">
00045 // </reviewed>
00046 
00047 // <prerequisite>
00048 //   <li> <linkto class=WCCompound>WCCompound</linkto>
00049 // </prerequisite>
00050 
00051 // <synopsis> 
00052 // The WCUnion class is a specialization of class
00053 // <linkto class=WCCompound>WCCompound</linkto>.
00054 // It makes it possible to take the union of 2 or more image regions.
00055 // Note that only world coordinate regions can be used in a compound,
00056 // thus an LCSlicer object is not allowed in a union.
00057 // <p>
00058 // The union of regions is the collection of the pixels masked-on
00059 // in any region.
00060 // Note that the bounding box of a union is determined by the outermost
00061 // pixels. It means that if regions are very far apart, the bounding
00062 // box of the union is very large and therefore inefficient.
00063 // <p>
00064 // The regions in a union can have different axes and dimensionalities.
00065 // The axes and dimensionality of a union are determined by the
00066 // collection of all different axes in its regions. Each individual region
00067 // will be auto-extended along the axes not being part of the region.
00068 // E.g. one can define a WCBox with axis RA and another WCBox with
00069 // axis DEC. The union will be 2-dim with axes RA and DEC. The first
00070 // box will be auto-extended to cover the DEC axis, which results
00071 // in a 2-dim box with its DEC axis the length of the image's DEC axis.
00072 // Similarly the second box will be auto-extended to cover the RA axis.
00073 // </synopsis> 
00074 
00075 // <example>
00076 // <srcblock>
00077 // </srcblock>
00078 // </example>
00079 
00080 //# <todo asof="1997/11/11">
00081 //# <li>
00082 //# </todo>
00083 
00084 
00085 class WCUnion: public WCCompound
00086 {
00087 public:
00088     // Construct the union of one or more image regions.
00089     // The image regions have to contain WCRegion objects, otherwise an
00090     // exception is thrown.
00091     // <group>
00092     WCUnion (const ImageRegion& region1, const ImageRegion& region2);
00093     WCUnion (const ImageRegion* region1,
00094              const ImageRegion* region2 = 0,
00095              const ImageRegion* region3 = 0,
00096              const ImageRegion* region4 = 0,
00097              const ImageRegion* region5 = 0,
00098              const ImageRegion* region6 = 0,
00099              const ImageRegion* region7 = 0,
00100              const ImageRegion* region8 = 0,
00101              const ImageRegion* region9 = 0,
00102              const ImageRegion* region10 = 0);
00103     WCUnion (const PtrBlock<const ImageRegion*>& regions);
00104     // </group>
00105 
00106     // Construct from multiple regions given as a Block.
00107     // When <src>takeOver</src> is True, the destructor will delete the
00108     // given regions. Otherwise a copy of the regions is made.
00109     WCUnion (Bool takeOver, const PtrBlock<const WCRegion*>& regions);
00110 
00111     // Copy constructor (copy semantics).
00112     WCUnion (const WCUnion& other);
00113 
00114     virtual ~WCUnion();
00115 
00116     // Assignment (copy semantics).
00117     WCUnion& operator= (const WCUnion& other);
00118 
00119     // Comparison
00120     virtual Bool operator== (const WCRegion& other) const;
00121 
00122     // Make a copy of the derived object.
00123     virtual WCRegion* cloneRegion() const;
00124 
00125     // Get the class name (to store in the record).
00126     static String className();
00127 
00128     // Get the region type.  Returns className()
00129     virtual String type() const;
00130 
00131     // Convert the (derived) object to a record.
00132     virtual TableRecord toRecord (const String& tableName) const;
00133 
00134     // Convert correct object from a record.
00135     static WCUnion* fromRecord (const TableRecord&,
00136                                 const String& tableName);
00137 
00138 protected:
00139     // Convert to an LCRegion using the given coordinate system and shape.
00140     // pixelAxesMap(i) gives the pixel axis in cSys of axes <src>i</src>
00141     // in the axesDesc.
00142     virtual LCRegion* doToLCRegion (const CoordinateSystem& cSys,
00143                                     const IPosition& shape,
00144                                     const IPosition& pixelAxesMap,
00145                                     const IPosition& outOrder) const;
00146 };
00147 
00148 
00149 
00150 } //# NAMESPACE CASACORE - END
00151 
00152 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1