Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::GenericIDRelationRule Class Reference

Relation rule for ID-only relations between IIdentifiable property providers. More...

#include <mitkGenericIDRelationRule.h>

Inheritance diagram for mitk::GenericIDRelationRule:
Collaboration diagram for mitk::GenericIDRelationRule:

Public Types

using RuleIDType = PropertyRelationRuleBase::RuleIDType
 
using RelationUIDType = PropertyRelationRuleBase::RelationUIDType
 
using RelationUIDVectorType = PropertyRelationRuleBase::RelationUIDVectorType
 
- Public Types inherited from mitk::PropertyRelationRuleBase
enum class  RelationType { None , Data , ID , Complete }
 
using RuleIDType = std::string
 
using RelationUIDType = Identifiable::UIDType
 
using RelationUIDVectorType = std::vector< RelationUIDType >
 
using RelationVectorType = std::vector< RelationType >
 
using InstanceIDType = std::string
 

Public Member Functions

 mitkClassMacro (GenericIDRelationRule, PropertyRelationRuleBase)
 
Pointer Clone () const
 
 mitkNewMacro1Param (Self, const RuleIDType &)
 
 mitkNewMacro2Param (Self, const RuleIDType &, const std::string &)
 
 mitkNewMacro4Param (Self, const RuleIDType &, const std::string &, const std::string &, const std::string &)
 
RuleIDType GetRuleID () const override
 Get the rule ID string ("IDRelation_<ruleIDTag>"). More...
 
bool IsAbstract () const override
 Check whether this rule instance is abstract. More...
 
std::string GetDisplayName () const override
 Get a human-readable display name for the rule. More...
 
std::string GetSourceRoleName () const override
 Get a human-readable description of the source role. More...
 
std::string GetDestinationRoleName () const override
 Get a human-readable description of the destination role. More...
 
RelationUIDType Connect (IPropertyOwner *source, const IPropertyProvider *destination) const
 Connect two property providers with an ID-based relation. More...
 
- Public Member Functions inherited from mitk::PropertyRelationRuleBase
 mitkClassMacroItkParent (PropertyRelationRuleBase, itk::Object)
 
Pointer Clone () const
 
 itkCreateAnotherMacro (Self)
 
virtual bool IsSourceCandidate (const IPropertyProvider *owner) const
 
virtual bool IsDestinationCandidate (const IPropertyProvider *owner) const
 
bool IsSource (const IPropertyProvider *owner) const
 
RelationVectorType GetRelationTypes (const IPropertyProvider *source, const IPropertyProvider *destination) const
 
bool HasRelation (const IPropertyProvider *source, const IPropertyProvider *destination, RelationType requiredRelation=RelationType::None) const
 
RelationUIDVectorType GetExistingRelations (const IPropertyProvider *source, RelationType layer=RelationType::None) 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 exclusiveRelation=RelationType::None) const
 
NodePredicateBase::ConstPointer GetDestinationsDetector (const IPropertyProvider *source, RelationType exclusiveRelation=RelationType::None) const
 
NodePredicateBase::ConstPointer GetDestinationDetector (const IPropertyProvider *source, RelationUIDType relationUID) const
 
void Disconnect (IPropertyOwner *source, const IPropertyProvider *destination, RelationType layer=RelationType::Complete) const
 
void Disconnect (IPropertyOwner *source, RelationUIDType relationUID, RelationType layer=RelationType::Complete) const
 
std::vector< PropertyKeyPath > GetRelationPropertyPaths (const IPropertyProvider *source, RelationUIDType relationUID, RelationType layer=RelationType::Data) const
 Get all property key paths relevant for a given relation. More...
 

Protected Types

using InstanceIDType = PropertyRelationRuleBase::InstanceIDType
 
using InstanceIDVectorType = PropertyRelationRuleBase::InstanceIDVectorType
 
using DataRelationUIDVectorType = PropertyRelationRuleBase::DataRelationUIDVectorType
 
- Protected Types inherited from mitk::PropertyRelationRuleBase
using InstanceIDVectorType = std::vector< InstanceIDType >
 
using DataRelationUIDVectorType = std::vector< std::pair< RelationUIDType, RuleIDType > >
 

Protected Member Functions

 GenericIDRelationRule (const RuleIDType &ruleIDTag)
 
 GenericIDRelationRule (const RuleIDType &ruleIDTag, const std::string &displayName)
 
 GenericIDRelationRule (const RuleIDType &ruleIDTag, const std::string &displayName, const std::string &sourceRole, const std::string &destinationRole)
 
 ~GenericIDRelationRule () override=default
 
DataRelationUIDVectorType GetRelationUIDs_DataLayer (const IPropertyProvider *source, const IPropertyProvider *destination, const InstanceIDVectorType &instances_IDLayer) const override
 
void Connect_datalayer (IPropertyOwner *source, const IPropertyProvider *destination, const InstanceIDType &instanceID) const override
 
void Disconnect_datalayer (IPropertyOwner *source, const RelationUIDType &relationUID) const override
 
bool IsSupportedRuleID (const RuleIDType &ruleID) const override
 
 GenericIDRelationRule (const GenericIDRelationRule &other)
 
 mitkCloneMacro (Self)
 
- Protected Member Functions inherited from mitk::PropertyRelationRuleBase
 PropertyRelationRuleBase ()=default
 
 PropertyRelationRuleBase (const PropertyRelationRuleBase &)
 
 ~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
 
std::string GetDestinationUIDByInstanceID (const IPropertyProvider *source, const InstanceIDType &instanceID) const
 
const Identifiable * CastProviderAsIdentifiable (const mitk::IPropertyProvider *provider) const
 

Additional Inherited Members

- Static Public Member Functions inherited from mitk::PropertyRelationRuleBase
static PropertyKeyPath GetRootKeyPath ()
 
static PropertyKeyPath GetRIIPropertyKeyPath (const std::string propName, const InstanceIDType &instanceID)
 
static PropertyKeyPath GetRIIRelationUIDPropertyKeyPath (const InstanceIDType &instanceID="")
 
static PropertyKeyPath GetRIIRuleIDPropertyKeyPath (const InstanceIDType &instanceID="")
 
static PropertyKeyPath GetRIIDestinationUIDPropertyKeyPath (const InstanceIDType &instanceID="")
 
- 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 IPropertyProvider *owner)
 

Detailed Description

Relation rule for ID-only relations between IIdentifiable property providers.

This rule class is used for relations that are defined solely on the ID-layer, with no connection on the Data-layer. It works for all ID-based relations between PropertyProviders that implement the IIdentifiable interface.

The ruleIDTag parameter, specified at construction time, serves as a suffix for the rule ID ("IDRelation_<ruleIDTag>") and allows creating distinguishable rule instances. When ruleIDTag is empty, the rule is abstract and can detect any generic ID relation but cannot create new connections.

Default role names (when not specified):

  • Display name: "<ruleIDTag> relation"
  • Source role: "source of <ruleIDTag> relation"
  • Destination role: "destination of <ruleIDTag> relation"
See also
PropertyRelationRuleBase
SourceImageRelationRule

Definition at line 40 of file mitkGenericIDRelationRule.h.

Member Typedef Documentation

◆ DataRelationUIDVectorType

◆ InstanceIDType

◆ InstanceIDVectorType

◆ RelationUIDType

◆ RelationUIDVectorType

◆ RuleIDType

Constructor & Destructor Documentation

◆ GenericIDRelationRule() [1/4]

mitk::GenericIDRelationRule::GenericIDRelationRule ( const RuleIDType &  ruleIDTag)
protected

◆ GenericIDRelationRule() [2/4]

mitk::GenericIDRelationRule::GenericIDRelationRule ( const RuleIDType &  ruleIDTag,
const std::string &  displayName 
)
protected

◆ GenericIDRelationRule() [3/4]

mitk::GenericIDRelationRule::GenericIDRelationRule ( const RuleIDType &  ruleIDTag,
const std::string &  displayName,
const std::string &  sourceRole,
const std::string &  destinationRole 
)
protected

◆ ~GenericIDRelationRule()

mitk::GenericIDRelationRule::~GenericIDRelationRule ( )
overrideprotecteddefault

◆ GenericIDRelationRule() [4/4]

mitk::GenericIDRelationRule::GenericIDRelationRule ( const GenericIDRelationRule &  other)
protected

Member Function Documentation

◆ Clone()

Pointer mitk::GenericIDRelationRule::Clone ( ) const

◆ Connect()

RelationUIDType mitk::GenericIDRelationRule::Connect ( IPropertyOwner *  source,
const IPropertyProvider *  destination 
) const

Connect two property providers with an ID-based relation.

Creates a new relation or updates an existing one between source and destination. The destination must implement IIdentifiable.

Parameters
[in,out]sourceThe source property owner to add the relation to.
[in]destinationThe destination property provider to relate to.
Returns
The UID of the created or updated relation.
Precondition
source must be a valid instance.
destination must be a valid instance.
The rule must not be abstract.
See also
PropertyRelationRuleBase::Connect

◆ Connect_datalayer()

void mitk::GenericIDRelationRule::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
source
destination
instanceIDis the ID for the relation instance that should be connected. Existence of the relation instance is ensured.
Precondition
source must be a valid instance.
destination must be a valid instance.

Implements mitk::PropertyRelationRuleBase.

◆ Disconnect_datalayer()

void mitk::GenericIDRelationRule::Disconnect_datalayer ( IPropertyOwner *  source,
const RelationUIDType &  relationUID 
) 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
This method should remove all properties that are set for a specific relation by Connect_datalayer(...). 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 source is valid and only invokes if instance exists.

Implements mitk::PropertyRelationRuleBase.

◆ GetDestinationRoleName()

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

Get a human-readable description of the destination role.

Returns
The destination role name string.

Implements mitk::PropertyRelationRuleBase.

◆ GetDisplayName()

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

Get a human-readable display name for the rule.

Returns
The display name string.

Implements mitk::PropertyRelationRuleBase.

◆ GetRelationUIDs_DataLayer()

DataRelationUIDVectorType mitk::GenericIDRelationRule::GetRelationUIDs_DataLayer ( const IPropertyProvider *  source,
const IPropertyProvider *  destination,
const InstanceIDVectorType &  instances_IDLayer 
) const
overrideprotectedvirtual

Returns the RelationUIDs of all relations that are defined by the data layer of source for this rule instance and, if defined, destination. If the passed source (and destination) instance has no relation on the data layer, an empty vector will be returned.

Remarks
Per definition for property relation rules only 0 or 1 instance should be found for one provider pair and concrete rule. But there might be more then one instance because either 1) the rule is abstract and supports multiple rule IDs or 2) the data layer may be ambiguous (e.g. because the destination was not specified) and therefore multiple relation instances of the rule instance could match. The implementation of this function should report all relation instances. The calling function will take care.
Parameters
source
destinationDestination the find relations should point to. If destination is NULL any relation on the data layer for this rule and source are wanted.
instances_IDLayerList of relation instances that are already defined by the ID layer. The implementation of this function should only cover relations that are not already resembled in the passed relarions_IDLayer.
Precondition
source must be a pointer to a valid IPropertyProvider instance.

Implements mitk::PropertyRelationRuleBase.

◆ GetRuleID()

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

Get the rule ID string ("IDRelation_<ruleIDTag>").

Returns
The rule ID string.

Implements mitk::PropertyRelationRuleBase.

◆ GetSourceRoleName()

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

Get a human-readable description of the source role.

Returns
The source role name string.

Implements mitk::PropertyRelationRuleBase.

◆ IsAbstract()

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

Check whether this rule instance is abstract.

The rule is abstract when the ruleIDTag is empty.

Returns
true if the ruleIDTag is empty (abstract rule), false otherwise.

Reimplemented from mitk::PropertyRelationRuleBase.

◆ IsSupportedRuleID()

bool mitk::GenericIDRelationRule::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.

◆ mitkClassMacro()

mitk::GenericIDRelationRule::mitkClassMacro ( GenericIDRelationRule  ,
PropertyRelationRuleBase   
)

◆ mitkCloneMacro()

mitk::GenericIDRelationRule::mitkCloneMacro ( Self  )
protected

◆ mitkNewMacro1Param()

mitk::GenericIDRelationRule::mitkNewMacro1Param ( Self  ,
const RuleIDType &   
)

◆ mitkNewMacro2Param()

mitk::GenericIDRelationRule::mitkNewMacro2Param ( Self  ,
const RuleIDType &  ,
const std::string &   
)

◆ mitkNewMacro4Param()

mitk::GenericIDRelationRule::mitkNewMacro4Param ( Self  ,
const RuleIDType &  ,
const std::string &  ,
const std::string &  ,
const std::string &   
)

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