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$ 00027 00028 #ifndef IMAGES_WCDIFFERENCE_H 00029 #define IMAGES_WCDIFFERENCE_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 difference of 2 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 WCDifference class is a specialization of class 00053 // <linkto class=WCCompound>WCCompound</linkto>. 00054 // It makes it possible to take the difference of 2 regions. 00055 // Note that only world coordinate regions can be used in a compound, 00056 // thus an LCSlicer object is not allowed in a difference. 00057 // <p> 00058 // The difference consists of all pixels masked-on in the first 00059 // region and not masked-on in the second region. 00060 // <p> 00061 // The regions in a difference can have different axes and dimensionalities. 00062 // The axes and dimensionality of a difference are determined by the 00063 // collection of all different axes in its regions. Each individual region 00064 // will be auto-extended along the axes not being part of the region. 00065 // E.g. one can define a WCBox with axis RA and another WCBox with 00066 // axis DEC. The difference will be 2-dim with axes RA and DEC. The first 00067 // box will be auto-extended to cover the DEC axis, which results 00068 // in a 2-dim box with its DEC axis the length of the image's DEC axis. 00069 // Similarly the second box will be auto-extended to cover the RA axis. 00070 // </synopsis> 00071 00072 // <example> 00073 // <srcblock> 00074 // </srcblock> 00075 // </example> 00076 00077 //# <todo asof="1997/11/11"> 00078 //# <li> 00079 //# </todo> 00080 00081 00082 class WCDifference: public WCCompound 00083 { 00084 public: 00085 // Construct the difference of one or more image regions. 00086 // The image regions have to contain WCRegion objects, otherwise an 00087 // exception is thrown. 00088 // <group> 00089 WCDifference (const ImageRegion& region1, const ImageRegion& region2); 00090 WCDifference (const PtrBlock<const ImageRegion*>& regions); 00091 // </group> 00092 00093 // Construct from multiple regions given as a Block. 00094 // When <src>takeOver</src> is True, the destructor will delete the 00095 // given regions. Otherwise a copy of the regions is made. 00096 WCDifference (Bool takeOver, const PtrBlock<const WCRegion*>& regions); 00097 00098 // Copy constructor (copy semantics). 00099 WCDifference (const WCDifference& other); 00100 00101 virtual ~WCDifference(); 00102 00103 // Assignment (copy semantics). 00104 WCDifference& operator= (const WCDifference& other); 00105 00106 // Comparison 00107 virtual Bool operator== (const WCRegion& other) const; 00108 00109 // Make a copy of the derived object. 00110 virtual WCRegion* cloneRegion() const; 00111 00112 // Get the class name (to store in the record). 00113 static String className(); 00114 00115 // Get the region type. Returns className() 00116 virtual String type() const; 00117 00118 // Convert the (derived) object to a record. 00119 virtual TableRecord toRecord (const String& tableName) const; 00120 00121 // Convert correct object from a record. 00122 static WCDifference* fromRecord (const TableRecord&, 00123 const String& tableName); 00124 00125 protected: 00126 // Convert to an LCRegion using the given coordinate system and shape. 00127 // pixelAxesMap(i) gives the pixel axis in cSys of axes <src>i</src> 00128 // in the axesDesc. 00129 virtual LCRegion* doToLCRegion (const CoordinateSystem& cSys, 00130 const IPosition& shape, 00131 const IPosition& pixelAxesMap, 00132 const IPosition& outOrder) const; 00133 }; 00134 00135 00136 00137 } //# NAMESPACE CASACORE - END 00138 00139 #endif