Hi all
I am trying to read a dicom image. The image has 49 frames. The PixelData has some bytes in the array. But the pixel_array is not working. Please guide me on how to display the multiple frames from .dcm image?
I am trying to read a dicom image. The image has 49 frames. The PixelData has some bytes in the array. But the pixel_array is not working. Please guide me on how to display the multiple frames from .dcm image?
import matplotlib.pyplot as plt import pydicom dataset = pydicom.dcmread('bscan.dcm') print("Storage type.....:", dataset.SOPClassUID) print() if 'PixelData' in dataset: rows = int(dataset.Rows) cols = int(dataset.Columns) print("Image size.......: {rows:d} x {cols:d}, {size:d} bytes".format( rows=rows, cols=cols, size=len(dataset.PixelData))) if 'PixelSpacing' in dataset: print("Pixel spacing....:", dataset.PixelSpacing) plt.imshow(dataset.pixel_array) plt.show()The above code gives the following output and error
Output:Image size.......: 496 x 512, 24887296 bytes
Pixel spacing....: [0.011606, 0.003872]
Error:AttributeError: Unable to convert the pixel data as the following required elements are missing from the dataset: SamplesPerPixel
Thank you in advance for the help