ImFusion SDK 4.3
ElementBase Class Referenceabstract

#include <ImFusion/Dicom/DicomElement.h>

Abstract base class for DICOM Elements. More...

+ Inheritance diagram for ElementBase:

Detailed Description

Abstract base class for DICOM Elements.

Elements serve as wrapper to access individual DICOM tags, which serve as most fundamental building block of a DICOM file. Every Element is uniquely identified by its DICOM Tag that can only occur once per dataset (aside from sequences). During construction of an Element you define whether it should be considered as Mandatory. If an Element is defined as Conditional, you can optionally provide a predicate function to determine whether it has to be present or not.

See also
Element

Public Types

enum  Type { Mandatory , Conditional }
 Conditionality of an Element. More...
 

Public Member Functions

 ElementBase (ElementList &parent, DcmTag tag, Type type=Conditional, bool searchIntoSubs=false)
 
 ElementBase (DcmItem &item, DcmTag tag, Type type=Conditional, bool searchIntoSubs=false)
 
void setCondition (std::function< bool()> predicate)
 Sets a callback function that determines if a conditional element is mandatory.
 
virtual DcmTag tag () const
 DICOM tag wrapped by this Element.
 
virtual bool isMandatory () const
 Evaluates whether this element is mandatory (based on the specified type and optionally condition).
 
virtual bool exists () const
 Returns true if the elements exists in the dataset.
 
virtual bool isValid () const =0
 Returns true if the element exists and is in a valid range.
 
void remove ()
 Removes the element from the dataset.
 
std::string valueString () const
 Returns the value of the element as a string.
 
void setTargetSequence (DcmItem *sequence)
 Sets an optional sequence item where this elements will write its value.
 

Protected Attributes

DcmItem & m_dataset
 DICOM data set/base element to retrieve element data from.
 
DcmItem * m_targetSeq
 Optional sequence to write element data to; only used for setValue().
 
DcmTag m_tag
 DICOM tag the Element refers to.
 
Type m_type
 Conditionality of the Element.
 
bool m_searchIntoSubs
 Flag whether to search into sub sequences or not.
 
std::function< bool()> m_typeCondition
 Optional predicate function to evaluate conditionality.
 

Member Enumeration Documentation

◆ Type

enum Type

Conditionality of an Element.

Enumerator
Mandatory 

Element is mandatory.

Conditional 

Element is optional. If a condition is met (see setCondition), it has to satisfy that.

Member Function Documentation

◆ setCondition()

void setCondition ( std::function< bool()> predicate)

Sets a callback function that determines if a conditional element is mandatory.

It is ignored if the type is set to Mandatory.

Parameters
predicatePredicate callback function to determine whether the element has to be present or not. If set to nullptr, the condition is always false (i.e. never mandatory). The default value is nullptr (correlates to DICOM's 'User Option' type).

◆ isValid()

◆ remove()

void remove ( )

Removes the element from the dataset.

If the element was created with searchIntoSubs=true, all instances of the tag are removed.

◆ setTargetSequence()

void setTargetSequence ( DcmItem * sequence)

Sets an optional sequence item where this elements will write its value.

This sequence is only used for setValue and has not effect when retrieving a value.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close