Skip to content

ENH: Added support in vtkMRMLNode for multiple references to the same node

Fixed limitations of node references:

  • Node reference modification request (SetAndObserveNthNodeReferenceID) was ignored if only events were different. This caused an issue in OpenIGTLinkIF, because different nodes in the same role required different event observations and so the role-default events that were restored from the scene were not correct.
  • One node could only be referenced a single time only, otherwise the most recently added/removed/modified reference overwrote all the previous event observations. This limitation was not acceptable, because even a temporarily created reference (the user selects a node as input that is already selected as an input in another node selector) could remove event observations. This caused an issue in Fiducial registration wizard, which has two input fiducial lists, and when the user selected one input fiducial list it often removed the observer from the other input fiducial list.

Other related changes:

  • Added more node reference tests
  • Simplified node references implementation: all reference add/remove/modification operations go through a single method (SetAndObserveNthNodeReferenceID), previously there were many potential execution path for these operations, which made it difficult to make changes consistently.
  • Fixed ObserverManager to update the observation even if only events or priorities are changed.
  • Made vtkMRMLNodeReference data members ReferencingNode, ReferencedNode, Events accessible only by get/set functions to allow consistency checks.
  • Renamed vtkMRMLNode::RemoveAllNodeReferenceIDs to RemoveNodeReferenceIDs to be consistent with similar method names

Merge request reports