MeVisLab Toolbox Reference
ml::MLImageFormatTagList Class Reference

Class defining a list of tags used in the MLImageFormat class. More...

#include <mlImageFormatTagList.h>

Inheritance diagram for ml::MLImageFormatTagList:

Public Member Functions

Basic class stuff, constructor, destructor, assignment etc.
 MLImageFormatTagList ()
 Default constructor, setting name and value to empty strings. More...
 
MLuint getTagListSizeInBytes () const
 Returns sum of sizes of all tag names and values of all tags including their terminating 0 characters or 0 on failure. More...
 
void tagListOut (std::ostream &ostr) const
 Passes the tag list into a the stream ostr. More...
 
std::string getTagListAsString () const
 Passes the tag list into a the string str. More...
 
const MLImageFormatTagfindConstTag (const std::string &tagName) const
 Returns pointer to first tag in list with name tagName or NULL if not found. More...
 
MLint findTagIdx (const std::string &tagName) const
 Returns index to first tag in list with name tagName or -1 if not found or on failure. More...
 
bool checkTag (const std::string &tagName, MLint &val) const
 Searches tag with name tagName in list and if it exists then its value is read into val and true is returned. More...
 
bool checkTag (const std::string &tagName, std::string &val) const
 Searches tag with name tagName in list and if it exists then its value is read into val and true is returned. More...
 
bool checkTag (const std::string &tagName, MLdouble &val) const
 Searches tag with name tagName in list and if it exists then its value is read into val and true is returned. More...
 
bool checkTag (const std::string &tagName, MLldouble &val) const
 Searches tag with name tagName in list and if it exists then its value is read into val and true is returned. More...
 
MLuint getExpectedHeaderAndListSizeAsBinary () const
 Returns the number of bytes which would be needed to store the header and tag list in memory before writing it to the file. More...
 
char * getHeaderAndListAsBinary (size_t &memSize, MLuint32 saveModeBits) const
 Create a memory buffer and fill if first with a null-terminated versionStr followed by all tagNames and values from the list. More...
 
MLErrorCode save (MLImageFormatAbstractFileHandle *fileHandle, MLuint filePos, MLuint32 saveModeBits) const
 Writes the tag list into an open and writable file to position filePos or to the current file position. More...
 
MLErrorCode load (MLImageFormatAbstractFileHandle *fileHandle, MLint filePos=0)
 Reads the tag list from start of open file given by valid file handle for a readable and open file. More...
 
MLErrorCode appendImageProperties (const PagedImage &props, const DataCompressor *compressor, const MLImageFormatTagList &compressionTagList, const MLImageFormatTagList &userTagList, const MLImageFormatTagList &privateTagList, const std::string &defaultVoxelValue, MLuint32 saveModeBits)
 Append image properties and other information to tagList. More...
 
MLErrorCode extractImageProperties (PagedImage &props, MLint &endianess, std::string &compressorName, std::string &compressorVersion, MLImageFormatTagList &compressionTagList, MLImageFormatTagList &userTagList, MLImageFormatTagList &privateTagList, std::string &defaultVoxelValue, MLint &usesCheckSum, MLint &usesPartialPages)
 Gets image properties from a non empty tag list, empty lists are considered okay, only safely found settings are changed in the return values. More...
 
MLErrorCode extractImageProperties (MLImageFormatInfos &infos)
 Gets all image properties of infos except of the. More...
 
void appendSpecialTags (const std::string &numTagsTagName, const std::string &tagNamePrefix, const MLImageFormatTagList &sourceTagList)
 Helper function to special tags in a standardized way to the tag list. More...
 
MLErrorCode extractSpecialTags (const std::string &numTagsTagName, const std::string &tagNamePrefix, MLImageFormatTagList &targetTagList) const
 Helper function to extract special tags in a standardized way from this tag list into a target tag list. More...
 

Static Public Member Functions

static const MLImageFormatTagListgetDefaultEmptyTagList ()
 Returns a default empty tags list. Must be called cfirst time in dll-init. More...
 

Static Public Attributes

static const MLint ML_LITTLE_ENDIAN
 Little endian. More...
 
static const MLint ML_BIG_ENDIAN
 Big endian. More...
 
static const std::string ML_DICOM_TAG_PREFIX
 Name prefix for all stored DICOM tags. More...
 
static const std::string ML_TAG_LIST_SIZE_IN_BYTES_TAG
 Name of first tag whose value denotes the size of the entire tag list size. More...
 

Detailed Description

Class defining a list of tags used in the MLImageFormat class.

Definition at line 39 of file mlImageFormatTagList.h.

Constructor & Destructor Documentation

◆ MLImageFormatTagList()

ml::MLImageFormatTagList::MLImageFormatTagList ( )

Default constructor, setting name and value to empty strings.

Member Function Documentation

◆ appendImageProperties()

MLErrorCode ml::MLImageFormatTagList::appendImageProperties ( const PagedImage props,
const DataCompressor compressor,
const MLImageFormatTagList compressionTagList,
const MLImageFormatTagList userTagList,
const MLImageFormatTagList privateTagList,
const std::string &  defaultVoxelValue,
MLuint32  saveModeBits 
)

Append image properties and other information to tagList.

Convenience function, independent of open files etc.

Parameters
propsthe properties to be stored in tag list.
compressorname of the data compressor stored in tag list.
compressionTagListadditional arguments for compressor to be stored in list.
userTagListuser tags to be added to tag list.
privateTagListprivate tags to be added to tag list.
defaultVoxelValuedefault voxel value for unstored pages to be stored in list.
saveModeBitsBit combination setting special save options: See MLImageFormatTools::SaveModeBits for possible options.
Returns
ML_RESULT_OK on success or on failure an MLErrorCode describing the problem.

◆ appendSpecialTags()

void ml::MLImageFormatTagList::appendSpecialTags ( const std::string &  numTagsTagName,
const std::string &  tagNamePrefix,
const MLImageFormatTagList sourceTagList 
)

Helper function to special tags in a standardized way to the tag list.

Parameters
numTagsTagNameThe name of the tag which will store the of added tags.
tagNamePrefixPrefix added before each name of added tags. tagNamePrefix must not contain ":" characters.
sourceTagListList of special tags to be added.

◆ checkTag() [1/4]

bool ml::MLImageFormatTagList::checkTag ( const std::string &  tagName,
MLdouble val 
) const

Searches tag with name tagName in list and if it exists then its value is read into val and true is returned.

On failure false is returned and val is left unchanged.

◆ checkTag() [2/4]

bool ml::MLImageFormatTagList::checkTag ( const std::string &  tagName,
MLint val 
) const

Searches tag with name tagName in list and if it exists then its value is read into val and true is returned.

On failure false is returned and val is left unchanged.

◆ checkTag() [3/4]

bool ml::MLImageFormatTagList::checkTag ( const std::string &  tagName,
MLldouble val 
) const

Searches tag with name tagName in list and if it exists then its value is read into val and true is returned.

On failure false is returned and val is left unchanged.

◆ checkTag() [4/4]

bool ml::MLImageFormatTagList::checkTag ( const std::string &  tagName,
std::string &  val 
) const

Searches tag with name tagName in list and if it exists then its value is read into val and true is returned.

On failure false is returned and val is left unchanged.

◆ extractImageProperties() [1/2]

MLErrorCode ml::MLImageFormatTagList::extractImageProperties ( MLImageFormatInfos infos)

Gets all image properties of infos except of the.

  • infos.fileHandle,
  • infos.idxTab, and
  • infos.tagList from a non empty tag list given by this. Empty lists are considered okay, only safely found settings are changed in the passed info parameter. Does the same as extractImageProperties(...) with multiple parameters.
    Parameters
    infosThe information object to be filled with extracted information.
    Returns
    ML_RESULT_OK on success or on failure an MLErrorCode describing the problem.

◆ extractImageProperties() [2/2]

MLErrorCode ml::MLImageFormatTagList::extractImageProperties ( PagedImage props,
MLint endianess,
std::string &  compressorName,
std::string &  compressorVersion,
MLImageFormatTagList compressionTagList,
MLImageFormatTagList userTagList,
MLImageFormatTagList privateTagList,
std::string &  defaultVoxelValue,
MLint usesCheckSum,
MLint usesPartialPages 
)

Gets image properties from a non empty tag list, empty lists are considered okay, only safely found settings are changed in the return values.

Parameters
propsis filled with the properties of the stored file.
endianessreturns the endianess of the data in the file.
compressorNamereturns the name of the data compressor used for that file.
compressorVersionreturns the version of the data compressor used for that file.
compressionTagListreturns compressionScheme and additional arguments.
userTagListreturns the list with user defined tags.
privateTagListreturns the list with private tags.
defaultVoxelValuereturns the default voxel value for non stored pages.
usesCheckSumreturns non zero if data is stored with check sum, otherwise 0.
usesPartialPagesreturns non zero if pages are potentially only stored partially, otherwise 0.
Returns
ML_RESULT_OK on success or on failure an MLErrorCode describing the problem.

◆ extractSpecialTags()

MLErrorCode ml::MLImageFormatTagList::extractSpecialTags ( const std::string &  numTagsTagName,
const std::string &  tagNamePrefix,
MLImageFormatTagList targetTagList 
) const

Helper function to extract special tags in a standardized way from this tag list into a target tag list.

See symmetric function appendSpecialTagsToTagList().

Parameters
numTagsTagNameThe name of the tag which contains the number of added tags.
tagNamePrefixPrefix added before each name of added tags. tagNamePrefix must not contain ":" characters.
targetTagListList in which to store the extracted tags.
Returns
ML_RESULT_OK on success or an error code on failure.

◆ findConstTag()

const MLImageFormatTag* ml::MLImageFormatTagList::findConstTag ( const std::string &  tagName) const

Returns pointer to first tag in list with name tagName or NULL if not found.

◆ findTagIdx()

MLint ml::MLImageFormatTagList::findTagIdx ( const std::string &  tagName) const

Returns index to first tag in list with name tagName or -1 if not found or on failure.

◆ getDefaultEmptyTagList()

static const MLImageFormatTagList& ml::MLImageFormatTagList::getDefaultEmptyTagList ( )
static

Returns a default empty tags list. Must be called cfirst time in dll-init.

◆ getExpectedHeaderAndListSizeAsBinary()

MLuint ml::MLImageFormatTagList::getExpectedHeaderAndListSizeAsBinary ( ) const

Returns the number of bytes which would be needed to store the header and tag list in memory before writing it to the file.

◆ getHeaderAndListAsBinary()

char* ml::MLImageFormatTagList::getHeaderAndListAsBinary ( size_t &  memSize,
MLuint32  saveModeBits 
) const

Create a memory buffer and fill if first with a null-terminated versionStr followed by all tagNames and values from the list.

Parameters
memSizereturns the size of the allocated memory or 0 on failure.
saveModeBitsBit combination setting special save options: See MLImageFormatTools::SaveModeBits for possible options.
Returns
the pointer to the created memory block or NULL on failure. The memory must be freed by the caller with Memory::freeMemory() or MLFree().

◆ getTagListAsString()

std::string ml::MLImageFormatTagList::getTagListAsString ( ) const

Passes the tag list into a the string str.

◆ getTagListSizeInBytes()

MLuint ml::MLImageFormatTagList::getTagListSizeInBytes ( ) const

Returns sum of sizes of all tag names and values of all tags including their terminating 0 characters or 0 on failure.

◆ load()

MLErrorCode ml::MLImageFormatTagList::load ( MLImageFormatAbstractFileHandle fileHandle,
MLint  filePos = 0 
)

Reads the tag list from start of open file given by valid file handle for a readable and open file.

The tagList will be reset always on start of call. On failure the tag list is reset/emptied.

Parameters
fileHandleThe handle for the file opened for reading.
filePosThe position in file where to read the table from. Should normally be 0, the default.
Returns
ML_RESULT_OK on success or on failure an MLErrorCode describing the problem.

◆ save()

MLErrorCode ml::MLImageFormatTagList::save ( MLImageFormatAbstractFileHandle fileHandle,
MLuint  filePos,
MLuint32  saveModeBits 
) const

Writes the tag list into an open and writable file to position filePos or to the current file position.

Parameters
fileHandlemust be a valid file handle of an open and writable file.
filePosis the position where to write the data.
saveModeBitsBit combination setting special save options: See MLImageFormatTools::SaveModeBits for possible options.
Returns
ML_RESULT_OK on success or on failure an MLErrorCode describing the problem.

◆ tagListOut()

void ml::MLImageFormatTagList::tagListOut ( std::ostream &  ostr) const

Passes the tag list into a the stream ostr.

Member Data Documentation

◆ ML_BIG_ENDIAN

const MLint ml::MLImageFormatTagList::ML_BIG_ENDIAN
static

Big endian.

Definition at line 46 of file mlImageFormatTagList.h.

◆ ML_DICOM_TAG_PREFIX

const std::string ml::MLImageFormatTagList::ML_DICOM_TAG_PREFIX
static

Name prefix for all stored DICOM tags.

Definition at line 51 of file mlImageFormatTagList.h.

◆ ML_LITTLE_ENDIAN

const MLint ml::MLImageFormatTagList::ML_LITTLE_ENDIAN
static

Little endian.

Definition at line 45 of file mlImageFormatTagList.h.

◆ ML_TAG_LIST_SIZE_IN_BYTES_TAG

const std::string ml::MLImageFormatTagList::ML_TAG_LIST_SIZE_IN_BYTES_TAG
static

Name of first tag whose value denotes the size of the entire tag list size.

Definition at line 56 of file mlImageFormatTagList.h.


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