nipy / nipype

Workflows and interfaces for neuroimaging packages
https://nipype.readthedocs.org/en/latest/
Other
746 stars 529 forks source link

afni.preprocess.TCorrMap is failing. #1681

Open tsalo opened 7 years ago

tsalo commented 7 years ago

Running the cmdline doctest raises an error.

OS: OS X El Capitan 10.11.6 Nipype version: Up-to-date with master No tools are installed, but this should just be an issue with the argument parsing in _format_arg().

from nipype.interfaces import afni
tcm = afni.TCorrMap()
tcm.inputs.in_file = 'functional.nii'
tcm.inputs.mask = 'mask.nii'
tcm.mean_file = 'functional_meancorr.nii'
tcm.cmdline

Traceback (most recent call last):

  File "<ipython-input-4-76b6d542a4b3>", line 6, in <module>
    tcm.cmdline

  File "/Users/salo/Desktop/tsalo/nipype/nipype/interfaces/base.py", line 1678, in cmdline
    allargs = self._parse_inputs()

  File "/Users/salo/Desktop/tsalo/nipype/nipype/interfaces/base.py", line 1915, in _parse_inputs
    arg = self._format_arg(name, spec, value)

  File "/Users/salo/Desktop/tsalo/nipype/nipype/interfaces/afni/preprocess.py", line 2049, in _format_arg
    return trait_spec.argstr % self.inputs.thresholds + [value]

TypeError: a float is required
mgxd commented 7 years ago

@tsalo does #1745 fix this?

tsalo commented 7 years ago

Sorry for the delay. I just updated my fork and tested it, but I'm still getting the same error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/tsalo/Documents/tsalo/nipype/nipype/interfaces/base.py", line 1678, in cmdline
    allargs = self._parse_inputs()
  File "/Users/tsalo/Documents/tsalo/nipype/nipype/interfaces/base.py", line 1915, in _parse_inputs
    arg = self._format_arg(name, spec, value)
  File "/Users/tsalo/Documents/tsalo/nipype/nipype/interfaces/afni/preprocess.py", line 2049, in _format_arg
    return trait_spec.argstr % self.inputs.thresholds + [value]
TypeError: a float is required
satra commented 7 years ago

@tsalo - looks like this interface needs to be fixed.

there is nothing that allows the user to choose what threshold method should be used.

https://github.com/nipy/nipype/blob/86cd8ffb6dae1362a07ed8e9c79d583db87780eb/nipype/interfaces/afni/preprocess.py#L1952

do you have some practical command lines for this interface from afni?

tsalo commented 7 years ago

@satra - I don't actually have any experience with 3dTCorrMap. I came across the error when I was just trying to clean up the doctests and understand why some were being skipped in the AFNI interface. I can look into it though.

tsalo commented 7 years ago

@adamkimbler and I have been trying to figure out why this is breaking, but so far we've been unable to do so.

It looks like _format_arg is trying to combine a list of values (self.inputs.thresholds) with the threshold option (absolute_threshold, var_absolute_threshold, var_absolute_threshold_normalize) in the threshold option's argstr. However, it doesn't seem to be putting them together correctly- instead of using the value of the threshold option's input, which should be a File, it's using the value fed into _format_arg, which is just functional_generated.

Since the different threshold options require different numbers of floats, we considered dropping self.inputs.thresholds and making the threshold options just traits.Tuples (e.g., absolute_threshold = traits.Tuple((traits.Float(), File()))) to avoid mixing separate arguments, but that's still causing problems with _format_arg for some reason.

Neither of us has any working 3dTCorrMap command lines at the moment.

effigies commented 6 years ago

Is this still an issue? @tsalo

tsalo commented 6 years ago

@effigies I pulled the most recent nipype/nipype docker image and tried out the doctest, but it still failed (although with a new error).

The doctest:

from nipype.interfaces import afni
tcm = afni.TCorrMap()
tcm.inputs.in_file = 'functional.nii'
tcm.inputs.mask = 'mask.nii'
tcm.inputs.mean_file = 'functional_meancorr.nii'
tcm.cmdline

The error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/src/nipype/nipype/interfaces/base/core.py", line 929, in cmdline
    allargs = [self.cmd] + self._parse_inputs()
  File "/src/nipype/nipype/interfaces/base/core.py", line 1166, in _parse_inputs
    arg = self._format_arg(name, spec, value)
  File "/src/nipype/nipype/interfaces/afni/preprocess.py", line 2284, in _format_arg
    return trait_spec.argstr % self.inputs.thresholds + [value]
TypeError: must be real number, not _Undefined