00001 //# WCComplement.h: Make the complement of an image region 00002 //# Copyright (C) 1998,2004 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_WCCOMPLEMENT_H 00029 #define IMAGES_WCCOMPLEMENT_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 complement of an image region. 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 WCComplement class is a specialization of class 00053 // <linkto class=WCCompound>WCCompound</linkto>. 00054 // It makes it possible to take the complement of the given region 00055 // (which can be a simple WCBox, but also a complex compound region). 00056 // Note that only world coordinate regions can be used in a compound, 00057 // thus an LCSlicer object is not allowed in an intersection. 00058 // <p> 00059 // Note that a region consists of all its masked-on pixels inside the 00060 // bounding box of the region. Thus the complement consists of all 00061 // pixels outside the bounding box and all masked-off pixels inside 00062 // the bounding box. So the complement of the complement of a region 00063 // is the region itself. 00064 // </synopsis> 00065 00066 // <example> 00067 // <srcblock> 00068 // </srcblock> 00069 // </example> 00070 00071 //# <todo asof="1997/11/11"> 00072 //# <li> 00073 //# </todo> 00074 00075 00076 class WCComplement: public WCCompound 00077 { 00078 public: 00079 WCComplement(); 00080 00081 // Construct the complement of the given region. 00082 WCComplement (const ImageRegion& region1); 00083 00084 // Copy constructor (copy semantics). 00085 WCComplement (const WCComplement& other); 00086 00087 virtual ~WCComplement(); 00088 00089 // Assignment (copy semantics). 00090 WCComplement& operator= (const WCComplement& other); 00091 00092 // Comparison 00093 virtual Bool operator== (const WCRegion& other) const; 00094 00095 // Make a copy of the derived object. 00096 // cloneRegion needs to return a WCRegion * because the 00097 // SGI compiler is smart enough to do the right thing. 00098 virtual WCRegion* cloneRegion() const; 00099 00100 // Get the class name (to store in the record). 00101 static String className(); 00102 00103 // Get the region type. Returns className() 00104 virtual String type() const; 00105 00106 // Convert the (derived) object to a record. 00107 virtual TableRecord toRecord (const String& tableName) const; 00108 00109 // Convert correct object from a record. 00110 static WCComplement* fromRecord (const TableRecord&, 00111 const String& tableName); 00112 00113 // Construct from multiple regions. 00114 // When <src>takeOver</src> is True, the destructor will delete the 00115 // given regions. Otherwise a copy of the regions is made. 00116 WCComplement (Bool takeOver, 00117 const PtrBlock<const WCRegion*>& regions); 00118 00119 protected: 00120 // Convert to an LCRegion using the given coordinate system and shape. 00121 // pixelAxesMap(i) gives the pixel axis in cSys of axes <src>i</src> 00122 // in the axesDesc. 00123 virtual LCRegion* doToLCRegion (const CoordinateSystem& cSys, 00124 const IPosition& shape, 00125 const IPosition& pixelAxesMap, 00126 const IPosition& outOrder) const; 00127 }; 00128 00129 00130 00131 } //# NAMESPACE CASACORE - END 00132 00133 #endif