My data (bids-formatted) has multiple T1w images for each session, and not every session will have all of the possible T1w images. Possible acquisition values that distinguish the T1s are: 800um, 800umxND, MPRAGE1mm. I’m trying to format the right regex query for the layout.get() function to return 800um if that acquisition value exists, and MPRAGE1mm if it doesn’t.
This command:
layout.get(suffix = “T1w”, acquisition = “800um$|MPRAGE1mm”, extension=‘nii.gz’, regex_search = True, return_type=“filename”)
will return both the 800um and MPRAGE1mm acquisitions, instead of the behavior I want, only returning the first match to “800um$”.
How do I format the regex to match the behavior I want? I’ve tried acquisition argument values with capture groups like these but haven’t gotten the result I wanted:
(800um$)?(?(1)800um$|MPRAGE1mm) : returns just MPRAGE1mm
(800um$)?(?(1)|MPRAGE1mm): returns both 800um and MPRAGE1mm
I am running a very old version of pybids, 0.12.2, I’m fighting with my environment about updating it now, but wanted to check if this issue will be solvable in any version of pybids.