pydicom / pydicom

Read, modify and write DICOM files with python code
https://pydicom.github.io/pydicom/dev
Other
1.92k stars 481 forks source link

Take DICOM pixel spacing from private tag #1369

Closed sulaimanvesal closed 3 years ago

sulaimanvesal commented 3 years ago

Hi,

I have 5K 3D ultrasound dicom images that they don't have pixel-spacing tag. However, the pixel-spacing information stored in private tags. I noticed, PyDicom and any other libraries, if they couldn't find pixel-spacing tag, they map the dicom images to a default pixel-spacing of [1.0 , 1.0, 1.0] and image-origin of [0.0 ,0.0 ,0.0]. As a result of this process, images are loaded with miss-alignment and wrong image resolution.

I have found a way to tackle this issue using 3D Slicer Python API. However, it takes too much time per case to convert them. I was wondering if there is any other solution using PyDicom to solve this issue.

The goal is to read the dicom images and read private tags to extract the correct pixel-spacing information and use that as actual pixel-spacing and don't allowing PyDicom to load dicom images with default pixel spacing [1.0 , 1.0, 1.0] and image origin [0.0 ,0.0 ,0.0].

I am sure, this would speed up the data preprocessing for my dicom images.

Best,

mrbean-bremen commented 3 years ago

pydicom does not do any image display, it just provides the pixel data - so it does not use Pixel Spacing for anything. You can of course read the private tag with the pixel spacing, but need to feed it into the imaging library you use for display. What are you using for display? Maybe you can share the relevant code to understand this better? (Note: I'm converting this into a disussion)