casacore
Loading...
Searching...
No Matches
FITSQualityImage.h
Go to the documentation of this file.
1// # FITSQualityImage.h: Class providing native access to FITS images
2// # Copyright (C) 2001,2002
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_FITSQUALITYIMAGE_H
27#define IMAGES_FITSQUALITYIMAGE_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/ArrayFwd.h>
32#include <casacore/images/Images/FITSErrorImage.h>
33#include <casacore/images/Images/ImageInterface.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// # Forward Declarations
38template <class T>
39class Lattice;
40//
41class FITSImage;
42class FITSQualityMask;
43class IPosition;
44class Slicer;
45
46// <summary>
47// Class providing native access to FITS Quality Images.
48// </summary>
49
50// <use visibility=export>
51
52// <reviewed reviewer="" date="" tests="tFITSQualityImage.cc">
53// </reviewed>
54
55// <prerequisite>
56// <li> <linkto class=FITSImage>FITSImage</linkto>
57// <li> <linkto class=FITSErrorImage>FITSErrorImage</linkto>
58// </prerequisite>
59
60// <etymology>
61// The class provides access to a quality image via two extensions
62// in the corresponding FITS file.
63// </etymology>
64
65// <synopsis>
66// A FITSQualityImage provides native access to FITS images by accessing
67// the data and the error values via the classes FITSImage and
68// FITSErrorImage, respectively. A QualityCoordinate connects these
69// two layers. The FITSQualityImage is read only.
70// </synopsis>
71
72// <example>
73// <srcblock>
74// FITSQualityImage fitsQIStat("im.fits", 1, 2);
75// LogIO logger(or);
76// ImageStatistics<Float> stats(fitsQIStat, logger);
77// Bool ok = stats.display();
78// </srcblock>
79// </example>
80
81// <motivation>
82// This provides access to FITS Quality Images
83// </motivation>
84
85// # <todo asof="2011/06/17">
86// # </todo>
87
88class FITSQualityImage : public ImageInterface<Float> {
89 public:
90 // Construct a FITSQualityImage from the FITS file name and extensions
91 // specified in the input.
92 explicit FITSQualityImage(const String& name);
93
94 // Construct a FITSQualityImage from the disk FITS file name and extensions.
96
97 // Copy constructor (reference semantics)
99
100 // Destructor
102
103 // Assignment (reference semantics).
105
106 // # ImageInterface virtual functions
107
108 // Make a copy of the object with new (reference semantics).
110
111 // Given the misc-info of a CASA image (with quality-axis)
112 // the misc-info of the data sub-image and the error sub-image
113 // are produced. This ensures that, if written to FITS, the
114 // data and error extensions have the all necessary keywords.
115 Bool static qualFITSInfo(String& error, TableRecord& dataExtMiscInfo,
116 TableRecord& errorExtMiscInfo, const TableRecord& miscInfo);
117
118 // Get the FITS data
119 FITSImage* fitsData() const { return fitsdata_p; };
120
121 // Get the FITS error
123
124 // Get the image type (returns FITSImage).
125 virtual String imageType() const;
126
127 // Function which changes the shape of the FITSQualityImage.
128 // Throws an exception as FITSQualityImage is not writable.
129 virtual void resize(const TiledShape& newShape);
130
131 // Has the object really a mask? The FITSQualityImage always
132 // has a pixel mask and never has a region mask so this
133 // always returns True
134 virtual Bool isMasked() const;
135
136 // FITSQualityImage always has a pixel mask so returns True
137 virtual Bool hasPixelMask() const;
138
139 // Get access to the pixelmask. FITSQualityImage always has a pixel mask.
140 // <group>
141 virtual const Lattice<Bool>& pixelMask() const;
143 // </group>
144
145 // Get the region used. There is no region.
146 // Always returns 0.
147 virtual const LatticeRegion* getRegionPtr() const;
148
149 // Do the actual get of the data.
150 // Returns False as the data do not reference another Array
151 virtual Bool doGetSlice(Array<Float>& buffer, const Slicer& theSlice);
152
153 // The FITSQualityImage is not writable, so this throws an exception.
154 virtual void doPutSlice(const Array<Float>& sourceBuffer, const IPosition& where,
155 const IPosition& stride);
156
157 // Do the actual get of the mask data. The return value is always
158 // False, thus the buffer does not reference another array.
159 virtual Bool doGetMaskSlice(Array<Bool>& buffer, const Slicer& section);
160
161 // # LatticeBase virtual functions
162
163 // The lattice is paged to disk.
164 virtual Bool isPaged() const;
165
166 // The lattice is persistent.
167 virtual Bool isPersistent() const;
168
169 // The FITSImage is not writable.
170 virtual Bool isWritable() const;
171
172 // Returns the name of the disk file.
173 virtual String name(Bool stripPath = False) const;
174
175 // Return the shape of the FITSImage.
176 virtual IPosition shape() const;
177
178 // Returns the maximum recommended number of pixels for a cursor. This is
179 // the number of pixels in a tile.
180 virtual uInt advisedMaxPixels() const;
181
182 // Help the user pick a cursor for most efficient access if they only want
183 // pixel values and don't care about the order or dimension of the
184 // cursor.
185 virtual IPosition doNiceCursorShape(uInt maxPixels) const;
186
187 // Check class invariants.
188 virtual Bool ok() const;
189
190 // Temporarily close the image.
191 virtual void tempClose();
192 virtual void tempCloseData();
193 virtual void tempCloseError();
194
195 // Reopen a temporarily closed image.
196 virtual void reopen();
197
198 // Return the (internal) data type (TpFloat or TpShort).
199 DataType dataType() const;
200
201 // Return the data HDU number
202 uInt whichDataHDU() const { return whichDataHDU_p; }
203
204 // Return the error HDU number
206
207 // Maximum size - not necessarily all used. In pixels.
208 virtual uInt maximumCacheSize() const;
209
210 // Set the maximum (allowed) cache size as indicated.
211 virtual void setMaximumCacheSize(uInt howManyPixels);
212
213 // Set the cache size as to "fit" the indicated path.
214 virtual void setCacheSizeFromPath(const IPosition& sliceShape, const IPosition& windowStart,
215 const IPosition& windowLength, const IPosition& axisPath);
216
217 // Set the actual cache size for this Array to be be big enough for the
218 // indicated number of tiles. This cache is not shared with PagedArrays
219 // in other rows and is always clipped to be less than the maximum value
220 // set using the setMaximumCacheSize member function.
221 // tiles. Tiles are cached using a first in first out algorithm.
222 virtual void setCacheSizeInTiles(uInt howManyTiles);
223
224 // Clears and frees up the caches, but the maximum allowed cache size is
225 // unchanged from when setCacheSize was called
226 virtual void clearCache();
227
228 // Report on cache success.
229 virtual void showCacheStatistics(ostream& os) const;
230
231 private:
245
246 // Reopen the image if needed.
247 void reopenIfNeeded() const;
250
251 // Get the extension indices from an
252 // extension expression.
254
255 // Setup the object (used by constructors).
256 void setup();
257
258 // Make sure the input is compatible.
260};
261
262} // namespace casacore
263
264#endif
ErrorType
The enum describes which types of error images exist.
virtual void tempCloseError()
Bool checkInput()
Make sure the input is compatible.
virtual void showCacheStatistics(ostream &os) const
Report on cache success.
virtual void clearCache()
Clears and frees up the caches, but the maximum allowed cache size is unchanged from when setCacheSiz...
virtual Lattice< Bool > & pixelMask()
virtual const Lattice< Bool > & pixelMask() const
Get access to the pixelmask.
virtual Bool doGetSlice(Array< Float > &buffer, const Slicer &theSlice)
Do the actual get of the data.
virtual Bool hasPixelMask() const
FITSQualityImage always has a pixel mask so returns True.
uInt whichErrorHDU() const
Return the error HDU number.
FITSQualityImage(const FITSQualityImage &other)
Copy constructor (reference semantics).
FITSQualityImage(const String &name, uInt whichDataHDU, uInt whichErrorHDU)
Construct a FITSQualityImage from the disk FITS file name and extensions.
virtual const LatticeRegion * getRegionPtr() const
Get the region used.
virtual Bool ok() const
Check class invariants.
void reopenIfNeeded() const
Reopen the image if needed.
FITSErrorImage::ErrorType errType_p
virtual void doPutSlice(const Array< Float > &sourceBuffer, const IPosition &where, const IPosition &stride)
The FITSQualityImage is not writable, so this throws an exception.
virtual void reopen()
Reopen a temporarily closed image.
virtual ImageInterface< Float > * cloneII() const
Make a copy of the object with new (reference semantics).
virtual uInt maximumCacheSize() const
Maximum size - not necessarily all used.
virtual IPosition doNiceCursorShape(uInt maxPixels) const
Help the user pick a cursor for most efficient access if they only want pixel values and don't care a...
virtual void tempCloseData()
virtual Bool doGetMaskSlice(Array< Bool > &buffer, const Slicer &section)
Do the actual get of the mask data.
void getExtInfo()
Get the extension indices from an extension expression.
virtual Bool isWritable() const
The FITSImage is not writable.
static Bool qualFITSInfo(String &error, TableRecord &dataExtMiscInfo, TableRecord &errorExtMiscInfo, const TableRecord &miscInfo)
Given the misc-info of a CASA image (with quality-axis) the misc-info of the data sub-image and the e...
FITSQualityImage & operator=(const FITSQualityImage &other)
Assignment (reference semantics).
virtual void setCacheSizeInTiles(uInt howManyTiles)
Set the actual cache size for this Array to be be big enough for the indicated number of tiles.
void setup()
Setup the object (used by constructors).
virtual Bool isMasked() const
Has the object really a mask?
virtual Bool isPersistent() const
The lattice is persistent.
~FITSQualityImage()
Destructor.
virtual IPosition shape() const
Return the shape of the FITSImage.
virtual uInt advisedMaxPixels() const
Returns the maximum recommended number of pixels for a cursor.
virtual Bool isPaged() const
The lattice is paged to disk.
virtual void tempClose()
Temporarily close the image.
FITSImage * fitsData() const
Get the FITS data.
virtual void resize(const TiledShape &newShape)
Function which changes the shape of the FITSQualityImage.
uInt whichDataHDU() const
Return the data HDU number.
virtual String imageType() const
Get the image type (returns FITSImage).
virtual void setMaximumCacheSize(uInt howManyPixels)
Set the maximum (allowed) cache size as indicated.
FITSQualityImage(const String &name)
Construct a FITSQualityImage from the FITS file name and extensions specified in the input.
virtual void setCacheSizeFromPath(const IPosition &sliceShape, const IPosition &windowStart, const IPosition &windowLength, const IPosition &axisPath)
Set the cache size as to "fit" the indicated path.
DataType dataType() const
Return the (internal) data type (TpFloat or TpShort).
FITSErrorImage * fitsError() const
Get the FITS error.
virtual String name(Bool stripPath=False) const
Returns the name of the disk file.
const TableRecord & miscInfo() const
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
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