Loading...
Searching...
No Matches
FITSQualityImage.h
Go to the documentation of this file.
//# FITSQualityImage.h: Class providing native access to FITS images
//# Copyright (C) 2001,2002
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: casa-feedback@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
#ifndef IMAGES_FITSQUALITYIMAGE_H
#define IMAGES_FITSQUALITYIMAGE_H
//# Includes
#include <casacore/casa/aips.h>
#include <casacore/casa/Arrays/ArrayFwd.h>
#include <casacore/images/Images/FITSErrorImage.h>
#include <casacore/images/Images/ImageInterface.h>
namespace casacore { //# NAMESPACE CASACORE - BEGIN
//# Forward Declarations
template <class T> class Lattice;
//
class FITSImage;
class FITSQualityMask;
class IPosition;
class Slicer;
// <summary>
// Class providing native access to FITS Quality Images.
// </summary>
// <use visibility=export>
// <reviewed reviewer="" date="" tests="tFITSQualityImage.cc">
// </reviewed>
// <prerequisite>
// <li> <linkto class=FITSImage>FITSImage</linkto>
// <li> <linkto class=FITSErrorImage>FITSErrorImage</linkto>
// </prerequisite>
// <etymology>
// The class provides access to a quality image via two extensions
// in the corresponding FITS file.
// </etymology>
// <synopsis>
// A FITSQualityImage provides native access to FITS images by accessing
// the data and the error values via the classes FITSImage and
// FITSErrorImage, respectively. A QualityCoordinate connects these
// two layers. The FITSQualityImage is read only.
// </synopsis>
// <example>
// <srcblock>
// FITSQualityImage fitsQIStat("im.fits", 1, 2);
// LogIO logger(or);
// ImageStatistics<Float> stats(fitsQIStat, logger);
// Bool ok = stats.display();
// </srcblock>
// </example>
// <motivation>
// This provides access to FITS Quality Images
// </motivation>
//# <todo asof="2011/06/17">
//# </todo>
class FITSQualityImage: public ImageInterface<Float>
{
public:
// Construct a FITSQualityImage from the FITS file name and extensions
// specified in the input.
explicit FITSQualityImage(const String& name);
// Construct a FITSQualityImage from the disk FITS file name and extensions.
explicit FITSQualityImage(const String& name, uInt whichDataHDU, uInt whichErrorHDU);
// Copy constructor (reference semantics)
FITSQualityImage(const FITSQualityImage& other);
// Destructor
~FITSQualityImage();
// Assignment (reference semantics).
FITSQualityImage& operator=(const FITSQualityImage& other);
//# ImageInterface virtual functions
// Make a copy of the object with new (reference semantics).
virtual ImageInterface<Float>* cloneII() const;
// Given the misc-info of a CASA image (with quality-axis)
// the misc-info of the data sub-image and the error sub-image
// are produced. This ensures that, if written to FITS, the
// data and error extensions have the all necessary keywords.
Bool static qualFITSInfo(String &error, TableRecord &dataExtMiscInfo, TableRecord &errorExtMiscInfo,
const TableRecord &miscInfo);
// Get the FITS data
FITSImage *fitsData() const {return fitsdata_p;};
// Get the FITS error
FITSErrorImage *fitsError() const {return fitserror_p;};
// Get the image type (returns FITSImage).
virtual String imageType() const;
// Function which changes the shape of the FITSQualityImage.
// Throws an exception as FITSQualityImage is not writable.
virtual void resize(const TiledShape& newShape);
// Has the object really a mask? The FITSQualityImage always
// has a pixel mask and never has a region mask so this
// always returns True
virtual Bool isMasked() const;
// FITSQualityImage always has a pixel mask so returns True
virtual Bool hasPixelMask() const;
// Get access to the pixelmask. FITSQualityImage always has a pixel mask.
// <group>
virtual const Lattice<Bool>& pixelMask() const;
virtual Lattice<Bool>& pixelMask();
// </group>
// Get the region used. There is no region.
// Always returns 0.
virtual const LatticeRegion* getRegionPtr() const;
// Do the actual get of the data.
// Returns False as the data do not reference another Array
virtual Bool doGetSlice (Array<Float>& buffer, const Slicer& theSlice);
// The FITSQualityImage is not writable, so this throws an exception.
virtual void doPutSlice (const Array<Float>& sourceBuffer,
const IPosition& where,
const IPosition& stride);
// Do the actual get of the mask data. The return value is always
// False, thus the buffer does not reference another array.
virtual Bool doGetMaskSlice (Array<Bool>& buffer, const Slicer& section);
//# LatticeBase virtual functions
// The lattice is paged to disk.
virtual Bool isPaged() const;
// The lattice is persistent.
virtual Bool isPersistent() const;
// The FITSImage is not writable.
virtual Bool isWritable() const;
// Returns the name of the disk file.
virtual String name (Bool stripPath=False) const;
// Return the shape of the FITSImage.
virtual IPosition shape() const;
// Returns the maximum recommended number of pixels for a cursor. This is
// the number of pixels in a tile.
virtual uInt advisedMaxPixels() const;
// Help the user pick a cursor for most efficient access if they only want
// pixel values and don't care about the order or dimension of the
// cursor.
virtual IPosition doNiceCursorShape (uInt maxPixels) const;
// Check class invariants.
virtual Bool ok() const;
// Temporarily close the image.
virtual void tempClose();
virtual void tempCloseData();
virtual void tempCloseError();
// Reopen a temporarily closed image.
virtual void reopen();
// Return the (internal) data type (TpFloat or TpShort).
DataType dataType () const;
// Return the data HDU number
uInt whichDataHDU () const
{ return whichDataHDU_p; }
// Return the error HDU number
uInt whichErrorHDU () const
{ return whichErrorHDU_p; }
// Maximum size - not necessarily all used. In pixels.
virtual uInt maximumCacheSize() const;
// Set the maximum (allowed) cache size as indicated.
virtual void setMaximumCacheSize (uInt howManyPixels);
// Set the cache size as to "fit" the indicated path.
virtual void setCacheSizeFromPath (const IPosition& sliceShape,
const IPosition& windowStart,
const IPosition& windowLength,
const IPosition& axisPath);
// Set the actual cache size for this Array to be be big enough for the
// indicated number of tiles. This cache is not shared with PagedArrays
// in other rows and is always clipped to be less than the maximum value
// set using the setMaximumCacheSize member function.
// tiles. Tiles are cached using a first in first out algorithm.
virtual void setCacheSizeInTiles (uInt howManyTiles);
// Clears and frees up the caches, but the maximum allowed cache size is
// unchanged from when setCacheSize was called
virtual void clearCache();
// Report on cache success.
virtual void showCacheStatistics (ostream& os) const;
private:
String name_p;
String fullname_p;
FITSImage *fitsdata_p;
FITSErrorImage *fitserror_p;
Lattice<Bool> *pPixelMask_p;
TiledShape shape_p;
uInt whichDataHDU_p;
uInt whichErrorHDU_p;
uInt whichMaskHDU_p;
FITSErrorImage::ErrorType errType_p;
Bool isClosed_p;
Bool isDataClosed_p;
Bool isErrorClosed_p;
// Reopen the image if needed.
void reopenIfNeeded() const;
void reopenDataIfNeeded();
void reopenErrorIfNeeded();
// Get the extension indices from an
// extension expression.
void getExtInfo();
// Setup the object (used by constructors).
void setup();
// Make sure the input is compatible.
Bool checkInput();
};
} //# NAMESPACE CASACORE - END
#endif
casacore::Array
Definition Array.h:155
casacore::FITSErrorImage
Definition FITSErrorImage.h:76
casacore::FITSErrorImage::ErrorType
ErrorType
The enum describes which types of error images exist.
Definition FITSErrorImage.h:82
casacore::FITSImage
Definition FITSImage.h:107
casacore::FITSQualityImage::whichMaskHDU_p
uInt whichMaskHDU_p
Definition FITSQualityImage.h:247
casacore::FITSQualityImage::tempCloseError
virtual void tempCloseError()
casacore::FITSQualityImage::checkInput
Bool checkInput()
Make sure the input is compatible.
casacore::FITSQualityImage::isClosed_p
Bool isClosed_p
Definition FITSQualityImage.h:249
casacore::FITSQualityImage::showCacheStatistics
virtual void showCacheStatistics(ostream &os) const
Report on cache success.
casacore::FITSQualityImage::clearCache
virtual void clearCache()
Clears and frees up the caches, but the maximum allowed cache size is unchanged from when setCacheSiz...
casacore::FITSQualityImage::pixelMask
virtual Lattice< Bool > & pixelMask()
casacore::FITSQualityImage::reopenErrorIfNeeded
void reopenErrorIfNeeded()
casacore::FITSQualityImage::pixelMask
virtual const Lattice< Bool > & pixelMask() const
Get access to the pixelmask.
casacore::FITSQualityImage::fitserror_p
FITSErrorImage * fitserror_p
Definition FITSQualityImage.h:242
casacore::FITSQualityImage::reopenDataIfNeeded
void reopenDataIfNeeded()
casacore::FITSQualityImage::doGetSlice
virtual Bool doGetSlice(Array< Float > &buffer, const Slicer &theSlice)
Do the actual get of the data.
casacore::FITSQualityImage::hasPixelMask
virtual Bool hasPixelMask() const
FITSQualityImage always has a pixel mask so returns True.
casacore::FITSQualityImage::whichErrorHDU
uInt whichErrorHDU() const
Return the error HDU number.
Definition FITSQualityImage.h:209
casacore::FITSQualityImage::FITSQualityImage
FITSQualityImage(const FITSQualityImage &other)
Copy constructor (reference semantics).
casacore::FITSQualityImage::FITSQualityImage
FITSQualityImage(const String &name, uInt whichDataHDU, uInt whichErrorHDU)
Construct a FITSQualityImage from the disk FITS file name and extensions.
casacore::FITSQualityImage::shape_p
TiledShape shape_p
Definition FITSQualityImage.h:244
casacore::FITSQualityImage::getRegionPtr
virtual const LatticeRegion * getRegionPtr() const
Get the region used.
casacore::FITSQualityImage::ok
virtual Bool ok() const
Check class invariants.
casacore::FITSQualityImage::reopenIfNeeded
void reopenIfNeeded() const
Reopen the image if needed.
casacore::FITSQualityImage::errType_p
FITSErrorImage::ErrorType errType_p
Definition FITSQualityImage.h:248
casacore::FITSQualityImage::doPutSlice
virtual void doPutSlice(const Array< Float > &sourceBuffer, const IPosition &where, const IPosition &stride)
The FITSQualityImage is not writable, so this throws an exception.
casacore::FITSQualityImage::reopen
virtual void reopen()
Reopen a temporarily closed image.
casacore::FITSQualityImage::cloneII
virtual ImageInterface< Float > * cloneII() const
Make a copy of the object with new (reference semantics).
casacore::FITSQualityImage::maximumCacheSize
virtual uInt maximumCacheSize() const
Maximum size - not necessarily all used.
casacore::FITSQualityImage::pPixelMask_p
Lattice< Bool > * pPixelMask_p
Definition FITSQualityImage.h:243
casacore::FITSQualityImage::doNiceCursorShape
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...
casacore::FITSQualityImage::tempCloseData
virtual void tempCloseData()
casacore::FITSQualityImage::doGetMaskSlice
virtual Bool doGetMaskSlice(Array< Bool > &buffer, const Slicer &section)
Do the actual get of the mask data.
casacore::FITSQualityImage::getExtInfo
void getExtInfo()
Get the extension indices from an extension expression.
casacore::FITSQualityImage::isWritable
virtual Bool isWritable() const
The FITSImage is not writable.
casacore::FITSQualityImage::qualFITSInfo
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...
casacore::FITSQualityImage::operator=
FITSQualityImage & operator=(const FITSQualityImage &other)
Assignment (reference semantics).
casacore::FITSQualityImage::setCacheSizeInTiles
virtual void setCacheSizeInTiles(uInt howManyTiles)
Set the actual cache size for this Array to be be big enough for the indicated number of tiles.
casacore::FITSQualityImage::setup
void setup()
Setup the object (used by constructors).
casacore::FITSQualityImage::isMasked
virtual Bool isMasked() const
Has the object really a mask?
casacore::FITSQualityImage::isPersistent
virtual Bool isPersistent() const
The lattice is persistent.
casacore::FITSQualityImage::isErrorClosed_p
Bool isErrorClosed_p
Definition FITSQualityImage.h:251
casacore::FITSQualityImage::~FITSQualityImage
~FITSQualityImage()
Destructor.
casacore::FITSQualityImage::whichErrorHDU_p
uInt whichErrorHDU_p
Definition FITSQualityImage.h:246
casacore::FITSQualityImage::shape
virtual IPosition shape() const
Return the shape of the FITSImage.
casacore::FITSQualityImage::advisedMaxPixels
virtual uInt advisedMaxPixels() const
Returns the maximum recommended number of pixels for a cursor.
casacore::FITSQualityImage::isPaged
virtual Bool isPaged() const
The lattice is paged to disk.
casacore::FITSQualityImage::fullname_p
String fullname_p
Definition FITSQualityImage.h:240
casacore::FITSQualityImage::tempClose
virtual void tempClose()
Temporarily close the image.
casacore::FITSQualityImage::fitsData
FITSImage * fitsData() const
Get the FITS data.
Definition FITSQualityImage.h:120
casacore::FITSQualityImage::resize
virtual void resize(const TiledShape &newShape)
Function which changes the shape of the FITSQualityImage.
casacore::FITSQualityImage::whichDataHDU
uInt whichDataHDU() const
Return the data HDU number.
Definition FITSQualityImage.h:205
casacore::FITSQualityImage::fitsdata_p
FITSImage * fitsdata_p
Definition FITSQualityImage.h:241
casacore::FITSQualityImage::isDataClosed_p
Bool isDataClosed_p
Definition FITSQualityImage.h:250
casacore::FITSQualityImage::imageType
virtual String imageType() const
Get the image type (returns FITSImage).
casacore::FITSQualityImage::setMaximumCacheSize
virtual void setMaximumCacheSize(uInt howManyPixels)
Set the maximum (allowed) cache size as indicated.
casacore::FITSQualityImage::FITSQualityImage
FITSQualityImage(const String &name)
Construct a FITSQualityImage from the FITS file name and extensions specified in the input.
casacore::FITSQualityImage::setCacheSizeFromPath
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.
casacore::FITSQualityImage::dataType
DataType dataType() const
Return the (internal) data type (TpFloat or TpShort).
casacore::FITSQualityImage::fitsError
FITSErrorImage * fitsError() const
Get the FITS error.
Definition FITSQualityImage.h:123
casacore::FITSQualityImage::name_p
String name_p
Definition FITSQualityImage.h:239
casacore::FITSQualityImage::name
virtual String name(Bool stripPath=False) const
Returns the name of the disk file.
casacore::FITSQualityImage::whichDataHDU_p
uInt whichDataHDU_p
Definition FITSQualityImage.h:245
casacore::FITSQualityMask
Definition FITSQualityMask.h:95
casacore::IPosition
Definition IPosition.h:117
casacore::ImageInterface< Float >::ImageInterface
ImageInterface()
casacore::ImageInterface< Float >::miscInfo
const TableRecord & miscInfo() const
Definition ImageInterface.h:226
casacore::LatticeRegion
Definition LatticeRegion.h:72
casacore::Lattice
Definition Lattice.h:230
casacore::Slicer
Definition Slicer.h:287
casacore::String
String: the storage and methods of handling collections of characters.
Definition String.h:223
casacore::TableRecord
Definition TableRecord.h:183
casacore::TiledShape
Definition TiledShape.h:95
casacore
this file contains all the compiler specific defines
Definition mainpage.dox:28
casacore::False
const Bool False
Definition aipstype.h:42
casacore::uInt
unsigned int uInt
Definition aipstype.h:49
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40