Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkSourceImageRelationRule.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkSourceImageRelationRule_h
14 #define mitkSourceImageRelationRule_h
15 
17 #include <mitkImage.h>
18 
19 namespace mitk
20 {
54  {
55  public:
57  itkNewMacro(Self);
59  mitkNewMacro2Param(Self, const RuleIDType &, const std::string &);
60  mitkNewMacro4Param(Self, const RuleIDType &, const std::string &, const std::string &, const std::string &);
61 
65 
67  RuleIDType GetRuleID() const override;
68 
70  bool IsAbstract() const override;
71 
73  std::string GetDisplayName() const override;
74 
76  std::string GetSourceRoleName() const override;
77 
79  std::string GetDestinationRoleName() const override;
80 
82  bool IsDestinationCandidate(const IPropertyProvider *owner) const override;
83 
92  RelationUIDType Connect(Image *source, const Image *destination) const;
93 
94  protected:
97 
102 
107  SourceImageRelationRule(const RuleIDType &purposeTag, const std::string &displayName);
108 
116  const std::string &displayName,
117  const std::string &sourceRole,
118  const std::string &destinationRole);
119 
120  ~SourceImageRelationRule() override = default;
121 
124 
131  std::vector<std::pair<size_t, std::string> > GetReferenceSequenceIndices(const IPropertyProvider * source,
132  const IPropertyProvider* destination = nullptr, InstanceIDVectorType ignoreInstances = {}) const;
133 
136  const IPropertyProvider* destination, const InstanceIDVectorType& instances_IDLayer) const override;
137 
139  const IPropertyProvider *destination,
140  const InstanceIDType &instanceID) const override;
141 
142  void Disconnect_datalayer(IPropertyOwner *source, const RelationUIDType& relationUID) const override;
143 
144  bool IsSupportedRuleID(const RuleIDType& ruleID) const override;
145 
147 
149 
159 
161  std::string GenerateRuleID(const std::string& purpose) const;
162 
163  private:
164  RuleIDType m_PurposeTag;
165  std::string m_DisplayName;
166  std::string m_SourceRole;
167  std::string m_DestinationRole;
168  };
169 
170 } // namespace mitk
171 
172 #endif
#define MITKCORE_EXPORT
Interface implemented by classes that provide write/read access to property information.
Interface implemented by classes that provide access to property information.
Image class for storing multi-dimensional medical image data.
Definition: mitkImage.h:76
Base class for defining and detecting property-based relations between data objects.
std::vector< RelationUIDType > RelationUIDVectorType
std::vector< std::pair< RelationUIDType, RuleIDType > > DataRelationUIDVectorType
std::vector< InstanceIDType > InstanceIDVectorType
Relation rule for referencing an image as the source of a destination entity.
bool IsAbstract() const override
Return whether this rule is abstract (i.e. has no purpose tag).
SourceImageRelationRule(const SourceImageRelationRule &other)
RuleIDType GetRuleID() const override
Return an ID string that identifies the rule class.
SourceImageRelationRule()
Default constructor. Creates an abstract rule with no purpose tag.
void Disconnect_datalayer(IPropertyOwner *source, const RelationUIDType &relationUID) const override
mitkNewMacro2Param(Self, const RuleIDType &, const std::string &)
std::string GenerateRuleID(const std::string &purpose) const
Generate a rule ID string from the given purpose tag.
mitkNewMacro4Param(Self, const RuleIDType &, const std::string &, const std::string &, const std::string &)
virtual DataRelationUIDVectorType GetRelationUIDs_DataLayer(const IPropertyProvider *source, const IPropertyProvider *destination, const InstanceIDVectorType &instances_IDLayer) const override
SourceImageRelationRule(const RuleIDType &purposeTag, const std::string &displayName)
Construct a rule with a purpose tag and display name.
RelationUIDType Connect(Image *source, const Image *destination) const
Connect two images using this relation rule.
SourceImageRelationRule(const RuleIDType &purposeTag)
Construct a rule with a specific purpose tag.
mitkNewMacro1Param(Self, const RuleIDType &)
~SourceImageRelationRule() override=default
std::vector< std::pair< size_t, std::string > > GetReferenceSequenceIndices(const IPropertyProvider *source, const IPropertyProvider *destination=nullptr, InstanceIDVectorType ignoreInstances={}) const
Get reference sequence indices from the DICOM Source Image Sequence (0008,2112).
std::string GetDisplayName() const override
Return a human-readable string describing the rule. Does not need to be unique.
PropertyKeyPath::ItemSelectionIndex CreateNewSourceImageSequenceItem(IPropertyOwner *source) const
Prepare a new reference to an image on the data layer.
bool IsSupportedRuleID(const RuleIDType &ruleID) const override
std::string GetSourceRoleName() const override
Return a human-readable string describing the role of a source in the context of this rule.
std::string GetDestinationRoleName() const override
Return a human-readable string describing the role of a destination in the context of this rule.
mitkClassMacro(SourceImageRelationRule, PropertyRelationRuleBase)
SourceImageRelationRule(const RuleIDType &purposeTag, const std::string &displayName, const std::string &sourceRole, const std::string &destinationRole)
Construct a rule with all customizable parameters.
void Connect_datalayer(IPropertyOwner *source, const IPropertyProvider *destination, const InstanceIDType &instanceID) const override
bool IsDestinationCandidate(const IPropertyProvider *owner) const override
Check whether the given property provider qualifies as a destination for this rule.
Find image slices visible on a given plane.