Skip to content

Commit

Permalink
ENH: adding support for slicer.app.openNodeModule by implementing req…
Browse files Browse the repository at this point in the history
…uired methods

- a confidence value of 0.7 is returned if parameter node belongs to Elastix and otherwise 0.0
- Slicer will be able to identify and open the corresponding user interface for
  directly editing the parameters saved in the parameter node
  • Loading branch information
che85 authored and lassoan committed Jun 21, 2023
1 parent 3ae5314 commit 28c40f0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Elastix/Elastix.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
self.parent.title = "General Registration (Elastix)"
self.parent.categories = ["Registration"]
self.parent.associatedNodeTypes = ["vtkMRMLScriptedModuleNode"]
self.parent.dependencies = []
self.parent.contributors = ["Andras Lasso (PerkLab - Queen's University), Christian Herz (CHOP)"]
self.parent.helpText = """Align volumes based on image content using <a href="http://elastix.isi.uu.nl/">Elastix medical image registration toolbox</a>.
Expand Down Expand Up @@ -54,6 +55,13 @@ def __init__(self, parent=None):
self._parameterNode = None
self._updatingGUIFromParameterNode = False

def setEditedNode(self, node, role='', context=''):
self.setParameterNode(node)
return node is not None

def nodeEditable(self, node):
return 0.7 if node is not None and node.GetAttribute('ModuleName') == self.moduleName else 0.0

def setup(self):
ScriptedLoadableModuleWidget.setup(self)

Expand Down Expand Up @@ -127,7 +135,7 @@ def onSceneEndClose(self, caller, event):
self.initializeParameterNode()

def initializeParameterNode(self):
self.setParameterNode(self.logic.getParameterNode())
self.setParameterNode(self.logic.getParameterNode() if not self._parameterNode else self._parameterNode)

def setParameterNode(self, inputParameterNode):
if inputParameterNode:
Expand Down

0 comments on commit 28c40f0

Please sign in to comment.