nipreps / smriprep

Structural MRI PREProcessing (sMRIPrep) workflows for NIPreps (NeuroImaging PREProcessing tools)
https://nipreps.github.io/smriprep
Apache License 2.0
133 stars 39 forks source link

Create a FreeSurfer-license canary that can be run by fMRIPrep #43

Closed chrisgorgo closed 4 years ago

chrisgorgo commented 6 years ago

https://openneuro.org/datasets/ds001230/versions/00001?app=FMRIPREP&version=51&job=5a847e689259cd00018b9810

Possible introduced in 1.0.7

--n_cpus 4 --participant_label 3129 --use-aroma --fs-license-file /input/data/b39610adfe02fdce2ad9d30797c567b3/LICENSE --output-space template T1w fsaverage

[Node] Error on "fmriprep_wf.single_subject_3129_wf.anat_preproc_wf.surface_recon_wf.autorecon1" (/root/src/fmriprep/work/fmriprep_wf/single_subject_3129_wf/anat_preproc_wf/surface_recon_wf/autorecon1)
Traceback (most recent call last):
  File "/usr/local/miniconda/bin/fmriprep", line 11, in <module>
    load_entry_point('fmriprep==1.0.7', 'console_scripts', 'fmriprep')()
  File "/usr/local/miniconda/lib/python3.6/site-packages/fmriprep/cli/run.py", line 267, in main
    fmriprep_wf.run(**plugin_settings)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/workflows.py", line 602, in run
    runner.run(execgraph, updatehash=updatehash, config=self.config)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/plugins/base.py", line 168, in run
    self._clean_queue(jobid, graph, result=result))
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/plugins/base.py", line 227, in _clean_queue
    raise RuntimeError("".join(result['traceback']))
RuntimeError: Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/plugins/multiproc.py", line 68, in run_node
    result['result'] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py", line 487, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py", line 571, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py", line 650, in _run_command
    result = self._interface.run(cwd=outdir)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base/core.py", line 516, in run
    runtime = self._run_interface(runtime)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base/core.py", line 1023, in _run_interface
    self.raise_exception(runtime)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base/core.py", line 960, in raise_exception
    ).format(**runtime.dictcopy()))
RuntimeError: Command:
recon-all -autorecon1 -i /snapshot/data/sub-3129/anat/sub-3129_acq-MPRAGE_run-1_T1w.nii.gz -noskullstrip -openmp 3 -subjid sub-3129 -sd /output/data/freesurfer
Standard output:
ERROR: You are trying to re-run an existing subject with (possibly)
 new input data (-i). If this is truly new input data, you should delete
 the subject folder and re-run, or specify a different subject name.
 If you are just continuing an analysis of an existing subject, then 
 omit all -i flags.
Standard error:

Return code: 1
chrisgorgo commented 6 years ago

Looking at recon-all.log I found:

mri_convert.bin /snapshot/data/sub-3129/anat/sub-3129_acq-MPRAGE_run-1_T1w.nii.gz /output/data/freesurfer/sub-3129/mri/orig/001.mgz 
--------------------------------------------------------------------------
ERROR: Invalid FreeSurfer license key found in license file /input/data/b39610adfe02fdce2ad9d30797c567b3/LICENSE
  If you are outside the NMR-Martinos Center,
  go to http://surfer.nmr.mgh.harvard.edu/registration.html to 
  get a valid license file (it's free).
  If you are inside the NMR-Martinos Center,
  make sure to source the standard environment.
--------------------------------------------------------------------------

so there is something wrong with error reporting (but the real reason was bad license).

effigies commented 6 years ago

Interesting. Perhaps we can create a kind of FreeSurfer canary (say mri_convert <some_image>.nii.gz canary.nii.gz) to make sure the license is valid?

chrisgorgo commented 6 years ago

I think it would be worth while to add something like this in the very beginning of the workflow.

chrisgorgo commented 6 years ago

The weird thing is that previously the error was much more clear.

effigies commented 6 years ago

I agree, that is weird.

I also think that maybe it makes sense to do during setup, when we check for the existence of the license file in the first place. So just run a bare MRIConvert interface, rather than try to find a place to insert it into the workflow.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

oesteban commented 4 years ago

Perhaps the implementation of the canary should go here in sMRIPrep, but then imported from fMRIPrep to actually run it.