Skip to content

Incorrect spacing is recorded when reading single pydicom dataset object with pydicom #6944

Closed
@KumoLiu

Description

@KumoLiu

Describe the bug
When reading the dicom series with LoadImage(pydicom backend) in MONAI transforms, the spacing is recorded incorrectly.

updated when reading dicom series:

stack_metadata["spacing"] = np.asarray(spacing)

didn't updated when reading a single pydicom dataset object:

for key in ["00200037", "00200032", "52009229", "52009230"]:

dr, dc = metadata.get("spacing", (1.0, 1.0))[:2]

To Reproduce
Steps to reproduce the behavior:

  1. Install the MONAI dev branch.
  2. Download the attachment dcm file whose md5 is f511acb750076c56ad2d9647dcfe521d, put it in a folder.
  3. Run
from monai.transforms import LoadImage
loader = LoadImage(reader='pydicomreader')
pydicom_result = loader('./test_data')
print(pydicom_result.affine)

loader = LoadImage(reader='itkreader')
itk_result = loader('./test_data')
print(itk_result.affine)

Expected behavior
pydicom can record spacing correctly when reading a single pydicom dataset object

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions