00001 //# WCExtension.h: Make the extension an image region 00002 //# Copyright (C) 1998,2001 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_WCEXTENSION_H 00029 #define IMAGES_WCEXTENSION_H 00030 00031 //# Includes 00032 #include <casacore/casa/aips.h> 00033 #include <casacore/images/Regions/WCCompound.h> 00034 #include <casacore/casa/Arrays/IPosition.h> 00035 00036 namespace casacore { //# NAMESPACE CASACORE - BEGIN 00037 00038 //# Forward declarations 00039 class WCBox; 00040 00041 00042 // <summary> 00043 // Make the extension of an image region. 00044 // </summary> 00045 00046 // <use visibility=export> 00047 00048 // <reviewed reviewer="" date="" tests=""> 00049 // </reviewed> 00050 00051 // <prerequisite> 00052 // <li> <linkto class=WCCompound>WCCompound</linkto> 00053 // </prerequisite> 00054 00055 // <synopsis> 00056 // The WCExtension class is a specialization of class 00057 // <linkto class=WCCompound>WCCompound</linkto>. 00058 // It makes it possible to extend a region along straight lines to 00059 // other dimensions. It is also possible to extend existing axes with 00060 // length 1, i.e. to stretch such axes. 00061 // E.g. a circle in the RA,DEC plane can be extended to 00062 // a cylinder in a RA,DEC,FREQ cube. It is possible to extend over 00063 // more than one dimension. One can also limit the extension range 00064 // E.g. in the forementioned example the circle can be extended 00065 // for a given range of frequencies only. 00066 // <br>The extension axes and ranges have to be given as a 00067 // <linkto class=WCBox>WCBox</linkto> object. The axes which are part 00068 // of the box and the region are the axes to be stretched. Box axes 00069 // which are not part of the region are the extension axes. 00070 // <p> 00071 // Note that regions get automatically extended when a region is used 00072 // for a higher dimensioned image. The extension is done for all 00073 // unknown axes (for their entire length). 00074 // </synopsis> 00075 00076 // <example> 00077 // <srcblock> 00078 // </srcblock> 00079 // </example> 00080 00081 //# <todo asof="1997/11/11"> 00082 //# <li> 00083 //# </todo> 00084 00085 00086 class WCExtension: public WCCompound 00087 { 00088 public: 00089 // Construct the extension of an image region using the axes 00090 // and blc,trc given in the extendBox. 00091 // The axes in region and box have to be disjoint. 00092 WCExtension (const ImageRegion& region, const WCBox& extendBox); 00093 00094 // Copy constructor (copy semantics). 00095 WCExtension (const WCExtension& other); 00096 00097 virtual ~WCExtension(); 00098 00099 // Assignment (copy semantics). 00100 WCExtension& operator= (const WCExtension& other); 00101 00102 // Comparison 00103 virtual Bool operator== (const WCRegion& other) const; 00104 00105 // Make a copy of the derived object. 00106 virtual WCRegion* cloneRegion() const; 00107 00108 // Get the class name (to store in the record). 00109 static String className(); 00110 00111 // Get the region type. Returns className() 00112 virtual String type() const; 00113 00114 // Convert the (derived) object to a record. 00115 virtual TableRecord toRecord (const String& tableName) const; 00116 00117 // Convert correct object from a record. 00118 static WCExtension* fromRecord (const TableRecord&, 00119 const String& tableName); 00120 00121 protected: 00122 // WCExtension can extend a region if WCBox can do so. 00123 virtual Bool canExtend() const; 00124 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 private: 00134 // Construct from multiple regions given as a Block. 00135 // When <src>takeOver</src> is True, the destructor will delete the 00136 // given regions. Otherwise a copy of the regions is made. 00137 WCExtension (Bool takeOver, const PtrBlock<const WCRegion*>& regions); 00138 00139 // Find the axes to be extended and stretched. 00140 // The extend axes are the axis numbers in the box. 00141 // For the stretch axes both box and region axes are returned. 00142 void findAxes (IPosition& extendBoxAxes, IPosition& stretchBoxAxes, 00143 IPosition& stretchRegionAxes) const; 00144 }; 00145 00146 00147 00148 } //# NAMESPACE CASACORE - END 00149 00150 #endif