nipype
nipype copied to clipboard
N4BiasFieldCorrection issues
trafficstars
When I try to use ANTs N4BiasFieldCorrection , I get the following error
No command "N4BiasFieldCorrection" found on host ubuntu. Please check that the corresponding package is installed.
Script/Workflow details
from nipype.interfaces.ants import N4BiasFieldCorrection
n4 = N4BiasFieldCorrection()
n4.inputs.dimension = 3
n4.inputs.input_image = 'structural.nii'
n4.inputs.bspline_fitting_distance = 300
n4.inputs.shrink_factor = 3
n4.inputs.n_iterations = [50,50,30,20]
# n4.run()
print(n4.cmdline)
If I uncomment n4.run(), it returns No command "N4BiasFieldCorrection" found on host ubuntu. Please check that the corresponding package is installed. So I tried using the terminal to run the command returned in print(n4.cmdline)
N4BiasFieldCorrection --bspline-fitting [ 300 ] -d 3 --input-image structural.nii --convergence [ 50x50x30x20 ] --output structural_corrected.nii --shrink-factor 3
and it worked.So I don't know how to solve this problem. And looking forward to your reply, thx!
Execution environment
Python version :3.9.13 Ubantu verison :20.04.5