MeVisLab Toolbox Reference
|
Internal and private index table for the MLImageFormat. More...
#include <mlImageFormatIdxTable.h>
Classes | |
struct | PageIdxType |
Internal helper class. More... | |
Public Member Functions | |
MLImageFormatIdxTable () | |
Constructor. More... | |
~MLImageFormatIdxTable () | |
Destructor. More... | |
MLErrorCode | create (MLint startIdx, MLint endIdx, MLint numAllPageIds, MLDataType dType, void *newTableData=nullptr, bool setTable=true) |
Creates/allocates the page index table or a subset of it and fills all allocated memory with 0 bytes. More... | |
void | setTableData (void *newTable) |
Sets new table data content, previous content will be freed with MLFree(). More... | |
void | toggleEndianess () |
Toggles all endian-dependent entries of the index table if table data is available; otherwise, the call is ignored. More... | |
void | reset () |
Destroys the internally allocated table and resets everything to construction state. More... | |
MLErrorCode | setEntry (MLint pageId, MLint pageDataStartPosInFile, MLint pageDataEndPosInFile, bool isCompressed, MLuint32 checkSum, bool isPartial, const MLTypeData *defaultVoxelData) |
Sets values of entry pageId of index table. More... | |
const PageIdxType * | getConstEntry (MLint pageId) const |
Returns pointer to constant entry with number pageId if available or NULL otherwise. More... | |
PageIdxType * | getEntry (MLint pageId) |
Returns pointer to entry with number pageId if available or NULL otherwise. More... | |
const MLTypeData * | getConstEntryVoxelData (MLint pageId) const |
Returns pointer to constant voxel data stored after entry if available or NULL otherwise. More... | |
MLTypeData * | getEntryVoxelData (MLint pageId) |
Returns pointer to voxel data stored after entry if available or NULL otherwise. More... | |
MLint | getNumAllocatedPageIds () const |
Returns number of allocated entries or 0 if still not created. More... | |
MLint | getNumImagePageIds () const |
Returns number of whole page IDs of image even if not allocated. More... | |
MLint | getAllocatedTableSizeInBytes () const |
Returns size of entire allocated page ID table in bytes, may be < 0 in case of non allocated table data. More... | |
MLint | getWholeTableSizeInBytes () const |
Returns size of whole page ID table in bytes even if not all entries are allocated. More... | |
MLErrorCode | load (const MLImageFormatInfos &infos, MLint numWholePageIds) |
Loads the index table containing all position and storage information of the pages in the file and stores it in idxTab. More... | |
MLErrorCode | save (MLImageFormatAbstractFileHandle *fileHandle, MLuint idxTabBasePos) |
Writes allocated section of index table to correct position in file if idxTabBasePos is position of entry of first page ID. More... | |
Internal and private index table for the MLImageFormat.
Not to be used, as it is subject to change.
Definition at line 39 of file mlImageFormatIdxTable.h.
ml::MLImageFormatIdxTable::MLImageFormatIdxTable | ( | ) |
Constructor.
ml::MLImageFormatIdxTable::~MLImageFormatIdxTable | ( | ) |
Destructor.
MLErrorCode ml::MLImageFormatIdxTable::create | ( | MLint | startIdx, |
MLint | endIdx, | ||
MLint | numAllPageIds, | ||
MLDataType | dType, | ||
void * | newTableData = nullptr , |
||
bool | setTable = true |
||
) |
Creates/allocates the page index table or a subset of it and fills all allocated memory with 0 bytes.
startIdx | First page ID to be allocated in table fragment. |
endIdx | Last page ID to be allocated in table fragment. |
numAllPageIds | Number of all pages in file image, even if not allocated. |
dType | MLDataType of voxel stored after each PageIdxType struct. |
newTableData | If passed as NULL, this call will allocate the table data in this call; otherwise, the passed data will be taken instead and owned from that moment, i.e., it will be destroyed on reset or destruction with MLFree(). Default is NULL. Note that the caller is responsible for valid allocate with compatible allocator for MLFree() and sufficient size of data chunk. |
setTable | If true the internal table data will be created if newTableData is NULL; otherwise, internal table is left unallocated. Default is true . |
MLint ml::MLImageFormatIdxTable::getAllocatedTableSizeInBytes | ( | ) | const |
Returns size of entire allocated page ID table in bytes, may be < 0 in case of non allocated table data.
const PageIdxType* ml::MLImageFormatIdxTable::getConstEntry | ( | MLint | pageId | ) | const |
Returns pointer to constant entry with number pageId if available or NULL otherwise.
const MLTypeData* ml::MLImageFormatIdxTable::getConstEntryVoxelData | ( | MLint | pageId | ) | const |
Returns pointer to constant voxel data stored after entry if available or NULL otherwise.
PageIdxType* ml::MLImageFormatIdxTable::getEntry | ( | MLint | pageId | ) |
Returns pointer to entry with number pageId if available or NULL otherwise.
MLTypeData* ml::MLImageFormatIdxTable::getEntryVoxelData | ( | MLint | pageId | ) |
Returns pointer to voxel data stored after entry if available or NULL otherwise.
MLint ml::MLImageFormatIdxTable::getNumAllocatedPageIds | ( | ) | const |
Returns number of allocated entries or 0 if still not created.
MLint ml::MLImageFormatIdxTable::getNumImagePageIds | ( | ) | const |
Returns number of whole page IDs of image even if not allocated.
MLint ml::MLImageFormatIdxTable::getWholeTableSizeInBytes | ( | ) | const |
Returns size of whole page ID table in bytes even if not all entries are allocated.
MLErrorCode ml::MLImageFormatIdxTable::load | ( | const MLImageFormatInfos & | infos, |
MLint | numWholePageIds | ||
) |
Loads the index table containing all position and storage information of the pages in the file and stores it in idxTab.
infos | The data structure describing the file opened for reading. |
numWholePageIds | Number of page IDs of the entire image. |
void ml::MLImageFormatIdxTable::reset | ( | ) |
Destroys the internally allocated table and resets everything to construction state.
MLErrorCode ml::MLImageFormatIdxTable::save | ( | MLImageFormatAbstractFileHandle * | fileHandle, |
MLuint | idxTabBasePos | ||
) |
Writes allocated section of index table to correct position in file if idxTabBasePos is position of entry of first page ID.
fileHandle | A file handle for a valid, open, and writable file in binary mode. |
idxTabBasePos | Position in file of entry corresponding to page ID 0 in file even if entry 0 is currently not allocated or written. |
MLErrorCode ml::MLImageFormatIdxTable::setEntry | ( | MLint | pageId, |
MLint | pageDataStartPosInFile, | ||
MLint | pageDataEndPosInFile, | ||
bool | isCompressed, | ||
MLuint32 | checkSum, | ||
bool | isPartial, | ||
const MLTypeData * | defaultVoxelData | ||
) |
Sets values of entry pageId of index table.
pageId | The entry whose values shall be set. Must be in allocated table range between first and last entry or call is ignored. |
pageDataStartPosInFile | Position in file where the first valid byte of page data is located. |
pageDataEndPosInFile | Position in file where the last valid first byte of page data is located. |
isCompressed | true if data of page is compressed, false otherwise. |
checkSum | Expects the checksum value for the page. |
defaultVoxelData | Pointer to one value of the image voxel type be stored. The voxel value in entry is not changed if pointer is passed as NULL. If defaultVoxelData is identical with the already set default voxel value pointer, then the data is not be copied onto itself but no copy is performed. |
isPartial | true if stored page is only partially stored, false otherwise. |
void ml::MLImageFormatIdxTable::setTableData | ( | void * | newTable | ) |
Sets new table data content, previous content will be freed with MLFree().
Note that the caller is responsible for valid allocated data compatible to MLFree(), sufficient size of data chunk, and valid content. newTable will be owned from this instance from time of call and is freed with MLFree() on reset() or instance destruction.
void ml::MLImageFormatIdxTable::toggleEndianess | ( | ) |
Toggles all endian-dependent entries of the index table if table data is available; otherwise, the call is ignored.