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