From f38dae268dced408b04db9d03625e6fe56b07aaa Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Tue, 31 Oct 2023 11:28:15 -0400 Subject: [PATCH] Fix HCP ingression for non-rest tasks (#986) --- xcp_d/utils/hcp2fmriprep.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xcp_d/utils/hcp2fmriprep.py b/xcp_d/utils/hcp2fmriprep.py index 21db0fe0e..ceed583a3 100644 --- a/xcp_d/utils/hcp2fmriprep.py +++ b/xcp_d/utils/hcp2fmriprep.py @@ -202,8 +202,13 @@ def convert_hcp_to_bids_single_subject(in_dir, out_dir, sub_ent): # NOTE: What is the first element in the folder name? _, base_task_id, dir_id = base_task_name.split("_") match = re.match(r"([A-Za-z0-9]+[a-zA-Z]+)(\d+)$", base_task_id) - task_id = match.group(1).lower() - run_id = int(match.group(2)) + if match: + task_id = match.group(1).lower() + run_id = int(match.group(2)) + else: + task_id = base_task_id.lower() + run_id = 1 + task_ent = f"task-{task_id}" run_ent = f"run-{run_id}" dir_ent = f"dir-{dir_id}"