Hi,
I’m trying to run N4ITK Bias correction (a cli module) from Jupyter Notebook and am struggling with defining the output parameter.
The code I wrote reads my inputs and creates a node, but I don’t know whether it ran (executed the bias correction) and how to save the output. I am working with NIFTII images.
My code:
input_volume=slicer.util.loadVolume(path_to_T1)
slicernb.ViewDisplay()#it worked
mask_volume=slicer.util.loadVolume(path_to_mask)
slicernb.ViewDisplay()#it worked
output_volume=(slicer.mrmlScene.AddNewNodeByClass (“vtkMRMLCommandLineModuleNode”,“Name_for_corrected volume.nii”))
slicer.mrmlScene.AddNode(output_volume)
parameters={}
parameters[‘initialMeshResolution’]=(1,1,1)
parameters[‘splineDistance’]=0.00
parameters[‘bfFWHM’]=0.00
parameters[‘numberOfIterations’]=(200,200,200)
parameters[‘convergenceThreshold’]=0.0001
parameters[‘bsplineOrder’]=3
parameters[‘shrinkFactor’]=4
parameters[‘weightImageName’]=‘None’
parameters[‘wienerFilterNoise’]=0.00
parameters[‘nHistogramBins’]=0
parameters[‘inputImageName’]=input_volume.GetID()
parameters[‘maskImageName’]=mask_volume.GetID()
parameters[‘outputImageName’]=output_volume.GetID()
parameters[‘outputBiasFieldName’]=‘None’
slicer.cli.run(slicer.modules.n4itkbiasfieldcorrection,node=None,parameters=parameters)
How could I make it save a corrected T1 volume?