Skip to content

Commit 4d775ea

Browse files
authored
Merge pull request #194 from nipreps/codex/add-petref-auto-option-for-registration
Add automatic PET reference selection
2 parents b03986b + 2af65ab commit 4d775ea

File tree

5 files changed

+295
-45
lines changed

5 files changed

+295
-45
lines changed

petprep/cli/parser.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,13 +583,14 @@ def _bids_filter(value, parser):
583583
g_hmc.add_argument(
584584
'--petref',
585585
default='template',
586-
choices=['template', 'twa', 'sum', 'first5min'],
586+
choices=['template', 'twa', 'sum', 'first5min', 'auto'],
587587
help=(
588588
"Strategy for generating the PET reference. 'template' uses the "
589589
"motion correction template, while 'twa' computes a time-weighted "
590590
"average, 'sum' produces a summed image of the motion-corrected "
591591
"series, and 'first5min' averages the early (0-5 minute) portion "
592-
'of the acquisition.'
592+
"of the acquisition. 'auto' evaluates multiple strategies to "
593+
'select the best reference.'
593594
),
594595
)
595596

@@ -788,8 +789,8 @@ def parse_args(args=None, namespace=None):
788789
config.execution.log_level = int(max(25 - 5 * opts.verbose_count, logging.DEBUG))
789790
config.from_dict(vars(opts), init=['nipype'])
790791

791-
config.workflow._petref_cli_set = '--petref' in argv
792-
config.workflow._pet2anat_method_cli_set = '--pet2anat-method' in argv
792+
config.workflow.petref_specified = '--petref' in argv
793+
config.workflow.pet2anat_method_specified = '--pet2anat-method' in argv
793794

794795
if config.execution.session_label:
795796
config.execution.bids_filters = config.execution.bids_filters or {}

petprep/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ class workflow(_Config):
561561
pet2anat_method_specified: bool = False
562562
"""Flag indicating whether ``--pet2anat-method`` was explicitly provided."""
563563
petref: str = 'template'
564-
"""Strategy for building the PET reference (``'template'``, ``'twa'``, ``'sum'`` or ``'first5min'``)."""
564+
"""Strategy for building the PET reference (``'template'``, ``'twa'``, ``'sum'``, ``'first5min'`` or ``'auto'``)."""
565565
petref_specified: bool = False
566566
"""Flag indicating whether ``--petref`` was explicitly provided."""
567567
cifti_output = None

petprep/interfaces/reports.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,17 @@ class FunctionalSummaryInputSpec(TraitedSpec):
252252
'twa',
253253
'sum',
254254
'first5min',
255+
'auto',
255256
mandatory=True,
256257
desc='PET reference generation strategy',
257258
)
258259
requested_petref_strategy = traits.Enum(
259-
'template', 'twa', 'sum', 'first5min', desc='User-requested PET reference strategy'
260+
'template',
261+
'twa',
262+
'sum',
263+
'first5min',
264+
'auto',
265+
desc='User-requested PET reference strategy',
260266
)
261267
hmc_disabled = traits.Bool(False, desc='Head motion correction disabled')
262268

@@ -295,6 +301,7 @@ def _generate_segment(self):
295301
'twa': 'Time-weighted average of motion-corrected series',
296302
'sum': 'Summed motion-corrected series',
297303
'first5min': 'Early (0-5 minute) average of motion-corrected series',
304+
'auto': 'Automatically selected reference',
298305
}
299306
petref_strategy = reference_map.get(self.inputs.petref_strategy, 'Unknown')
300307
requested = getattr(self.inputs, 'requested_petref_strategy', None)

0 commit comments

Comments
 (0)