Skip to content

[ENH] Adds extraction of physio signals from DICOMs#446

Draft
pvelasco wants to merge 25 commits into
nipy:masterfrom
cbinyu:dcm_physio
Draft

[ENH] Adds extraction of physio signals from DICOMs#446
pvelasco wants to merge 25 commits into
nipy:masterfrom
cbinyu:dcm_physio

Conversation

@pvelasco

@pvelasco pvelasco commented May 5, 2020

Copy link
Copy Markdown
Contributor

It uses bidsphysio to extract physiological signals from CMRR EPI DICOMs.

It includes regression test

pvelasco added 2 commits May 5, 2020 15:18
It uses [`bidsphysio`](https://github.com/cbinyu/bidsphysio) to extract physiological signals from CMRR EPI DICOMs.

It includes regression test
@codecov

codecov Bot commented May 5, 2020

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.39785% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.96%. Comparing base (d8e5c5f) to head (15e4a49).
⚠️ Report is 720 commits behind head on master.

Files with missing lines Patch % Lines
heudiconv/convert.py 70.58% 5 Missing ⚠️
heudiconv/dicoms.py 66.66% 1 Missing ⚠️
heudiconv/heuristics/bids_PhoenixReport.py 93.33% 1 Missing ⚠️
heudiconv/heuristics/bids_physio.py 94.11% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yarikoptic yarikoptic left a comment

Copy link
Copy Markdown
Member

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.

Comment thread Dockerfile Outdated
Comment thread heudiconv/convert.py
Comment thread heudiconv/dicoms.py Outdated
Comment thread heudiconv/tests/test_regression.py
Comment thread heudiconv/tests/test_regression.py Outdated
Comment thread heudiconv/convert.py Outdated

@mgxd mgxd left a comment

Copy link
Copy Markdown
Member

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 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?

Comment thread heudiconv/convert.py Outdated
Comment thread heudiconv/convert.py Outdated
Comment thread heudiconv/convert.py
Comment thread heudiconv/dicoms.py Outdated
Comment thread heudiconv/dicoms.py Outdated
@yarikoptic

Copy link
Copy Markdown
Member

re blacking: I don't mind at all. But we have outstanding sizeable PRs so it would introduce conflicts... will need to check with @tsalo and @bpinsard

@pvelasco

pvelasco commented May 6, 2020

Copy link
Copy Markdown
Contributor Author

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.

pvelasco and others added 4 commits May 6, 2020 14:29
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>
@tsalo

tsalo commented May 6, 2020

Copy link
Copy Markdown
Member

@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?

@mgxd

mgxd commented May 6, 2020

Copy link
Copy Markdown
Member

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

@yarikoptic

Copy link
Copy Markdown
Member

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

@yarikoptic

Copy link
Copy Markdown
Member

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 ;-)...

@yarikoptic

Copy link
Copy Markdown
Member

Thinking about it - iirc dicoms compress nicely. I will try with enabling shared encryption - that should compress them while stored in lfs.

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
yarikoptic and others added 6 commits January 12, 2021 13:34
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`.
Comment thread heudiconv/info.py Outdated

@yarikoptic yarikoptic left a comment

Copy link
Copy Markdown
Member

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

Comment thread heudiconv/convert.py
if outtype == 'dicom':
convert_dicom(item_dicoms, bids_options, prefix,
outdir, tempdirs, symlink, overwrite)
elif outtype == 'physio':

Copy link
Copy Markdown
Member

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)

Comment thread heudiconv/convert.py
"bidsphysio.dcm2bids not found. "
"Not extracting physiological recordings."
)
return

Copy link
Copy Markdown
Member

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

Comment thread heudiconv/info.py
'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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'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

Comment thread heudiconv/info.py
]
}

# Flatten the lists

Copy link
Copy Markdown
Member

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.

Comment thread heudiconv/utils.py
'series_uid', # 25
]
'time', # 26
]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would conflict with WiP of #637 / #581 but the main concern is that I do not see it needed/used at all by the target need of this PR -- conversion of physio data. Spurious wishful change? ;-)

@yarikoptic yarikoptic marked this pull request as draft February 17, 2023 15:19
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.

4 participants