FITSImage.h

Classes

FITSImage -- Class providing native access to FITS images. (full description)

class FITSImage: public ImageInterface<Float>

Interface

Public Members
explicit FITSImage(const String& name)
FITSImage(const String& name, const MaskSpecifier&)
FITSImage(const FITSImage& other)
~FITSImage()
FITSImage& operator=(const FITSImage& other)
virtual ImageInterface<Float>* cloneII() const
virtual String imageType() const
virtual void resize(const TiledShape& newShape)
virtual Bool isMasked() const
virtual Bool hasPixelMask() const
virtual const Lattice<Bool>& pixelMask() const
virtual Lattice<Bool>& pixelMask()
virtual Bool doGetMaskSlice (Array<Bool>& buffer, const Slicer& section)
virtual const LatticeRegion* getRegionPtr() const
virtual Bool doGetSlice (Array<Float>& buffer, const Slicer& theSlice)
virtual void doPutSlice (const Array<Float>& sourceBuffer, const IPosition& where, const IPosition& stride)
virtual Bool isPaged() const
virtual Bool isPersistent() const
virtual Bool isWritable() const
virtual String name (Bool stripPath=False) const
virtual IPosition shape() const
virtual uInt advisedMaxPixels() const
virtual IPosition doNiceCursorShape (uInt maxPixels) const
virtual void tempClose()
virtual void reopen()
virtual Bool ok() const
DataType dataType () const
virtual uInt maximumCacheSize() const
virtual void setMaximumCacheSize (uInt howManyPixels)
virtual void setCacheSizeFromPath (const IPosition& sliceShape, const IPosition& windowStart, const IPosition& windowLength, const IPosition& axisPath)
virtual void setCacheSizeInTiles (uInt howManyTiles)
virtual void clearCache()
virtual void showCacheStatistics (ostream& os) const
Private Members
void reopenIfNeeded() const
void setup()
void open()
void getImageAttributes (CoordinateSystem& cSys, IPosition& shape, ImageInfo& info, Unit& brightnessUnit, RecordInterface& miscInfo, Int& recsize, Int& recno, FITS::ValueType& dataType, Float& scale, Float& offset, Short& shortMagic, Int& longMagic, Bool& hasBlanks, const String& name)
template <typename T> void crackHeader (T& cSys, CoordinateSystem& shape, IPosition& imageInfo, ImageInfo& brightnessUnit, RecordInterface& miscInfo, Float& scale, Float& offset, Short& magicShort, Int& magicLong, Bool& hasBlanks, LogIO& os, Recorderface& infile)

Description

Review Status

Programs:
Tests:

Prerequisite

Etymology

This class provides native access to FITS images. 64bit, 32bit floating point, 32 bit and 16bit integer FITS images are presently supported.

Synopsis

A FITSImage provides native access to FITS images by accessing them with the TiledFileAccess class. The FITSImage is read only. We could implement a writable FITSImage but putting the mask would lose data values (uses magic blanking) and FITS is really meant as an interchange medium, not an internal format.

Because FITS uses magic value blanking, the mask is generated on the fly as needed.

Example

    FITSImage im("in.fits"); 
    LogIO logger(or);
    ImageStatistics<Float> stats(im, logger);
    Bool ok = stats.display();                              // Display statistics

Motivation

This provides native access to FITS images.

Member Description

explicit FITSImage(const String& name)

Construct a FITSImage from the disk FITS file name and apply mask.

FITSImage(const String& name, const MaskSpecifier&)

Construct a FITSImage from the disk FITS file name and apply mask or not.

FITSImage(const FITSImage& other)

Copy constructor (reference semantics)

~FITSImage()

Destructor does nothing

FITSImage& operator=(const FITSImage& other)

Assignment (reference semantics)

virtual ImageInterface<Float>* cloneII() const

Make a copy of the object with new (reference semantics).

virtual String imageType() const

Get the image type (returns FITSImage).

virtual void resize(const TiledShape& newShape)

Function which changes the shape of the FITSImage. Throws an exception as FITSImage is not writable.

virtual Bool isMasked() const

Has the object really a mask? The FITSImage always has a pixel mask and never has a region mask so this always returns True

virtual Bool hasPixelMask() const

FITSimage always has a pixel mask so returns True

virtual const Lattice<Bool>& pixelMask() const
virtual Lattice<Bool>& pixelMask()

Get access to the pixelmask. FITSImage always has a pixel mask.

virtual Bool doGetMaskSlice (Array<Bool>& buffer, const Slicer& section)

Do the actual get of the mask data. The return value is always False, thus the buffer does not reference another array.

virtual const LatticeRegion* getRegionPtr() const

Get the region used. There is no region. Always returns 0.

virtual Bool doGetSlice (Array<Float>& buffer, const Slicer& theSlice)

Do the actual get of the data. Returns False as the data do not reference another Array

virtual void doPutSlice (const Array<Float>& sourceBuffer, const IPosition& where, const IPosition& stride)

The FITSImage is not writable, so this throws an exception.

virtual Bool isPaged() const

The lattice is paged to disk.

virtual Bool isPersistent() const

The lattice is persistent.

virtual Bool isWritable() const

The FITSImage is not writable.

virtual String name (Bool stripPath=False) const

Returns the name of the disk file.

virtual IPosition shape() const

return the shape of the FITSImage

virtual uInt advisedMaxPixels() const

Returns the maximum recommended number of pixels for a cursor. This is the number of pixels in a tile.

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 about the order or dimension of the cursor.

virtual void tempClose()

Temporarily close the image.

virtual void reopen()

Reopen a temporarily closed image.

virtual Bool ok() const

Check class invariants.

DataType dataType () const

Return the (internal) data type (TpFloat or TpShort).

virtual uInt maximumCacheSize() const

Maximum size - not necessarily all used. In pixels.

virtual void setMaximumCacheSize (uInt howManyPixels)

Set the maximum (allowed) cache size as indicated.

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.

virtual void setCacheSizeInTiles (uInt howManyTiles)

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 clearCache()

Clears and frees up the caches, but the maximum allowed cache size is unchanged from when setCacheSize was called

virtual void showCacheStatistics (ostream& os) const

Report on cache success.

void reopenIfNeeded() const

Reopen the image if needed.

void setup()

Setup the object (used by constructors).

void open()

Open the image (used by setup and reopen).

void getImageAttributes (CoordinateSystem& cSys, IPosition& shape, ImageInfo& info, Unit& brightnessUnit, RecordInterface& miscInfo, Int& recsize, Int& recno, FITS::ValueType& dataType, Float& scale, Float& offset, Short& shortMagic, Int& longMagic, Bool& hasBlanks, const String& name)

Fish things out of the FITS file

template <typename T> void crackHeader (T& cSys, CoordinateSystem& shape, IPosition& imageInfo, ImageInfo& brightnessUnit, RecordInterface& miscInfo, Float& scale, Float& offset, Short& magicShort, Int& magicLong, Bool& hasBlanks, LogIO& os, Recorderface& infile)

Crack the header