casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef IMAGES_EXTENDIMAGE_H
27#define IMAGES_EXTENDIMAGE_H
28
29
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/images/Images/ImageInterface.h>
33#include <memory>
34
35namespace casacore { //# NAMESPACE CASACORE - BEGIN
36
37//# Forward Declarations
38template <class T> class ExtendLattice;
39
40// <summary>
41// An extension of an ImageInterface object.
42// </summary>
43//
44// <use visibility=export>
45//
46// <reviewed reviewer="" date="" tests="tExtendImage.cc">
47// </reviewed>
48//
49// <prerequisite>
50// <li> <linkto class=ImageInterface>ImageInterface</linkto>
51// <li> <linkto class=ExtendLattice>ExtendLattice</linkto>
52// </prerequisite>
53//
54// <synopsis>
55// Class ExtendImage can be used to (virtually) extend an image
56// along axes with length 1 and/or to add new axes. In this way such
57// an image can be made conformant with another image.
58// E.g. it can be used to extend the continuum channel to
59// subtract it from each channel in an image cube.
60// </synopsis>
61//
62// <example>
63// <srcblock>
64// </srcblock>
65// </example>
66//
67// <motivation>
68// Used by LEL to handle images with different dimensionalities.
69// </motivation>
70//
71//# <todo asof="1998/02/09">
72//# </todo>
73
74
75template <class T> class ExtendImage: public ImageInterface<T>
76{
77public:
78 // The default constructor
80
81 // Create a ExtendImage from a Image.
82 // The coordinate system of the given image should be a subset of the
83 // new coordinate system. The same is true for the shape.
85 const IPosition& newShape,
86 const CoordinateSystem& newCsys);
87
88 // Copy constructor (reference semantics).
90
91 virtual ~ExtendImage();
92
93 // Assignment (reference semantics).
95
96 // Make a copy of the object (reference semantics).
97 // <group>
98 virtual ImageInterface<T>* cloneII() const;
99 // </group>
100
101 // Get the image type (returns name of derived class).
102 virtual String imageType() const;
103
104 // Is the ExtendImage masked?
105 // It is if its parent image is masked.
106 virtual Bool isMasked() const;
107
108 // Does the image object have a pixelmask?
109 // It does if its parent has a pixelmask.
110 virtual Bool hasPixelMask() const;
111
112 // Get access to the pixelmask in use (thus to the pixelmask of the parent).
113 // An exception is thrown if the parent does not have a pixelmask.
114 // <group>
115 virtual const Lattice<Bool>& pixelMask() const;
117 // </group>
118
119 // Get the region used (always returns 0).
120 virtual const LatticeRegion* getRegionPtr() const;
121
122 // A ExtendImage is not persistent.
123 virtual Bool isPersistent() const;
124
125 // Is the ExtendImage paged to disk?
126 virtual Bool isPaged() const;
127
128 // An ExtendImage is not writable
129 virtual Bool isWritable() const;
130
131 // Returns the shape of the ExtendImage
132 virtual IPosition shape() const;
133
134 // This function returns the recommended maximum number of pixels to
135 // include in the cursor of an iterator.
136 virtual uInt advisedMaxPixels() const;
137
138 // Function which changes the shape of the ExtendImage.
139 // Throws an exception as resizing an ExtendImage is not possible.
140 virtual void resize(const TiledShape& newShape);
141
142 // Return the name of the parent ImageInterface object.
143 virtual String name (Bool stripPath=False) const;
144
145 // Check class invariants.
146 virtual Bool ok() const;
147
148 // Get access to the attribute handler (of the parent image).
149 // If a handler keyword does not exist yet, it is created if
150 // <src>createHandler</src> is set.
151 // Otherwise the handler is empty and no groups can be created for it.
152 virtual ImageAttrHandler& attrHandler (Bool createHandler=False);
153
154 // Do the actual getting of an array of values.
155 virtual Bool doGetSlice (Array<T>& buffer, const Slicer& section);
156
157 // Putting data is not possible.
158 virtual void doPutSlice (const Array<T>& sourceBuffer,
159 const IPosition& where,
160 const IPosition& stride);
161
162 // Get a section of the mask.
163 virtual Bool doGetMaskSlice (Array<Bool>& buffer, const Slicer& section);
164
165 // This function is used by the LatticeIterator class to generate an
166 // iterator of the correct type for this Lattice. Not recommended
167 // for general use.
169 (const LatticeNavigator& navigator,
170 Bool useRef) const;
171
172 // Get the best cursor shape.
173 virtual IPosition doNiceCursorShape (uInt maxPixels) const;
174
175 // Handle the (un)locking and syncing, etc.
176 // <group>
177 virtual Bool lock (FileLocker::LockType, uInt nattempts);
178 virtual void unlock();
180 virtual void resync();
181 virtual void flush();
182 virtual void tempClose();
183 virtual void reopen();
184 // </group>
185
186private:
187 //# itsImagePtr points to the parent image.
188 std::unique_ptr<ImageInterface<T>> itsImagePtr;
189 std::unique_ptr<ExtendLattice<T>> itsExtLatPtr;
190
191 //# Make members of parent class known.
192public:
193 using ImageInterface<T>::logger;
194protected:
196};
197
198
199
200} //# NAMESPACE CASACORE - END
201
202#ifndef CASACORE_NO_AUTO_TEMPLATES
203#include <casacore/images/Images/ExtendImage.tcc>
204#endif //# CASACORE_NO_AUTO_TEMPLATES
205#endif
virtual Bool isWritable() const
An ExtendImage is not writable.
virtual const Lattice< Bool > & pixelMask() const
Get access to the pixelmask in use (thus to the pixelmask of the parent).
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 Bool doGetSlice(Array< T > &buffer, const Slicer &section)
Do the actual getting of an array of values.
virtual void resize(const TiledShape &newShape)
Function which changes the shape of the ExtendImage.
virtual Bool ok() const
Check class invariants.
virtual void tempClose()
Temporarily close the lattice.
virtual ImageInterface< T > * cloneII() const
Make a copy of the object (reference semantics).
virtual void unlock()
virtual String name(Bool stripPath=False) const
Return the name of the parent ImageInterface object.
virtual Lattice< Bool > & pixelMask()
virtual void resync()
Resynchronize the Lattice object with the lattice file.
virtual const LatticeRegion * getRegionPtr() const
Get the region used (always returns 0).
virtual void reopen()
Explicitly reopen the temporarily closed lattice.
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 Bool hasLock(FileLocker::LockType) const
virtual IPosition doNiceCursorShape(uInt maxPixels) const
Get the best cursor shape.
virtual Bool isPersistent() const
A ExtendImage is not persistent.
virtual ImageAttrHandler & attrHandler(Bool createHandler=False)
Get access to the attribute handler (of the parent image).
virtual String imageType() const
Get the image type (returns name of derived class).
ExtendImage()
The default constructor.
virtual Bool doGetMaskSlice(Array< Bool > &buffer, const Slicer &section)
Get a section of the mask.
ExtendImage(const ImageInterface< T > &image, const IPosition &newShape, const CoordinateSystem &newCsys)
Create a ExtendImage from a Image.
virtual IPosition shape() const
Returns the shape of the ExtendImage.
virtual Bool isPaged() const
Is the ExtendImage paged to disk?
ExtendImage(const ExtendImage< T > &other)
Copy constructor (reference semantics).
std::unique_ptr< ImageInterface< T > > itsImagePtr
virtual uInt advisedMaxPixels() const
This function returns the recommended maximum number of pixels to include in the cursor of an iterato...
virtual void flush()
Flush the data (but do not unlock).
virtual Bool hasPixelMask() const
Does the image object have a pixelmask? It does if its parent has a pixelmask.
ExtendImage< T > & operator=(const ExtendImage< T > &other)
Assignment (reference semantics).
std::unique_ptr< ExtendLattice< T > > itsExtLatPtr
virtual Bool lock(FileLocker::LockType, uInt nattempts)
Handle the (un)locking and syncing, etc.
LockType
Define the possible lock types.
Definition FileLocker.h:93
void setCoordsMember(const CoordinateSystem &coords)
Set the coordinate system variable.
LoggerHolder & logger()
Get access to the LoggerHolder.
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40