[ENH] Adds extraction of physio signals from DICOMs#446
Conversation
It uses [`bidsphysio`](https://github.com/cbinyu/bidsphysio) to extract physiological signals from CMRR EPI DICOMs. It includes regression test
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #446 +/- ##
==========================================
+ Coverage 76.01% 76.96% +0.95%
==========================================
Files 38 40 +2
Lines 3010 3100 +90
==========================================
+ Hits 2288 2386 +98
+ Misses 722 714 -8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
yarikoptic
left a comment
There was a problem hiding this comment.
sweet!!!!! Left notes from a very initial cursory review.
mgxd
left a comment
There was a problem hiding this comment.
this is awesome, thank you!
a few style suggestions, though we might just consider blacking the whole repo and adhering to a stricter style guide.
another consideration while looking at this - WDYT about fetching the data via datalad instead of hosting it in the repo?
Of course, that would be great. You can just download the data from my branch, or I can send you a zip file with them. Once they are in DataLad, I'll modify the regression tests accordingly. |
... from `Dockerfile`
Co-authored-by: Mathias Goncalves <goncalves.mathias@gmail.com>
Co-authored-by: Mathias Goncalves <goncalves.mathias@gmail.com>
Co-authored-by: Mathias Goncalves <goncalves.mathias@gmail.com>
|
@yarikoptic, I like automated code formatting, but I think running black would introduce a ton of conflicts in #442. Could aggressive re-formatting be something that's done in its own PR after the pending larger PRs are handled? |
|
of course, it would make it nearly unreviewable! I meant showing some love to formatting prior to the next release, and then inserting a style check into our CI |
|
Just a note (I am ok either way): theoretically (didn't try yet) if there is no value in individual commits in a or (or if they are way to split from a full diff, eg different files), and both branches are auto blacked when pr branch having master branch merged right before blacking - should be easy to force refresh PRs with blacked version ;-) I can try if we decide to black it all |
|
Re data - I think it is time to remove the middle man me! Let's (ab)use lfs of GitHub with datalad: http://handbook.datalad.org/en/latest/basics/101-138-sharethirdparty.html?highlight=Lfs#use-github-for-sharing-content . I will initiate a repo with the content of this PR data files, and invite everyone possibly interested ;-)... |
|
Thinking about it - iirc dicoms compress nicely. I will try with enabling shared encryption - that should compress them while stored in lfs. |
That reduces indentation in the function code.
To preserve backwards compatibility
To preserve backwards compatibility
…cedata This way the user can go back to the scanner and import the exact same protocol that was run for a given subject, improving reproducibility.
[`bidsphysio`](https://github.com/cbinyu/bidsphysio) has been refractored into subpackages so that now we only need to import `bidsphysio.dcm2bids`, which has fewer dependencies
Merges `adds_acq_time_to_seqinfo` into `dcm_physio` branch
Merge `handles_phoenix_file` into `dcm_physio`
The dependencies for `bidsphysio.dcm2bids>=1.4.3` require Python 3.6 or higher, so don't try to install `bidsphysio.dcm2bids` unless `python_version > 3.5`.
Thanks to @tsalo for his suggestion
| if outtype == 'dicom': | ||
| convert_dicom(item_dicoms, bids_options, prefix, | ||
| outdir, tempdirs, symlink, overwrite) | ||
| elif outtype == 'physio': |
There was a problem hiding this comment.
we would need to document that, e.g. at https://github.com/nipy/heudiconv/blob/HEAD/docs/heuristics.rst#infotodictseqinfos (make it all into a nice itemized list there for nii, dicom and now physio)
| "bidsphysio.dcm2bids not found. " | ||
| "Not extracting physiological recordings." | ||
| ) | ||
| return |
There was a problem hiding this comment.
I would be ok with erroring out here since if heuristic did instruct to get those physio - we better have all dependencies
| 'datalad': ['datalad >=%s' % MIN_DATALAD_VERSION] | ||
| 'datalad': ['datalad >=%s' % MIN_DATALAD_VERSION], | ||
| 'physio': [ | ||
| 'bidsphysio.dcm2bids >=1.4.3; python_version>"3.5"', # if dicoms with physio need to be converted |
There was a problem hiding this comment.
| 'bidsphysio.dcm2bids >=1.4.3; python_version>"3.5"', # if dicoms with physio need to be converted | |
| 'bidsphysio.dcm2bids >=1.4.3', # if dicoms with physio need to be converted |
as 3.5 is already below what we support
| ] | ||
| } | ||
|
|
||
| # Flatten the lists |
There was a problem hiding this comment.
all those binary files below adding up to over 1MB -- I think should be moved to some external dataset and used via fetch_data. ATM fetch_data hardcodes to access from datasets.datalad.org but I think we should change that -- if full url is provided - just use that URL, and then share them on some repo, could be even not annex, just regular git repo on github.
Later we should improve this fetch_data to make data persistent locally etc... but not for this PR.
| 'series_uid', # 25 | ||
| ] | ||
| 'time', # 26 | ||
| ] |
It uses
bidsphysioto extract physiological signals from CMRR EPI DICOMs.It includes regression test