casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
WCDifference.h
Go to the documentation of this file.
00001 //# WCDifference.h: Make the difference of 2 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: WCDifference.h 20615 2009-06-09 02:16:01Z Malte.Marquarding $
00027 
00028 #ifndef IMAGES_WCDIFFERENCE_H
00029 #define IMAGES_WCDIFFERENCE_H
00030 
00031 //# Includes
00032 #include <images/Regions/WCCompound.h>
00033 
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 // <summary>
00038 // Make the difference of 2 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 WCDifference class is a specialization of class
00052 // <linkto class=WCCompound>WCCompound</linkto>.
00053 // It makes it possible to take the difference of 2 regions.
00054 // Note that only world coordinate regions can be used in a compound,
00055 // thus an LCSlicer object is not allowed in a difference.
00056 // <p>
00057 // The difference consists of all pixels masked-on in the first
00058 // region and not masked-on in the second region.
00059 // <p>
00060 // The regions in a difference can have different axes and dimensionalities.
00061 // The axes and dimensionality of a difference 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 difference 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 WCDifference: public WCCompound
00082 {
00083 public:
00084     // Construct the difference of one or more image regions.
00085     // The image regions have to contain WCRegion objects, otherwise an
00086     // exception is thrown.
00087     // <group>
00088     WCDifference (const ImageRegion& region1, const ImageRegion& region2);
00089     WCDifference (const PtrBlock<const ImageRegion*>& regions);
00090     // </group>
00091 
00092     // Construct from multiple regions given as a Block.
00093     // When <src>takeOver</src> is True, the destructor will delete the
00094     // given regions. Otherwise a copy of the regions is made.
00095     WCDifference (Bool takeOver, const PtrBlock<const WCRegion*>& regions);
00096 
00097     // Copy constructor (copy semantics).
00098     WCDifference (const WCDifference& other);
00099 
00100     virtual ~WCDifference();
00101 
00102     // Assignment (copy semantics).
00103     WCDifference& operator= (const WCDifference& other);
00104 
00105     // Comparison
00106     virtual Bool operator== (const WCRegion& other) const;
00107 
00108     // Make a copy of the derived object.
00109     virtual WCRegion* cloneRegion() const;
00110 
00111     // Get the class name (to store in the record).
00112     static String className();
00113 
00114     // Get the region type.  Returns className()
00115     virtual String type() const;
00116 
00117     // Convert the (derived) object to a record.
00118     virtual TableRecord toRecord (const String& tableName) const;
00119 
00120     // Convert correct object from a record.
00121     static WCDifference* fromRecord (const TableRecord&,
00122                                      const String& tableName);
00123 
00124 protected:
00125     // Convert to an LCRegion using the given coordinate system and shape.
00126     // pixelAxesMap(i) gives the pixel axis in cSys of axes <src>i</src>
00127     // in the axesDesc.
00128     virtual LCRegion* doToLCRegion (const CoordinateSystem& cSys,
00129                                     const IPosition& shape,
00130                                     const IPosition& pixelAxesMap,
00131                                     const IPosition& outOrder) const;
00132 };
00133 
00134 
00135 
00136 } //# NAMESPACE CASA - END
00137 
00138 #endif