Skip to content

BUG: Fixed edit properties option in node selectors

Fixes http://www.na-mic.org/Bug/view.php?id=2109

Now any module can associate a MRML node type with a module (instead of having a hardcoded list of modules in qSlicerApplication) and when switching to a module, the chosen node is selected as active node. Associations can be added by calling qSlicerApplication::registerNodeModule(). Multiple modules can be associated with the same MRML node type.

The best module for a specific node instance is determined run-time, by calling qSlicerAbstractModuleWidget::nodeEditable() for each candidate and choosing the one that has the highest confidence in handling the node. This mechanism is used for selecting the CLI module that corresponds to a specific CLI module parameter node. This mechanism is also used for switching to volume rendering module if a volume rendering clipping ROI node is selected for editing (instead of switching to the Annotations module). The most suitable module's qSlicerAbstractModuleWidget::setEditedNode() method is called to select the currently edited node. qSlicerAbstractModuleWidget::nodeEditable() and qSlicerAbstractModuleWidget::setEditedNode() methods can be overridden in scripted loadable modules as well.

As edited node selection is now possible using a clean, unified method call, it is no longer necessary to access GUI widgets directly. Therefore, almost all editProperties() method calls in subject hierarchy plugins were removed (replaced by a common implementation in the base class). This new, simplified method fixes robustness issues of using node name filters for selecting a node in model hierarchy, inability to choose annotation hierarchy nodes, etc.

qSlicerAbstractModuleWidget::setEditedNode(vtkMRMLNode* node, QString role, QString context) has two extra (optional) arguments. Role can be used to specify additional nodes for a module (e.g., if there are multiple inputs for a module then role argument can select between them). Context can be used for specifying a sub-selection within a node (for example, Segment Editor module can be activated for a selected segment - specified by 'context' - of a specific segmentation node - specified by 'node').

Merge request reports

Loading