MeVisLab Toolbox Reference
mlDicomBoolInheritAndWriteTagInterface.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
6
10//----------------------------------------------------------------------------------
11#pragma once
12
15
17
18// Forwards.
20
21//----------------------------------------------------------------------------------
23//----------------------------------------------------------------------------------
25{
26public:
27
28 //-----------
30 enum { NumInheritModes = 3 };
31
34 DoNotInherit=0,
35 InheritFromTopLevel,
37 InheritRecursively
39 };
40
42 static const char * const InheritModeStrings[NumInheritModes];
43
59 const DCMTree::RawTagId tagId, /* e.g. DCMTree_BurnedInAnnotation */
60 const std::string &valueFieldName, /* e.g. "burnedInAnnotation" */
61 const std::string &fieldSuffix, /* e.g. "BurnedInAnnotation" */
62 const std::string &dicomModuleInfoString="", /* e.g. " (Enhanced MR Image)" */
63 const bool valueFldDefault=false,
64 const bool writeFldDefault=false,
65 const InheritMode inheritModeFldDefault=InheritFromTopLevel,
66 const bool defaultFldDefault=false,
67 const bool updateWriteOnInheritFldDefault=true,
68 const bool alwaysWrite=false
69 );
70
72 void addFields() override;
73
75 void inheritValues(DCMTree::Const_TreePtr dcmTree) override;
76
79 const FieldContainer *treeInfos=nullptr) override;
80
83
85 std::string checkConsistency() const override;
86
88 virtual BoolField &getValueFld() { return *_valueFld; }
90 virtual const BoolField &getValueFld() const { return *_valueFld; }
91
93 virtual BoolField &getWriteFld() { return *_writeFld; }
95 virtual const BoolField &getWriteFld() const { return *_writeFld; }
96
98 virtual EnumField &getInheritModeFld() { return *_inheritModeFld; }
100 virtual const EnumField &getInheritModeFld() const { return *_inheritModeFld; }
101
103 virtual BoolField &getDefaultValueFld() { return *_defaultValueFld; }
105 virtual const BoolField &getDefaultValueFld() const { return *_defaultValueFld; }
106
108 virtual BoolField &getUpdateWriteOnInheritFld() { return *_updateWriteOnInheritFld; }
110 virtual const BoolField &getUpdateWriteOnInheritFld() const { return *_updateWriteOnInheritFld; }
111
112protected:
115
117 const std::string _valueFieldName;
118
120 const std::string _fieldSuffix;
121
123 const std::string _dicomModuleInfoString;
124
127
130
133
136
139
142
145
148
151
154
156 const bool _alwaysWrite;
157};
158
Project global and OS specific declarations.
#define MLDICOMTAGINTERFACES_EXPORT
DLL export macro definition.
Field to encapsulate a boolean value.
Definition mlFields.h:56
FieldAddOn class supporting inheritance and optional writing of a boolean tag value.
const std::string _dicomModuleInfoString
Stores the description of the DICOM module for error message generation.
EnumField * _inheritModeFld
Controls whether or how the value is inherited.
virtual const BoolField & getUpdateWriteOnInheritFld() const
Constant read-only access, see _updateWriteOnInheritFld.
void addFields() override
Add fields to field container of module.
virtual EnumField & getInheritModeFld()
See _inheritModeFld.
virtual const BoolField & getValueFld() const
Constant read-only access, see _valueFld.
BoolField * _writeFld
Controls whether the value is written or not as tag in applyModification().
BoolField * _defaultValueFld
The value to be inherited if no or only a bad value can be inherited.
virtual const BoolField & getWriteFld() const
Constant read-only access, see _writeFld.
DicomBoolInheritAndWriteTagInterface(Module &modRef, const DCMTree::RawTagId tagId, const std::string &valueFieldName, const std::string &fieldSuffix, const std::string &dicomModuleInfoString="", const bool valueFldDefault=false, const bool writeFldDefault=false, const InheritMode inheritModeFldDefault=InheritFromTopLevel, const bool defaultFldDefault=false, const bool updateWriteOnInheritFldDefault=true, const bool alwaysWrite=false)
Constructor, setting the reference of the module for which the fields shall be managed.
FieldAddOnBase::FieldChangeState handleFieldChanges(Field *field) override
Handle field notifications.
const bool _defaultValueFldDefault
Corresponding default passed to constructor.
virtual BoolField & getUpdateWriteOnInheritFld()
See _updateWriteOnInheritFld.
std::string checkConsistency() const override
Checks for invalid parameters; return textual description on error, or empty string on success.
const bool _updateWriteOnInheritFldDefault
Corresponding default passed to constructor.
const bool _alwaysWrite
If true then the tag is always written, independent of the state of the write field.
BoolField * _updateWriteOnInheritFld
The value to be inherited if no or only a bad value can be inherited.
virtual const EnumField & getInheritModeFld() const
Constant read-only access, see _inheritModeFld.
virtual BoolField & getDefaultValueFld()
See _defaultValueFld.
void inheritValues(DCMTree::Const_TreePtr dcmTree) override
Implements the copy of tag values from the given dcmTree to the fields.
const InheritMode _inheritModeFldDefault
Corresponding default passed to constructor.
const bool _valueFldDefault
Corresponding default passed to constructor.
virtual const BoolField & getDefaultValueFld() const
Constant read-only access, see _defaultValueFld.
const bool _writeFldDefault
Corresponding default passed to constructor.
const DCMTree::RawTagId _tagId
Stores the ID of the DICOM tag to be managed.
std::string applyModifications(DCMTree::TreePtr dcmTree, const FieldContainer *treeInfos=nullptr) override
See DicomModifyFieldAddOnBase::applyModifications() for documentation.
const std::string _valueFieldName
Name of the value field.
The class DicomModifyFieldAddOnBase is dedicated to manage fields for ML modules and instances derive...
Field to encapsulate an enumerated value.
Definition mlFields.h:173
FieldChangeState
Describes the type of a field changes detected in handleFieldChanges(Field *field).
Defines the class FieldContainer to encapsulate a vector of fields (see class Field).
Base class for all fields used in the ML.
Definition mlField.h:73
Base class for an image processing module of the ML.
Definition mlModule.h:151
Header file of the DicomModifyFieldAddOnBase class dedicated to manage fields for ML modules and inst...
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
boost::shared_ptr< const Tree > Const_TreePtr
Definition DCMTree_Lib.h:67
boost::shared_ptr< Tree > TreePtr
Shared pointer to a DCMTree::Tree.
Definition DCMTree_Lib.h:66
unsigned int RawTagId
Base class for classes creating default values.