heudiconv
heudiconv copied to clipboard
Multiple converted file sliceorientationpatient
Here is a PR to allow scans including variable slicing, such as localizer, to be labelled with acq-<orient>
instead of the suffix being indexed (default).
As the different slicing still share a same SeriesID and are split by dcm2niix, I think it can only be done within heudiconv. Correct me if I am wrong.
Another case that doesn't seem to be yet managed is when data are exported with split channels, I might work on a separate PR unless someone feels like it.
Oups, just saw the #424. It might be worth integrating this feature with #424 .
Codecov Report
Merging #441 (eb60770) into master (5a1e9e8) will decrease coverage by
7.06%
. The diff coverage is41.05%
.
:exclamation: Current head eb60770 differs from pull request most recent head 418601f. Consider uploading reports for the commit 418601f to get more accurate results
@@ Coverage Diff @@
## master #441 +/- ##
==========================================
- Coverage 81.24% 74.18% -7.07%
==========================================
Files 41 35 -6
Lines 3813 2932 -881
==========================================
- Hits 3098 2175 -923
- Misses 715 757 +42
Impacted Files | Coverage Δ | |
---|---|---|
heudiconv/convert.py | 71.79% <41.05%> (-15.43%) |
:arrow_down: |
heudiconv/cli/run.py | 79.64% <0.00%> (-11.85%) |
:arrow_down: |
heudiconv/bids.py | 82.97% <0.00%> (-6.71%) |
:arrow_down: |
heudiconv/dicoms.py | 81.55% <0.00%> (-4.22%) |
:arrow_down: |
heudiconv/heuristics/bids_ME.py | 90.90% <0.00%> (-3.54%) |
:arrow_down: |
heudiconv/heuristics/reproin.py | 81.11% <0.00%> (-2.81%) |
:arrow_down: |
heudiconv/heuristics/example.py | 4.22% <0.00%> (-1.34%) |
:arrow_down: |
heudiconv/utils.py | 90.08% <0.00%> (-1.29%) |
:arrow_down: |
heudiconv/tests/test_regression.py | 92.00% <0.00%> (-1.26%) |
:arrow_down: |
... and 14 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update e9bc381...418601f. Read the comment docs.
placed comments along the code. But also we need to figure out how to test it... if any scout suffice (didn't check) -- we already use some in testing, so we could test on those
I looked at the test data and the scout is only one dicom file, would require at least 2 dicom files with differing ImageOrientationPatient, from a localizer for instance. Did you follow a specific procedure to include dicoms in the test set (anonymize, strip data... )?
Did you follow a specific procedure to include dicoms in the test set (anonymize, strip data... )?
so you looked at ./heudiconv/tests/data/01-anat-scout
which indeed we have a single file.
I wish @mvdoc had annotated in 0cb8fab16d0747a07861ce31f39cef08670f87e7 commit where he got it from so we could add more.
But in the other tests we already use datalad to fetch full blown phantom dataset which would have "good" scouts: see https://github.com/nipy/heudiconv/blob/master/heudiconv/tests/test_regression.py#L28 which fetches http://datasets.datalad.org/?dir=/dbic/QA/ and uses tarball(s) from under http://datasets.datalad.org/?dir=/dbic/QA/sourcedata .
eventually we should add proper fixtures and caching so we don't need to refetch them across tests and tests reruns (would be a nice contribution, if interested, but in a separate PR).
I first thought that you could just add testing to the existing test_conversion
in that file using the scout tarball of http://datasets.datalad.org/?dir=/dbic/QA/sourcedata/sub-emmet/ses-20180508/anat (can guess why subject is called emmet? ... but apparently all our scouts are proper 3d volumes in that dataset (never looked at them, thought wrong). But there is a bunch of dicoms we have in http://datasets.datalad.org/?dir=/dicoms/dartmouth-phantoms dataset, so you could craft a similar test which installs ///dicoms/dartmouth-phantoms/
(instead of ///dbic/QA
) and uses e.g. bids_test3-20161011/AAHead_Scout_32ch-head-coil_MPR_cor
which has 3 dicoms and dcm2niix produces 3 nii.gz
$> dcm2niix -9 -b y -o . -z y .
Chris Rorden's dcm2niiX version v1.0.20200331 (JP2:OpenJPEG) GCC8.3.0 (64-bit Linux)
Found 3 DICOM file(s)
Slices not stacked: orientation varies (vNav or localizer?) [0.991633 -0.0203033 0.127482 0.125499 0.382898 -0.915226] != [0.990337 -0.0649062 0.122559 0.138123 0.382102 -0.91374]
Convert 1 DICOM as ./__AAHead_Scout_32ch-head-coil_20161011084552_4_i00002 (162x162x1x1)
Warning: Check that 2D images are not mirrored.
Convert 1 DICOM as ./__AAHead_Scout_32ch-head-coil_20161011084552_4_i00003 (162x162x1x1)
Warning: Check that 2D images are not mirrored.
Convert 1 DICOM as ./__AAHead_Scout_32ch-head-coil_20161011084552_4_i00001 (162x162x1x1)
Warning: Check that 2D images are not mirrored.
Conversion required 0.052689 seconds (0.052680 for core code).
(dev3) 1 21811.....................................:Thu 23 Apr 2020 05:09:28 PM EDT:.
(git-annex)lena:…-phantoms[master]bids_test3-20161011/AAHead_Scout_32ch-head-coil_MPR_cor
$> ls
1.3.12.2.1107.5.2.43.66112.2016101108475682845701835.dcm
1.3.12.2.1107.5.2.43.66112.2016101108475682864701836.dcm
1.3.12.2.1107.5.2.43.66112.2016101108475682884501837.dcm
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00001.json
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00001.nii.gz
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00002.json
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00002.nii.gz
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00003.json
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00003.nii.gz
(dev3) 1 21812.....................................:Thu 23 Apr 2020 05:09:30 PM EDT:.
(git-annex)lena:…-phantoms[master]bids_test3-20161011/AAHead_Scout_32ch-head-coil_MPR_cor
$> grep Orient *json
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00001.json: "ImageOrientationPatientDICOM": [
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00002.json: "ImageOrientationPatientDICOM": [
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00003.json: "ImageOrientationPatientDICOM": [
(dev3) 1 21813.....................................:Thu 23 Apr 2020 05:12:03 PM EDT:.
(git-annex)lena:…-phantoms[master]bids_test3-20161011/AAHead_Scout_32ch-head-coil_MPR_cor
$> grep -A4 Orient *json
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00001.json: "ImageOrientationPatientDICOM": [
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00001.json- 0.987256,
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00001.json- -0.0511309,
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00001.json- 0.150699,
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00001.json- 0.159073,
--
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00002.json: "ImageOrientationPatientDICOM": [
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00002.json- 0.991633,
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00002.json- -0.0203033,
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00002.json- 0.127482,
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00002.json- 0.125499,
--
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00003.json: "ImageOrientationPatientDICOM": [
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00003.json- 0.990337,
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00003.json- -0.0649062,
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00003.json- 0.122559,
__AAHead_Scout_32ch-head-coil_20161011084552_4_i00003.json- 0.138123,
FWIW: woohoo -- based on checksum, that test scout we have is from http://datasets.datalad.org/?dir=/dicoms/dartmouth-phantoms/bids_test4-20161014/phantom-1/anat-scout_ses-localizer , for which we also have e.g. http://datasets.datalad.org/?dir=/dicoms/dartmouth-phantoms/bids_test4-20161014/phantom-1/anat-scout_ses-localizer_MPR_cor which has 3 dicoms which are similarly of the different orientations. So you might use those (instead of the ones I recommended) for consistency. ... those 3 files gzip into 100k, so in principle we could have carried their copy, but I would prefer not to as long as we can fetch them.