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 elements, constructor, destructor, assignment, etc.
 MLImageFormatTagList ()
 Default constructor that is setting name and value to empty strings.
MLuint getTagListSizeInBytes () const
void tagListOut (std::ostream &ostr) const
 Passes the tag list into the stream ostr.
std::string getTagListAsString () const
 Passes the tag list into the string str.
const MLImageFormatTagfindConstTag (const std::string &tagName) const
MLint findTagIdx (const std::string &tagName) const
bool checkTag (const std::string &tagName, MLint &val) const
bool checkTag (const std::string &tagName, std::string &val) const
bool checkTag (const std::string &tagName, MLdouble &val) const
bool checkTag (const std::string &tagName, MLldouble &val) const
MLuint getExpectedHeaderAndListSizeAsBinary () const
char * getHeaderAndListAsBinary (size_t &memSize, MLuint32 saveModeBits) const
MLErrorCode save (MLImageFormatAbstractFileHandle *fileHandle, MLuint filePos, MLuint32 saveModeBits) const
MLErrorCode load (MLImageFormatAbstractFileHandle *fileHandle, MLint filePos=0)
MLErrorCode appendImageProperties (const PagedImage &props, const DataCompressor *compressor, const MLImageFormatTagList &compressionTagList, const MLImageFormatTagList &userTagList, const MLImageFormatTagList &privateTagList, const std::string &defaultVoxelValue, MLuint32 saveModeBits)
MLErrorCode extractImageProperties (PagedImage &props, MLint &endianness, std::string &compressorName, std::string &compressorVersion, MLImageFormatTagList &compressionTagList, MLImageFormatTagList &userTagList, MLImageFormatTagList &privateTagList, std::string &defaultVoxelValue, MLint &usesCheckSum, MLint &usesPartialPages)
MLErrorCode extractImageProperties (MLImageFormatInfos &infos)
void appendSpecialTags (const std::string &numTagsTagName, const std::string &tagNamePrefix, const MLImageFormatTagList &sourceTagList)
MLErrorCode extractSpecialTags (const std::string &numTagsTagName, const std::string &tagNamePrefix, MLImageFormatTagList &targetTagList) const

Static Public Member Functions

static const MLImageFormatTagListgetDefaultEmptyTagList ()
 Returns a default empty tags list. Must be called first time in DLL initialization.

Static Public Attributes

static const MLint ML_LITTLE_ENDIAN
 Little endian.
static const MLint ML_BIG_ENDIAN
 Big endian.
static const std::string ML_DICOM_TAG_PREFIX
 Name prefix for all stored DICOM tags.
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.

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 that is setting name and value to empty strings.

Referenced by appendImageProperties(), appendSpecialTags(), extractImageProperties(), extractSpecialTags(), and getDefaultEmptyTagList().

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 )

Appends image properties and other information to tagList. Convenience function that is independent of open files.

Parameters
propsThe properties to be stored in the tag list.
compressorName of the data compressor stored in the tag list.
compressionTagListAdditional arguments for compressor to be stored in the tag list.
userTagListUser tags to be added to the tag list.
privateTagListPrivate tags to be added to the tag list.
defaultVoxelValueDefault voxel value for unstored pages to be stored in the tag list.
saveModeBitsBit combination that is setting special save options: See MLImageFormatTools::SaveModeBits for possible options.
Returns
ML_RESULT_OK on success or on failure an MLErrorCode describing the problem.

References MLImageFormatTagList().

◆ 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 that 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.

References MLImageFormatTagList().

◆ checkTag() [1/4]

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

Searches the tag with the name tagName in the 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 the tag with the name tagName in the 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 the tag with the name tagName in the 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 the tag with the name tagName in the 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)

Returns 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 and 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 & endianness,
std::string & compressorName,
std::string & compressorVersion,
MLImageFormatTagList & compressionTagList,
MLImageFormatTagList & userTagList,
MLImageFormatTagList & privateTagList,
std::string & defaultVoxelValue,
MLint & usesCheckSum,
MLint & usesPartialPages )

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

Parameters
propsFilled with the properties of the stored file.
endiannessReturns the endianness 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, 0 otherwise.
usesPartialPagesReturns non-zero if pages are potentially only stored partially, 0 otherwise.
Returns
ML_RESULT_OK on success or on failure an MLErrorCode describing the problem.

References MLImageFormatTagList().

◆ 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 the symmetric function appendSpecialTagsToTagList().

Parameters
numTagsTagNameThe name of the tag that 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.

References MLImageFormatTagList().

◆ findConstTag()

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

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

◆ findTagIdx()

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

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

◆ getDefaultEmptyTagList()

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

Returns a default empty tags list. Must be called first time in DLL initialization.

References MLImageFormatTagList().

Referenced by ml::MLImageFormat::open(), ml::MLImageFormatTools::open(), and ml::MLImageFormatTools::open().

◆ getExpectedHeaderAndListSizeAsBinary()

MLuint ml::MLImageFormatTagList::getExpectedHeaderAndListSizeAsBinary ( ) const

Returns the number of bytes that 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

Creates 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 the string str.

◆ getTagListSizeInBytes()

MLuint ml::MLImageFormatTagList::getTagListSizeInBytes ( ) const

Returns the 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 the start of the open file given by a 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 that is opened for reading.
filePosThe position in the 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.
filePosThe 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 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: