MeVisLab Toolbox Reference
mlDicomModifyOrdinary.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 
38  PrependIfItExistsOtherwiseAdd,
40  AppendIfItExistsOtherwiseAdd,
42  SetNewUIDIfItExistsOtherwiseAdd,
44  ReplaceOtherValuesOnlyIfItExists,
47  SetOtherValuesIfItExistsOtherwiseAdd
50  };
51 
53  enum { NumModificationModes = SetOtherValuesIfItExistsOtherwiseAdd+1 };
54 
56  static const char * const ModificationModesStrings[NumModificationModes];
57 
60  const std::string &modStrVal = "",
62  bool splitMode = false);
63 
66 
69 
71  void setSplitMode(bool split);
72 
74  bool getSplitMode() const;
75 
77  void setOtherVR(DCMTree::Vr otherVr);
78 
81 
87  std::string applyModifications(DCMTree::TreePtr dcmTree,
88  const FieldContainer *treeInfos=nullptr) override;
89 
90 private:
92  ModificationModes _modificationMode;
93 
95  bool _splitMode;
96 
98  DCMTree::Vr _otherVr;
99 };
100 
101 ML_END_NAMESPACE
Project global and OS specific declarations.
#define ML_DICOM_MODIFY_EXPORT
DLL export macro definition.
Class to wrap a tag-id.
Definition: DCMTree_TagId.h:40
A base class which allows the modification of DICOM tags in a (cloned) DICOM tree.
A concrete class derived from DicomModifyBase which allows the modification of ordinary,...
DCMTree::Vr getOtherVR() const
Returns the currently set otherVR.
void setOtherVR(DCMTree::Vr otherVr)
Sets the value representation to be used for (re)created "Other" tags.
ModificationModes getModificationMode() const
Returns the currently set modification mode.
DicomModifyOrdinary(DCMTree::TagId tagId=DCMTree::TagId(), const std::string &modStrVal="", ModificationModes modMode=DoNotModify, bool splitMode=false)
Constructor setting TagId, ModificationStringValue(""), splitMode(false), and ModificationMode(DoNotM...
void setModificationMode(ModificationModes modMode)
Sets how the tag with given id and modification value shall be modified.
void setSplitMode(bool split)
If true then completely set values are split at backslashes into different values.
std::string applyModifications(DCMTree::TreePtr dcmTree, const FieldContainer *treeInfos=nullptr) override
Apply a change to dcmTree according to the currently selected _modificationMode.
bool getSplitMode() const
Returns whether split mode is on.
ModificationModes
Available modes for tag modifications.
@ PrependOnlyIfItExists
If the tag is found then the string is prepended after the existing tag value.
@ AddIfItDoesNotExist
The tag is added if it is not found in the source tree, otherwise it is left unchanged.
@ ReplaceIfItExistsOtherwiseAdd
The tag value is replaced if the tag is found, otherwise a new tag with the value is added.
@ RemoveTag
The is removed if found in the source tree, otherwise nothing is done.
@ ReplaceOnlyIfItExists
If the tag is found then its value is replaced with the new value.
@ SetNewUIDOnlyIfItExists
If the tag is found then a newly created UID is set as tag value.
@ AppendOnlyIfItExists
If the tag is found then the string is appended after the existing tag value.
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.
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.