Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitk::SourceImageRelationRule Class Reference

#include <mitkSourceImageRelationRule.h>

Inheritance diagram for mitk::SourceImageRelationRule:
Collaboration diagram for mitk::SourceImageRelationRule:

Public Types

typedef SourceImageRelationRule Self
 
typedef PropertyRelationRuleBase Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
using RuleIDType = PropertyRelationRuleBase::RuleIDType
 
using RelationUIDType = PropertyRelationRuleBase::RelationUIDType
 
using RelationUIDVectorType = PropertyRelationRuleBase::RelationUIDVectorType
 
- Public Types inherited from mitk::PropertyRelationRuleBase
enum  RelationType { RelationType::None, RelationType::Implicit_Data, RelationType::Connected_Data, RelationType::Connected_ID }
 
typedef PropertyRelationRuleBase Self
 
typedef itk::Object Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
using RuleIDType = std::string
 
using RelationUIDType = Identifiable::UIDType
 
using RelationUIDVectorType = std::vector< RelationUIDType >
 

Public Member Functions

virtual std::vector< std::string > GetClassHierarchy () const override
 
virtual const char * GetClassName () const
 
RuleIDType GetRuleID () const override
 
bool IsAbstract () const override
 
std::string GetDisplayName () const override
 
std::string GetSourceRoleName () const override
 
std::string GetDestinationRoleName () const override
 
bool IsDestinationCandidate (const IPropertyProvider *owner) const override
 
RelationUIDType Connect (Image *source, const Image *destination) const
 
- Public Member Functions inherited from mitk::PropertyRelationRuleBase
Pointer Clone () const
 
 itkCreateAnotherMacro (Self)
 
virtual bool IsSourceCandidate (const IPropertyProvider *owner) const
 
bool IsSource (const IPropertyProvider *owner) const
 
RelationType HasRelation (const IPropertyProvider *source, const IPropertyProvider *destination) const
 
RelationUIDVectorType GetExistingRelations (const IPropertyProvider *source) const
 
RelationUIDVectorType GetRelationUIDs (const IPropertyProvider *source, const IPropertyProvider *destination) const
 
RelationUIDType GetRelationUID (const IPropertyProvider *source, const IPropertyProvider *destination) const
 
NodePredicateBase::ConstPointer GetSourceCandidateIndicator () const
 
NodePredicateBase::ConstPointer GetDestinationCandidateIndicator () const
 
NodePredicateBase::ConstPointer GetConnectedSourcesDetector () const
 
NodePredicateBase::ConstPointer GetSourcesDetector (const IPropertyProvider *destination, RelationType minimalRelation=RelationType::Implicit_Data) const
 
NodePredicateBase::ConstPointer GetDestinationsDetector (const IPropertyProvider *source, RelationType minimalRelation=RelationType::Implicit_Data) const
 
NodePredicateBase::ConstPointer GetDestinationDetector (const IPropertyProvider *source, RelationUIDType relationUID) const
 
void Disconnect (IPropertyOwner *source, const IPropertyProvider *destination) const
 
void Disconnect (IPropertyOwner *source, RelationUIDType relationUID) const
 

Static Public Member Functions

static const char * GetStaticNameOfClass ()
 
static Pointer New ()
 
static Pointer New (const RuleIDType &_arg)
 
static Pointer New (const RuleIDType &_arga, const std::string &_argb)
 
static Pointer New (const RuleIDType &_arga, const std::string &_argb, const std::string &_argc, const std::string &_argd)
 
- Static Public Member Functions inherited from mitk::PropertyRelationRuleBase
static const char * GetStaticNameOfClass ()
 
static PropertyKeyPath GetRootKeyPath ()
 

Protected Types

using InstanceIDType = PropertyRelationRuleBase::InstanceIDType
 
using InstanceIDVectorType = PropertyRelationRuleBase::InstanceIDVectorType
 
- Protected Types inherited from mitk::PropertyRelationRuleBase
using InstanceIDType = std::string
 
using InstanceIDVectorType = std::vector< InstanceIDType >
 

Protected Member Functions

 SourceImageRelationRule ()
 
 SourceImageRelationRule (const RuleIDType &purposeTag)
 
 SourceImageRelationRule (const RuleIDType &purposeTag, const std::string &displayName)
 
 SourceImageRelationRule (const RuleIDType &purposeTag, const std::string &displayName, const std::string &sourceRole, const std::string &destinationRole)
 
 ~SourceImageRelationRule () override=default
 
std::vector< std::string > GetReferenceSequenceIndices (const IPropertyProvider *source, const IPropertyProvider *destination=nullptr) const
 
InstanceIDVectorType GetInstanceID_datalayer (const IPropertyProvider *source, const IPropertyProvider *destination) const override
 
bool HasImplicitDataRelation (const IPropertyProvider *source, const IPropertyProvider *destination) const override
 
void Connect_datalayer (IPropertyOwner *source, const IPropertyProvider *destination, const InstanceIDType &instanceID) const override
 
void Disconnect_datalayer (IPropertyOwner *source, const InstanceIDType &instanceID) const override
 
bool IsSupportedRuleID (const RuleIDType &ruleID) const override
 
itk::LightObject::Pointer InternalClone () const override
 
PropertyKeyPath::ItemSelectionIndex CreateNewSourceImageSequenceItem (IPropertyOwner *source) const
 
- Protected Member Functions inherited from mitk::PropertyRelationRuleBase
 PropertyRelationRuleBase ()=default
 
 ~PropertyRelationRuleBase () override=default
 
InstanceIDVectorType GetInstanceID_IDLayer (const IPropertyProvider *source, const IPropertyProvider *destination) const
 
RelationUIDType GetRelationUIDByInstanceID (const IPropertyProvider *source, const InstanceIDType &instanceID) const
 
InstanceIDType GetInstanceIDByRelationUID (const IPropertyProvider *source, const RelationUIDType &relationUID) const
 
RelationUIDType Connect (IPropertyOwner *source, const IPropertyProvider *destination) const
 
std::string GetRIIPropertyRegEx (const std::string propName="", const InstanceIDType &instanceID="") const
 
RuleIDType GetRuleIDByInstanceID (const IPropertyProvider *source, const InstanceIDType &instanceID) const
 
itk::LightObject::Pointer InternalClone () const override
 

Additional Inherited Members

- Static Protected Member Functions inherited from mitk::PropertyRelationRuleBase
static InstanceIDType NULL_INSTANCE_ID ()
 
static InstanceIDType GetInstanceIDByPropertyName (const std::string propName)
 
static std::vector< std::string > GetPropertyKeys (const mitk::IPropertyProvider *owner)
 

Detailed Description

This rule class can be used for relations that reference an image as source for a destination entity. (e.g. an image that is used to generate the relation source). The ID-layer is supported like for GenericIDReleations. So it can be used for all ID based relations between PropertyProviders that also implement the interface identifiable. In addition the rule uses the data-layer to deduce/define relations. For this layer it uses properties compliant to DICOM. Thus (1) the information is stored in a DICOM Source Image Sequence item (0x0008,0x2112) and (2) the destination must have properties DICOM SOP Instance UIDs (0x0008, 0x0018) and DICOM SOP Class UID (0x0008, 0x0016). If the destination does not have this properties, no connection can be made on the data-layer.

Remarks
Please note that PropertyRelationRules and DICOM use the term "source" differently. The DICOM source (image) equals the PropertyRelationRule destination. This is due to an inverted relation direction. So in the context of the SourceImageRelationRule interface a derived data is the source and points to the original image, it derives from. In the context of DICOM this referenced original image would be called source image (as the name of this class). In order to be able to use this class for different relation types (DICOM would call it purposes), the purposeTag is used. It must be specified when creating a rule instance. The purposeTag will be used as suffix for the rule ID of the instance and therefore allows to create specific and distinguishable rules instances based on this class. One may also specify the display name and the role names of the instance. If not specified the default values are used (display name: "<purposeTag> relation", source role name: "derived data", destination role name: "source image")

Definition at line 44 of file mitkSourceImageRelationRule.h.

Member Typedef Documentation

◆ ConstPointer

◆ InstanceIDType

◆ InstanceIDVectorType

◆ Pointer

◆ RelationUIDType

◆ RelationUIDVectorType

◆ RuleIDType

◆ Self

◆ Superclass

Constructor & Destructor Documentation

◆ SourceImageRelationRule() [1/4]

mitk::SourceImageRelationRule::SourceImageRelationRule ( )
protected

Definition at line 69 of file mitkSourceImageRelationRule.cpp.

◆ SourceImageRelationRule() [2/4]

mitk::SourceImageRelationRule::SourceImageRelationRule ( const RuleIDType purposeTag)
protected

Definition at line 73 of file mitkSourceImageRelationRule.cpp.

◆ SourceImageRelationRule() [3/4]

mitk::SourceImageRelationRule::SourceImageRelationRule ( const RuleIDType purposeTag,
const std::string &  displayName 
)
protected

Definition at line 76 of file mitkSourceImageRelationRule.cpp.

◆ SourceImageRelationRule() [4/4]

mitk::SourceImageRelationRule::SourceImageRelationRule ( const RuleIDType purposeTag,
const std::string &  displayName,
const std::string &  sourceRole,
const std::string &  destinationRole 
)
protected

Definition at line 80 of file mitkSourceImageRelationRule.cpp.

◆ ~SourceImageRelationRule()

mitk::SourceImageRelationRule::~SourceImageRelationRule ( )
overrideprotecteddefault

Member Function Documentation

◆ Connect()

mitk::SourceImageRelationRule::RelationUIDType mitk::SourceImageRelationRule::Connect ( Image source,
const Image destination 
) const

Connects to passed images.

Remarks
destination must specifiy DICOM SOP Instance UIDs (0x0008, 0x0018) and DICOM SOP Class UID (0x0008, 0x0016) in order to establish a connection on the data layer.

Definition at line 64 of file mitkSourceImageRelationRule.cpp.

References mitk::PropertyRelationRuleBase::Connect().

◆ Connect_datalayer()

void mitk::SourceImageRelationRule::Connect_datalayer ( IPropertyOwner source,
const IPropertyProvider destination,
const InstanceIDType instanceID 
) const
overrideprotectedvirtual

Is called by Connect() to ensure that source has correctly set properties to resemble the relation on the data layer. This means that the method should set the properties that describe and encode the relation on the data layer (data-layer-specific relation properties). If the passed instance are already connected, the old settings should be overwritten. Connect() will ensure that source and destination are valid pointers.

Parameters
instanceIDis the ID for the relation instance that should be connected. Existance of the relation instance is ensured.
Precondition
source must be a valid instance.
destination must be a valid instance.

Implements mitk::PropertyRelationRuleBase.

Definition at line 268 of file mitkSourceImageRelationRule.cpp.

References mitk::PropertyKeyPath::AddElement(), mitk::PropertyKeyPath::AddSelection(), CreateNewSourceImageSequenceItem(), mitk::GeneratePropertyNameForDICOMTag(), mitk::IPropertyProvider::GetConstProperty(), GetReferenceSequenceIndices(), mitk::PropertyRelationRuleBase::GetRootKeyPath(), MITK_DEBUG, mitk::StringProperty::New(), mitk::PropertyKeyPathToPropertyName(), and mitk::IPropertyOwner::SetProperty().

◆ CreateNewSourceImageSequenceItem()

mitk::PropertyKeyPath::ItemSelectionIndex mitk::SourceImageRelationRule::CreateNewSourceImageSequenceItem ( IPropertyOwner source) const
protected

Prepares a new reference to an image on the data layer. Therefore an unused and valid sequence item index for the passed source will be genarated and a relationUID property with the relationUID will be set to block the instance ID. The instance ID will be returned.

Remarks
The method is guarded by a class wide mutex to avoid racing conditions in a scenario where rules are used concurrently.

Definition at line 213 of file mitkSourceImageRelationRule.cpp.

References mitk::PropertyKeyPath::AddAnySelection(), mitk::PropertyKeyPath::AddElement(), mitk::PropertyKeyPath::AddSelection(), mitk::PropertyRelationRuleBase::GetPropertyKeys(), mitk::TemporoSpatialStringProperty::New(), mitk::PropertyKeyPathToPropertyName(), mitk::PropertyKeyPathToPropertyRegEx(), and mitk::IPropertyOwner::SetProperty().

Referenced by Connect_datalayer().

◆ Disconnect_datalayer()

void mitk::SourceImageRelationRule::Disconnect_datalayer ( IPropertyOwner source,
const InstanceIDType instanceID 
) const
overrideprotectedvirtual

This method is called by Disconnect() to remove all properties of the relation from the source that are set by Connect_datalayer().

Remarks
All RII-properties of this relation will removed by Disconnect() after this method call. If the relationUID is not part of the source. Nothing will be changed. Disconnect() ensures that source is a valid pointer if called.
Disconnect() ensures that sourece is valid and only invokes if instance exists.

Implements mitk::PropertyRelationRuleBase.

Definition at line 311 of file mitkSourceImageRelationRule.cpp.

References mitk::PropertyKeyPath::AddAnyElement(), mitk::PropertyKeyPath::AddElement(), mitk::PropertyKeyPath::AddSelection(), mitk::IPropertyProvider::GetConstProperty(), mitk::IPropertyOwner::GetNonConstProperty(), mitk::PropertyRelationRuleBase::GetPropertyKeys(), GetReferenceSequenceIndices(), mitk::PropertyRelationRuleBase::GetRootKeyPath(), mitk::StringProperty::New(), mitk::PropertyKeyPathToPropertyName(), mitk::PropertyKeyPathToPropertyRegEx(), mitk::PropertyNameToPropertyKeyPath(), mitk::IPropertyOwner::RemoveProperty(), and mitk::IPropertyOwner::SetProperty().

◆ GetClassHierarchy()

virtual std::vector<std::string> mitk::SourceImageRelationRule::GetClassHierarchy ( ) const
inlineoverridevirtual

Reimplemented from mitk::PropertyRelationRuleBase.

Definition at line 47 of file mitkSourceImageRelationRule.h.

◆ GetClassName()

virtual const char* mitk::SourceImageRelationRule::GetClassName ( ) const
virtual

Reimplemented from mitk::PropertyRelationRuleBase.

◆ GetDestinationRoleName()

std::string mitk::SourceImageRelationRule::GetDestinationRoleName ( ) const
overridevirtual

Returns a human readable string that can be used to describe the role of a destination in context of the rule instance.

Implements mitk::PropertyRelationRuleBase.

Definition at line 48 of file mitkSourceImageRelationRule.cpp.

◆ GetDisplayName()

std::string mitk::SourceImageRelationRule::GetDisplayName ( ) const
overridevirtual

Returns a human readable string that can be used to describe the rule. Does not need to be unique.

Implements mitk::PropertyRelationRuleBase.

Definition at line 38 of file mitkSourceImageRelationRule.cpp.

◆ GetInstanceID_datalayer()

mitk::SourceImageRelationRule::InstanceIDVectorType mitk::SourceImageRelationRule::GetInstanceID_datalayer ( const IPropertyProvider source,
const IPropertyProvider destination 
) const
overrideprotectedvirtual

Is called if a instance ID cannot be deduced on the ID-layer. Implement this method to check which existing relation(s) as Connected_Data exists between both passed instances. If the passed instances have no explicit relation of type Connected_Data, an empty vector will be returned.

Remarks
Per definition of property relation rules only 0 or 1 instance should be found for one provider pair and rule. But the data layer may be ambiguous and there for muliple relation instances of the rule instance could match. The implementation of this function should report all relation instances. The calling function will take care of this violation.
Precondition
source must be a pointer to a valid IPropertyProvider instance.
destination must be a pointer to a valid IPropertyProvider instance.

Implements mitk::PropertyRelationRuleBase.

Definition at line 86 of file mitkSourceImageRelationRule.cpp.

References mitk::IPropertyProvider::GetConstProperty(), mitk::PropertyRelationRuleBase::GetInstanceIDByPropertyName(), mitk::PropertyRelationRuleBase::GetPropertyKeys(), GetReferenceSequenceIndices(), mitk::PropertyRelationRuleBase::GetRIIPropertyRegEx(), mitk::PropertyRelationRuleBase::GetRuleIDByInstanceID(), and IsSupportedRuleID().

◆ GetReferenceSequenceIndices()

std::vector< std::string > mitk::SourceImageRelationRule::GetReferenceSequenceIndices ( const IPropertyProvider source,
const IPropertyProvider destination = nullptr 
) const
protected

◆ GetRuleID()

mitk::SourceImageRelationRule::RuleIDType mitk::SourceImageRelationRule::GetRuleID ( ) const
overridevirtual

Returns an ID string that identifies the rule class

Implements mitk::PropertyRelationRuleBase.

Definition at line 33 of file mitkSourceImageRelationRule.cpp.

Referenced by IsSupportedRuleID().

◆ GetSourceRoleName()

std::string mitk::SourceImageRelationRule::GetSourceRoleName ( ) const
overridevirtual

Returns a human readable string that can be used to describe the role of a source in context of the rule instance.

Implements mitk::PropertyRelationRuleBase.

Definition at line 43 of file mitkSourceImageRelationRule.cpp.

◆ GetStaticNameOfClass()

static const char* mitk::SourceImageRelationRule::GetStaticNameOfClass ( )
inlinestatic

Definition at line 47 of file mitkSourceImageRelationRule.h.

◆ HasImplicitDataRelation()

bool mitk::SourceImageRelationRule::HasImplicitDataRelation ( const IPropertyProvider source,
const IPropertyProvider destination 
) const
overrideprotectedvirtual

Is called by HasRelation() if no relation of type Connected_ID (GetInstanceID_IDLayer()) or Connected_Data (GetInstanceID_datalayer()) is evident. Implement this method to deduce if the passed instances have a relation of type Implicit_Data.

Precondition
source must be a pointer to a valid IPropertyProvider instance.
destination must be a pointer to a valid IPropertyProvider instance.

Implements mitk::PropertyRelationRuleBase.

Definition at line 176 of file mitkSourceImageRelationRule.cpp.

References mitk::PropertyKeyPath::AddElement(), mitk::PropertyKeyPath::AddSelection(), mitk::IPropertyProvider::GetConstProperty(), GetReferenceSequenceIndices(), IsAbstract(), and mitk::PropertyKeyPathToPropertyName().

◆ InternalClone()

itk::LightObject::Pointer mitk::SourceImageRelationRule::InternalClone ( ) const
overrideprotected

Definition at line 371 of file mitkSourceImageRelationRule.cpp.

References New().

◆ IsAbstract()

bool mitk::SourceImageRelationRule::IsAbstract ( ) const
overridevirtual

Returns if the instance is a abstract rule (true). Default implementation is true. Overwrite and reimplement if another behavior is needed.

Reimplemented from mitk::PropertyRelationRuleBase.

Definition at line 23 of file mitkSourceImageRelationRule.cpp.

Referenced by GetReferenceSequenceIndices(), HasImplicitDataRelation(), and IsSupportedRuleID().

◆ IsDestinationCandidate()

bool mitk::SourceImageRelationRule::IsDestinationCandidate ( const IPropertyProvider owner) const
overridevirtual

This method checks if owner is eligible to be a Destination for the rule. The default implementation returns a True for every valid IPropertyProvider (so only a null_ptr results into false). May be reimplement by derived rules if they have requirements on potential Sources).

Reimplemented from mitk::PropertyRelationRuleBase.

Definition at line 53 of file mitkSourceImageRelationRule.cpp.

References image.

◆ IsSupportedRuleID()

bool mitk::SourceImageRelationRule::IsSupportedRuleID ( const RuleIDType ruleID) const
overrideprotectedvirtual

Returns if the passed rule ID is supported/relevant for the rule. Either because it is the very ID of the rule (default implementation) or because it is an abstract rule which also supports the rule ID.

Returns
true: If the rule ID can handle the rule ID. false: the rule does not support the rule ID.

Reimplemented from mitk::PropertyRelationRuleBase.

Definition at line 28 of file mitkSourceImageRelationRule.cpp.

References GetRuleID(), and IsAbstract().

Referenced by GetInstanceID_datalayer().

◆ New() [1/4]

static Pointer mitk::SourceImageRelationRule::New ( )
static

Referenced by InternalClone().

◆ New() [2/4]

static Pointer mitk::SourceImageRelationRule::New ( const RuleIDType _arg)
inlinestatic

Definition at line 49 of file mitkSourceImageRelationRule.h.

◆ New() [3/4]

static Pointer mitk::SourceImageRelationRule::New ( const RuleIDType _arga,
const std::string &  _argb 
)
inlinestatic

Definition at line 50 of file mitkSourceImageRelationRule.h.

◆ New() [4/4]

static Pointer mitk::SourceImageRelationRule::New ( const RuleIDType _arga,
const std::string &  _argb,
const std::string &  _argc,
const std::string &  _argd 
)
inlinestatic

Definition at line 51 of file mitkSourceImageRelationRule.h.


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