casa
$Rev:20696$
|
00001 //# ExtendImage.h: An extension of an ImageInterface object 00002 //# Copyright (C) 2001,2003 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: ExtendImage.h 20505 2009-01-19 14:37:24Z gervandiepen $ 00027 00028 #ifndef IMAGES_EXTENDIMAGE_H 00029 #define IMAGES_EXTENDIMAGE_H 00030 00031 00032 //# Includes 00033 #include <images/Images/ImageInterface.h> 00034 00035 namespace casa { //# NAMESPACE CASA - BEGIN 00036 00037 //# Forward Declarations 00038 template <class T> class ExtendLattice; 00039 00040 00041 // <summary> 00042 // An extension of an ImageInterface object. 00043 // </summary> 00044 // 00045 // <use visibility=export> 00046 // 00047 // <reviewed reviewer="" date="" tests="tExtendImage.cc"> 00048 // </reviewed> 00049 // 00050 // <prerequisite> 00051 // <li> <linkto class=ImageInterface>ImageInterface</linkto> 00052 // <li> <linkto class=ExtendLattice>ExtendLattice</linkto> 00053 // </prerequisite> 00054 // 00055 // <synopsis> 00056 // Class ExtendImage can be used to (virtually) extend an image 00057 // along axes with length 1 and/or to add new axes. In this way such 00058 // an image can be made conformant with another image. 00059 // E.g. it can be used to extend the continuum channel to 00060 // subtract it from each channel in an image cube. 00061 // </synopsis> 00062 // 00063 // <example> 00064 // <srcblock> 00065 // </srcblock> 00066 // </example> 00067 // 00068 // <motivation> 00069 // Used by LEL to handle images with different dimensionalities. 00070 // </motivation> 00071 // 00072 //# <todo asof="1998/02/09"> 00073 //# </todo> 00074 00075 00076 template <class T> class ExtendImage: public ImageInterface<T> 00077 { 00078 public: 00079 // The default constructor 00080 ExtendImage(); 00081 00082 // Create a ExtendImage from a Image. 00083 // The coordinate system of the given image should be a subset of the 00084 // new coordinate system. The same is true for the shape. 00085 ExtendImage (const ImageInterface<T>& image, 00086 const IPosition& newShape, 00087 const CoordinateSystem& newCsys); 00088 00089 // Copy constructor (reference semantics). 00090 ExtendImage (const ExtendImage<T>& other); 00091 00092 virtual ~ExtendImage(); 00093 00094 // Assignment (reference semantics). 00095 ExtendImage<T>& operator= (const ExtendImage<T>& other); 00096 00097 // Make a copy of the object (reference semantics). 00098 // <group> 00099 virtual ImageInterface<T>* cloneII() const; 00100 // </group> 00101 00102 // Get the image type (returns name of derived class). 00103 virtual String imageType() const; 00104 00105 // Is the ExtendImage masked? 00106 // It is if its parent image is masked. 00107 virtual Bool isMasked() const; 00108 00109 // Does the image object have a pixelmask? 00110 // It does if its parent has a pixelmask. 00111 virtual Bool hasPixelMask() const; 00112 00113 // Get access to the pixelmask in use (thus to the pixelmask of the parent). 00114 // An exception is thrown if the parent does not have a pixelmask. 00115 // <group> 00116 virtual const Lattice<Bool>& pixelMask() const; 00117 virtual Lattice<Bool>& pixelMask(); 00118 // </group> 00119 00120 // Get the region used (always returns 0). 00121 virtual const LatticeRegion* getRegionPtr() const; 00122 00123 // A ExtendImage is not persistent. 00124 virtual Bool isPersistent() const; 00125 00126 // Is the ExtendImage paged to disk? 00127 virtual Bool isPaged() const; 00128 00129 // An ExtendImage is not writable 00130 virtual Bool isWritable() const; 00131 00132 // Returns the shape of the ExtendImage 00133 virtual IPosition shape() const; 00134 00135 // This function returns the recommended maximum number of pixels to 00136 // include in the cursor of an iterator. 00137 virtual uInt advisedMaxPixels() const; 00138 00139 // Function which changes the shape of the ExtendImage. 00140 // Throws an exception as resizing an ExtendImage is not possible. 00141 virtual void resize(const TiledShape& newShape); 00142 00143 // Return the name of the parent ImageInterface object. 00144 virtual String name (Bool stripPath=False) const; 00145 00146 // Check class invariants. 00147 virtual Bool ok() const; 00148 00149 // Do the actual getting of an array of values. 00150 virtual Bool doGetSlice (Array<T>& buffer, const Slicer& section); 00151 00152 // Putting data is not possible. 00153 virtual void doPutSlice (const Array<T>& sourceBuffer, 00154 const IPosition& where, 00155 const IPosition& stride); 00156 00157 // Get a section of the mask. 00158 virtual Bool doGetMaskSlice (Array<Bool>& buffer, const Slicer& section); 00159 00160 // This function is used by the LatticeIterator class to generate an 00161 // iterator of the correct type for this Lattice. Not recommended 00162 // for general use. 00163 virtual LatticeIterInterface<T>* makeIter 00164 (const LatticeNavigator& navigator, 00165 Bool useRef) const; 00166 00167 // Get the best cursor shape. 00168 virtual IPosition doNiceCursorShape (uInt maxPixels) const; 00169 00170 // Handle the (un)locking and syncing, etc. 00171 // <group> 00172 virtual Bool lock (FileLocker::LockType, uInt nattempts); 00173 virtual void unlock(); 00174 virtual Bool hasLock (FileLocker::LockType) const; 00175 virtual void resync(); 00176 virtual void flush(); 00177 virtual void tempClose(); 00178 virtual void reopen(); 00179 // </group> 00180 00181 private: 00182 //# itsImagePtr points to the parent image. 00183 ImageInterface<T>* itsImagePtr; 00184 ExtendLattice<T>* itsExtLatPtr; 00185 00186 //# Make members of parent class known. 00187 public: 00188 using ImageInterface<T>::logger; 00189 protected: 00190 using ImageInterface<T>::setCoordsMember; 00191 }; 00192 00193 00194 00195 } //# NAMESPACE CASA - END 00196 00197 #ifndef CASACORE_NO_AUTO_TEMPLATES 00198 #include <images/Images/ExtendImage.tcc> 00199 #endif //# CASACORE_NO_AUTO_TEMPLATES 00200 #endif