Operating system: Linux Ubuntu 18.04.5 LTS
Slicer version: 4.11.20210226-linux-amd64
Expected behavior: saving a nifti file using saveNode
Actual behavior: not saving
Hi all, I have a code written in python which should load some volumes and a transform and use the module brain resample.
It seems to work fine and when I run it using the command:
./Slicer --no-main-window --python-script /home/user/Desktop/test_3D_slicer.py
it outputs a table with standard output and at the end the line: "Resample Image (BRAINS) completed without errors. The problem is that it doesn’t save the new resampled image. I attach part of the code I use below. This is within a for loop where I change all parameters each iteration.
resampledNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLLabelMapVolumeNode') parameters = {'inputVolume': itemCT, 'referenceVolume': itemMR, 'outputVolume': resampledNode, 'warpTransform': itemTransform, 'interpolationMode': 'Linear'} slicer.cli.run(slicer.modules.brainsresample, None, parameters) slicer.util.saveNode(resampledNode, output_filename)
It seems to run fine except for not saving the new nifti. But if I copy paste each line of my code in the python interactor (CTRL+3) for just one iteration, it saves it and also in the right folder so surely output_filename is defined correctly.
Any ideas why this happens?