Isis Developer Reference
|
IO Handler for Isis Cubes using the BSQ format. More...
#include <CubeBsqHandler.h>
Public Member Functions | |
CubeBsqHandler (QFile *dataFile, const QList< int > *virtualBandList, const Pvl &label, bool alreadyOnDisk) | |
Construct a BSQ IO handler. | |
~CubeBsqHandler () | |
The destructor writes all cached data to disk. | |
void | updateLabels (Pvl &labels) |
Function to update the labels with a Pvl object. | |
void | read (Buffer &bufferToFill) const |
Read cube data from disk into the buffer. | |
void | write (const Buffer &bufferToWrite) |
Write buffer data into the cube data on disk. | |
void | addCachingAlgorithm (CubeCachingAlgorithm *algorithm) |
This will add the given caching algorithm to the list of attempted caching algorithms. | |
void | clearCache (bool blockForWriteCache=true) const |
Free all cube chunks (cached cube data) from memory and write them to disk. | |
BigInt | getDataSize () const |
void | setVirtualBands (const QList< int > *virtualBandList) |
This changes the virtual band list. | |
QMutex * | dataFileMutex () |
Get the mutex that this IO handler is using around I/Os on the given data file. | |
Protected Member Functions | |
virtual void | readRaw (RawCubeChunk &chunkToFill) |
This needs to populate the chunkToFill with unswapped raw bytes from the disk. | |
virtual void | writeRaw (const RawCubeChunk &chunkToWrite) |
This needs to write the chunkToWrite directly to disk with no modifications to the data itself. | |
int | bandCount () const |
int | getBandCountInChunk () const |
BigInt | getBytesPerChunk () const |
int | getChunkCountInBandDimension () const |
int | getChunkCountInLineDimension () const |
int | getChunkCountInSampleDimension () const |
int | getChunkIndex (const RawCubeChunk &) const |
Given a chunk, what's its index in the file. | |
BigInt | getDataStartByte () const |
QFile * | getDataFile () |
int | lineCount () const |
int | getLineCountInChunk () const |
PixelType | pixelType () const |
int | sampleCount () const |
int | getSampleCountInChunk () const |
void | setChunkSizes (int numSamples, int numLines, int numBands) |
This should be called once from the child constructor. | |
IO Handler for Isis Cubes using the BSQ format.
This class is used to open, create, read, and write data from Isis cube files.
Isis::CubeBsqHandler::CubeBsqHandler | ( | QFile * | dataFile, |
const QList< int > * | virtualBandList, | ||
const Pvl & | labels, | ||
bool | alreadyOnDisk ) |
Construct a BSQ IO handler.
This will determine a good chunk size to use that does not result in the cube being enlarged or misordered.
dataFile | The file with cube DN data in it |
virtualBandList | The mapping from virtual band to physical band, see CubeIoHandler's description. |
labels | The Pvl labels for the cube |
alreadyOnDisk | True if the cube is allocated on the disk, false otherwise |
References Isis::CubeIoHandler::lineCount(), Isis::CubeIoHandler::pixelType(), Isis::CubeIoHandler::sampleCount(), Isis::CubeIoHandler::setChunkSizes(), and Isis::SizeOf().
Isis::CubeBsqHandler::~CubeBsqHandler | ( | ) |
The destructor writes all cached data to disk.
References Isis::CubeIoHandler::clearCache().
|
inherited |
This will add the given caching algorithm to the list of attempted caching algorithms.
The algorithms are tried in the opposite order that they were added - the first algorithm added is the last algorithm tried.
This method takes ownership of algorithm.
algorithm | The caching algorithm to add to the Cube for I/O |
Referenced by Isis::Cube::addCachingAlgorithm().
|
protectedinherited |
|
inherited |
Free all cube chunks (cached cube data) from memory and write them to disk.
Child destructors need to call this method.
This method should only be called otherwise when lots of cubes are in memory and the many caches cause problems with system RAM limitations.
blockForWriteCache | This should be true unless this method is called from the write thread. |
Referenced by Isis::Cube::clearIoCache(), Isis::Cube::copy(), ~CubeBsqHandler(), and Isis::CubeTileHandler::~CubeTileHandler().
|
inherited |
Get the mutex that this IO handler is using around I/Os on the given data file.
A lock should be acquired before doing any reads/writes on the data file externally.
Referenced by Isis::Cube::read(), and Isis::Cube::write().
|
protectedinherited |
Referenced by Isis::CubeIoHandler::getChunkIndex(), and Isis::CubeIoHandler::read().
|
protectedinherited |
References Isis::SizeOf().
Referenced by Isis::CubeIoHandler::getDataSize().
|
protectedinherited |
Referenced by Isis::CubeIoHandler::getDataSize().
|
protectedinherited |
Referenced by Isis::CubeIoHandler::getChunkIndex(), Isis::CubeIoHandler::getDataSize(), and Isis::CubeIoHandler::read().
|
protectedinherited |
Referenced by Isis::CubeIoHandler::getChunkIndex(), Isis::CubeIoHandler::getDataSize(), and Isis::CubeIoHandler::read().
|
protectedinherited |
Given a chunk, what's its index in the file.
Chunks are ordered from left to right, then top to bottom, then front to back (BSQ). The first chunk is at the top left of band 1 and is index 0, for example. In other words, this is going from the value of m_rawData to the key.
Chunks which sit outside of the cube entirely must not be passed into this method; the results will be wrong.
References Isis::CubeIoHandler::getBandCountInChunk(), Isis::CubeIoHandler::getChunkCountInLineDimension(), Isis::CubeIoHandler::getChunkCountInSampleDimension(), Isis::CubeIoHandler::getLineCountInChunk(), and Isis::CubeIoHandler::getSampleCountInChunk().
|
protectedinherited |
Referenced by readRaw(), Isis::CubeTileHandler::readRaw(), writeRaw(), and Isis::CubeTileHandler::writeRaw().
|
inherited |
References Isis::CubeIoHandler::getBytesPerChunk(), Isis::CubeIoHandler::getChunkCountInBandDimension(), Isis::CubeIoHandler::getChunkCountInLineDimension(), and Isis::CubeIoHandler::getChunkCountInSampleDimension().
Referenced by Isis::CubeIoHandler::setChunkSizes(), and Isis::Cube::write().
|
protectedinherited |
Referenced by Isis::CubeIoHandler::setChunkSizes().
|
protectedinherited |
Referenced by Isis::CubeIoHandler::getChunkIndex(), Isis::CubeIoHandler::read(), and Isis::CubeTileHandler::updateLabels().
|
protectedinherited |
Referenced by Isis::CubeIoHandler::getChunkIndex(), Isis::CubeIoHandler::read(), and Isis::CubeTileHandler::updateLabels().
|
protectedinherited |
Referenced by CubeBsqHandler(), and Isis::CubeTileHandler::CubeTileHandler().
|
protectedinherited |
Referenced by CubeBsqHandler(), and Isis::CubeTileHandler::CubeTileHandler().
|
inherited |
Read cube data from disk into the buffer.
This is not const because it caches the read cube chunks from the disk.
bufferToFill | The buffer to populate with cube data. |
References Isis::CubeIoHandler::getBandCountInChunk(), Isis::CubeIoHandler::getChunkCountInLineDimension(), Isis::CubeIoHandler::getChunkCountInSampleDimension(), Isis::CubeIoHandler::getLineCountInChunk(), Isis::CubeIoHandler::getSampleCountInChunk(), and Isis::Null.
Referenced by Isis::Cube::read().
|
protectedvirtual |
This needs to populate the chunkToFill with unswapped raw bytes from the disk.
chunkToFill | The container that needs to be filled with cube data. |
Implements Isis::CubeIoHandler.
References _FILEINFO_, Isis::CubeIoHandler::getDataFile(), and Isis::IException::Io.
|
protectedinherited |
Referenced by CubeBsqHandler(), and Isis::CubeTileHandler::CubeTileHandler().
|
protectedinherited |
This should be called once from the child constructor.
This determines the chunk sizes used for the cube and often should remain constant for a particular cube (BSQ, for example, doesn't need it to be constant but Tile does). These being large can cause excessive use of disk space that stores no cube data. These being large can also drastically increase the amount of RAM consumed.
numSamples | The chunk size in the sample dimension |
numLines | The chunk size in the line dimension |
numBands | The chunk size in the band dimension |
References _FILEINFO_, Isis::CubeIoHandler::getDataSize(), Isis::CubeIoHandler::getDataStartByte(), and Isis::IException::Programmer.
Referenced by CubeBsqHandler(), and Isis::CubeTileHandler::CubeTileHandler().
|
inherited |
This changes the virtual band list.
virtualBandList | A list where the indices are the vbands and the values are the physical bands. The values are 1-based. This can be specified as NULL, in which case the vbands are the physical bands. The virtual band list is copied (the pointer provided isn't remembered). |
Referenced by Isis::CubeIoHandler::CubeIoHandler(), and Isis::Cube::setVirtualBands().
|
virtual |
Function to update the labels with a Pvl object.
label | Pvl object to update with |
Implements Isis::CubeIoHandler.
References Isis::PvlObject::findObject(), and Isis::PvlContainer::Replace.
|
inherited |
Write buffer data into the cube data on disk.
This could do no IO if the cube chunks required are already in memory and our caching algorithms say to not free any of the cube chunks afterwards.
bufferToWrite | The buffer to get cube data from. |
Referenced by Isis::Cube::write().
|
protectedvirtual |
This needs to write the chunkToWrite directly to disk with no modifications to the data itself.
chunkToWrite | The container that needs to be put on disk. |
Implements Isis::CubeIoHandler.
References _FILEINFO_, Isis::CubeIoHandler::getDataFile(), and Isis::IException::Io.