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

Entities in CuBIDS.change_filename are not comprehensive/up-to-date #271

Open
tsalo opened this issue Sep 19, 2023 · 5 comments · May be fixed by #392
Open

Entities in CuBIDS.change_filename are not comprehensive/up-to-date #271

tsalo opened this issue Sep 19, 2023 · 5 comments · May be fixed by #392
Assignees
Labels
bug Something isn't working priority: high

Comments

@tsalo
Copy link
Member

tsalo commented Sep 19, 2023

I was running cubids-apply on a dataset with complex-valued, multi-echo BOLD data, and it looks like CuBIDS.change_filename is not aware of certain entities, because those entities are not hardcoded into the function.

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.

We may want to grab config info from PyBIDS or the BIDS schema.

Of course, users may want to provide their own configuration files, in order to support entities or suffixes that are not yet covered by BIDS. In my case, I have _noRF files, which are associated with a currently open PR in the BIDS repo (bids-standard/bids-specification#1451).

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

tsalo commented Sep 19, 2023

It's probably easier for the average CuBIDS user with BIDS noncompliant data to write a PyBIDS JSON config file than a set of BIDS schema files. However, PyBIDS is going to swap out its JSON-based config files for the BIDS schema files at some point, though I don't know when that'll actually happen.

@tsalo tsalo changed the title Entities in CuBIDS.change_filename are not comprehensive Entities in CuBIDS.change_filename are not comprehensive/up-to-date Sep 19, 2023
@tsalo
Copy link
Member Author

tsalo commented Jan 23, 2024

@mattcieslak BIDS makes the schema available as a single JSON file (https://bids-specification.readthedocs.io/en/stable/schema.json). I wonder if we could use that here.

@dabrielz
Copy link

Hi all, after running cubids apply I ran into the same issue as above where only some bids keys were kept in the filename instead of all keys present. For example, this sub-01_ses-02_acq-TSE_ce-gad_rec-NORM_run-001_T1w.nii.gz was renamed to sub-01_ses-02_acq-TSEVARIANTEchoTime_rec-NORM_run-001_T1w.nii.gz where the ce key is dropped but the acq and rec keys are retained.

  • CuBIDS version: 1.1.1.dev7+g3f35046
  • Datalad version: Not using datalad

I was expecting any key found in the bids schema to pass through the apply step since these keys are retained in the RenameKeyGroup column of the summary.tsv file. The scan from the example is classified as acquisition-TSEVARIANTEchoTime_ceagent-gad_datatype-anat_reconstruction-NORM_run-001_suffix_T1w in the RenameKeyGroup column.

@tsalo
Copy link
Member Author

tsalo commented Aug 20, 2024

Thanks @dabrielz! Agreed 100%.

@tsalo
Copy link
Member Author

tsalo commented Jan 16, 2025

Trying to come up with a plan for this. What about the following?

  1. Download a copy of the schema JSON to cubids/data/.
    • We'll need a way to update this regularly. That's the part that worries me.
  2. Add schema argument to CuBIDS command-line interfaces so users can provide their own version.
    • One drawback is that users will almost certainly have a hard time creating custom schema JSONs.
  3. Use the schema JSON to determine what entities are allowed and in what order they should appear.
    • The entities are in schema['objects']['entities'].
    • The order of entities is in schema['rules']['entities'].

@tsalo tsalo linked a pull request Jan 16, 2025 that will close this issue
4 tasks
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.

4 participants