casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExtendImage.h
Go to the documentation of this file.
1 //# ExtendImage.h: An extension of an ImageInterface object
2 //# Copyright (C) 2001,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id: ExtendImage.h 21538 2015-01-07 09:08:57Z gervandiepen $
27 
28 #ifndef IMAGES_EXTENDIMAGE_H
29 #define IMAGES_EXTENDIMAGE_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 //# Forward Declarations
40 template <class T> class ExtendLattice;
41 
42 // <summary>
43 // An extension of an ImageInterface object.
44 // </summary>
45 //
46 // <use visibility=export>
47 //
48 // <reviewed reviewer="" date="" tests="tExtendImage.cc">
49 // </reviewed>
50 //
51 // <prerequisite>
52 // <li> <linkto class=ImageInterface>ImageInterface</linkto>
53 // <li> <linkto class=ExtendLattice>ExtendLattice</linkto>
54 // </prerequisite>
55 //
56 // <synopsis>
57 // Class ExtendImage can be used to (virtually) extend an image
58 // along axes with length 1 and/or to add new axes. In this way such
59 // an image can be made conformant with another image.
60 // E.g. it can be used to extend the continuum channel to
61 // subtract it from each channel in an image cube.
62 // </synopsis>
63 //
64 // <example>
65 // <srcblock>
66 // </srcblock>
67 // </example>
68 //
69 // <motivation>
70 // Used by LEL to handle images with different dimensionalities.
71 // </motivation>
72 //
73 //# <todo asof="1998/02/09">
74 //# </todo>
75 
76 
77 template <class T> class ExtendImage: public ImageInterface<T>
78 {
79 public:
80  // The default constructor
81  ExtendImage();
82 
83  // Create a ExtendImage from a Image.
84  // The coordinate system of the given image should be a subset of the
85  // new coordinate system. The same is true for the shape.
86  ExtendImage (const ImageInterface<T>& image,
87  const IPosition& newShape,
88  const CoordinateSystem& newCsys);
89 
90  // Copy constructor (reference semantics).
91  ExtendImage (const ExtendImage<T>& other);
92 
93  virtual ~ExtendImage();
94 
95  // Assignment (reference semantics).
97 
98  // Make a copy of the object (reference semantics).
99  // <group>
100  virtual ImageInterface<T>* cloneII() const;
101  // </group>
102 
103  // Get the image type (returns name of derived class).
104  virtual String imageType() const;
105 
106  // Is the ExtendImage masked?
107  // It is if its parent image is masked.
108  virtual Bool isMasked() const;
109 
110  // Does the image object have a pixelmask?
111  // It does if its parent has a pixelmask.
112  virtual Bool hasPixelMask() const;
113 
114  // Get access to the pixelmask in use (thus to the pixelmask of the parent).
115  // An exception is thrown if the parent does not have a pixelmask.
116  // <group>
117  virtual const Lattice<Bool>& pixelMask() const;
118  virtual Lattice<Bool>& pixelMask();
119  // </group>
120 
121  // Get the region used (always returns 0).
122  virtual const LatticeRegion* getRegionPtr() const;
123 
124  // A ExtendImage is not persistent.
125  virtual Bool isPersistent() const;
126 
127  // Is the ExtendImage paged to disk?
128  virtual Bool isPaged() const;
129 
130  // An ExtendImage is not writable
131  virtual Bool isWritable() const;
132 
133  // Returns the shape of the ExtendImage
134  virtual IPosition shape() const;
135 
136  // This function returns the recommended maximum number of pixels to
137  // include in the cursor of an iterator.
138  virtual uInt advisedMaxPixels() const;
139 
140  // Function which changes the shape of the ExtendImage.
141  // Throws an exception as resizing an ExtendImage is not possible.
142  virtual void resize(const TiledShape& newShape);
143 
144  // Return the name of the parent ImageInterface object.
145  virtual String name (Bool stripPath=False) const;
146 
147  // Check class invariants.
148  virtual Bool ok() const;
149 
150  // Get access to the attribute handler (of the parent image).
151  // If a handler keyword does not exist yet, it is created if
152  // <src>createHandler</src> is set.
153  // Otherwise the handler is empty and no groups can be created for it.
154  virtual ImageAttrHandler& attrHandler (Bool createHandler=False);
155 
156  // Do the actual getting of an array of values.
157  virtual Bool doGetSlice (Array<T>& buffer, const Slicer& section);
158 
159  // Putting data is not possible.
160  virtual void doPutSlice (const Array<T>& sourceBuffer,
161  const IPosition& where,
162  const IPosition& stride);
163 
164  // Get a section of the mask.
165  virtual Bool doGetMaskSlice (Array<Bool>& buffer, const Slicer& section);
166 
167  // This function is used by the LatticeIterator class to generate an
168  // iterator of the correct type for this Lattice. Not recommended
169  // for general use.
171  (const LatticeNavigator& navigator,
172  Bool useRef) const;
173 
174  // Get the best cursor shape.
175  virtual IPosition doNiceCursorShape (uInt maxPixels) const;
176 
177  // Handle the (un)locking and syncing, etc.
178  // <group>
179  virtual Bool lock (FileLocker::LockType, uInt nattempts);
180  virtual void unlock();
181  virtual Bool hasLock (FileLocker::LockType) const;
182  virtual void resync();
183  virtual void flush();
184  virtual void tempClose();
185  virtual void reopen();
186  // </group>
187 
188 private:
189  //# itsImagePtr points to the parent image.
192 
193  //# Make members of parent class known.
194 public:
196 protected:
198 };
199 
200 
201 
202 } //# NAMESPACE CASACORE - END
203 
204 #ifndef CASACORE_NO_AUTO_TEMPLATES
205 #include <casacore/images/Images/ExtendImage.tcc>
206 #endif //# CASACORE_NO_AUTO_TEMPLATES
207 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
virtual LatticeIterInterface< T > * makeIter(const LatticeNavigator &navigator, Bool useRef) const
This function is used by the LatticeIterator class to generate an iterator of the correct type for th...
virtual String imageType() const
Get the image type (returns name of derived class).
virtual String name(Bool stripPath=False) const
Return the name of the parent ImageInterface object.
virtual Bool isMasked() const
Is the ExtendImage masked? It is if its parent image is masked.
virtual void doPutSlice(const Array< T > &sourceBuffer, const IPosition &where, const IPosition &stride)
Putting data is not possible.
virtual void flush()
Flush the data (but do not unlock).
virtual void resync()
Resynchronize the Lattice object with the lattice file.
Hold and delete pointers not deleted by object destructors.
PtrHolder< ExtendLattice< T > > itsExtLatPtr
Definition: ExtendImage.h:191
Abstract base class for an image attributes handler.
virtual const LatticeRegion * getRegionPtr() const
Get the region used (always returns 0).
virtual ImageAttrHandler & attrHandler(Bool createHandler=False)
Get access to the attribute handler (of the parent image).
A base class for Lattice iterators.
Definition: SubImage.h:46
Define the shape and tile shape.
Definition: TiledShape.h:99
virtual IPosition doNiceCursorShape(uInt maxPixels) const
Get the best cursor shape.
A base class for astronomical images.
virtual const Lattice< Bool > & pixelMask() const
Get access to the pixelmask in use (thus to the pixelmask of the parent).
virtual Bool doGetSlice(Array< T > &buffer, const Slicer &section)
Do the actual getting of an array of values.
virtual Bool isPersistent() const
A ExtendImage is not persistent.
virtual Bool lock(FileLocker::LockType, uInt nattempts)
Handle the (un)locking and syncing, etc.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
ExtendImage()
The default constructor.
virtual Bool isPaged() const
Is the ExtendImage paged to disk?
An extension of an ImageInterface object.
Definition: ExtendImage.h:77
virtual Bool ok() const
Check class invariants.
const Bool False
Definition: aipstype.h:44
template &lt;class T, class U&gt; class vector;
Definition: MSFlagger.h:37
virtual ImageInterface< T > * cloneII() const
Make a copy of the object (reference semantics).
PtrHolder< ImageInterface< T > > itsImagePtr
Definition: ExtendImage.h:190
virtual IPosition shape() const
Returns the shape of the ExtendImage.
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:289
virtual Bool hasPixelMask() const
Does the image object have a pixelmask? It does if its parent has a pixelmask.
virtual void reopen()
Explicitly reopen the temporarily closed lattice.
virtual Bool doGetMaskSlice(Array< Bool > &buffer, const Slicer &section)
Get a section of the mask.
virtual uInt advisedMaxPixels() const
This function returns the recommended maximum number of pixels to include in the cursor of an iterato...
ExtendImage< T > & operator=(const ExtendImage< T > &other)
Assignment (reference semantics).
virtual void tempClose()
Temporarily close the lattice.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
An optionally strided region in a Lattice.
Definition: LatticeRegion.h:74
virtual Bool hasLock(FileLocker::LockType) const
LockType
Define the possible lock types.
Definition: FileLocker.h:95
virtual Bool isWritable() const
An ExtendImage is not writable.
virtual void resize(const TiledShape &newShape)
Function which changes the shape of the ExtendImage.
Interconvert pixel and world coordinates.
unsigned int uInt
Definition: aipstype.h:51
Abstract base class to steer lattice iterators.
virtual void unlock()
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42