Skip to content

Commit

Permalink
Limit session-wise processing to sessions with dwi
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed Dec 9, 2024
1 parent d1fc735 commit 20425b4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions qsiprep/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,18 +800,19 @@ def parse_args(args=None, namespace=None):

# Examine the available sessions for each participant
for subject_id in participant_label:
# Find sessions with DWI data
sessions = config.execution.layout.get_sessions(
subject=subject_id,
session=session_filters or Query.OPTIONAL,
suffix=['T1w', 'T2w', 'dwi'],
suffix=['dwi'],
)

# If there are no sessions, there is only one option:
if not sessions:
if config.workflow.subject_anatomical_reference == 'sessionwise':
config.loggers.workflow.warning(
f'Subject {subject_id} had no sessions, '
"but --subject-anatomical-reference was set to 'sessionwise'. "
'but --subject-anatomical-reference was set to "sessionwise". '
'Outputs will NOT appear in a session directory for '
f'{subject_id}.',
)
Expand All @@ -823,6 +824,12 @@ def parse_args(args=None, namespace=None):
for session in sessions:
processing_groups.append([subject_id, [session]])
else:
# We can now use sessions that have anatomical data, but no DWI
sessions = config.execution.layout.get_sessions(
subject=subject_id,
session=session_filters or Query.OPTIONAL,
suffix=['dwi', 'T1w', 'T2w'],
)
processing_groups.append([subject_id, sessions])

# Make a nicely formatted message showing what we will process
Expand Down

0 comments on commit 20425b4

Please sign in to comment.