Hi all,
Does anyone know what is the correct code for resampling and resave the volume file as mhd format?
Basically, what I have is a nrrd file named disp, a reference nrrd file named ref, and a tranform file named tran.
I would like to go to the module of ’ Resample Scalar/Vector/DWI Volume’ and output a new vector volume, and save this new output vector volume as mhd format.
This is what I used.
############# save as mhd file
parameters = {}
parameters[‘inputVolume’] = slicer.util.getNode(‘DISP’)
#Set output as vector volume
parameters[‘outputVolume’] = slicer.util.getNode(‘DISP’)
parameters[‘referenceVolume’] = slicer.util.getNode(REF)
parameters[‘transformationFile’] = slicer.util.getNode(‘TRAN’)
parameters[‘interpolationType’] = interpolationType
cliNode = slicer.cli.runSync(slicer.modules.resamplescalarvectordwivolume,None,parameters)
volumeNode = slicer.mrmlScene.GetFirstNodeByClass(‘vtkMRMLScalarVolumeNode’)
slicer.util.saveNode(volumeNode , outputDisplacementfield_resampled,{“useCompression”: 0})
But this is wrong, I am so confused that I can not get the correct output from my code. Does anyone help me to check my code?
Thanks for any kinds of discussion and help.
Best,
Chuan