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

smriprep errors out during autorecon2-vol due to missing lta file #326

Closed girishmm closed 1 year ago

girishmm commented 1 year ago

I tried to run the complete smriprep pipeline on a structural MRI dataset. The dataset was organized according to BIDS and had T1w, T2W, and FLAIR images for each subject. To check if the pipeline completes successfully, I ran it over one subject.

smriprep bids bids/derivatives participant --participant-label 150352

It errors out during the autorecon2-vol phase of recon-all. To verify if it completes without freesurfer surface preprocessing and subcortical segmentation, I ran it with the fs-no-reconall flag.

smriprep bids bids/derivatives participant --participant-label 150352 --fs-no-reconall

This completes without throwing any errors.

I trace the issue in the autorecon2 phase to the canorm step mentioned here. mri_ca_normalize tries to read the xform file talairach.lta from /bids/derivatives/freesurfer/sub-150352/mri/transforms but it is absent, and this leads to the error. Instead of talairach.lta, there is a talairach.xfm.lta file. On running, canorm step using this xform file, it runs successfully.

Is this a misnaming problem by the smriprep pipeline, or am I missing something? Log below for more info.

Node: smriprep_wf.single_subject_140152_wf.anat_preproc_wf.surface_recon_wf.autorecon_resume_wf.autorecon2_vol
Working directory: /home/bhalla/girishmm/data/work/smriprep_wf/single_subject_140152_wf/anat_preproc_wf/surface_recon_wf/autorecon_resume_wf/autorecon2_vol

Node inputs:

FLAIR_file = <undefined>
T1_files = <undefined>
T2_file = <undefined>
args = <undefined>
big_ventricles = <undefined>
brainstem = <undefined>
directive = autorecon2-volonly
environ = {}
expert = <undefined>
flags = <undefined>
hemi = <undefined>
hippocampal_subfields_T1 = <undefined>
hippocampal_subfields_T2 = <undefined>
hires = <undefined>
mprage = <undefined>
mri_aparc2aseg = <undefined>
mri_ca_label = <undefined>
mri_ca_normalize = <undefined>
mri_ca_register = <undefined>
mri_edit_wm_with_aseg = <undefined>
mri_em_register = <undefined>
mri_fill = <undefined>
mri_mask = <undefined>
mri_normalize = <undefined>
mri_pretess = <undefined>
mri_remove_neck = <undefined>
mri_segment = <undefined>
mri_segstats = <undefined>
mri_tessellate = <undefined>
mri_watershed = <undefined>
mris_anatomical_stats = <undefined>
mris_ca_label = <undefined>
mris_fix_topology = <undefined>
mris_inflate = <undefined>
mris_make_surfaces = <undefined>
mris_register = <undefined>
mris_smooth = <undefined>
mris_sphere = <undefined>
mris_surf2vol = <undefined>
mrisp_paint = <undefined>
openmp = 8
parallel = <undefined>
steps = <undefined>
subject_id = recon_all
subjects_dir = <undefined>
talairach = <undefined>
use_FLAIR = <undefined>
use_T2 = <undefined>
xopts = <undefined>

Traceback (most recent call last):
  File "/home/bhalla/girishmm/miniconda3/envs/napi/lib/python3.10/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/home/bhalla/girishmm/miniconda3/envs/napi/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/home/bhalla/girishmm/miniconda3/envs/napi/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/home/bhalla/girishmm/miniconda3/envs/napi/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node autorecon2_vol.

Cmdline:
    recon-all -autorecon2-volonly -openmp 8 -subjid sub-140152 -sd /home/bhalla/girishmm/data/bids/derivatives/freesurfer 
Stdout:
    fs-check-version --s sub-140152 --o /tmp/tmp.TYR5Ox
    Wed Mar 15 14:19:19 IST 2023

    setenv SUBJECTS_DIR /home/bhalla/girishmm/data/bids/derivatives/freesurfer
    cd /home/bhalla/girishmm/data/work/smriprep_wf/single_subject_140152_wf/anat_preproc_wf/surface_recon_wf/autorecon_resume_wf/autorecon2_vol
    /home/bhalla/girishmm/packages/freesurfer/bin/fs-check-version --s sub-140152 --o /tmp/tmp.TYR5Ox
    -rwxrwxr-x 1 girishmm bhalla 18565 Aug  4  2022 /home/bhalla/girishmm/packages/freesurfer/bin/fs-check-version

    freesurfer-linux-ubuntu22_x86_64-7.3.2-20220804-6354275
    $Id$
    Linux xutuli 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
    pid 2558366
    Current FS Version freesurfer-linux-ubuntu22_x86_64-7.3.2-20220804-6354275
    bstampfile exists /home/bhalla/girishmm/data/bids/derivatives/freesurfer/sub-140152/scripts/build-stamp.txt
    Subject FS Version: freesurfer-linux-ubuntu22_x86_64-7.3.2-20220804-6354275
    No constraints on version because REQ=UnSet and FsVerFile=NotThere
    #@#% fs-check-version match = 1
    fs-check-version Done
    INFO: SUBJECTS_DIR is /home/bhalla/girishmm/data/bids/derivatives/freesurfer
    Actual FREESURFER_HOME /home/bhalla/girishmm/packages/freesurfer
    -rw-rw-r-- 1 girishmm bhalla 47243 Mar 15 14:19 /home/bhalla/girishmm/data/bids/derivatives/freesurfer/sub-140152/scripts/recon-all.log
    Linux xutuli 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
    ~/data/bids/derivatives/freesurfer/sub-140152/mri/transforms ~/data/bids/derivatives/freesurfer/sub-140152 
    ~/data/bids/derivatives/freesurfer/sub-140152 
    #--------------------------------------
    #@# CA Normalize Wed Mar 15 14:19:19 IST 2023
    /home/bhalla/girishmm/data/bids/derivatives/freesurfer/sub-140152/mri

     mri_ca_normalize -c ctrl_pts.mgz -mask brainmask.mgz nu.mgz /home/bhalla/girishmm/packages/freesurfer/average/RB_all_2020-01-02.gca transforms/talairach.lta norm.mgz 

    writing control point volume to ctrl_pts.mgz
    using MR volume brainmask.mgz to mask input volume...
    reading 1 input volume
    reading atlas from '/home/bhalla/girishmm/packages/freesurfer/average/RB_all_2020-01-02.gca'...
    reading transform from 'transforms/talairach.lta'...
    error: No such file or directory
    error: ltaReadFile(transforms/talairach.lta): can't open file
    error: No such file or directory
    error: mri_ca_normalize: could not open xform file transforms/talairach.lta
    Command exited with non-zero status 252
    @#@FSTIME  2023:03:15:14:19:19 mri_ca_normalize N 8 e 0.63 S 0.10 U 0.52 P 99% M 432936 F 0 R 106867 W 0 c 1 w 2 I 0 O 0 L 12.97 18.99 36.60
    @#@FSLOADPOST 2023:03:15:14:19:20 mri_ca_normalize N 8 12.97 18.99 36.60
    Linux xutuli 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

    recon-all -s sub-140152 exited with ERRORS at Wed Mar 15 14:19:20 IST 2023

    For more details, see the log file /home/bhalla/girishmm/data/bids/derivatives/freesurfer/sub-140152/scripts/recon-all.log
    To report a problem, see http://surfer.nmr.mgh.harvard.edu/fswiki/BugReporting

Stderr:

Traceback:
    RuntimeError: subprocess exited with code 1.
effigies commented 1 year ago

What version of freesurfer and smriprep? This should be fixed in the latest release.

girishmm commented 1 year ago

FreeSurfer version: freesurfer-linux-ubuntu22_x86_64-7.3.2-20220804-6354275 smriprep version : smriprep v0.10.0

Freesurfer 7.3.2 is the latest version available. I will upgrade smriprep to 0.11.0 and try again.

girishmm commented 1 year ago

Upgrading smriprep to 0.11.0 resolves the error. I suggest adding Connectome Workbench to the list of well-known software packages used in README as smriprep fails to run without wb_command in the latest version. Closing issue as resolved.