以下の部分的なコードは、エラーなしで機能します。
#fslorient forceneurological
fslorient = pe.Node(interface = fslorient.FslOrient(), name = 'fslorient')
fslorient.inputs.main_option = 'forceneurological'
Node
ただし、同じ script( )で秒を追加するとfslorient
、属性エラーが発生します。
#fslorient deleteorient
fslorient1 = pe.Node(interface = fslorient.FslOrient(), name = 'fslorient1')
fslorient1.inputs.main_option = 'deleteorient'
属性エラー:
Traceback (most recent call last):
File "bs_pipeline.py", line 139, in <module>
fslorient1 = pe.Node(interface = fslorient.FslOrient(), name = 'fslorient1')
AttributeError: 'Node' object has no attribute 'FslOrient'
以下のこのコードは fslorient.py という名前です
from nipype.interfaces.fsl.base import FSLCommand, FSLCommandInputSpec
from nipype.interfaces.base import TraitedSpec, File, traits
import os
class FslOrientInputSpec(FSLCommandInputSpec):
main_option = traits.Str(desc='main option', argstr='-%s', position=0, mandatory=True)
code = traits.Int(argstr='%d', desc='code for setsformcode', position=1)
in_file = File(exists=True, desc='input file', argstr='%s', position=2, mandatory=True)
class FslOrientOutputSpec(TraitedSpec):
out_file = File(desc = "out file", exists = True)
class FslOrient(FSLCommand):
_cmd = 'fslorient'
input_spec = FslOrientInputSpec
output_spec = FslOrientOutputSpec
def _list_outputs(self):
outputs = self.output_spec().get()
outputs['out_file'] = os.path.abspath(self.inputs.in_file)
return outputs
問題が見つかりませんでした。
編集:他のラップも使用しましたが、同じエラーが発生しました!