Skip to content

[feat] Modify subject ID regex to also support MEN-RT data files#11

Open
vpchung wants to merge 3 commits into
BraTS:mainfrom
vpchung:feat/add-regex-for-menrt
Open

[feat] Modify subject ID regex to also support MEN-RT data files#11
vpchung wants to merge 3 commits into
BraTS:mainfrom
vpchung:feat/add-regex-for-menrt

Conversation

@vpchung

@vpchung vpchung commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Changelog

  • Modify the subject ID regex to accept xxxx-x, in addition to the existing ones (xxxxx-xxx, xxxxx)
  • Pre-compile the regex outside of loop
  • Update programmatic example

Preview

>>> subject_id_pattern = re.compile(r"(\d{4,5}(?:-\d{1,3})?)")
>>> ped_filename = "BraTS-PED-12345-000.nii.gz"
>>> goat_filename = "BraTS-GoAT-12345.nii.gz"
>>> menrt_filename = "BraTS-MEN-RT-1234-1.nii.gz"
>>>
>>> subject_id_pattern.search(ped_filename).group(1)
'12345-000'
>>> subject_id_pattern.search(goat_filename).group(1)
'12345'
>>> subject_id_pattern.search(menrt_filename).group(1)
'1234-1'
>>> 

@vpchung

vpchung commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

I tested the programmatic example before and after the update, and everything is running as expected. Let me know if if there's anything else I should check!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant