Skip to content

Commit

Permalink
FIX: Add none option when selecting surface recon method, deprecated …
Browse files Browse the repository at this point in the history
…ambiguous options
  • Loading branch information
mgxd committed Sep 26, 2024
1 parent a4e5740 commit 719a71f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
14 changes: 8 additions & 6 deletions nibabies/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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',
Expand Down
8 changes: 5 additions & 3 deletions nibabies/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 719a71f

Please sign in to comment.