ExtendImage.h

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

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1