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

Metadata modification for updated filenames doesn't cover B0Field fields #273

Open
tsalo opened this issue Sep 19, 2023 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@tsalo
Copy link
Member

tsalo commented Sep 19, 2023

In addition to IntendedFor, which CuBIDS does cover, BIDS has B0Fieldentifier and B0FieldSource (and potentially other bids:uri or path-format fields pointing to files in the dataset) that it doesn't modify. See below for the section that explicitly covers IntendedFor.

CuBIDS/cubids/cubids.py

Lines 494 to 513 in b8f5d47

if "IntendedFor" in data.keys():
# check if IntendedFor field is a str or list
if isinstance(data["IntendedFor"], str):
if data["IntendedFor"] == _get_intended_for_reference(filepath):
# replace old filename with new one (overwrite string)
data["IntendedFor"] = _get_intended_for_reference(new_path)
# update the json with the new data dictionary
_update_json(str(path), data)
if isinstance(data["IntendedFor"], list):
for item in data["IntendedFor"]:
if item in _get_intended_for_reference(filepath):
# remove old filename
data["IntendedFor"].remove(item)
# add new filename
data["IntendedFor"].append(_get_intended_for_reference(new_path))
# update the json with the new data dictionary
_update_json(str(path), data)

@tsalo tsalo added the bug Something isn't working label Sep 19, 2023
@tsalo tsalo changed the title Metadata modification for update filenames doesn't cover B0Field fields Metadata modification for updated filenames doesn't cover B0Field fields Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants