Error with new extension Elastix

Operating system:MacOS 10.12.4
Slicer version:Slicer-4.7.0-2017-05-02-macosx-amd64
Expected behavior:successful registration between two volume
Actual behavior:“KeyError: ‘LD_LIBRARY_PATH’”
Hey there, I am trying to register with this new extension Elastix. I have installed the extension and the Elastix toolbox from its official website. I can call elastix successfully in the terminal. However, when I am trying to register two volume, I have got this error:

Volume registration is started in working directory: /var/folders/z8/4grvc78d4nn0d4nhy2l4869w0000gn/T/Slicer/Elastix/20170507_000009_410
Register volumes…
Register volumes using: /Applications/elastix_macosx64_v4.8/bin/elastix: [‘-f’, u’/var/folders/z8/4grvc78d4nn0d4nhy2l4869w0000gn/T/Slicer/Elastix/20170507_000009_410/input/fixed.mha’, ‘-m’, u’/var/folders/z8/4grvc78d4nn0d4nhy2l4869w0000gn/T/Slicer/Elastix/20170507_000009_410/input/moving.mha’, ‘-out’, u’/var/folders/z8/4grvc78d4nn0d4nhy2l4869w0000gn/T/Slicer/Elastix/20170507_000009_410/result-transform’, ‘-p’, ‘/Applications/Slicer.app/Contents/Extensions-25996/SlicerElastix/lib/Slicer-4.7/qt-scripted-modules/Resources/RegistrationParameters/Parameters_Rigid.txt’, ‘-p’, ‘/Applications/Slicer.app/Contents/Extensions-25996/SlicerElastix/lib/Slicer-4.7/qt-scripted-modules/Resources/RegistrationParameters/Parameters_BSpline.txt’]
‘LD_LIBRARY_PATH’
Traceback (most recent call last):
File “/Applications/Slicer.app/Contents/Extensions-25996/SlicerElastix/lib/Slicer-4.7/qt-scripted-modules/Elastix.py”, line 327, in onApplyButton
movingVolumeMaskNode = self.movingVolumeMaskSelector.currentNode())
File “/Applications/Slicer.app/Contents/Extensions-25996/SlicerElastix/lib/Slicer-4.7/qt-scripted-modules/Elastix.py”, line 556, in registerVolumes
ep = self.startElastix(inputParamsElastix)
File “/Applications/Slicer.app/Contents/Extensions-25996/SlicerElastix/lib/Slicer-4.7/qt-scripted-modules/Elastix.py”, line 466, in startElastix
return subprocess.Popen([executableFilePath] + cmdLineArguments, env=self.getElastixEnv(),
File “/Applications/Slicer.app/Contents/Extensions-25996/SlicerElastix/lib/Slicer-4.7/qt-scripted-modules/Elastix.py”, line 433, in getElastixEnv
elastixEnv[“LD_LIBRARY_PATH”] = elastixLibDir + os.pathsep + elastixEnv[“LD_LIBRARY_PATH”]
KeyError: ‘LD_LIBRARY_PATH’

I could not figure this problem out, Any help will be appreciated.
Sincerely
Kaiwei Han M.D.
Department of Neurosurgery, Changzheng Hospital, Shanghai, China.

I’ve made the path setup more robust, which hopefully will fix the problem.

To try the fix right now, update “/Applications/Slicer.app/Contents/Extensions-25996/SlicerElastix/lib/Slicer-4.7/qt-scripted-modules/Elastix.py” file on your computer: change elastixEnv["LD_LIBRARY_PATH"]... line to the one shown here: https://github.com/lassoan/SlicerElastix/blob/master/Elastix/Elastix.py#L433

Or, use Slicer’s nightly version that you download tomorrow or later.

1 Like

to Andras Lasso,thank you very much,problem solved.