MeVisLabToolboxReference
ml::MLImageFormatTagList Class Reference

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

#include <mlImageFormatTagList.h>

Inherits std::vector< T >.

List of all members.

Public Member Functions

Basic class stuff, constructor, destructor, assignment etc.
 MLImageFormatTagList ()
 Default constructor, setting name and value to empty strings.
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.
void tagListOut (std::ostream &ostr) const
 Passes the tag list into a the stream ostr.
std::string getTagListAsString () const
 Passes the tag list into a the string str.
const MLImageFormatTagfindConstTag (const std::string &tagName) const
 Returns pointer to first tag in list with name tagName or NULL if not found.
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.
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.
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.
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.
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.
MLint 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.
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.
MLErrorCode save (int fd, MLuint filePos, MLuint32 saveModeBits) const
 Writes the tag list into an open and writable file to position filePos or to the current file position.
MLErrorCode load (int fd, MLint filePos=0)
 Reads the tag list from start of open file given by valid descriptor fd for a readable and open file.
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.
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.
MLErrorCode extractImageProperties (MLImageFormatInfos &infos)
 Gets all image properties of infos except of the.
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.
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.

Static Public Member Functions

static const MLImageFormatTagListgetDefaultEmptyTagList ()
 Returns a default empty tags list.

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 40 of file mlImageFormatTagList.h.


Constructor & Destructor Documentation

ml::MLImageFormatTagList::MLImageFormatTagList ( ) [inline]

Default constructor, setting name and value to empty strings.

Definition at line 71 of file mlImageFormatTagList.h.


Member Function Documentation

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

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.

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.

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.

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.
MLErrorCode ml::MLImageFormatTagList::extractImageProperties ( MLImageFormatInfos infos)

Gets all image properties of infos except of the.

  • infos.fd,
  • infos.fileName,
  • 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.
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.
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.

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.

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

Returns a default empty tags list.

MLint 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.

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().
std::string ml::MLImageFormatTagList::getTagListAsString ( ) const

Passes the tag list into a the string str.

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.

MLErrorCode ml::MLImageFormatTagList::load ( int  fd,
MLint  filePos = 0 
)

Reads the tag list from start of open file given by valid descriptor fd 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:
fdThe descriptor 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.
MLErrorCode ml::MLImageFormatTagList::save ( int  fd,
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:
fdmust be a valid file descriptor 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.
void ml::MLImageFormatTagList::tagListOut ( std::ostream &  ostr) const

Passes the tag list into a the stream ostr.


Member Data Documentation

Big endian.

Definition at line 47 of file mlImageFormatTagList.h.

Name prefix for all stored DICOM tags.

Definition at line 52 of file mlImageFormatTagList.h.

Little endian.

Definition at line 46 of file mlImageFormatTagList.h.

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

Definition at line 57 of file mlImageFormatTagList.h.


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