From 719a71f1536bcaae9ee686f4e635d4cb1446281e Mon Sep 17 00:00:00 2001 From: mathiasg Date: Thu, 26 Sep 2024 16:41:37 -0400 Subject: [PATCH] FIX: Add none option when selecting surface recon method, deprecated ambiguous options --- nibabies/cli/parser.py | 14 ++++++++------ nibabies/workflows/base.py | 8 +++++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/nibabies/cli/parser.py b/nibabies/cli/parser.py index 60c63910..b2b6a8a5 100644 --- a/nibabies/cli/parser.py +++ b/nibabies/cli/parser.py @@ -28,6 +28,8 @@ def _build_parser(): # parser attribute name: (replacement flag, version slated to be removed in) 'bold2t1w_init': ('--bold2anat-init', '24.2.0'), 'bold2t1w_dof': ('--bold2anat-dof', '24.2.0'), + 'force_reconall': ('--surface-recon-method freesurfer', '24.2.0'), + 'fs_no_reconall': ('--surface-recon-method none', '24.2.0'), } class DeprecatedAction(Action): @@ -597,9 +599,9 @@ def _slice_time_ref(value, parser): ) g_surfs_xor.add_argument( '--fs-no-reconall', - action='store_false', + action=DeprecatedAction, dest='run_reconall', - help='disable FreeSurfer surface preprocessing.', + help='Deprecated - use `--surface-recon-method none` instead.', ) g_other = parser.add_argument_group('Other options') @@ -728,14 +730,14 @@ def _slice_time_ref(value, parser): g_baby.add_argument( '--force-reconall', default=False, - action='store_true', - help='Force traditional FreeSurfer surface reconstruction.', + action=DeprecatedAction, + help='Deprecated - use `--surface-recon-method freesurfer` instead.', ) g_baby.add_argument( '--surface-recon-method', - choices=('infantfs', 'freesurfer', 'mcribs', 'auto'), + choices=('auto', 'infantfs', 'freesurfer', 'mcribs', 'none'), default='auto', - help='Method to use for surface reconstruction', + help='Method to use for surface reconstruction.', ) g_baby.add_argument( '--reference-anat', diff --git a/nibabies/workflows/base.py b/nibabies/workflows/base.py index 1b85624c..8c851e53 100644 --- a/nibabies/workflows/base.py +++ b/nibabies/workflows/base.py @@ -351,9 +351,11 @@ def init_single_subject_wf( f'Requested to use {requested_anat} as anatomical reference but none available' ) elif (reference_anat := requested_anat) is None: # Both available with no preference - reference_anat = 'T2w' if any( - (recon_method == 'none' and age <= AUTO_T2W_MAX_AGE, recon_method == 'mcribs') - ) else 'T1w' + reference_anat = ( + 'T2w' + if any((recon_method == 'none' and age <= AUTO_T2W_MAX_AGE, recon_method == 'mcribs')) + else 'T1w' + ) anat = reference_anat.lower() # To be used for workflow connections