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
28
29class FieldContainer;
30
31//----------------------------------------------------------------------------------
34//----------------------------------------------------------------------------------
36public:
37
40 const std::string &modStrVal = "");
41
44
61 virtual std::string applyModifications(DCMTree::TreePtr dcmTree,
62 const FieldContainer *treeInfos=nullptr);
63
66
70 void setTagId(const std::string &tagIdStr);
71
75
78 void setModificationStringValue(const std::string &modStrVal);
79
83 const std::string &getModificationStringValue() const;
84
90
93 const std::string &modStrVal);
94
98 bool tagExists(DCMTree::TreePtr dcmTree) const;
99
106 std::string *errStr=nullptr) const;
107
117 std::string *errStr=nullptr,
118 bool setValue=true,
119 bool splitValue=false) const;
120
124 void removeTag(DCMTree::TreePtr dcmTree) const;
125
134 std::string *errStr=nullptr,
135 const DICOMTagTools::ValueModifyModes modMode=DICOMTagTools::Replace,
136 bool splitValue=false) const;
137
138private:
141 mutable DCMTree::TagId _currentTagId;
142
145 DCMTree::TagId _tagId;
146
149 mutable std::string _currentModificationStringValue;
150
154 std::string _modificationStringValue;
155};
156
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...
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(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 for (see class Field).
A collection of tools related to DICOM tags and dictionaries.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition mlTypeDefs.h:490
boost::shared_ptr< Tag > TagPtr
shared-pointer to tag
Definition DCMTree_Lib.h:62
boost::shared_ptr< Tree > TreePtr
shared pointer to a DCMTree::Tree
Definition DCMTree_Lib.h:72
ValueModifyModes
Ways how to modify a tag with with _modificationStringValue.