[NiPype] mcflirt inputs error

49 views
Skip to first unread message

Dan

unread,
Aug 22, 2012, 11:12:02 AM8/22/12
to nipy...@googlegroups.com
Hello,

I'm getting an error using mcflirt when setting the boolean inputs to False (any of the inputs save_plots, save_rms, save_imgs, or save_mats causes this error). If I set the input to True, it runs without a problem, or if I don't specify the inputs at all. Here is the traceback of the error:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nipype/pipeline/plugins/linear.py", line 37, in run
    node.run(updatehash=updatehash)
  File "/usr/local/lib/python2.7/dist-packages/nipype/pipeline/engine.py", line 1128, in run
    self._run_interface()
  File "/usr/local/lib/python2.7/dist-packages/nipype/pipeline/engine.py", line 1226, in _run_interface
    self._result = self._run_command(execute)
  File "/usr/local/lib/python2.7/dist-packages/nipype/pipeline/engine.py", line 1340, in _run_command
    cmd = self._interface.cmdline
  File "/usr/local/lib/python2.7/dist-packages/nipype/interfaces/base.py", line 1047, in cmdline
    allargs = self._parse_inputs()
  File "/usr/local/lib/python2.7/dist-packages/nipype/interfaces/base.py", line 1199, in _parse_inputs
    arg = self._format_arg(name, spec, value)
  File "/usr/local/lib/python2.7/dist-packages/nipype/interfaces/fsl/preprocess.py", line 582, in _format_arg
    return super(MCFLIRT, self)._format_arg(name, spec, value)
  File "/usr/local/lib/python2.7/dist-packages/nipype/interfaces/base.py", line 1144, in _format_arg
    raise ValueError(msg)
ValueError: Object '<nipype.interfaces.fsl.preprocess.MCFLIRT object at 0x53f9c90>' attempting to format argument string for attr 'None' with value 'False'.

Here is how I build my node:
    mcflirt = pe.Node(interface=fsl.MCFLIRT(), name='mcflirt')
    mcflirt.inputs.save_plots = True
    mcflirt.inputs.save_rms = True
    mcflirt.inputs.save_mats = False
    mcflirt.inputs.stats_imgs = False
    mcflirt.inputs.output_type = 'NIFTI'

I suppose I can omit the lines that say False, but that would just be a work-around.

Thanks,
Dan

Satrajit Ghosh

unread,
Aug 22, 2012, 11:22:51 AM8/22/12
to nipy...@googlegroups.com
hi dan,

in our original discussions we were trying to avoid people setting things to False - the reason being that things are Undefined by default and the only time one would set it would be to activate that flag. this discussion was a long time back.

here is the relevant comment:


this is something that we could change, but might be worth a discussion.

for now commenting those lines or setting it to Undefined (from nipype.interfaces.base import Undefined) is the proper route

cheers,

satra



--
 
 
 

Dan

unread,
Aug 23, 2012, 10:47:05 AM8/23/12
to nipy...@googlegroups.com
I see. I'll just comment it out for now.

Perhaps adding a line that's something along the lines of "if False: value=Undefined" would solve the issue? From a user's standpoint, it's a bit strange that setting a boolean to False would cause the node to crash.  The reason being is if I wanted to pass a config file parameter to it, it would not be completely clear to someone else using the script why it's "True or Undefined" vs "True or False"

Anyway, thanks for the clarification.

Best,
Dan

Satrajit Ghosh

unread,
Aug 25, 2012, 9:52:03 AM8/25/12
to nipy...@googlegroups.com
hi dan,

this pull request updates the code to allow for False.


and here is the branch if you want to test:


cheers,

satra


--
 
 
 

Baldur

unread,
Oct 12, 2012, 3:32:09 AM10/12/12
to nipy...@googlegroups.com
Just my 2c worth. I agree with Dan that the current behavior is counter-intuitive. 

I ran into the same problem where I was putting a workflow into a MapNode by means of a Function. I had declared the boolean arguments in the wrapper function to be default False and got exactly the same message as Dan. (attempting to format argument string for attr 'None' with value 'False')
I was completely flummoxed until I found this thread.

Cheers
Baldur

Satrajit Ghosh

unread,
Oct 12, 2012, 8:03:40 AM10/12/12
to nipy...@googlegroups.com
hi baldur,

does the current master create the same problem? the pull request mentioned below has been merged for a little while now.

cheers,

satra


--
 
 
 

Baldur

unread,
Oct 12, 2012, 11:45:45 AM10/12/12
to nipy...@googlegroups.com
Hi Satra

I just double checked that - pkg_resources gives version 0.7.0.g6b646b8-dev. Is that the right one?

Cheers
Baldur 

Baldur

unread,
Oct 12, 2012, 11:50:48 AM10/12/12
to nipy...@googlegroups.com
Oops I've checked the code  - looks like I've still got the old version. Drat! I thought I'd updated that.  I'll do that Monday

Thanks Satra

Satrajit Ghosh

unread,
Oct 12, 2012, 11:52:15 AM10/12/12
to nipy...@googlegroups.com
Oops I've checked the code  - looks like I've still got the old version. Drat! I thought I'd updated that.  I'll do that Monday

Thanks Satra

do let us know if the error still persists. the version you have is from about 3 months back without the patch.

cheers,

satra
 
--
 
 
 

Baldur

unread,
Oct 15, 2012, 10:25:40 AM10/15/12
to nipy...@googlegroups.com
Yep it works fine now.

BTW for other git noobs like me a good place to start is http://rogerdudler.github.com/git-guide/

Thanks again
Baldur
Reply all
Reply to author
Forward
0 new messages