OSError:在主机pc上未找到命令"N4BiasFieldCorrection“。请检查是否安装了相应的包。
我在使用nipype.can时遇到问题,请帮助我?
from nipype.interfaces.ants import N4BiasFieldCorrection
n4 = N4BiasFieldCorrection()
n4.inputs.dimension = 3
n4.inputs.input_image =('/home/abhayadev/Desktop/project/Dataset/BRATS2013_CHALLENGE/Challenge/HG/0301/VSD.Brain.XX.O.MR_Flair/VSD.Brain.XX.O.MR_Flair.17572.mha')
n4.inputs.n_iterations = [20, 20, 10, 5]
n4.run()
res=n4.run()
print(res)输出:
``OSError Traceback (most recent call last)
<ipython-input-10-49ae4ec58583> in <module>
5 n4.inputs.input_image =`enter code here`('/home/abhayadev/Desktop/project/Dataset/BRATS2013_CHALLENGE/Challenge/HG/0301/VSD.Brain.XX.O.MR_Flair/VSD.Brain.XX.O.MR_Flair.17572.mha')
6 n4.inputs.n_iterations = [20, 20, 10, 5]
----> 7 n4.run()
8 res=n4.run()
9 print(res)
~/anaconda3/lib/python3.7/site-packages/nipype/interfaces/base/core.py in run(self, cwd, ignore_exception, **inputs)
374 try:
375 runtime = self._pre_run_hook(runtime)
--> 376 runtime = self._run_interface(runtime)
377 runtime = self._post_run_hook(runtime)
378 outputs = self.aggregate_outputs(runtime)
~/anaconda3/lib/python3.7/site-packages/nipype/interfaces/base/core.py in _run_interface(self, runtime, correct_return_codes)
750 'No command "%s" found on host %s. Please check that the '
751 'corresponding package is installed.' % (executable_name,
--> 752 runtime.hostname))
753
754 runtime.command_path = cmd_path
OSError: No command "N4BiasFieldCorrection" found on host abhayadev. Please check that the corresponding package is installed.发布于 2020-03-06 16:54:59
您需要在PATH变量中包含ANTS的安装目录。来自the install guide
假设您的安装前缀是/opt/ ANTs,现在将有一个包含and可执行文件和脚本的二进制目录/opt/ANTs/bin。脚本还要求ANTSPATH指向bin目录,包括尾部斜杠。
对于bash shell ( Mac和一些Linux上的默认设置),您需要设置
export ANTSPATH=/opt/ANTs/bin/ export PATH=${ANTs}:$PATH
如果在neurodocker中使用nipype (建议),则必须使用:source activate neuro才能使ANTS命令可用。
https://stackoverflow.com/questions/58015188
复制相似问题