MeVisLab Toolbox Reference
ml::DicomValueInheritAndCreateTagInterface Class Reference

FieldAddOn class supporting inheritance and auto creating tag values (for example DICOM UIDs or tag values). More...

#include <mlDicomValueInheritAndCreateTagInterface.h>

Inheritance diagram for ml::DicomValueInheritAndCreateTagInterface:
ml::DicomModifyFieldAddOnBase ml::DicomModifyList ml::FieldAddOnBase ml::Base

Public Types

enum  { NumInheritModes = 5 }
 Number of available InheritModes. More...
 
enum  {
  DoNotInherit =0 , InheritFromTopLevel , InheritRecursively , CreateNew ,
  CreateNewIfNeeded
}
 Enumerator for the _inheritValueFld. More...
 
enum  { NumAutoCreateValueModes = 3 }
 Number of available _autoCreateValueFld values. More...
 
enum  { DoNotAutoCreate =0 , AutoCreateAlways , CreateIfNeeded }
 Enumerator for the _autoCreateFld. More...
 
- Public Types inherited from ml::Base
enum  PersistenceInterface { PersistenceByString , PersistenceByTreeNode , PersistenceByStream }
 This enum describes the different persistence interfaces available. More...
 
- Public Types inherited from ml::FieldAddOnBase
enum  FieldChangeState { NoChange = 0 , StatusOnlyChange , RecalculationRequired }
 Describes the type of a field changes detected in handleFieldChanges(Field *field). More...
 

Public Member Functions

 DicomValueInheritAndCreateTagInterface (Module &modRef, DCMTree::RawTagId tagId, const std::string &valueFieldName, const std::string &fieldSuffix, bool valueIsType1, const std::string &dicomModuleInfoString, const bool useDefaultField=false, const std::string &defaultFieldValue="")
 Constructor, setting the reference of the module for which the fields shall be managed. More...
 
 ~DicomValueInheritAndCreateTagInterface () override
 Destructor. More...
 
void addFields () override
 Add fields to field container of module. More...
 
void inheritValues (DCMTree::Const_TreePtr dcmTree) override
 Implements the copy of tag values from the given dcmTree to the fields. More...
 
std::string applyModifications (DCMTree::TreePtr dcmTree, const FieldContainer *treeInfos=nullptr) override
 See DicomModifyFieldAddOnBase::applyModifications() for documentation. More...
 
FieldAddOnBase::FieldChangeState handleFieldChanges (Field *field) override
 Handle field notifications. More...
 
std::string checkConsistency () const override
 Checks for invalid parameters; return textual description on error, or empty string on success. More...
 
virtual StringFieldgetValueFld ()
 See _valueFld. More...
 
virtual const StringFieldgetValueFld () const
 Constant read-only access, see _valueFld. More...
 
virtual EnumFieldgetInheritModeFld ()
 See _inheritModeFld. More...
 
virtual const EnumFieldgetInheritModeFld () const
 Constant read-only access, see _inheritModeFld. More...
 
virtual StringFieldgetDefaultFieldFld ()
 See _defaultFieldFld, returns nullptr if not available. More...
 
virtual const StringFieldgetDefaultFieldFld () const
 Constant read-only access, see _defaultFieldFld, returns nullptr if not available. More...
 
virtual EnumFieldgetAutoCreateValueFld ()
 See _autoCreateValueFld. More...
 
virtual const EnumFieldgetAutoCreateValueFld () const
 Constant read-only access, see _autoCreateValueFld. More...
 
virtual bool isDefaultFieldUsed () const
 See _useDefaultField. More...
 
virtual void setUseDefaultField (bool useDefaultField)
 On true sets the default field is used or otherwise the default value function. More...
 
virtual NotifyFieldgetCreateValueFld ()
 See _createValueFld. More...
 
virtual const NotifyFieldgetCreateValueFld () const
 Constant read-only access, see _createValueFld. More...
 
virtual void setDefaultCreateFunction (DefaultValueCreatorBase *newDefaultCreator)
 Sets a new object to create default values if not nullptr, otherwise a CreateDefaultDICOMUID instance is automatically created instead; the passed object must be created with new and ownership is passed to the DicomValueInheritAndCreateTagInterface instance. More...
 
virtual const DefaultValueCreatorBasegetDefaultCreateFunction () const
 Returns the current default value creator; returned pointer is never nullptr. More...
 
virtual void createValue ()
 Set _valueFld to a new value according to settings of isDefaultFieldUsed() and getDefaultCreatFunction(): if isDefaultFieldUsed and a default field exists then _valueField is set to the value given in getDefaultFieldFld(), otherwise it is set to the value created with getDefautCreateFunction. More...
 
virtual void createValueIfNeeded ()
 Same as createValue() but creates a value only if getValueFld() is empty. More...
 
- Public Member Functions inherited from ml::DicomModifyFieldAddOnBase
 DicomModifyFieldAddOnBase (FieldContainer &fieldContainerRef, size_t numInstances=1, bool createInputModifyTagsPluginBaseConnectorField=false, bool createOutputModifyTagsPluginBaseConnectorField=false)
 Constructor, setting the reference of the FieldContainer managing the fields, the number of field instances to create and optionally input and output fields to create modification pipelines. More...
 
 ~DicomModifyFieldAddOnBase () override
 Destructor resetting connector fields if they exist. More...
 
size_t getNumInstances () const
 Returns the number of instances to be created by derived fields. More...
 
void handleFieldActivationChanges () override
 Handle class changes according to Module::activateAttachments. More...
 
BaseFieldgetOutputModifierListFld () const
 Provide access to output base field if it was created. More...
 
BaseFieldgetInputModifierListFld () const
 Provide access to input base connector field if it was created. More...
 
- Public Member Functions inherited from ml::DicomModifyList
 DicomModifyList ()
 Constructor creating an empty list of tag modifiers and setting the optional input plugin with a concatenated DicomModifyList. More...
 
 ~DicomModifyList () override
 Destructor also destroying all of its stored Modifiers. More...
 
void addModifier (DicomModifyBase *modifier, bool atEnd=true)
 Add an object derived from DicomModifyBase which then will be owned (and on destruction deleted) by this. More...
 
void clear ()
 Makes modifier array empty and deletes all of them. More...
 
std::vector< DicomModifyBase * > & getModifierList ()
 Get direct access to internal list to allow callers direct manipulations which, however, must obey the restriction that ownership belongs to *this, i.e. More...
 
const std::vector< DicomModifyBase * > & getModifierList () const
 Same as getModifierList() only for constant access. More...
 
void setInputPlugin (DicomModifyList *inputPlugin=nullptr)
 Sets an optional plugin to be called by applyModififcations or resets it to nullptr; the input is called after the objects in _modfiers list. More...
 
DicomModifyListgetInputPlugin () const
 Returns the optional plugin to be called by applyModififcations. More...
 
- Public Member Functions inherited from ml::Base
 Base ()
 Constructor. More...
 
virtual ~Base ()
 Destructor. More...
 
virtual BasedeepCopy () const
 Set addStateToTree version number that can be accessed via getAddStateVersion() More...
 
bool isOfAllowedType (const std::vector< const RuntimeType * > &types) const
 Check if this object's type is equal to or derived from one of the types given in the argument. More...
 
virtual bool isRefCountedBase () const
 Returns if the instance is derived from RefCountedBase. More...
 
virtual std::string detailString () const
 Return a string describing this object. More...
 
virtual bool implementsPersistence (PersistenceInterface) const
 Override this method to declare which persistence interfaces are implemented by your derived class. More...
 
virtual std::string persistentState () const
 Returns a string describing the object's internal state. More...
 
virtual void setPersistentState (const std::string &state)
 Restores the object's internal state from a string that had been previously generated using persistentState(). More...
 
virtual void addStateToTree (TreeNode *) const
 Attaches the object state as children of the given parent node. More...
 
virtual void readStateFromTree (TreeNode *)
 Reads the object state from the children of the given parent node. More...
 
virtual void writeTo (AbstractPersistenceOutputStream *) const
 Write the objects state to the data stream object. More...
 
virtual void readFrom (AbstractPersistenceInputStream *, int)
 Read the objects state from the data stream object. More...
 
- Public Member Functions inherited from ml::FieldAddOnBase
 FieldAddOnBase (FieldContainer &fieldContainerRef)
 Constructor, setting the reference of the FieldContainer managing the fields. More...
 
virtual ~FieldAddOnBase ()
 Destructor. More...
 
FieldContainergetFieldContainer ()
 Returns the referenced container. More...
 
const FieldContainergetFieldContainer () const
 Returns the referenced container. More...
 
std::vector< Field * > & getFields ()
 Return modification access to the list of managed fields, use at own risk! More...
 
const std::vector< Field * > & getFields () const
 Return constant access to the list of managed fields! More...
 
virtual FieldChangeState getMergedFieldChangeState (FieldChangeState state1, FieldChangeState state2) const
 Returns a FieldChangeState which best represents a merge of the two given states. More...
 
virtual bool hasField (Field *field) const
 Returns true if the passed fieldPtr is in _fieldPointers, otherwise false. More...
 

Static Public Attributes

static const char *const InheritModeStrings [NumInheritModes]
 String representations for the _inheritModeFld.
More...
 
static const char *const AutoCreateValueModeStrings [NumAutoCreateValueModes]
 String representations for the _autoCreateValueFld. More...
 

Protected Attributes

StringField_valueFld
 The (tag) value to be managed. More...
 
const DCMTree::RawTagId _tagId
 Stores the ID of the DICOM tag to be managed. More...
 
const std::string _valueFieldName
 Name of the value field. More...
 
const std::string _fieldSuffix
 Field suffix. More...
 
EnumField_inheritModeFld
 Controls whether or how the value is inherited. More...
 
EnumField_autoCreateValueFld
 Controls whether or when a new value is generated. More...
 
NotifyField_createValueFld
 If notified a new value is created. More...
 
const bool _valueIsType1
 If true then the value is handled as Type 1 (mandatory and not empty) tag, otherwise it is allowed to be empty (only for backward compatibility and not recommended). More...
 
const std::string _dicomModuleInfoString
 Stores the description of the DICOM module for error message generation. More...
 
bool _useDefaultField
 If enabled then a hidden default field is generated and/or used its value is used instead of a generated default. More...
 
const std::string _defaultInitValue
 Default value passed to constructor. More...
 
StringField_defaultFieldFld
 Used as default value for the hidden default field if _useDefaultFieldFld is true, otherwise not generated. More...
 
DefaultValueCreatorBase_createDefaultValuePtr
 The function to create default values if no default field is available. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ml::DicomModifyFieldAddOnBase
static bool isIn (const std::string &str, const char *const *values, size_t numValues)
 Static helper function which checks whether str is part of the given list of values which has numValues entries. More...
 
- Protected Member Functions inherited from ml::Base
virtual char * getPersistentState () const
 Returns a C string describing the object's internal state. More...
 
virtual void setPersistentState (const char *)
 Restores the object's internal state from a string that had been previously generated using getPersistentState(). More...
 
virtual void clearPersistentState (char *) const
 Disposes a string previously allocated by getPersistentState(). More...
 
- Protected Member Functions inherited from ml::FieldAddOnBase
void _addFieldPointer (Field *field)
 Helper routine to add a Field pointer to _fieldPointers, empty pointers and pointers added more than once will be handled fatally. More...
 

Detailed Description

FieldAddOn class supporting inheritance and auto creating tag values (for example DICOM UIDs or tag values).

Definition at line 25 of file mlDicomValueInheritAndCreateTagInterface.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Number of available InheritModes.

Enumerator
NumInheritModes 

Definition at line 31 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ anonymous enum

anonymous enum

Enumerator for the _inheritValueFld.

Enumerator
DoNotInherit 

Do not inherit value from input.

InheritFromTopLevel 

Inherit value from top level of DCMTree or set empty if not found.

InheritRecursively 

Inherit value from recursively search in DCMTree or set empty if not found.

CreateNew 

Create a new value on inheritance instead of inheriting one.

CreateNewIfNeeded 

Same as CreateNew but only if value field is empty.

Definition at line 34 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ anonymous enum

anonymous enum

Number of available _autoCreateValueFld values.

Enumerator
NumAutoCreateValueModes 

Definition at line 46 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ anonymous enum

anonymous enum

Enumerator for the _autoCreateFld.

Enumerator
DoNotAutoCreate 

Do not create a new value whatever happens.

AutoCreateAlways 

Always create a new value even if another valid one is set.

CreateIfNeeded 

Create a new value if _valueFld is empty.

Definition at line 49 of file mlDicomValueInheritAndCreateTagInterface.h.

Constructor & Destructor Documentation

◆ DicomValueInheritAndCreateTagInterface()

ml::DicomValueInheritAndCreateTagInterface::DicomValueInheritAndCreateTagInterface ( Module modRef,
DCMTree::RawTagId  tagId,
const std::string &  valueFieldName,
const std::string &  fieldSuffix,
bool  valueIsType1,
const std::string &  dicomModuleInfoString,
const bool  useDefaultField = false,
const std::string &  defaultFieldValue = "" 
)

Constructor, setting the reference of the module for which the fields shall be managed.

Parameters
modRefThe reference to the ML Module instance in which this FieldAdddOn will be inserted.
tagIdThe 32 bit tag id of the DICOM tag to be managed.
valueFieldNameThe name of the value field itself.
fieldSuffixThe suffix for all other fields to make the multiply usabble without name collisions.
valueIsType1If true then the tag value is handled as type 1 (mandatory and not empty) value.
dicomModuleInfoStringOptional information string explaining from which DICOM module or macro the tag comes from; will be used for error message generation and can be left empty.
useDefaultFieldif enabled then a hidden default field is generated and its value is used instead of a generated default.
defaultFieldValueused as default value for the hidden default field if useDefaultField is true, otherwise ignored.

◆ ~DicomValueInheritAndCreateTagInterface()

ml::DicomValueInheritAndCreateTagInterface::~DicomValueInheritAndCreateTagInterface ( )
override

Destructor.

Member Function Documentation

◆ addFields()

void ml::DicomValueInheritAndCreateTagInterface::addFields ( )
overridevirtual

Add fields to field container of module.

Reimplemented from ml::DicomModifyFieldAddOnBase.

◆ applyModifications()

std::string ml::DicomValueInheritAndCreateTagInterface::applyModifications ( DCMTree::TreePtr  dcmTree,
const FieldContainer treeInfos = nullptr 
)
overridevirtual

◆ checkConsistency()

std::string ml::DicomValueInheritAndCreateTagInterface::checkConsistency ( ) const
overridevirtual

Checks for invalid parameters; return textual description on error, or empty string on success.

Reimplemented from ml::DicomModifyFieldAddOnBase.

◆ createValue()

virtual void ml::DicomValueInheritAndCreateTagInterface::createValue ( )
virtual

Set _valueFld to a new value according to settings of isDefaultFieldUsed() and getDefaultCreatFunction(): if isDefaultFieldUsed and a default field exists then _valueField is set to the value given in getDefaultFieldFld(), otherwise it is set to the value created with getDefautCreateFunction.

◆ createValueIfNeeded()

virtual void ml::DicomValueInheritAndCreateTagInterface::createValueIfNeeded ( )
virtual

Same as createValue() but creates a value only if getValueFld() is empty.

◆ getAutoCreateValueFld() [1/2]

virtual EnumField& ml::DicomValueInheritAndCreateTagInterface::getAutoCreateValueFld ( )
inlinevirtual

See _autoCreateValueFld.

Definition at line 119 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ getAutoCreateValueFld() [2/2]

virtual const EnumField& ml::DicomValueInheritAndCreateTagInterface::getAutoCreateValueFld ( ) const
inlinevirtual

Constant read-only access, see _autoCreateValueFld.

Definition at line 121 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ getCreateValueFld() [1/2]

virtual NotifyField& ml::DicomValueInheritAndCreateTagInterface::getCreateValueFld ( )
inlinevirtual

See _createValueFld.

Definition at line 129 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ getCreateValueFld() [2/2]

virtual const NotifyField& ml::DicomValueInheritAndCreateTagInterface::getCreateValueFld ( ) const
inlinevirtual

Constant read-only access, see _createValueFld.

Definition at line 131 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ getDefaultCreateFunction()

virtual const DefaultValueCreatorBase& ml::DicomValueInheritAndCreateTagInterface::getDefaultCreateFunction ( ) const
virtual

Returns the current default value creator; returned pointer is never nullptr.

◆ getDefaultFieldFld() [1/2]

virtual StringField* ml::DicomValueInheritAndCreateTagInterface::getDefaultFieldFld ( )
inlinevirtual

See _defaultFieldFld, returns nullptr if not available.

Definition at line 114 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ getDefaultFieldFld() [2/2]

virtual const StringField* ml::DicomValueInheritAndCreateTagInterface::getDefaultFieldFld ( ) const
inlinevirtual

Constant read-only access, see _defaultFieldFld, returns nullptr if not available.

Definition at line 116 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ getInheritModeFld() [1/2]

virtual EnumField& ml::DicomValueInheritAndCreateTagInterface::getInheritModeFld ( )
inlinevirtual

See _inheritModeFld.

Definition at line 109 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ getInheritModeFld() [2/2]

virtual const EnumField& ml::DicomValueInheritAndCreateTagInterface::getInheritModeFld ( ) const
inlinevirtual

Constant read-only access, see _inheritModeFld.

Definition at line 111 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ getValueFld() [1/2]

virtual StringField& ml::DicomValueInheritAndCreateTagInterface::getValueFld ( )
inlinevirtual

See _valueFld.

Definition at line 104 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ getValueFld() [2/2]

virtual const StringField& ml::DicomValueInheritAndCreateTagInterface::getValueFld ( ) const
inlinevirtual

Constant read-only access, see _valueFld.

Definition at line 106 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ handleFieldChanges()

FieldAddOnBase::FieldChangeState ml::DicomValueInheritAndCreateTagInterface::handleFieldChanges ( Field field)
overridevirtual

Handle field notifications.

Reimplemented from ml::DicomModifyFieldAddOnBase.

◆ inheritValues()

void ml::DicomValueInheritAndCreateTagInterface::inheritValues ( DCMTree::Const_TreePtr  dcmTree)
overridevirtual

Implements the copy of tag values from the given dcmTree to the fields.

Reimplemented from ml::DicomModifyFieldAddOnBase.

◆ isDefaultFieldUsed()

virtual bool ml::DicomValueInheritAndCreateTagInterface::isDefaultFieldUsed ( ) const
inlinevirtual

See _useDefaultField.

Definition at line 124 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ setDefaultCreateFunction()

virtual void ml::DicomValueInheritAndCreateTagInterface::setDefaultCreateFunction ( DefaultValueCreatorBase newDefaultCreator)
virtual

Sets a new object to create default values if not nullptr, otherwise a CreateDefaultDICOMUID instance is automatically created instead; the passed object must be created with new and ownership is passed to the DicomValueInheritAndCreateTagInterface instance.

◆ setUseDefaultField()

virtual void ml::DicomValueInheritAndCreateTagInterface::setUseDefaultField ( bool  useDefaultField)
inlinevirtual

On true sets the default field is used or otherwise the default value function.

Definition at line 126 of file mlDicomValueInheritAndCreateTagInterface.h.

Member Data Documentation

◆ _autoCreateValueFld

EnumField* ml::DicomValueInheritAndCreateTagInterface::_autoCreateValueFld
protected

Controls whether or when a new value is generated.

Definition at line 166 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ _createDefaultValuePtr

DefaultValueCreatorBase* ml::DicomValueInheritAndCreateTagInterface::_createDefaultValuePtr
protected

The function to create default values if no default field is available.

Definition at line 189 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ _createValueFld

NotifyField* ml::DicomValueInheritAndCreateTagInterface::_createValueFld
protected

If notified a new value is created.

Definition at line 169 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ _defaultFieldFld

StringField* ml::DicomValueInheritAndCreateTagInterface::_defaultFieldFld
protected

Used as default value for the hidden default field if _useDefaultFieldFld is true, otherwise not generated.

Definition at line 186 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ _defaultInitValue

const std::string ml::DicomValueInheritAndCreateTagInterface::_defaultInitValue
protected

Default value passed to constructor.

Definition at line 183 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ _dicomModuleInfoString

const std::string ml::DicomValueInheritAndCreateTagInterface::_dicomModuleInfoString
protected

Stores the description of the DICOM module for error message generation.

Definition at line 177 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ _fieldSuffix

const std::string ml::DicomValueInheritAndCreateTagInterface::_fieldSuffix
protected

Field suffix.

Definition at line 160 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ _inheritModeFld

EnumField* ml::DicomValueInheritAndCreateTagInterface::_inheritModeFld
protected

Controls whether or how the value is inherited.

Definition at line 163 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ _tagId

const DCMTree::RawTagId ml::DicomValueInheritAndCreateTagInterface::_tagId
protected

Stores the ID of the DICOM tag to be managed.

Definition at line 154 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ _useDefaultField

bool ml::DicomValueInheritAndCreateTagInterface::_useDefaultField
protected

If enabled then a hidden default field is generated and/or used its value is used instead of a generated default.

Definition at line 180 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ _valueFieldName

const std::string ml::DicomValueInheritAndCreateTagInterface::_valueFieldName
protected

Name of the value field.

Definition at line 157 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ _valueFld

StringField* ml::DicomValueInheritAndCreateTagInterface::_valueFld
protected

The (tag) value to be managed.

Definition at line 151 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ _valueIsType1

const bool ml::DicomValueInheritAndCreateTagInterface::_valueIsType1
protected

If true then the value is handled as Type 1 (mandatory and not empty) tag, otherwise it is allowed to be empty (only for backward compatibility and not recommended).

Definition at line 174 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ AutoCreateValueModeStrings

const char* const ml::DicomValueInheritAndCreateTagInterface::AutoCreateValueModeStrings[NumAutoCreateValueModes]
static

String representations for the _autoCreateValueFld.

Definition at line 56 of file mlDicomValueInheritAndCreateTagInterface.h.

◆ InheritModeStrings

const char* const ml::DicomValueInheritAndCreateTagInterface::InheritModeStrings[NumInheritModes]
static

String representations for the _inheritModeFld.

Definition at line 43 of file mlDicomValueInheritAndCreateTagInterface.h.


The documentation for this class was generated from the following file: