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

Add handling of renaming files after dcm2niix conversion #693

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion heudiconv/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,11 @@ def convert(
overwrite=overwrite,
)

# TODO: add heuristic call to possibly adjust filenames
# renames = rename_after_dcm2niix(item, bids_outfiles)
# for file_from, file_to in renames.items():
# safe_movefile(...)

# save acquisition time information if it's BIDS
# at this point we still have acquisition date
if bids_options is not None:
Expand All @@ -635,6 +640,10 @@ def convert(
tuneup_bids_json_files(bids_outfiles)

if prov_file:
# TODO: check if it remains sensible since save_converted_files
# would do all kinds of renames etc
# if above bids_outfiles become dict -- it could add
# additional prov fields for renaming or just adjust the records
prov_files.append(prov_file)

tempdirs.rmtree(tmpdir)
Expand Down Expand Up @@ -1031,7 +1040,7 @@ def save_converted_files(
bids_outfiles.append(outname_bids)
except TypeError: ##catch lists
raise TypeError("Multiple BIDS sidecars detected.")
return bids_outfiles
return bids_outfiles # TODO: make this to be a dict which would point to original filenames


def add_taskname_to_infofile(infofiles: str | list[str]) -> None:
Expand Down