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

[ENH]: DICOM to NIFTI BIDS conversion with Heudiconv #9

Merged
merged 92 commits into from
Jul 25, 2024

Conversation

alexpron
Copy link
Contributor

@alexpron alexpron commented Mar 22, 2024

Adding datalad support within shanoir2bids.py script relying on heudiconv software.

Tried to reproduce as far as possible the current usage of the shanoir2bids.py script from configuration.json file

  • DICOM download only from Shanoir instance (regression)
  • removed automri format output (regression)
  • BIDS mapping generated from the result of the solr search to handle case where regex like terms were passed into .json file
  • BIDS conversion is performed at the subject level (session if longitudinal)
  • Modified a bit dcm2niix options so that it matches the --dcmconfig option .json file
    (keys are attributes to DCM2NIIX nipype class)
  • DICOM to NIFTI BIDS conversion, both DICOM and NIFTI are stored into datalad datasets (sourcedata, rawdata)

TODO:

  • check bids metadata generated
  • add studyname in dl_dir using locator ?
  • better handle temporary directory
  • add conversion directly from zip files
  • write Heudiconv heuristic to handle conversion into automri format
  • define what to do when chosen outputs are not BIDS compliant (e.g. sub-\d\d--\d\d)

…onfiguration.json file. Configuration file was slightly modified to handle dcm2niix options following nipype DC2NIIX attributes
@alexpron
Copy link
Contributor Author

some bids compliance errors with default dcm2niix options used:
image

@alexpron alexpron changed the title [ENH]: DICOM to NIFTI BIDS conversion with heuristic generated from c… [ENH]: DICOM to NIFTI BIDS conversion with Heudiconv Mar 25, 2024
alexpron and others added 2 commits March 25, 2024 11:48
…cted and heuristic and tempfiles for dcm2niix configuration and heudivconv heuristic files.
@alexpron
Copy link
Contributor Author

  • bids compliance problem was solved using -ba option of dcm2niix if -ba should not be applyied check field by field
  • bids validator was run on the obtained files and current filenames used should be modified in the configuration file
  • some characters are forbidden in subject_id such as - hence XX-XX is not a BIDS compliant name
  • in order to keep this name use the non bids formatting and manually recreats ontology within the heuristic file ?

@alexpron
Copy link
Contributor Author

tar or tar.gz files only are correctly handled by heudiconv (.zip files currently not supported)

@alexpron alexpron marked this pull request as ready for review May 21, 2024 12:24
@alexpron
Copy link
Contributor Author

alexpron commented May 21, 2024

  • include debug mode with directory kept i.e. switch to manually specified directories and manual delete if required
  • remove commit 5064edb
  • remove {subject_session_dir} prefix in case of automri heuristic
  • remove {subject_session_prefix} in case of automri heuristic
  • if not working implement simple BIDS to automri mappping

Optional

to be done in a dedicated PR

  • solr query enhancement : concatenate all queries into a single one

@alexpron
Copy link
Contributor Author

alexpron commented May 22, 2024

  • include debug mode with directory kept i.e. switch to manually specified directories and manual delete if required
    by default temporary directory are deleted after context execution.
    The delete keyword allowing to keep the directory is only available in python 3.12 which is too restrictive currently
    Hence temporary directory mechanism will be replaced by directories and conditional manual deletion

See https://docs.python.org/3.12/library/tempfile.html#tempfile.TemporaryDirectory and https://docs.python.org/3.11/library/tempfile.html#tempfile.TemporaryDirectory

alexpron and others added 28 commits July 22, 2024 10:30
…onfiguration.json file. Configuration file was slightly modified to handle dcm2niix options following nipype DC2NIIX attributes
@quentinduche quentinduche merged commit f4370b5 into Inria-Empenn:main Jul 25, 2024
@alexpron alexpron deleted the heudiconv branch July 25, 2024 09:38
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.

2 participants