Perform bulk resamples with python

I would like to perform a bulk resampling on several volumes, each volume has another associated who is the reference. I can use the module Resample Image (BRAINS) to do this, but since they are several ones and it is just a matter of defining Image to warp, Reference image, Output image, interpolation mode and default value and apply, I want to automatize this step.

How can I call recursively the Resample module from within python?

I am currently having problems with the following code

    parameters = {'ImageToWarp':itemCT, 'ReferenceImage':itemSPECT, 'OutputImage':clonedNode, 
                          'InterpolationMode':'Lanczos', 'DefaultValue':minCT}
    slicer.cli.run(slicer.modules.brainsresample, None, parameters)

the output has no data

Ok, my mistake, the correct parameter list is

    parameters = {'inputVolume':itemCT, 'referenceVolume':itemSPECT, 'outputVolume':clonedNode, 
                          'interpolationMode':'Lanczos', 'defaultValue':minCT}

1 Like