Commit 3bd4c4f
### Description
Fixes #8468. When `ImageOrientationPatient` (0020,0037) and
`ImagePositionPatient` (0020,0032) are missing from the metadata (e.g.
some multi-frame Enhanced DICOM), `PydicomReader._get_affine` returned
`np.eye(4)` with no indication, so downstream orientation and spacing
were silently wrong.
This adds a `UserWarning` that names the missing tags, states the affine
defaults to identity, and suggests `ITKReader` for such files. The
fallback behaviour itself is unchanged — this only surfaces it.
### Types of changes
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [x] New tests added to cover the changes.
### Testing
Added `tests/data/test_pydicom_reader.py` asserting that `_get_affine`
warns (`UserWarning`) and returns identity when the orientation/position
tags are absent or only partially present.
```
python -m unittest tests.data.test_pydicom_reader
# Ran 2 tests ... OK
```
Signed-off-by: Lanre Shittu <136805224+Shizoqua@users.noreply.github.com>
Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
1 parent 1a26bc9 commit 3bd4c4f
2 files changed
Lines changed: 49 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
744 | 744 | | |
745 | 745 | | |
746 | 746 | | |
747 | | - | |
748 | | - | |
749 | | - | |
750 | | - | |
751 | | - | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
752 | 752 | | |
753 | 753 | | |
754 | 754 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
0 commit comments