MeVisLab Toolbox Reference
ml::DicomModifyPrivateAdd Class Reference

A concrete class derived from DicomModifyBase which allows the addition or replacement of private DICOM tags in a (cloned) DICOM tree; see also DicomModifyPrivateAddFieldAddOn. More...

#include <mlDicomModifyPrivateAdd.h>

Inheritance diagram for ml::DicomModifyPrivateAdd:
ml::DicomModifyBase

Public Types

enum  { NumberOfPrivateTags = 4 }
 Number of private tags created together with one Private creator entry. More...
 
enum  ModificationModes { DoNotModify = 0 , AddOrReplace }
 Available modes for tag/tree modifications. More...
 
enum  { NumModificationModes = AddOrReplace+1 }
 Defines the number of available modification modes. More...
 

Public Member Functions

 DicomModifyPrivateAdd (const std::string &privateCreator="PRIVATE_CREATOR", MLuint16 groupId=0x009, MLuint8 elementGroupId=0x10, DCMTree::Vr vr=DCMTree::LO, MLuint8 lowerByteOfElementIdsBase=0x10, const std::string &modStrVal="", ModificationModes modModes=DoNotModify, bool splitMode=false)
 Constructor creating a no operation default object.
 
void setPrivateCreator (const std::string &privateCreator)
 Sets the private creator string, shall be non empty.
 
const std::string & getPrivateCreator () const
 Returns the currently set private creator string.
 
void setPrivateGroupId (MLuint16 groupId)
 Sets preferred group id of the private creator and by the private tags; shall be odd and from [0x09, 0xffff].
 
MLuint16 getPrivateGroupId () const
 Returns the currently set private group id.
 
void setPrivateElementGroupId (MLuint8 elementGroupId)
 Sets the preferred element group id to be defined by the private creator and to be used by the private tags; shall be >= 0x10 and <= 0xFF.
 
MLuint8 getPrivateElementGroupId () const
 Returns the currently set private element group id.
 
void setPrivateTagLowerByteOfElementId (MLuint8 lowerByte, size_t pIdx)
 Sets the lower byte of the element id of the manipulated private tag with index pIdx.
 
MLuint8 getPrivateTagLowerByteOfElementId (size_t pIdx) const
 Returns the lower byte of the element id of the manipulated private tag.
 
void setSplitMode (bool split, size_t pIdx)
 If true then set or changed values are split at backslashes into different values.
 
bool getSplitMode (size_t pIdx) const
 Returns whether split mode is on.
 
void setPrivateTagVR (DCMTree::Vr vr, size_t pIdx)
 Sets the value representation to be used by the private tags.
 
DCMTree::Vr getPrivateTagVR (size_t pIdx) const
 Returns the currently set value representation for the private tag.
 
void setPrivateTagModificationStringValue (const std::string &modStrVal, size_t pIdx)
 Sets the value to be used to modify the private tag.
 
std::string getPrivateTagModificationStringValue (size_t pIdx) const
 Returns the value used to modify the private tag.
 
void setPrivateTagModificationMode (ModificationModes modMode, size_t pIdx)
 Sets how the tag with given id and modification value shall be modified.
 
ModificationModes getPrivateTagModificationMode (size_t pIdx) const
 Returns the currently set modification mode.
 
std::string applyModifications (DCMTree::TreePtr dcmTree, const FieldContainer *treeInfos=nullptr) override
 Apply a change to dcmTree according to the currently selected _modificationMode.
 
- Public Member Functions inherited from ml::DicomModifyBase
 DicomModifyBase (DCMTree::TagId tagId=DCMTree::TagId(), const std::string &modStrVal="")
 Constructor setting the tag ID and the string value for modifications.
 
virtual ~DicomModifyBase ()
 Virtual destructor.
 
void setTagId (DCMTree::TagId tagId)
 Set the id of the tag to be modified.
 
void setTagId (const std::string &tagIdStr)
 Set the id (as std::string) of the tag to be modified; invalid ids will cause an ML_ERROR_PRINT, empty strings shall be ignored by specification and will set an id (0000,0000).
 
DCMTree::TagId getTagId () const
 Returns the id of the tag to be modified (might be temporarily overridden be a "modificationTagIdReplacement" field in treeInfos parameter of applyModifications()).
 
void setModificationStringValue (const std::string &modStrVal)
 Set the string value to be used for the tag modification if not overridden by a treeInfos-"modificationStringValueReplacement" entry as described in applyModifications.
 
const std::string & getModificationStringValue () const
 Returns the string which is used to manipulate tag value(s) (might be temporarily overridden by a "modificationStringValueReplacement" field in treeInfos parameter of applyModifications()).
 
bool getModificationStringValueAsMLInt (MLint &retVal) const
 If the modificationStringValue() can be interpreted as an integer value then true is returned and the string is converted to that integer and returned in retVal; otherwise false is returned and retVal is left unchanged.
 
void setTagIdAndModificationStringValue (DCMTree::TagId tagId, const std::string &modStrVal)
 Calls setTagId(tagId) and setModificationStringValue(modStrVal).
 
bool tagExists (DCMTree::TreePtr dcmTree) const
 
DCMTree::TagPtr getTagIfItExists (DCMTree::TreePtr dcmTree, std::string *errStr=nullptr) const
 
DCMTree::TagPtr addTag (DCMTree::TreePtr dcmTree, std::string *errStr=nullptr, bool setValue=true, bool splitValue=false) const
 Add the tag with ID getTagId() to tree dcmTree and value _modificationStringValue; requires a valid non nullptr dcmTree.
 
void removeTag (DCMTree::TreePtr dcmTree) const
 Remove the tag with the ID getTagId() if it exists, otherwise do nothing; (if dcmTree member is nullptr the call is ignored).
 
void setTagValue (DCMTree::TreePtr dcmTree, std::string *errStr=nullptr, const DICOMTagTools::ValueModifyModes modMode=DICOMTagTools::Replace, bool splitValue=false) const
 Sets the value of tag with getTagId() in dcmTree with new value _modificationStringValue.
 

Static Public Attributes

static const char *const ModificationModesStrings [NumModificationModes]
 String versions for ModificationModes.
 

Detailed Description

A concrete class derived from DicomModifyBase which allows the addition or replacement of private DICOM tags in a (cloned) DICOM tree; see also DicomModifyPrivateAddFieldAddOn.


Definition at line 25 of file mlDicomModifyPrivateAdd.h.

Member Enumeration Documentation

◆ anonymous enum

Number of private tags created together with one Private creator entry.

Enumerator
NumberOfPrivateTags 

Definition at line 29 of file mlDicomModifyPrivateAdd.h.

◆ anonymous enum

Defines the number of available modification modes.

Enumerator
NumModificationModes 

Definition at line 38 of file mlDicomModifyPrivateAdd.h.

◆ ModificationModes

Available modes for tag/tree modifications.

Enumerator
DoNotModify 

No change is applied to the tree.

AddOrReplace 

The tag with id and the given private creator is removed.

Definition at line 32 of file mlDicomModifyPrivateAdd.h.

Constructor & Destructor Documentation

◆ DicomModifyPrivateAdd()

ml::DicomModifyPrivateAdd::DicomModifyPrivateAdd ( const std::string & privateCreator = "PRIVATE_CREATOR",
MLuint16 groupId = 0x009,
MLuint8 elementGroupId = 0x10,
DCMTree::Vr vr = DCMTree::LO,
MLuint8 lowerByteOfElementIdsBase = 0x10,
const std::string & modStrVal = "",
ModificationModes modModes = DoNotModify,
bool splitMode = false )

Constructor creating a no operation default object.

Member Function Documentation

◆ applyModifications()

std::string ml::DicomModifyPrivateAdd::applyModifications ( DCMTree::TreePtr dcmTree,
const FieldContainer * treeInfos = nullptr )
overridevirtual

Apply a change to dcmTree according to the currently selected _modificationMode.

Parameters
dcmTreeThe DICOM tree to be modified.
treeInfosA FieldContainer which - if not nullptr - can contain additional user defined information fields about dcmTree.
Returns
An empty string on success, otherwise a cumulative descriptive string of all problems.

Reimplemented from ml::DicomModifyBase.

◆ getPrivateCreator()

const std::string & ml::DicomModifyPrivateAdd::getPrivateCreator ( ) const

Returns the currently set private creator string.

◆ getPrivateElementGroupId()

MLuint8 ml::DicomModifyPrivateAdd::getPrivateElementGroupId ( ) const

Returns the currently set private element group id.

◆ getPrivateGroupId()

MLuint16 ml::DicomModifyPrivateAdd::getPrivateGroupId ( ) const

Returns the currently set private group id.

◆ getPrivateTagLowerByteOfElementId()

MLuint8 ml::DicomModifyPrivateAdd::getPrivateTagLowerByteOfElementId ( size_t pIdx) const

Returns the lower byte of the element id of the manipulated private tag.

◆ getPrivateTagModificationMode()

ModificationModes ml::DicomModifyPrivateAdd::getPrivateTagModificationMode ( size_t pIdx) const

Returns the currently set modification mode.

◆ getPrivateTagModificationStringValue()

std::string ml::DicomModifyPrivateAdd::getPrivateTagModificationStringValue ( size_t pIdx) const

Returns the value used to modify the private tag.

◆ getPrivateTagVR()

DCMTree::Vr ml::DicomModifyPrivateAdd::getPrivateTagVR ( size_t pIdx) const

Returns the currently set value representation for the private tag.

◆ getSplitMode()

bool ml::DicomModifyPrivateAdd::getSplitMode ( size_t pIdx) const

Returns whether split mode is on.

◆ setPrivateCreator()

void ml::DicomModifyPrivateAdd::setPrivateCreator ( const std::string & privateCreator)

Sets the private creator string, shall be non empty.

◆ setPrivateElementGroupId()

void ml::DicomModifyPrivateAdd::setPrivateElementGroupId ( MLuint8 elementGroupId)

Sets the preferred element group id to be defined by the private creator and to be used by the private tags; shall be >= 0x10 and <= 0xFF.

◆ setPrivateGroupId()

void ml::DicomModifyPrivateAdd::setPrivateGroupId ( MLuint16 groupId)

Sets preferred group id of the private creator and by the private tags; shall be odd and from [0x09, 0xffff].

◆ setPrivateTagLowerByteOfElementId()

void ml::DicomModifyPrivateAdd::setPrivateTagLowerByteOfElementId ( MLuint8 lowerByte,
size_t pIdx )

Sets the lower byte of the element id of the manipulated private tag with index pIdx.

Parameters
lowerByteThe least significant byte of the manipulated private tag, must be from [0x00, 0xFF].
pIdxSelects the private tag for which the parameter shall be set; must be from [0, NumberOfPrivateTags-1].

◆ setPrivateTagModificationMode()

void ml::DicomModifyPrivateAdd::setPrivateTagModificationMode ( ModificationModes modMode,
size_t pIdx )

Sets how the tag with given id and modification value shall be modified.

Parameters
modModeDefined how the private tag shall be modified; see ModificationModes.
pIdxSelects the private tag for which the parameter shall be set; must be from [0, NumberOfPrivateTags-1].

◆ setPrivateTagModificationStringValue()

void ml::DicomModifyPrivateAdd::setPrivateTagModificationStringValue ( const std::string & modStrVal,
size_t pIdx )

Sets the value to be used to modify the private tag.

Parameters
modStrValthe value to be used for the manipulation (set/replace) of the tag value.
pIdxSelects the private tag for which the parameter shall be set; must be from [0, NumberOfPrivateTags-1].

◆ setPrivateTagVR()

void ml::DicomModifyPrivateAdd::setPrivateTagVR ( DCMTree::Vr vr,
size_t pIdx )

Sets the value representation to be used by the private tags.

Parameters
vrThe value representation to be used by the tag.
pIdxSelects the private tag for which the parameter shall be set; must be from [0, NumberOfPrivateTags-1].

◆ setSplitMode()

void ml::DicomModifyPrivateAdd::setSplitMode ( bool split,
size_t pIdx )

If true then set or changed values are split at backslashes into different values.

Member Data Documentation

◆ ModificationModesStrings

const char* const ml::DicomModifyPrivateAdd::ModificationModesStrings[NumModificationModes]
static

String versions for ModificationModes.

Definition at line 41 of file mlDicomModifyPrivateAdd.h.


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