-
Notifications
You must be signed in to change notification settings - Fork 126
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] Adds extraction of physio signals from DICOMs #446
base: master
Are you sure you want to change the base?
Conversation
It uses [`bidsphysio`](https://github.com/cbinyu/bidsphysio) to extract physiological signals from CMRR EPI DICOMs. It includes regression test
Codecov ReportAttention: 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweet!!!!! Left notes from a very initial cursory review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is awesome, thank you!
a few style suggestions, though we might just consider black
ing 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry it took so long. Did a pass. Also of interest either bidsphysio can convert fresh WiP 1066 Siemens physio data.
edit: I will convert it to draft. Please undraft/ping whenever ready for re-review etc
@@ -461,6 +461,8 @@ def convert(items, converter, scaninfo_suffix, custom_callable, with_prov, | |||
if outtype == 'dicom': | |||
convert_dicom(item_dicoms, bids_options, prefix, | |||
outdir, tempdirs, symlink, overwrite) | |||
elif outtype == 'physio': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'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
'datalad': ['datalad >=%s' % MIN_DATALAD_VERSION], | ||
'physio': [ | ||
'bidsphysio.dcm2bids >=1.4.3; python_version>"3.5"', # if dicoms with physio need to be converted | ||
] | ||
} | ||
|
||
# Flatten the lists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -46,7 +46,8 @@ | |||
'patient_sex', # 23 | |||
'date', # 24 | |||
'series_uid', # 25 | |||
] | |||
'time', # 26 | |||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It uses
bidsphysio
to extract physiological signals from CMRR EPI DICOMs.It includes regression test