"command 'bet' could not be found on host" 在 Windows 10 通过 Python 3.5 在 FSL 中使用 BET 时出错

"command 'bet' could not be found on host" error while using BET in FSL on Windows 10 via Python 3.5

我需要对 .nii 图像执行大脑提取。 我在 Windows 10 上使用 Anaconda,并且有一个基于 Python 3.5.4 的环境。 在 Nipype 上,我从 FSL 找到了 BET,我遵循了代码:

mybet = fsl.BET()
mybet.inputs.in_file = 'example.nii'
mybet.inputs.out_file = 'example_bet.nii' 
result = mybet.run()

请注意,我希望输出文件 example_bet.nii 由 fsl.BET 创建,而不是要覆盖的图像。 我只能找到基于 Unix 系统的解决方案,而且似乎需要在基于 Unix 的 OS 上安装 FSL,如果 Windows 中没有虚拟机,这是不可能的。 嗯,这是我得到的输出:

171122-12:02:48,988 interface WARNING:
     FSLOUTPUTTYPE environment variable is not set. Setting FSLOUTPUTTYPE=NIFTI

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-12-5b900fbd5263> in <module>()
      2 mybet.inputs.in_file = 'prova.nii'
      3 mybet.inputs.out_file = 'prova_bet.nii'
----> 4 result = mybet.run()

~\Anaconda3\envs\tensorflow\lib\site-packages\nipype\interfaces\base.py in run(self, **inputs)
   1079                         version=self.version)
   1080         try:
-> 1081             runtime = self._run_wrapper(runtime)
   1082             outputs = self.aggregate_outputs(runtime)
   1083             runtime.endTime = dt.isoformat(dt.utcnow())

~\Anaconda3\envs\tensorflow\lib\site-packages\nipype\interfaces\base.py in _run_wrapper(self, runtime)
   1722 
   1723     def _run_wrapper(self, runtime):
-> 1724         runtime = self._run_interface(runtime)
   1725         return runtime
   1726 

~\Anaconda3\envs\tensorflow\lib\site-packages\nipype\interfaces\fsl\preprocess.py in _run_interface(self, runtime)
    142         # in stderr and if it's set, then update the returncode
    143         # accordingly.
--> 144         runtime = super(BET, self)._run_interface(runtime)
    145         if runtime.stderr:
    146             self.raise_exception(runtime)

~\Anaconda3\envs\tensorflow\lib\site-packages\nipype\interfaces\base.py in _run_interface(self, runtime, correct_return_codes)
   1748         if not exist_val:
   1749             raise IOError("command '%s' could not be found on host %s" %
-> 1750                           (self.cmd.split()[0], runtime.hostname))
   1751         setattr(runtime, 'command_path', cmd_path)
   1752         setattr(runtime, 'dependencies', get_dependencies(executable_name,

OSError: command 'bet' could not be found on host DESKTOP-MYPC
Interface BET failed to run. 

我需要切换到 Linux 还是有解决办法?

您只能通过 Docker, Virtual Machine, or Windows Subsystem for Linux 在 Windows 上使用 FSL。 运行天真地不可能。