Hello,
I want to implement BSpline registration in a custom module in a seamless way for the user. For the registration I want to use Elastix with the “Generic (all)” preset.
I imported Elastix logic and used ElastixLogic.registerVolumes. I linked it to a Push Button to trigger the registration. My current code is :
def onRegistrationPushed(self):
FixedVolume = self.ui.SeqFixeSelector.currentNode()
MovingVolume = self.ui.SeqVariableSelector.currentNode()
parameters = "Parameters_BSpline.txt"
Transform = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLBSplineTransformNode")
volumesLogic = slicer.modules.volumes.logic()
OutputVolume = volumesLogic.CloneVolume(slicer.mrmlScene, MovingVolume, MovingVolume.GetName() + '_Registered' )
ElastixLogic.registerVolumes(self,FixedVolume, MovingVolume,parameters,OutputVolume, Transform)
However, when I tried to run it in 3DSlicer with 2 image sequences, it gave the error :
AttributeError: ‘GemSegmentWidget’ object has no attribute ‘createTempDirectory’
GemSegment is my module’s name. Digging a bit I saw that createTempDirectory is a function from Elastix.py, but then I don’t understand why it doesn’t search for it there. I tried to integrate createTempDirectory to my module’s .py file but it just moved the problem upwards, asking for the getTempDirectoryBase function.
If someone can help me understand how to properly use Elastix in my module I would be very glad ! Thank you !