FITSImage.h
Classes
- FITSImage -- Class providing native access to FITS images. (full description)
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)
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.
Construct a FITSImage from the disk FITS file name and apply mask or not.
FITSImage(const FITSImage& other)
Copy constructor (reference semantics)
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).
Get the image type (returns FITSImage).
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
FITSimage always has a pixel mask so returns True
Get access to the pixelmask. FITSImage always has a pixel mask.
Do the actual get of the mask data. The return value is always
False, thus the buffer does not reference another array.
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.
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.
return the shape of the FITSImage
Returns the maximum recommended number of pixels for a cursor. This is
the number of pixels in a tile.
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.
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).
Maximum size - not necessarily all used. In pixels.
Set the maximum (allowed) cache size as indicated.
Set the cache size as to "fit" the indicated path.
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.
Clears and frees up the caches, but the maximum allowed cache size is
unchanged from when setCacheSize was called
Report on cache success.
Reopen the image if needed.
Setup the object (used by constructors).
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