TiledFileAccess.h

Classes

TiledFileAccess -- Tiled access to an array in a file. (full description)

class TiledFileAccess

Interface

Public Members
TiledFileAccess (const String& fileName, Int64 fileOffset, const IPosition& shape, const IPosition& tileShape, DataType dataType, uInt maximumCacheSize=0, Bool writable=False)
TiledFileAccess (const String& fileName, Int64 fileOffset, const IPosition& shape, const IPosition& tileShape, DataType dataType, uInt maximumCacheSize, Bool writable, Bool bigEndian)
~TiledFileAccess()
Bool isWritable() const
DataType dataType() const
Array<Bool> getBool (const Slicer& section)
Array<Short> getShort (const Slicer& section)
Array<Int> getInt (const Slicer& section)
Array<Float> getFloat (const Slicer& section)
Array<Double> getDouble (const Slicer& section)
Array<Complex> getComplex (const Slicer& section)
Array<DComplex> getDComplex (const Slicer& section)
void get (Array<Bool>&, const Slicer& section)
void get (Array<Short>&, const Slicer& section)
void get (Array<Int>&, const Slicer& section)
void get (Array<Float>&, const Slicer& section)
void get (Array<Double>&, const Slicer& section)
void get (Array<Complex>&, const Slicer& section)
void get (Array<DComplex>&, const Slicer& section)
Array<Float> getFloat (const Slicer& section, Float scale, Float offset, Short deleteValue, Bool examineForDeleteValues=True)
Array<Float> getFloat (const Slicer& section, Float scale, Float offset, Int deleteValue, Bool examineForDeleteValues=True)
void get (Array<Float>&, const Slicer& section, Float scale, Float offset, Short deleteValue, Bool examineForDeleteValues=True)
void get (Array<Float>&, const Slicer& section, Float scale, Float offset, Int deleteValue, Bool examineForDeleteValues=True)
void put (const Array<Bool>&, const Slicer& section)
void put (const Array<Short>&, const Slicer& section)
void put (const Array<Int>&, const Slicer& section)
void put (const Array<Float>&, const Slicer& section)
void put (const Array<Double>&, const Slicer& section)
void put (const Array<Complex>&, const Slicer& section)
void put (const Array<DComplex>&, const Slicer& section)
void flush()
void clearCache()
void showCacheStatistics (ostream& os) const
const IPosition& shape() const
const IPosition& tileShape() const
void setMaximumCacheSize (uInt nbytes)
uInt maximumCacheSize() const
uInt cacheSize() const
void setCacheSize (const IPosition& sliceShape, const IPosition& axisPath, Bool forceSmaller=True)
void setCacheSize (const IPosition& sliceShape, const IPosition& windowStart, const IPosition& windowLength, const IPosition& axisPath, Bool forceSmaller=True)
void setCacheSize (uInt nbuckets, Bool forceSmaller=True)
static IPosition makeTileShape (const IPosition& arrayShape, uInt nrPixelsPerTile = 32768)
Private Members
TiledFileAccess (const TiledFileAccess&)
TiledFileAccess& operator= (const TiledFileAccess&)

Description

Review Status

Programs:
Tests:

Prerequisite

Synopsis

TiledFileAccess is a class that makes it possible to access an arbitrary array in a file using the tiled storage manager classes. It can handle arrays of any type supported by the tiled storage managers. The array can be in big or little endian canonical format.

See ROTiledStManAccessor for a more detailed discussion.

Motivation

This class makes it possible to access an image in a FITS file.

Example

  // Define the object which also opens the file.
  // The (float) array starts at offset 2880.
  TiledFileAccess tfa ("fits.file", 2880, IPosition(2,512,512),
                       IPosition(2,512,1), TpFloat);
  // Get all the data.
  Array<Float> data = tfa.getFloat (Slicer(IPosition(2,0,0), tfa.shape()));

Member Description

TiledFileAccess (const String& fileName, Int64 fileOffset, const IPosition& shape, const IPosition& tileShape, DataType dataType, uInt maximumCacheSize=0, Bool writable=False)

Create a TiledFileAccess object. The data is assumed to be in local canonical format (thus big endian on e.g. SUN and little endian on e.g. PC).

TiledFileAccess (const String& fileName, Int64 fileOffset, const IPosition& shape, const IPosition& tileShape, DataType dataType, uInt maximumCacheSize, Bool writable, Bool bigEndian)

Create a TiledFileAccess object. The endian format of the data is explicitly given.

~TiledFileAccess()

Bool isWritable() const

Is the file writable?

DataType dataType() const

Array<Bool> getBool (const Slicer& section)
Array<Short> getShort (const Slicer& section)
Array<Int> getInt (const Slicer& section)
Array<Float> getFloat (const Slicer& section)
Array<Double> getDouble (const Slicer& section)
Array<Complex> getComplex (const Slicer& section)
Array<DComplex> getDComplex (const Slicer& section)
void get (Array<Bool>&, const Slicer& section)
void get (Array<Short>&, const Slicer& section)
void get (Array<Int>&, const Slicer& section)
void get (Array<Float>&, const Slicer& section)
void get (Array<Double>&, const Slicer& section)
void get (Array<Complex>&, const Slicer& section)
void get (Array<DComplex>&, const Slicer& section)

Get part of the array. The Array object is resized if needed.

Array<Float> getFloat (const Slicer& section, Float scale, Float offset, Short deleteValue, Bool examineForDeleteValues=True)
Array<Float> getFloat (const Slicer& section, Float scale, Float offset, Int deleteValue, Bool examineForDeleteValues=True)
void get (Array<Float>&, const Slicer& section, Float scale, Float offset, Short deleteValue, Bool examineForDeleteValues=True)
void get (Array<Float>&, const Slicer& section, Float scale, Float offset, Int deleteValue, Bool examineForDeleteValues=True)

Get the array and scale/offset the data using the given values. It is meant for FITS, so for now they can only be used for TpShort or TpInt TiledFileAccess objects. A deleteValue is set to a NaN without being scaled.

void put (const Array<Bool>&, const Slicer& section)
void put (const Array<Short>&, const Slicer& section)
void put (const Array<Int>&, const Slicer& section)
void put (const Array<Float>&, const Slicer& section)
void put (const Array<Double>&, const Slicer& section)
void put (const Array<Complex>&, const Slicer& section)
void put (const Array<DComplex>&, const Slicer& section)

Put part of the array.

void flush()

Flush the cache.

void clearCache()

Empty the cache. It will flush the cache as needed and remove all buckets from it resulting in a possibly large drop in memory used. It'll also clear the userSetCache_p flag.

void showCacheStatistics (ostream& os) const

Show the cache statistics.

const IPosition& shape() const

Get the shape of the array.

const IPosition& tileShape() const

Get the shape of the tiles.

void setMaximumCacheSize (uInt nbytes)

Set the maximum cache size (in bytes). 0 means no maximum.

uInt maximumCacheSize() const

Get the maximum cache size (in bytes).

uInt cacheSize() const

Get the current cache size (in buckets).

void setCacheSize (const IPosition& sliceShape, const IPosition& axisPath, Bool forceSmaller=True)
void setCacheSize (const IPosition& sliceShape, const IPosition& windowStart, const IPosition& windowLength, const IPosition& axisPath, Bool forceSmaller=True)

Set the cache size using the given access pattern.

void setCacheSize (uInt nbuckets, Bool forceSmaller=True)

Set the cache size for accessing the data. When the give cache size exceeds the maximum cache size with more than 10%, the maximum cache size is used instead.
When forceSmaller is False, the cache is not resized when the new size is smaller.

static IPosition makeTileShape (const IPosition& arrayShape, uInt nrPixelsPerTile = 32768)

Make a tile shape from the array shape to fit as closely as possible the number of pixels in the tile.

TiledFileAccess (const TiledFileAccess&)
TiledFileAccess& operator= (const TiledFileAccess&)

Forbid copy constructor and assignment.