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