suyashkumar / dicom

⚡High Performance DICOM Medical Image Parser in Go.
MIT License
933 stars 136 forks source link

Allow option to tolerate PixelData VL and expected length mismatches. #245

Closed ducquangkstn closed 2 years ago

ducquangkstn commented 2 years ago

Sometimes, the VL of pixel data does not match with calculated value. (I can not provide the sample file to test this)

ducquangkstn commented 2 years ago

Anyway, just thought I'd get a better sense of your use case. Thanks!

We have a DICOM which the PixelData under tag Icon Image Sequence is broken. The main PixelData is fine

import pydicom
dcm = pydicom.dcmread('...')
dcm.pixel_array
array([[1899, 1927, 1875, ..., 4889, 5041, 5266],
       [1906, 1926, 1882, ..., 4865, 5072, 5240],
       [1923, 1907, 1865, ..., 4977, 5050, 5171],
       ...,
       [2288, 2319, 2271, ..., 6861, 6835, 6822],
       [2330, 2358, 2277, ..., 6888, 6835, 6848],
       [2337, 2359, 2301, ..., 6861, 6848, 6749]], dtype=uint16)

dcm.IconImageSequence[0]
(0028, 0002) Samples per Pixel                   US: 1
(0028, 0004) Photometric Interpretation          CS: 'MONOCHROME2'
(0028, 0010) Rows                                US: 64
(0028, 0011) Columns                             US: 64
(0028, 0100) Bits Allocated                      US: 8
(0028, 0101) Bits Stored                         US: 8
(0028, 0102) High Bit                            US: 7
(0028, 0103) Pixel Representation                US: 0
(0028, 1040) Pixel Intensity Relationship        CS: 'LOG'
(7fe0, 0010) Pixel Data                          OB: Array of 1976 elements

dcm.IconImageSequence[0].pixel_array
error

My use-case is reading the DICOM and just ignoring the pixelData inside IconImageSequence

ducquangkstn commented 2 years ago

@suyashkumar Pls also approve workflow for enable Github CI for this PR.

suyashkumar commented 2 years ago

🎉 Merged! Thank you again!