![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Dicom/DicomElement.h>
Dicom Element with a concrete value type. More...
Dicom Element with a concrete value type.
Currently the following template specializations are implemented:
Public Member Functions | |
Element (ElementList &module, DcmTag tag, Type type=ElementBase::Conditional, bool searchIntoSubs=false) | |
Creates a new Element instance, to be used from a Module (or other ElementList as parent). | |
Element (DcmItem &item, DcmTag tag, Type type=ElementBase::Conditional, bool searchIntoSubs=false) | |
Creates a new Element instance, to be used from anywhere which is not a ElementList. | |
T | value () const |
Retrieves the value from the dataset. | |
T | value (const T &defaultValue) const |
Tries retrieving the value from the dataset. | |
void | setValue (T value) |
Sets the value in the dataset. | |
void | setValidator (std::function< bool(const T &)> isValid) |
Assigns an optional callback function to determine if the element's value is valid in the current context. | |
bool | isValid () const override |
Returns whether the element contains valid data (wrt. to the set validator). | |
void | insertEmptyElement () |
Inserts an empty element, forcing the tag to be written into the dataset. | |
![]() | |
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. | |
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. | |
Additional Inherited Members | |
![]() | |
enum | Type { Mandatory , Conditional } |
Conditionality of an Element. More... | |
![]() | |
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. | |
Element | ( | ElementList & | module, |
DcmTag | tag, | ||
Type | type = ElementBase::Conditional, | ||
bool | searchIntoSubs = false ) |
Creates a new Element instance, to be used from a Module (or other ElementList as parent).
Element | ( | DcmItem & | item, |
DcmTag | tag, | ||
Type | type = ElementBase::Conditional, | ||
bool | searchIntoSubs = false ) |
Creates a new Element instance, to be used from anywhere which is not a ElementList.
T value | ( | ) | const |
Retrieves the value from the dataset.
Throws a value_error if the value could not be retrieved from the dataset (e.g. when it does not exist).
T value | ( | const T & | defaultValue | ) | const |
Tries retrieving the value from the dataset.
In contrast to the value() overload, this method returns defaultValue instead of throwing an exception if the value could not be retrieved from the dataset (e.g. when it does not exist).
void setValue | ( | T | value | ) |
Sets the value in the dataset.
Overrides existing values or creates new element in dataset otherwise.
void setValidator | ( | std::function< bool(const T &)> | isValid | ) |
Assigns an optional callback function to determine if the element's value is valid in the current context.
The default validator (nullptr) always returns true (i.e. element is always valid).
|
overridevirtual |
Returns whether the element contains valid data (wrt. to the set validator).
Implements ElementBase.