nipy / nipype

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

error running afni 3d despike interface #1318

Closed arielletambini closed 7 years ago

arielletambini commented 8 years ago

Hi all,

I am unable to successfully run the interface for AFNI's 3d despike (afni.Despike). I think this is probably a bug as it looks like the despiking itself runs and output files are created, but it looks like the nipype code is looking for the incorrect output files. I am able to run (w/o errors) the afni script itself when it isn't called through the interface. See here:

from nipype.interfaces import afni ... test_dir = '/home/despo/simpace/rename_files_wbug/sub01/sess01/sub01_sess01_run01/niftis' test_file = glob(pjoin(test_dir, 'test.nii'))[0]

despike = afni.Despike() despike.inputs.in_file = test_file despike.inputs.out_file = pjoin(test_dir, 'despike') despike.run()

the despiking itself runs, and then is followed by an error. here are some outputs: ... 160112-16:14:33,69 interface INFO: stderr 2016-01-12T16:14:33.068865:++ start slice 0 160112-16:14:33,609 interface INFO: stderr 2016-01-12T16:14:33.609532:++ start slice 1; so far 314340 data points, 21792 edits [6.933%], 4022 big edits [1.280%] ... 160112-16:14:48,809 interface INFO: stderr 2016-01-12T16:14:48.809516:++ start slice 29; so far 9596145 data points, 613381 edits [6.392%], 74736 big edits [0.779%] 160112-16:14:48,915 interface INFO: stderr 2016-01-12T16:14:48.915590:++ Elapsed despike time = 15s 848ms 160112-16:14:48,920 interface INFO: stderr 2016-01-12T16:14:48.920029:++ FINAL: 9662835 data points, 617743 edits [6.393%], 75138 big edits [0.778%] 160112-16:14:50,379 interface INFO: stderr 2016-01-12T16:14:50.379550:++ Output dataset /home/despo/simpace/rename_files_wbug/sub01/sess01/sub01_sess01_run01/niftis/despike+tlrc.BRIK Traceback (most recent call last): File "/usr/local/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 3066, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in despike.run() File "/srv/local/anaconda-1.9.2/lib/python2.7/site-packages/nipype/interfaces/base.py", line 1034, in run outputs = self.aggregate_outputs(runtime) File "/srv/local/anaconda-1.9.2/lib/python2.7/site-packages/nipype/interfaces/base.py", line 1128, in aggregate_outputs raise FileNotFoundError(msg) FileNotFoundError: File/Directory '/home/despo/simpace/rename_files_wbug/sub01/sess01/sub01_sess01_run01/niftis/despike+orig.BRIK' not found for Despike output 'out_file'. Interface Despike failed to run.

however, other output files were indeed created, just not what is being looked for: [arielle@nx9 niftis]$ ls despike* despike+tlrc.BRIK despike+tlrc.HEAD

also, the afni 3d despike script itself runs fine if it is run via the command line instead of through the interface, despike.run(), i.e. os.system(despike.cmdline)

runs to completion (as long as I delete the previous despike* output files from the directory from previous attempts to run): (end of output) ++ start slice 29; so far 9596145 data points, 613381 edits [6.392%], 74736 big edits [0.779%] ++ Elapsed despike time = 15s 783ms ++ FINAL: 9662835 data points, 617743 edits [6.393%], 75138 big edits [0.778%] ++ Output dataset /home/despo/simpace/rename_files_wbug/sub01/sess01/sub01_sess01_run01/niftis/despike+tlrc.BRIK

I'd love to integrate the interface into a workflow, so would be cool if it works!

Thanks, Arielle

satra commented 8 years ago

@arielletambini - which version of nipype are you running? if an older version, could you please check with the current master version from github?

arielletambini commented 8 years ago

I just switched to the master version from github. Still getting the same error and behavior (output files were created of the name despike+tlrc.BRIK / .HEAD, but it looks like nipype is looking for despike+orig* files):

160113-14:06:24,949 interface INFO: stderr 2016-01-13T14:06:24.948986:++ Elapsed despike time = 15s 727ms 160113-14:06:24,953 interface INFO: stderr 2016-01-13T14:06:24.953393:++ FINAL: 9662835 data points, 617743 edits [6.393%], 75138 big edits [0.778%] 160113-14:06:26,334 interface INFO: stderr 2016-01-13T14:06:26.334680:++ Output dataset /home/despo/simpace/rename_files_wbug/sub01/sess01/sub01_sess01_run01/niftis/despike+tlrc.BRIK Traceback (most recent call last): File "/usr/local/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 3066, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in despike.run() File "/home/despo/arielle/.local/lib/python2.7/site-packages/nipype/interfaces/base.py", line 1046, in run outputs = self.aggregate_outputs(runtime) File "/home/despo/arielle/.local/lib/python2.7/site-packages/nipype/interfaces/base.py", line 1140, in aggregate_outputs raise FileNotFoundError(msg) FileNotFoundError: File/Directory '/home/despo/simpace/rename_files_wbug/sub01/sess01/sub01_sess01_run01/niftis/despike+orig.BRIK' not found for Despike output 'out_file'. Interface Despike failed to run.

arielletambini commented 8 years ago

Also, I wonder if this is related to these issues w/ afni interfaces and output files?:

https://github.com/nipy/nipype/pull/617 https://github.com/nipy/nipype/issues/594 https://github.com/FCP-INDI/C-PAC/issues/366

chrisgorgo commented 8 years ago

Do you also get the error if you set the outputtype to 'NIFTI_GZ' and you do not set the out_file directly?

despike.inputs.outputtype = 'NIFTI_GZ'
arielletambini commented 8 years ago

Thanks, yes, it runs cleanly if I set outputtype to either 'NIFTI' or 'NIFTI_GZ' as long as out_file is not set!