Skip to content

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

Closed

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

Activity

  1. self-assigned this
    on Sep 5, 2023
  2. added a commit that references this issue on Sep 5, 2023
    7a3ddc7
  3. added a commit that references this issue on Sep 5, 2023
    8e77e03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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