From f301f3ab0d1e037b85625d125db01b95df40f096 Mon Sep 17 00:00:00 2001 From: pcamach2 <49655443+pcamach2@users.noreply.github.com> Date: Sat, 23 Apr 2022 18:42:55 -0500 Subject: [PATCH] Add quick fix check for FastSurfer Adds the check_fastsurfer function call to log FastSurfer outputs detected in subjects_dir and touch mri/aseg.auto_noCCseg.label_intensities.txt to prevent failure in surfaces.py as a temporary fix for https://github.com/nipreps/smriprep/issues/278 --- smriprep/workflows/anatomical.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/smriprep/workflows/anatomical.py b/smriprep/workflows/anatomical.py index f0ae4da2e4..f3ba1b400a 100644 --- a/smriprep/workflows/anatomical.py +++ b/smriprep/workflows/anatomical.py @@ -47,7 +47,7 @@ from niworkflows.utils.misc import fix_multi_T1w_source_name, add_suffix from niworkflows.anat.ants import init_brain_extraction_wf, init_n4_only_wf from ..utils.bids import get_outputnode_spec -from ..utils.misc import apply_lut as _apply_bids_lut, fs_isRunning as _fs_isRunning +from ..utils.misc import apply_lut as _apply_bids_lut, fs_isRunning as _fs_isRunning, check_fastsurfer as _check_fastsurfer from .norm import init_anat_norm_wf from .outputs import init_anat_reports_wf, init_anat_derivatives_wf from .surfaces import init_surface_recon_wf @@ -514,7 +514,14 @@ def _check_img(img): niu.Function(function=_fs_isRunning), overwrite=True, name="fs_isrunning" ) fs_isrunning.inputs.logger = LOGGER - + + # check for FastSurfer .mgz files and + # touch mri/aseg.auto_noCCseg.label_intensities.txt to prevent failure in surfaces.py (temporary fix) + check_fastsurfer = pe.Node( + niu.Function(function=_check_fastsurfer), overwrite=True, name="check_fastsurfer" + ) + check_fastsurfer.inputs.logger = LOGGER + # 5. Surface reconstruction (--fs-no-reconall not set) surface_recon_wf = init_surface_recon_wf( name="surface_recon_wf", omp_nthreads=omp_nthreads, hires=hires @@ -522,6 +529,9 @@ def _check_img(img): applyrefined = pe.Node(fsl.ApplyMask(), name="applyrefined") # fmt:off workflow.connect([ + (inputnode, check_fastsurfer, [ + ('subjects_dir', 'subjects_dir'), + ('subject_id', 'subject_id')]), (inputnode, fs_isrunning, [ ('subjects_dir', 'subjects_dir'), ('subject_id', 'subject_id')]),