casa
$Rev:20696$
|
Tiled access to an array in a file. More...
#include <TiledFileAccess.h>
Public Member Functions | |
TiledFileAccess (const String &fileName, Int64 fileOffset, const IPosition &shape, const IPosition &tileShape, DataType dataType, const TSMOption &=TSMOption(), Bool writable=False) | |
Create a TiledFileAccess object. | |
TiledFileAccess (const String &fileName, Int64 fileOffset, const IPosition &shape, const IPosition &tileShape, DataType dataType, const TSMOption &, Bool writable, Bool bigEndian) | |
Create a TiledFileAccess object. | |
~TiledFileAccess () | |
Bool | isWritable () const |
Is the file writable? | |
DataType | dataType () const |
Array< Bool > | getBool (const Slicer §ion) |
Get part of the array. | |
Array< uChar > | getUChar (const Slicer §ion) |
Array< Short > | getShort (const Slicer §ion) |
Array< Int > | getInt (const Slicer §ion) |
Array< Float > | getFloat (const Slicer §ion) |
Array< Double > | getDouble (const Slicer §ion) |
Array< Complex > | getComplex (const Slicer §ion) |
Array< DComplex > | getDComplex (const Slicer §ion) |
void | get (Array< Bool > &, const Slicer §ion) |
void | get (Array< uChar > &, const Slicer §ion) |
void | get (Array< Short > &, const Slicer §ion) |
void | get (Array< Int > &, const Slicer §ion) |
void | get (Array< Float > &, const Slicer §ion) |
void | get (Array< Double > &, const Slicer §ion) |
void | get (Array< Complex > &, const Slicer §ion) |
void | get (Array< DComplex > &, const Slicer §ion) |
Array< Float > | getFloat (const Slicer §ion, Float scale, Float offset, uChar deleteValue, Bool examineForDeleteValues=True) |
Get the array and scale/offset the data using the given values. | |
Array< Float > | getFloat (const Slicer §ion, Float scale, Float offset, Short deleteValue, Bool examineForDeleteValues=True) |
Array< Float > | getFloat (const Slicer §ion, Float scale, Float offset, Int deleteValue, Bool examineForDeleteValues=True) |
void | get (Array< Float > &, const Slicer §ion, Float scale, Float offset, uChar deleteValue, Bool examineForDeleteValues=True) |
void | get (Array< Float > &, const Slicer §ion, Float scale, Float offset, Short deleteValue, Bool examineForDeleteValues=True) |
void | get (Array< Float > &, const Slicer §ion, Float scale, Float offset, Int deleteValue, Bool examineForDeleteValues=True) |
void | put (const Array< Bool > &, const Slicer §ion) |
Put part of the array. | |
void | put (const Array< uChar > &, const Slicer §ion) |
void | put (const Array< Short > &, const Slicer §ion) |
void | put (const Array< Int > &, const Slicer §ion) |
void | put (const Array< Float > &, const Slicer §ion) |
void | put (const Array< Double > &, const Slicer §ion) |
void | put (const Array< Complex > &, const Slicer §ion) |
void | put (const Array< DComplex > &, const Slicer §ion) |
void | flush () |
Flush the cache. | |
void | clearCache () |
Empty the cache. | |
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). | |
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) |
Set the cache size using the given access pattern. | |
void | setCacheSize (const IPosition &sliceShape, const IPosition &windowStart, const IPosition &windowLength, const IPosition &axisPath, Bool forceSmaller=True) |
void | setCacheSize (uInt nbuckets, Bool forceSmaller=True) |
Set the cache size for accessing the data. | |
Static Public Member Functions | |
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. | |
Private Member Functions | |
TiledFileAccess (const TiledFileAccess &) | |
Forbid copy constructor and assignment. | |
TiledFileAccess & | operator= (const TiledFileAccess &) |
Private Attributes | |
TSMCube * | itsCube |
TiledFileHelper * | itsTSM |
uInt | itsLocalPixelSize |
Bool | itsWritable |
DataType | itsDataType |
Tiled access to an array in a file.
Public interface
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.
This class makes it possible to access an image in a FITS file.
// 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()));
Definition at line 91 of file TiledFileAccess.h.
casa::TiledFileAccess::TiledFileAccess | ( | const String & | fileName, |
Int64 | fileOffset, | ||
const IPosition & | shape, | ||
const IPosition & | tileShape, | ||
DataType | dataType, | ||
const TSMOption & | = TSMOption() , |
||
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). The TSMOption determines how the file is accessed.
casa::TiledFileAccess::TiledFileAccess | ( | const String & | fileName, |
Int64 | fileOffset, | ||
const IPosition & | shape, | ||
const IPosition & | tileShape, | ||
DataType | dataType, | ||
const TSMOption & | , | ||
Bool | writable, | ||
Bool | bigEndian | ||
) |
Create a TiledFileAccess object.
The endian format of the data is explicitly given.
casa::TiledFileAccess::TiledFileAccess | ( | const TiledFileAccess & | ) | [private] |
Forbid copy constructor and assignment.
uInt casa::TiledFileAccess::cacheSize | ( | ) | const [inline] |
Get the current cache size (in buckets).
Definition at line 207 of file TiledFileAccess.h.
References casa::TSMCube::cacheSize(), and itsCube.
void casa::TiledFileAccess::clearCache | ( | ) | [inline] |
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.
Definition at line 184 of file TiledFileAccess.h.
References casa::TSMCube::emptyCache(), and itsCube.
DataType casa::TiledFileAccess::dataType | ( | ) | const [inline] |
Definition at line 118 of file TiledFileAccess.h.
References itsDataType.
void casa::TiledFileAccess::flush | ( | ) | [inline] |
Flush the cache.
Definition at line 177 of file TiledFileAccess.h.
References casa::TSMCube::flushCache(), and itsCube.
void casa::TiledFileAccess::get | ( | Array< Bool > & | , |
const Slicer & | section | ||
) |
void casa::TiledFileAccess::get | ( | Array< uChar > & | , |
const Slicer & | section | ||
) |
void casa::TiledFileAccess::get | ( | Array< Short > & | , |
const Slicer & | section | ||
) |
void casa::TiledFileAccess::get | ( | Array< Int > & | , |
const Slicer & | section | ||
) |
void casa::TiledFileAccess::get | ( | Array< Float > & | , |
const Slicer & | section | ||
) |
void casa::TiledFileAccess::get | ( | Array< Double > & | , |
const Slicer & | section | ||
) |
void casa::TiledFileAccess::get | ( | Array< Complex > & | , |
const Slicer & | section | ||
) |
void casa::TiledFileAccess::get | ( | Array< DComplex > & | , |
const Slicer & | section | ||
) |
void casa::TiledFileAccess::get | ( | Array< Float > & | , |
const Slicer & | section, | ||
Float | scale, | ||
Float | offset, | ||
uChar | deleteValue, | ||
Bool | examineForDeleteValues = True |
||
) |
void casa::TiledFileAccess::get | ( | Array< Float > & | , |
const Slicer & | section, | ||
Float | scale, | ||
Float | offset, | ||
Short | deleteValue, | ||
Bool | examineForDeleteValues = True |
||
) |
void casa::TiledFileAccess::get | ( | Array< Float > & | , |
const Slicer & | section, | ||
Float | scale, | ||
Float | offset, | ||
Int | deleteValue, | ||
Bool | examineForDeleteValues = True |
||
) |
Array<Bool> casa::TiledFileAccess::getBool | ( | const Slicer & | section | ) |
Get part of the array.
The Array object is resized if needed.
Array<Complex> casa::TiledFileAccess::getComplex | ( | const Slicer & | section | ) |
Array<DComplex> casa::TiledFileAccess::getDComplex | ( | const Slicer & | section | ) |
Array<Double> casa::TiledFileAccess::getDouble | ( | const Slicer & | section | ) |
Array<Float> casa::TiledFileAccess::getFloat | ( | const Slicer & | section | ) |
Array<Float> casa::TiledFileAccess::getFloat | ( | const Slicer & | section, |
Float | scale, | ||
Float | offset, | ||
uChar | 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 TpUChar, TpShort or TpInt TiledFileAccess objects. A deleteValue is set to a NaN without being scaled.
Array<Float> casa::TiledFileAccess::getFloat | ( | const Slicer & | section, |
Float | scale, | ||
Float | offset, | ||
Short | deleteValue, | ||
Bool | examineForDeleteValues = True |
||
) |
Array<Float> casa::TiledFileAccess::getFloat | ( | const Slicer & | section, |
Float | scale, | ||
Float | offset, | ||
Int | deleteValue, | ||
Bool | examineForDeleteValues = True |
||
) |
Array<Int> casa::TiledFileAccess::getInt | ( | const Slicer & | section | ) |
Array<Short> casa::TiledFileAccess::getShort | ( | const Slicer & | section | ) |
Array<uChar> casa::TiledFileAccess::getUChar | ( | const Slicer & | section | ) |
Bool casa::TiledFileAccess::isWritable | ( | ) | const [inline] |
static IPosition casa::TiledFileAccess::makeTileShape | ( | const IPosition & | arrayShape, |
uInt | nrPixelsPerTile = 32768 |
||
) | [static] |
Make a tile shape from the array shape to fit as closely as possible the number of pixels in the tile.
uInt casa::TiledFileAccess::maximumCacheSize | ( | ) | const |
Get the maximum cache size (in bytes).
TiledFileAccess& casa::TiledFileAccess::operator= | ( | const TiledFileAccess & | ) | [private] |
void casa::TiledFileAccess::put | ( | const Array< Bool > & | , |
const Slicer & | section | ||
) |
Put part of the array.
void casa::TiledFileAccess::put | ( | const Array< uChar > & | , |
const Slicer & | section | ||
) |
void casa::TiledFileAccess::put | ( | const Array< Short > & | , |
const Slicer & | section | ||
) |
void casa::TiledFileAccess::put | ( | const Array< Int > & | , |
const Slicer & | section | ||
) |
void casa::TiledFileAccess::put | ( | const Array< Float > & | , |
const Slicer & | section | ||
) |
void casa::TiledFileAccess::put | ( | const Array< Double > & | , |
const Slicer & | section | ||
) |
void casa::TiledFileAccess::put | ( | const Array< Complex > & | , |
const Slicer & | section | ||
) |
void casa::TiledFileAccess::put | ( | const Array< DComplex > & | , |
const Slicer & | section | ||
) |
void casa::TiledFileAccess::setCacheSize | ( | const IPosition & | sliceShape, |
const IPosition & | axisPath, | ||
Bool | forceSmaller = True |
||
) | [inline] |
Set the cache size using the given access pattern.
Definition at line 212 of file TiledFileAccess.h.
References itsCube, casa::TSMCube::setCacheSize(), and casa::True.
void casa::TiledFileAccess::setCacheSize | ( | const IPosition & | sliceShape, |
const IPosition & | windowStart, | ||
const IPosition & | windowLength, | ||
const IPosition & | axisPath, | ||
Bool | forceSmaller = True |
||
) | [inline] |
Definition at line 217 of file TiledFileAccess.h.
References itsCube, casa::TSMCube::setCacheSize(), and casa::True.
void casa::TiledFileAccess::setCacheSize | ( | uInt | nbuckets, |
Bool | forceSmaller = True |
||
) | [inline] |
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.
Definition at line 231 of file TiledFileAccess.h.
References itsCube, casa::TSMCube::setCacheSize(), and casa::True.
void casa::TiledFileAccess::setMaximumCacheSize | ( | uInt | nbytes | ) |
Set the maximum cache size (in bytes).
0 means no maximum.
const IPosition& casa::TiledFileAccess::shape | ( | ) | const [inline] |
Get the shape of the array.
Definition at line 192 of file TiledFileAccess.h.
References casa::TSMCube::cubeShape(), and itsCube.
void casa::TiledFileAccess::showCacheStatistics | ( | ostream & | os | ) | const [inline] |
Show the cache statistics.
Definition at line 188 of file TiledFileAccess.h.
References itsCube, and casa::TSMCube::showCacheStatistics().
const IPosition& casa::TiledFileAccess::tileShape | ( | ) | const [inline] |
Get the shape of the tiles.
Definition at line 196 of file TiledFileAccess.h.
References itsCube, and casa::TSMCube::tileShape().
TSMCube* casa::TiledFileAccess::itsCube [private] |
Definition at line 248 of file TiledFileAccess.h.
Referenced by cacheSize(), clearCache(), flush(), setCacheSize(), shape(), showCacheStatistics(), and tileShape().
DataType casa::TiledFileAccess::itsDataType [private] |
Definition at line 252 of file TiledFileAccess.h.
Referenced by dataType().
uInt casa::TiledFileAccess::itsLocalPixelSize [private] |
Definition at line 250 of file TiledFileAccess.h.
TiledFileHelper* casa::TiledFileAccess::itsTSM [private] |
Definition at line 249 of file TiledFileAccess.h.
Bool casa::TiledFileAccess::itsWritable [private] |
Definition at line 251 of file TiledFileAccess.h.
Referenced by isWritable().