Skip to content

Commit

Permalink
ENH: Add node references from output transform to inputs
Browse files Browse the repository at this point in the history
This is related to the recent changes in Slicer, SlicerExecutionModel, and BRAINSTools, the goal of which is to update registration modules to have the output transforms reference the inputs (images/fiducial lists/models, fixed and moving separately).
  • Loading branch information
cpinter authored and lassoan committed Apr 2, 2019
1 parent 631eb01 commit 9b0a159
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Elastix/Elastix.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def getStartupInfo(self):
info.dwFlags = 1
info.wShowWindow = 0
return info

def startElastix(self, cmdLineArguments):
self.addLog("Register volumes...")
import subprocess
Expand All @@ -488,7 +488,7 @@ def startTransformix(self, cmdLineArguments):
self.addLog("Generate output...")
import subprocess
executableFilePath = os.path.join(self.getElastixBinDir(), self.transformixFilename)
logging.info("Generate output using: " + executableFilePath + ": " + repr(cmdLineArguments))
logging.info("Generate output using: " + executableFilePath + ": " + repr(cmdLineArguments))
if subprocess.mswindows:
return subprocess.Popen([os.path.join(self.getElastixBinDir(),self.transformixFilename)] + cmdLineArguments, env=self.getElastixEnv(),
stdout=subprocess.PIPE, universal_newlines = True, startupinfo=self.getStartupInfo())
Expand Down Expand Up @@ -617,6 +617,8 @@ def registerVolumes(self, fixedVolumeNode, movingVolumeNode, parameterFilenames
slicer.mrmlScene.RemoveNode(loadedOutputTransformNode)
else:
self.addLog("Failed to load output transform from "+outputTransformPath)
outputTransformNode.AddNodeReferenceID(slicer.vtkMRMLTransformNode.GetMovingNodeReferenceRole(), movingVolumeNode.GetID())
outputTransformNode.AddNodeReferenceID(slicer.vtkMRMLTransformNode.GetFixedNodeReferenceRole(), fixedVolumeNode.GetID())

# Clean up
if self.deleteTemporaryFiles:
Expand Down

0 comments on commit 9b0a159

Please sign in to comment.