MeVisLab Toolbox Reference
ml::MLImageFormatIdxTable Class 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. More...
 
 ~MLImageFormatIdxTable ()
 Destructor. More...
 
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. More...
 
void setTableData (void *newTable)
 Set new table data content, previous content will be freed with MLFree(). More...
 
void toggleEndianess ()
 Toggle 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)
 Set values of entry pageId of index table. More...
 
const PageIdxTypegetConstEntry (MLint pageId) const
 Get pointer to constant entry with number pageId if available or NULL otherwise. More...
 
PageIdxTypegetEntry (MLint pageId)
 Get pointer to entry with number pageId if available or NULL otherwise. More...
 
const MLTypeDatagetConstEntryVoxelData (MLint pageId) const
 Get pointer to constant voxel data stored after entry if available or NULL otherwise. More...
 
MLTypeDatagetEntryVoxelData (MLint pageId)
 Get pointer to voxel data stored after entry if available or NULL otherwise. More...
 
MLint getNumAllocatedPageIds () const
 Return number of allocated entries or 0 if still not created. More...
 
MLint getNumImagePageIds () const
 Return number of whole page ids of image even if not allocated. More...
 
MLint getAllocatedTableSizeInBytes () const
 Return size of entire allocated page id table in bytes, maybe < 0 in case of non allocated table data. More...
 
MLint getWholeTableSizeInBytes () const
 Return 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)
 Write allocated section of index table to correct position in file if idxTabBasePos is position of entry of first page id. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ MLImageFormatIdxTable()

ml::MLImageFormatIdxTable::MLImageFormatIdxTable ( )

Constructor.

◆ ~MLImageFormatIdxTable()

ml::MLImageFormatIdxTable::~MLImageFormatIdxTable ( )

Destructor.

Member Function Documentation

◆ create()

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.

Parameters
startIdxFirst page id to be allocated in table fragment.
endIdxLast page id to be allocated in table fragment.
numAllPageIdsNumber of all pages in file image, even if not allocated.
dTypeMLDataType of voxel stored after each PageIdxType struct.
newTableDataif 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.
setTableif true the internal table data will be created if newTableData is NULL, otherwise internal table is left unallocated. Default is true.
Returns
ML_RESULT_OK on success or another code on failure.

◆ getAllocatedTableSizeInBytes()

MLint ml::MLImageFormatIdxTable::getAllocatedTableSizeInBytes ( ) const

Return size of entire allocated page id table in bytes, maybe < 0 in case of non allocated table data.

◆ getConstEntry()

const PageIdxType* ml::MLImageFormatIdxTable::getConstEntry ( MLint  pageId) const

Get pointer to constant entry with number pageId if available or NULL otherwise.

◆ getConstEntryVoxelData()

const MLTypeData* ml::MLImageFormatIdxTable::getConstEntryVoxelData ( MLint  pageId) const

Get pointer to constant voxel data stored after entry if available or NULL otherwise.

◆ getEntry()

PageIdxType* ml::MLImageFormatIdxTable::getEntry ( MLint  pageId)

Get pointer to entry with number pageId if available or NULL otherwise.

◆ getEntryVoxelData()

MLTypeData* ml::MLImageFormatIdxTable::getEntryVoxelData ( MLint  pageId)

Get pointer to voxel data stored after entry if available or NULL otherwise.

◆ getNumAllocatedPageIds()

MLint ml::MLImageFormatIdxTable::getNumAllocatedPageIds ( ) const

Return number of allocated entries or 0 if still not created.

◆ getNumImagePageIds()

MLint ml::MLImageFormatIdxTable::getNumImagePageIds ( ) const

Return number of whole page ids of image even if not allocated.

◆ getWholeTableSizeInBytes()

MLint ml::MLImageFormatIdxTable::getWholeTableSizeInBytes ( ) const

Return size of whole page id table in bytes even if not all entries are allocated.

◆ load()

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.

Parameters
infosThe data structure describing the file opened for reading.
numWholePageIdsNumber of page ids of the entire image.
Returns
ML_RESULT_OK on success or on failure and MLErrorCode describing the problem.

◆ reset()

void ml::MLImageFormatIdxTable::reset ( )

Destroys the internally allocated table and resets everything to construction state.

◆ save()

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.

Parameters
fileHandleA file handle for a valid, open and writable file in binary mode.
idxTabBasePosPosition in file of entry corresponding to page id 0 in file even if entry 0 is currently not allocated or written.
Returns
ML_RESULT_OK on success or on failure an MLErrorCode describing the problem.

◆ setEntry()

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.

Parameters
pageIdThe entry whose values shall be set. Must be in allocated table range between first and last entry or call is ignored.
pageDataStartPosInFilePosition in file where the first valid byte of page data is located.
pageDataEndPosInFilePosition in file where the last valid first byte of page data is located.
isCompressedtrue if data of page is compressed, false otherwise.
checkSumExpects the checkSum value for the page.
defaultVoxelDatapointer 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.
isPartialtrue if stored page is only partially stored, false otherwise.
Returns
ML_RESULT_OK or another error-describing code in case of failure.

◆ setTableData()

void ml::MLImageFormatIdxTable::setTableData ( void *  newTable)

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.

◆ toggleEndianess()

void ml::MLImageFormatIdxTable::toggleEndianess ( )

Toggle all endian dependent entries of the index table if table data is available, otherwise the call is ignored.


The documentation for this class was generated from the following file: