MeVisLab Toolbox Reference
mlDicomModifyBase.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
6
11//----------------------------------------------------------------------------------
12#pragma once
13
14#include "MLDicomModifySystem.h"
15#include <mlTypeDefs.h>
16
17#include <FMEThirdPartyWarningsDisable.h>
18#include <string>
19#include <FMEThirdPartyWarningsRestore.h>
20
22
23#include <DCMTree_TagId.h>
24#include <DCMTree_Tag.h>
25#include <DCMTree_Tree.h>
26
27ML_START_NAMESPACE
28
29class FieldContainer;
30
31//----------------------------------------------------------------------------------
34//----------------------------------------------------------------------------------
36public:
37
40 const std::string &modStrVal = "");
41
44
47
50
67 virtual std::string applyModifications(DCMTree::TreePtr dcmTree,
68 const FieldContainer *treeInfos=nullptr);
69
72
76 void setTagId(const std::string &tagIdStr);
77
81
84 void setModificationStringValue(const std::string &modStrVal);
85
89 const std::string &getModificationStringValue() const;
90
96
99 const std::string &modStrVal);
100
104 bool tagExists(DCMTree::TreePtr dcmTree) const;
105
112 std::string *errStr=nullptr) const;
113
123 std::string *errStr=nullptr,
124 bool setValue=true,
125 bool splitValue=false) const;
126
130 void removeTag(DCMTree::TreePtr dcmTree) const;
131
140 std::string *errStr=nullptr,
141 const DICOMTagTools::ValueModifyModes modMode=DICOMTagTools::Replace,
142 bool splitValue=false) const;
143
144private:
147 mutable DCMTree::TagId _currentTagId;
148
151 DCMTree::TagId _tagId;
152
155 mutable std::string _currentModificationStringValue;
156
160 std::string _modificationStringValue;
161};
162
163ML_END_NAMESPACE
Project global and OS specific declarations.
#define ML_DICOM_MODIFY_EXPORT
DLL export macro definition.
Class to wrap a tag ID.
A base class which allows the modification of DICOM tags in a (cloned) DICOM tree.
bool tagExists(DCMTree::TreePtr dcmTree) const
void removeTag(DCMTree::TreePtr dcmTree) const
Remove the tag with the ID getTagId() if it exists, otherwise do nothing; (if dcmTree member is nullp...
void setTagIdAndModificationStringValue(DCMTree::TagId tagId, const std::string &modStrVal)
Calls setTagId(tagId) and setModificationStringValue(modStrVal).
DCMTree::TagId getTagId() const
Returns the id of the tag to be modified (might be temporarily overridden be a "modificationTagIdRepl...
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,...
virtual ~DicomModifyBase()
Virtual destructor.
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.
virtual std::string applyModifications(DCMTree::TreePtr dcmTree, const FieldContainer *treeInfos=nullptr)
Apply a change to the given dcmTree.
bool getModificationStringValueAsMLInt(MLint &retVal) const
If the modificationStringValue() can be interpreted as an integer value then true is returned and the...
DicomModifyBase(const DicomModifyBase &)=default
Default copy constructor.
void setModificationStringValue(const std::string &modStrVal)
Set the string value to be used for the tag modification if not overridden by a treeInfos-"modificati...
DCMTree::TagPtr getTagIfItExists(DCMTree::TreePtr dcmTree, std::string *errStr=nullptr) const
void setTagId(DCMTree::TagId tagId)
Set the id of the tag to be modified.
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 n...
const std::string & getModificationStringValue() const
Returns the string which is used to manipulate tag value(s) (might be temporarily overridden by a "mo...
DicomModifyBase & operator=(const DicomModifyBase &)=default
Default assignment operator.
DicomModifyBase(DCMTree::TagId tagId=DCMTree::TagId(), const std::string &modStrVal="")
Constructor setting the tag ID and the string value for modifications.
Defines the class FieldContainer to encapsulate a vector of fields (see class Field).
A collection of tools related to DICOM tags and dictionaries.
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition mlTypeDefs.h:489
boost::shared_ptr< Tag > TagPtr
Shared pointer to tag.
Definition DCMTree_Lib.h:56
boost::shared_ptr< Tree > TreePtr
Shared pointer to a DCMTree::Tree.
Definition DCMTree_Lib.h:66
ValueModifyModes
Ways how to modify a tag with with _modificationStringValue.