MeVisLab Toolbox Reference
|
Internal and private index table for the MLImageFormat, not to be used, because it is subject to change. More...
#include <mlImageFormatIdxTable.h>
Classes | |
struct | PageIdxType |
Internal helper class. More... | |
Public Member Functions | |
MLImageFormatIdxTable () | |
Constructor. | |
~MLImageFormatIdxTable () | |
Destructor. | |
MLErrorCode | create (MLint startIdx, MLint endIdx, MLint numAllPageIds, MLDataType dType, void *newTableData=nullptr, bool setTable=true) |
Create/allocate the page index table or a subset of it and fill all allocated memory with 0 bytes. | |
void | setTableData (void *newTable) |
Set new table data content, previous content will be freed with MLFree(). | |
void | toggleEndianess () |
Toggle all endian dependent entries of the index table if table data is available, otherwise the call is ignored. | |
void | reset () |
Destroys the internally allocated table and resets everything to construction state. | |
MLErrorCode | setEntry (MLint pageId, MLint pageDataStartPosInFile, MLint pageDataEndPosInFile, bool isCompressed, MLuint32 checkSum, bool isPartial, const MLTypeData *defaultVoxelData) |
Set values of entry pageId of index table. | |
const PageIdxType * | getConstEntry (MLint pageId) const |
Get pointer to constant entry with number pageId if available or NULL otherwise. | |
PageIdxType * | getEntry (MLint pageId) |
Get pointer to entry with number pageId if available or NULL otherwise. | |
const MLTypeData * | getConstEntryVoxelData (MLint pageId) const |
Get pointer to constant voxel data stored after entry if available or NULL otherwise. | |
MLTypeData * | getEntryVoxelData (MLint pageId) |
Get pointer to voxel data stored after entry if available or NULL otherwise. | |
MLint | getNumAllocatedPageIds () const |
Return number of allocated entries or 0 if still not created. | |
MLint | getNumImagePageIds () const |
Return number of whole page ids of image even if not allocated. | |
MLint | getAllocatedTableSizeInBytes () const |
Return size of entire allocated page id table in bytes, maybe < 0 in case of non allocated table data. | |
MLint | getWholeTableSizeInBytes () const |
Return size of whole page id table in bytes even if not all entries are allocated. | |
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. | |
MLErrorCode | save (MLImageFormatAbstractFileHandle *fileHandle, MLuint idxTabBasePos) |
Write allocated section of index table to correct position in file if idxTabBasePos is position of entry of first page id. | |
Internal and private index table for the MLImageFormat, not to be used, because 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 ) |
Create/allocate the page index table or a subset of it and fill 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 |
Return size of entire allocated page id table in bytes, maybe < 0 in case of non allocated table data.
const PageIdxType * ml::MLImageFormatIdxTable::getConstEntry | ( | MLint | pageId | ) | const |
Get pointer to constant entry with number pageId if available or NULL otherwise.
const MLTypeData * ml::MLImageFormatIdxTable::getConstEntryVoxelData | ( | MLint | pageId | ) | const |
Get pointer to constant voxel data stored after entry if available or NULL otherwise.
PageIdxType * ml::MLImageFormatIdxTable::getEntry | ( | MLint | pageId | ) |
Get pointer to entry with number pageId if available or NULL otherwise.
MLTypeData * ml::MLImageFormatIdxTable::getEntryVoxelData | ( | MLint | pageId | ) |
Get pointer to voxel data stored after entry if available or NULL otherwise.
MLint ml::MLImageFormatIdxTable::getNumAllocatedPageIds | ( | ) | const |
Return number of allocated entries or 0 if still not created.
MLint ml::MLImageFormatIdxTable::getNumImagePageIds | ( | ) | const |
Return number of whole page ids of image even if not allocated.
MLint ml::MLImageFormatIdxTable::getWholeTableSizeInBytes | ( | ) | const |
Return 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 ) |
Write 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 ) |
Set 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. |
Set 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 | ( | ) |
Toggle all endian dependent entries of the index table if table data is available, otherwise the call is ignored.