本文介绍了“在主机上找不到命令'bet'"通过Python 3.5在Windows 10的FSL中使用BET时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need to perform brain extraction on .nii images.I am using Anaconda on Windows 10 and have an environment based on Python 3.5.4.On Nipype I found the BET from FSL and I followed the code:

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中的虚拟机,这是不可能的.好吧,这是我得到的输出:

Please note that I expect the output file example_bet.nii to be created by fsl.BET, not to be an image to be overwritten.I can only find solutions based on Unix systems and it seems one needs to have FSL installed on a Unix-based OS, which is not possible without a Virtual Machine in Windows.Well, this is the output I get:

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还是可以解决?

Do I need to switch to Linux or is there a way around it?

推荐答案

您只能通过 Docker在Windows上使用FSL.虚拟机适用于Linux的Windows子系统.天真地运行它是不可能的.

You can only use FSL on Windows via Docker, Virtual Machine, or Windows Subsystem for Linux. Running it naively is not possible.

这篇关于“在主机上找不到命令'bet'"通过Python 3.5在Windows 10的FSL中使用BET时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-29 15:37