MeVisLab Toolbox Reference
mlDicomModifyPrivateAdd.h
Go to the documentation of this file.
1 // Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2 // **InsertLicense** code
3 //----------------------------------------------------------------------------------
7 
12 //----------------------------------------------------------------------------------
13 #pragma once
14 
15 #include "MLDicomModifySystem.h"
16 #include "mlDicomModifyBase.h"
17 
18 ML_START_NAMESPACE
19 
20 //----------------------------------------------------------------------------------
24 //----------------------------------------------------------------------------------
26 public:
27 
29  enum { NumberOfPrivateTags = 4 };
30 
34  AddOrReplace
35  };
36 
38  enum { NumModificationModes = AddOrReplace+1 };
39 
41  static const char * const ModificationModesStrings[NumModificationModes];
42 
43 
45  DicomModifyPrivateAdd(const std::string &privateCreator = "PRIVATE_CREATOR",
46  MLuint16 groupId = 0x009,
47  MLuint8 elementGroupId = 0x10,
49  MLuint8 lowerByteOfElementIdsBase = 0x10,
50  const std::string &modStrVal = "",
51  ModificationModes modModes = DoNotModify,
52  bool splitMode = false);
53 
55  void setPrivateCreator(const std::string &privateCreator);
57  const std::string &getPrivateCreator() const;
58 
60  void setPrivateGroupId(MLuint16 groupId);
63 
66  void setPrivateElementGroupId(MLuint8 elementGroupId);
69 
74  void setPrivateTagLowerByteOfElementId(MLuint8 lowerByte, size_t pIdx);
77 
79  void setSplitMode(bool split, size_t pIdx);
80 
82  bool getSplitMode(size_t pIdx) const;
83 
88  void setPrivateTagVR(DCMTree::Vr vr, size_t pIdx);
90  DCMTree::Vr getPrivateTagVR(size_t pIdx) const;
91 
96  void setPrivateTagModificationStringValue(const std::string &modStrVal, size_t pIdx);
98  std::string getPrivateTagModificationStringValue(size_t pIdx) const;
99 
107 
113  std::string applyModifications(DCMTree::TreePtr dcmTree,
114  const FieldContainer *treeInfos=nullptr) override;
115 
116 private:
118  std::string _privateCreator;
119 
121  MLuint16 _privateGroupId;
122 
124  MLuint8 _privateElementGroupId;
125 
127  MLuint8 _privateTagLowerByteOfElementId[NumberOfPrivateTags];
128 
130  bool _privateSplitMode[NumberOfPrivateTags];
131 
133  DCMTree::Vr _privateTagVR[NumberOfPrivateTags];
134 
136  std::string _privateTagModificationStringValue[NumberOfPrivateTags];
137 
139  ModificationModes _privateTagModificationMode[NumberOfPrivateTags];
140 };
141 
142 ML_END_NAMESPACE
Project global and OS specific declarations.
#define ML_DICOM_MODIFY_EXPORT
DLL export macro definition.
A base class which allows the modification of DICOM tags in a (cloned) DICOM tree.
A concrete class derived from DicomModifyBase which allows the addition or replacement of private DIC...
void setPrivateTagModificationMode(ModificationModes modMode, size_t pIdx)
Sets how the tag with given id and modification value shall be modified.
MLuint8 getPrivateElementGroupId() const
Returns the currently set private element group id.
void setPrivateTagVR(DCMTree::Vr vr, size_t pIdx)
Sets the value representation to be used by the private tags.
void setPrivateCreator(const std::string &privateCreator)
Sets the private creator string, shall be non empty.
void setPrivateGroupId(MLuint16 groupId)
Sets preferred group id of the private creator and by the private tags; shall be odd and from [0x09,...
void setPrivateTagModificationStringValue(const std::string &modStrVal, size_t pIdx)
Sets the value to be used to modify the private tag.
void setPrivateTagLowerByteOfElementId(MLuint8 lowerByte, size_t pIdx)
Sets the lower byte of the element id of the manipulated private tag with index pIdx.
const std::string & getPrivateCreator() const
Returns the currently set private creator string.
MLuint8 getPrivateTagLowerByteOfElementId(size_t pIdx) const
Returns the lower byte of the element id of the manipulated private tag.
DCMTree::Vr getPrivateTagVR(size_t pIdx) const
Returns the currently set value representation for the private tag.
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.
ModificationModes getPrivateTagModificationMode(size_t pIdx) const
Returns the currently set modification mode.
void setPrivateElementGroupId(MLuint8 elementGroupId)
Sets the preferred element group id to be defined by the private creator and to be used by the privat...
ModificationModes
Available modes for tag/tree modifications.
bool getSplitMode(size_t pIdx) const
Returns whether split mode is on.
std::string getPrivateTagModificationStringValue(size_t pIdx) const
Returns the value used to modify the private tag.
std::string applyModifications(DCMTree::TreePtr dcmTree, const FieldContainer *treeInfos=nullptr) override
Apply a change to dcmTree according to the currently selected _modificationMode.
MLuint16 getPrivateGroupId() const
Returns the currently set private group id.
void setSplitMode(bool split, size_t pIdx)
If true then set or changed values are split at backslashes into different values.
Defines the class FieldContainer to encapsulate a vector of fields for (see class Field).
Header file of a base class which allows the modification of DICOM tags in a (cloned) DICOM tree.
unsigned char MLuint8
Definition: mlTypeDefs.h:115
unsigned short MLuint16
Definition: mlTypeDefs.h:148
DCMTREE_EXPORT StringList split(const std::string &tosplit, char c, bool skipempties=false)
split the given string at each c if skipempties is true, all empty results would be removed
Vr
DICOM VR.
Definition: DCMTree_Lib.h:208
boost::shared_ptr< Tree > TreePtr
shared pointer to a DCMTree::Tree
Definition: DCMTree_Lib.h:70
@ DoNotModify
The value of the DICOM tag is not modified.