![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Dicom/DicomElement.h>
Abstract base class for DICOM Elements. More...
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.
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. | |
enum Type |
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
.
predicate | Predicate 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). |
|
pure virtual |
Returns true if the element exists and is in a valid range.
Implemented in Element< T >, Element< bool >, Element< Data::Modality >, Element< DcmPixelData * >, Element< double >, Element< int >, Element< PhotometricInterpretation >, Element< std::string >, Element< std::vector< double > >, Element< std::vector< int > >, Element< std::vector< std::string > >, Element< std::vector< unsigned char > >, Element< std::vector< unsigned short > >, Element< vec2 >, Sequence< T >, Sequence< ImFusion::CT::XrayFunctionalGroups::XrayFunctionalGroupMacro >, Sequence< ImFusion::CT::XrayPositioning::ZiehmImageSpotPositionSequence >, Sequence< ImFusion::Dicom::EnhancedMultiFrameImageIOD::DimensionIndexSequenceItem >, Sequence< ImFusion::Dicom::EnhancedMultiFrameImageIOD::FunctionalGroupMacro >, Sequence< ImFusion::Dicom::EnhancedMultiFrameImageIOD::FunctionalGroupMacro::FrameContentSequenceItem >, Sequence< ImFusion::Dicom::EnhancedMultiFrameImageIOD::FunctionalGroupMacro::SegmentIdentificationSequenceItem >, Sequence< ImFusion::Dicom::ImagePlane::DetectorInformationSequence >, Sequence< ImFusion::Dicom::ModalityLUT::LutItem >, Sequence< ImFusion::Dicom::SegmentItem >, Sequence< ImFusion::Dicom::SegmentItem::SegmentedPropertyCode >, Sequence< ImFusion::Dicom::VOILUTExtension::VOILUT::LutItem >, and Sequence< ImFusion::US::DicomGeVividE9IOD::VividVolumeGroupItem >.
void remove | ( | ) |
Removes the element from the dataset.
If the element was created with searchIntoSubs=true, all instances of the tag are removed.
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.