MeVisLab Toolbox Reference
mlDicomValueComboBoxSelectorTagInterface.h
Go to the documentation of this file.
1 // Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2 // **InsertLicense** code
3 //----------------------------------------------------------------------------------
5 
10 //----------------------------------------------------------------------------------
11 #pragma once
12 
15 
16 ML_START_NAMESPACE
17 
18 //----------------------------------------------------------------------------------
26 //----------------------------------------------------------------------------------
28 {
29 public:
30 
32  enum { NumInheritModeStrings = 4 };
33 
35  static const char * const InheritModeStrings[NumInheritModeStrings];
36 
38  enum InheritMode {
39  InheritValidOnly=0
40  ,InheritValidOtherwiseDefault
41  ,InheritAny
42  ,DoNotInherit
43  };
44 
54  const std::string &fieldName,
55  const char * const *selectableValues,
56  size_t numSelectableValues,
57  size_t defaultValueIndex=0,
58  InheritMode inheritModeDefault=InheritValidOnly);
59 
61  void addFields() override;
62 
65 
68 
71  virtual void inheritValues(DCMTree::Const_TreePtr dcmTree,
72  const std::string &inValue,
73  const std::string *fallBack=nullptr);
74 
78  std::string applyModifications(DCMTree::TreePtr dcmTree,
79  const FieldContainer *treeInfos=nullptr) override;
80 
84  virtual std::string checkConsistency(const std::string *errorFieldName=nullptr) const;
85 
87  BoolField &getCheckConsistencyFld() const { return *_checkConsistencyFld; }
88 
90  EnumField &getInheritModeFld() const { return *_inheritModeFld; }
91 
93  StringField &getSelectableValuesFld() const { return *_selectableValuesFld; }
94 
96  StringField &getValueFld() const { return *_valueFld; }
97 
100  static std::string getComposedString(const char*const *stringSet,
101  const size_t numStrings,
102  const std::string &separator=",");
103 
104 protected:
105 
107  const std::string _fieldName;
108 
110  const char * const *_selectableValues;
111 
113  const size_t _numSelectableValues;
114 
117 
120 
121 
124 
127 
130 
133 };
134 
135 ML_END_NAMESPACE
Project global and OS specific declarations.
#define MLDICOMTAGINTERFACES_EXPORT
DLL export macro definition.
Field to encapsulate a boolean value.
Definition: mlFields.h:62
The class DicomModifyFieldAddOnBase is dedicated to manage fields for ML modules and instances derive...
A complex field interface managing a value selector for combo boxes with a number of predefined value...
FieldAddOnBase::FieldChangeState handleFieldChanges(Field *field) override
Handle field notifications according to Module::activateAttachments with a return of field change sta...
virtual void inheritValues(DCMTree::Const_TreePtr dcmTree, const std::string &inValue, const std::string *fallBack=nullptr)
Implements the call of DicomModifyFieldAddOnBase and passes the unmodified values form the source.
virtual std::string checkConsistency(const std::string *errorFieldName=nullptr) const
Checks for invalid parameters; return textual description on error, or empty string on success; if er...
BoolField & getCheckConsistencyFld() const
See _checkConsistencyFld.
const size_t _numSelectableValues
The number of values in selectableValuesStr.
void handleFieldActivationChanges() override
Handle class changes according to Module::activateAttachments.
static std::string getComposedString(const char *const *stringSet, const size_t numStrings, const std::string &separator=",")
Mainly internally used static helper function which returns a string composed from all entries of str...
StringField & getSelectableValuesFld() const
See _selectableValuesFld.
EnumField * _inheritModeFld
Enumerator field controls the way how values for the valueFld may be inherited or adapted.
BoolField * _checkConsistencyFld
Controls whether the content of _valueFld is checked in checkConsistency or not.
StringField * _selectableValuesFld
Allowed values for _valueField, composed for use in a MeVisLab ComoboBox field control.
DicomValueComboBoxSelectorTagInterface(Module &modRef, const std::string &fieldName, const char *const *selectableValues, size_t numSelectableValues, size_t defaultValueIndex=0, InheritMode inheritModeDefault=InheritValidOnly)
Constructor, setting the reference of the module for which the fields shall be managed.
std::string applyModifications(DCMTree::TreePtr dcmTree, const FieldContainer *treeInfos=nullptr) override
See DicomModifyFieldAddOnBase::applyModifications() for documentation; adds field values as tags to d...
void addFields() override
Add fields to field container of module.
const char *const * _selectableValues
The array of numSelectableValues string values which are allowed in _valueField.
const InheritMode _inheritModeDefault
The default index to the default value to be used in _valueField.
const std::string _fieldName
The name of the value field.
const size_t _defaultSelectableValueIndex
The index of the default value to be used in _valueField.
Field to encapsulate an enumerated value.
Definition: mlFields.h:363
FieldChangeState
Describes the type of a field changes detected in handleFieldChanges(Field *field).
Defines the class FieldContainer to encapsulate a vector of fields for (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:156
Field to encapsulate a string value.
Definition: mlFields.h:1000
Header file of the DicomModifyFieldAddOnBase class dedicated to manage fields for ML modules and inst...
boost::shared_ptr< const Tree > Const_TreePtr
Definition: DCMTree_Lib.h:73
boost::shared_ptr< Tree > TreePtr
shared pointer to a DCMTree::Tree
Definition: DCMTree_Lib.h:70