MeVisLab Toolbox Reference
|
The GenericPrivateDICOMTagDecoder class is a default decoder usable for all private DICOM tags as well as some tool functions for derived classes. More...
#include <mlGenericPrivateDICOMTagDecoder.h>
Public Member Functions | |
GenericPrivateDICOMTagDecoder () | |
Constructor doing nothing. More... | |
~GenericPrivateDICOMTagDecoder () override | |
PrivateDICOMTagDecoderPluginBase::DecodeStates | decodePrivateTag (const std::string &privateCreator, DCMTree::Const_TagPtr tagPtr, PrivateDICOMTagValueFields &resultFields) override |
If a private Toshiba PMTF header tag is passed then this routine converts its data element(s) to fields in resultFields container. More... | |
PrivateDICOMTagDecoderPluginBase::DecodeStates | extractTag (const std::string &prefix, const unsigned char *&tagData, MLuint32 &tagDataSize, bool decodeImplicitSeqVR, PrivateDICOMTagValueFields &resultFields, bool translateStdIdToName) const |
Assume a DICOM tag as binary data and add human readable information to resultFields of the tag id, names, and content(s) as far as it can be decoded. More... | |
Public Member Functions inherited from ml::PrivateDICOMTagDecoderPluginBase | |
PrivateDICOMTagDecoderPluginBase (PrivateCreatorIdMap *privateCreatorMap=nullptr) | |
Default constructor implementation creating a link symbol to make this base class always linked. More... | |
~PrivateDICOMTagDecoderPluginBase () override | |
Virtual destructor. More... | |
PrivateCreatorIdMap * | getPrivateCreatorMap () const |
Returns the map which stores a set of known private creators, typically from the currently traversed DICOM tree. More... | |
void | setPrivateCreatorMap (PrivateCreatorIdMap *pcm) |
Sets the map which stores a set of known private creators, typically from the currently traversed DICOM tree. More... | |
Public Member Functions inherited from ml::Base | |
Base () | |
Constructor. More... | |
virtual | ~Base () |
Destructor. More... | |
virtual Base * | deepCopy () const |
Set addStateToTree version number that can be accessed via getAddStateVersion() More... | |
bool | isOfAllowedType (const std::vector< const RuntimeType * > &types) const |
Check if this object's type is equal to or derived from one of the types given in the argument. More... | |
virtual bool | isRefCountedBase () const |
Returns if the instance is derived from RefCountedBase. More... | |
virtual std::string | detailString () const |
Return a string describing this object. More... | |
virtual bool | implementsPersistence (PersistenceInterface) const |
Override this method to declare which persistence interfaces are implemented by your derived class. More... | |
virtual std::string | persistentState () const |
Returns a string describing the object's internal state. More... | |
virtual void | setPersistentState (const std::string &state) |
Restores the object's internal state from a string that had been previously generated using persistentState() . More... | |
virtual void | addStateToTree (TreeNode *) const |
Attaches the object state as children of the given parent node. More... | |
virtual void | readStateFromTree (TreeNode *) |
Reads the object state from the children of the given parent node. More... | |
virtual void | writeTo (AbstractPersistenceOutputStream *) const |
Write the objects state to the data stream object. More... | |
virtual void | readFrom (AbstractPersistenceInputStream *, int) |
Read the objects state from the data stream object. More... | |
Static Public Member Functions | |
static void | dumpHexArea (const std::string &prefix, const unsigned char *tagData, size_t tagDataSize, PrivateDICOMTagValueFields &resultFields, size_t rowSize=16) |
Add a range of bytes as a hex dump to the PrivateDICOMTagValueFields resultFields as "otherInfo" tag information with disabled "isValidTag" flag. More... | |
static bool | isValidVRString (const std::string &vrStr) |
Returns true if the passed VR string is a valid known one, otherwise false. More... | |
Protected Member Functions | |
bool | _getTagNameAndVrFromId (unsigned int groupId, unsigned int elementId, std::string &retName, std::string &retVr) const |
Determines the tag name and value representation corresponding to a tag id given by groupId and elementId and returns true, or - if it cannot be determined - it returns false. More... | |
const unsigned char * | _findStr (const unsigned char *buffer, const std::string &str, size_t bufferSize) const |
Returns the pointer to the first occurrence of str in the buffer given by buffer and bufferSize. More... | |
PrivateDICOMTagDecoderPluginBase::DecodeStates | _decodeSequenceTagData (const std::string &prefix, const unsigned char *&tagData, MLuint32 &tagDataSize, bool implicit, PrivateDICOMTagValueFields &resultFields, bool translateStdIdToName) const |
Extract a sequence of DICOM tag values whose value representations are given in VRs. More... | |
Protected Member Functions inherited from ml::Base | |
virtual char * | getPersistentState () const |
Returns a C string describing the object's internal state. More... | |
virtual void | setPersistentState (const char *) |
Restores the object's internal state from a string that had been previously generated using getPersistentState() . More... | |
virtual void | clearPersistentState (char *) const |
Disposes a string previously allocated by getPersistentState() . More... | |
Static Protected Member Functions | |
static std::string | _dumpRange (const unsigned char *start, size_t num=16, bool showStartAddress=true, bool showHexDump=true, bool showASCII=true, size_t maxRowSize=16, char defaultNonReadableChar='.') |
Creates a string containing one row with a hexadecimal start address of the buffer, hexadecimal byte data values, and ASCII dump corresponding to the data bytes. More... | |
Additional Inherited Members | |
Public Types inherited from ml::PrivateDICOMTagDecoderPluginBase | |
enum | DecodeStates { NOT_DECODED = 0 , PARTIALLY_DECODED , FULLY_DECODED } |
Return states of decoding. More... | |
typedef std::map< DCMTree::RawTagId, std::string > | PrivateCreatorIdMap |
A type storing tag group ids for strings found in private tags (tags with odd numbers and id 0x10-0xFF). More... | |
Public Types inherited from ml::Base | |
enum | PersistenceInterface { PersistenceByString , PersistenceByTreeNode , PersistenceByStream } |
This enum describes the different persistence interfaces available. More... | |
The GenericPrivateDICOMTagDecoder class is a default decoder usable for all private DICOM tags as well as some tool functions for derived classes.
Definition at line 25 of file mlGenericPrivateDICOMTagDecoder.h.
ml::GenericPrivateDICOMTagDecoder::GenericPrivateDICOMTagDecoder | ( | ) |
Constructor doing nothing.
|
override |
|
protected |
Extract a sequence of DICOM tag values whose value representations are given in VRs.
prefix | String added before each entry added to resultFields. |
tagData | The pointer to the tag data to be dumped, may be nullptr. |
tagDataSize | The number of bytes in tagData to be dumped. |
implicit | If false then an explicitly coded tag is assumed, otherwise the VR is determined from the tag id. |
resultFields | The container to be extended with extracted header, section, and tag information. |
translateStdIdToName | If true and if a tag id can be determined which seems to be a standard one (even group id) then try to look up the standard tag name. |
|
staticprotected |
Creates a string containing one row with a hexadecimal start address of the buffer, hexadecimal byte data values, and ASCII dump corresponding to the data bytes.
start | Points to the first byte to be dumped. |
num | The number of bytes to be dumped. |
showStartAddress | If enabled (the default) then the buffer start address is added at the begin of the returned string. |
showHexDump | If enabled (the default) then the data bytes are added as hex numbers after the startAddrees. |
showASCII | If enabled (the default) then the data bytes are added as ASCII bytes after the hex byte dump. Non readable values are shown as a defaultNonReadableChar. |
maxRowSize | If showASCII is enabled then maxRowSize determines to how many bytes the hex dump section shall be filled with spaces to have a formatted ASCII output in different rows. This normally is the same as rowSize of _dumpHexArea. |
defaultNonReadableChar | The character to be used instead of non readable byte values in the ASCII dump. |
|
protected |
Returns the pointer to the first occurrence of str in the buffer given by buffer and bufferSize.
If not found the nullptr is returned. In contrast to a normal string search buffer may contain nullptr characters.
buffer | The pointer to the first byte of the buffer to be scanned, may be nullptr. |
str | The string to be searched in the buffer. |
bufferSize | The number of bytes in the buffer. |
|
protected |
Determines the tag name and value representation corresponding to a tag id given by groupId and elementId and returns true, or - if it cannot be determined - it returns false.
If the tag id is not a standard one and privateCreator is non-empty the it is tried to find it in private dictionaries. retName and retVr are set empty if false is returned, otherwise they contained the determined values.
|
overridevirtual |
If a private Toshiba PMTF header tag is passed then this routine converts its data element(s) to fields in resultFields container.
The privateCreator must be a "PMTF INFORMATION DATA" one.
privateCreator | A string with the name of the private creator this tags belongs to. |
tagPtr | The tag whose value shall be decoded. |
resultFields | The field container to be filled with extracted information from tagPtr or returned empty if no data could be decoded. |
Implements ml::PrivateDICOMTagDecoderPluginBase.
Reimplemented in ml::PrivateSequenceDICOMTagDecoders, and ml::PMTFToshibaPrivateDICOMTagDecoders.
|
static |
Add a range of bytes as a hex dump to the PrivateDICOMTagValueFields resultFields as "otherInfo" tag information with disabled "isValidTag" flag.
prefix | String added before each entry added to resultFields. |
tagData | The pointer to the data to be dumped, may be nullptr. |
tagDataSize | The number of bytes in tagData to be dumped. |
resultFields | The container to be extended with string rows of dumped data. |
rowSize | The number of bytes to be dumped in one row. |
PrivateDICOMTagDecoderPluginBase::DecodeStates ml::GenericPrivateDICOMTagDecoder::extractTag | ( | const std::string & | prefix, |
const unsigned char *& | tagData, | ||
MLuint32 & | tagDataSize, | ||
bool | decodeImplicitSeqVR, | ||
PrivateDICOMTagValueFields & | resultFields, | ||
bool | translateStdIdToName | ||
) | const |
Assume a DICOM tag as binary data and add human readable information to resultFields of the tag id, names, and content(s) as far as it can be decoded.
prefix | String added before each entry added to resultFields. |
tagData | The pointer to the tag data to be dumped, may be nullptr. |
tagDataSize | The number of bytes in tagData to be dumped. |
decodeImplicitSeqVR | If false then an explicitly coded tag is assumed, otherwise the VR is determined from the tag id. |
resultFields | The container to be extended with extracted header, section, and tag information. |
translateStdIdToName | If true and if a tag id can be determined which seems to be a standard one (even group id) then try to look up the standard tag name. |
|
static |
Returns true if the passed VR string is a valid known one, otherwise false.