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
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/casa/Arrays/ArrayFwd.h>
33#include <casacore/images/Images/FITSErrorImage.h>
34#include <casacore/images/Images/ImageInterface.h>
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38//# Forward Declarations
39template <class T> class 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{
90public:
91 // Construct a FITSQualityImage from the FITS file name and extensions
92 // specified in the input.
93 explicit FITSQualityImage(const String& name);
94
95 // Construct a FITSQualityImage from the disk FITS file name and extensions.
97
98 // Copy constructor (reference semantics)
100
101 // Destructor
103
104 // Assignment (reference semantics).
106
107 //# ImageInterface virtual functions
108
109 // Make a copy of the object with new (reference semantics).
111
112 // Given the misc-info of a CASA image (with quality-axis)
113 // the misc-info of the data sub-image and the error sub-image
114 // are produced. This ensures that, if written to FITS, the
115 // data and error extensions have the all necessary keywords.
116 Bool static qualFITSInfo(String &error, TableRecord &dataExtMiscInfo, TableRecord &errorExtMiscInfo,
117 const TableRecord &miscInfo);
118
119 // Get the FITS data
120 FITSImage *fitsData() const {return fitsdata_p;};
121
122 // Get the FITS error
124
125 // Get the image type (returns FITSImage).
126 virtual String imageType() const;
127
128 // Function which changes the shape of the FITSQualityImage.
129 // Throws an exception as FITSQualityImage is not writable.
130 virtual void resize(const TiledShape& newShape);
131
132 // Has the object really a mask? The FITSQualityImage always
133 // has a pixel mask and never has a region mask so this
134 // always returns True
135 virtual Bool isMasked() const;
136
137 // FITSQualityImage always has a pixel mask so returns True
138 virtual Bool hasPixelMask() const;
139
140 // Get access to the pixelmask. FITSQualityImage always has a pixel mask.
141 // <group>
142 virtual const Lattice<Bool>& pixelMask() const;
144 // </group>
145
146
147 // Get the region used. There is no region.
148 // Always returns 0.
149 virtual const LatticeRegion* getRegionPtr() const;
150
151 // Do the actual get of the data.
152 // Returns False as the data do not reference another Array
153 virtual Bool doGetSlice (Array<Float>& buffer, const Slicer& theSlice);
154
155 // The FITSQualityImage is not writable, so this throws an exception.
156 virtual void doPutSlice (const Array<Float>& sourceBuffer,
157 const IPosition& where,
158 const IPosition& stride);
159
160 // Do the actual get of the mask data. The return value is always
161 // False, thus the buffer does not reference another array.
162 virtual Bool doGetMaskSlice (Array<Bool>& buffer, const Slicer& section);
163
164 //# LatticeBase virtual functions
165
166 // The lattice is paged to disk.
167 virtual Bool isPaged() const;
168
169 // The lattice is persistent.
170 virtual Bool isPersistent() const;
171
172 // The FITSImage is not writable.
173 virtual Bool isWritable() const;
174
175 // Returns the name of the disk file.
176 virtual String name (Bool stripPath=False) const;
177
178 // Return the shape of the FITSImage.
179 virtual IPosition shape() const;
180
181 // Returns the maximum recommended number of pixels for a cursor. This is
182 // the number of pixels in a tile.
183 virtual uInt advisedMaxPixels() const;
184
185 // Help the user pick a cursor for most efficient access if they only want
186 // pixel values and don't care about the order or dimension of the
187 // cursor.
188 virtual IPosition doNiceCursorShape (uInt maxPixels) const;
189
190 // Check class invariants.
191 virtual Bool ok() const;
192
193 // Temporarily close the image.
194 virtual void tempClose();
195 virtual void tempCloseData();
196 virtual void tempCloseError();
197
198 // Reopen a temporarily closed image.
199 virtual void reopen();
200
201 // Return the (internal) data type (TpFloat or TpShort).
202 DataType dataType () const;
203
204 // Return the data HDU number
206 { return whichDataHDU_p; }
207
208 // Return the error HDU number
210 { return whichErrorHDU_p; }
211
212 // Maximum size - not necessarily all used. In pixels.
213 virtual uInt maximumCacheSize() const;
214
215 // Set the maximum (allowed) cache size as indicated.
216 virtual void setMaximumCacheSize (uInt howManyPixels);
217
218 // Set the cache size as to "fit" the indicated path.
219 virtual void setCacheSizeFromPath (const IPosition& sliceShape,
220 const IPosition& windowStart,
221 const IPosition& windowLength,
222 const IPosition& axisPath);
223
224 // Set the actual cache size for this Array to be be big enough for the
225 // indicated number of tiles. This cache is not shared with PagedArrays
226 // in other rows and is always clipped to be less than the maximum value
227 // set using the setMaximumCacheSize member function.
228 // tiles. Tiles are cached using a first in first out algorithm.
229 virtual void setCacheSizeInTiles (uInt howManyTiles);
230
231 // Clears and frees up the caches, but the maximum allowed cache size is
232 // unchanged from when setCacheSize was called
233 virtual void clearCache();
234
235 // Report on cache success.
236 virtual void showCacheStatistics (ostream& os) const;
237
238private:
252
253 // Reopen the image if needed.
254 void reopenIfNeeded() const;
257
258 // Get the extension indices from an
259 // extension expression.
261
262 // Setup the object (used by constructors).
263 void setup();
264
265 // Make sure the input is compatible.
267};
268
269
270
271} //# NAMESPACE CASACORE - END
272
273#endif
274
275
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? The FITSQualityImage always has a pixel mask and never has a region mas...
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
Often we have miscellaneous information we want to attach to an image.
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