Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cubids-apply adds extra leading zero to run entity #272

Closed
tsalo opened this issue Sep 19, 2023 · 2 comments · Fixed by #382
Closed

cubids-apply adds extra leading zero to run entity #272

tsalo opened this issue Sep 19, 2023 · 2 comments · Fixed by #382
Assignees
Labels
bug Something isn't working priority: high

Comments

@tsalo
Copy link
Member

tsalo commented Sep 19, 2023

In my case, it tried to rename sub-03_ses-1_task-rest_acq-multiecho_run-02_echo-1_part-mag_bold.nii.gz to sub-03_ses-1_task-rest_acq-multiechoVARIANTNumVolumes_run-002_bold.nii.gz. Note the shift from one leading zero to two.

This seems to be due to this section of CuBIDS.change_filename:

CuBIDS/cubids/cubids.py

Lines 392 to 393 in b8f5d47

if "run" in list(entities.keys()) and "run-0" in filepath:
entities["run"] = "0" + str(entities["run"])

EDIT: This only happens if the run entity includes leading zeroes. Also, it doesn't account for multiple leading zeroes.

@tsalo tsalo added the bug Something isn't working label Sep 19, 2023
@mattcieslak
Copy link
Contributor

I think we don't want this to happen

@tsalo
Copy link
Member Author

tsalo commented Jan 16, 2025

One workaround might be to use BIDSLayout's build_path method. That way we might not need to figure out how to parse these entities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: high
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants