Dicom image reading - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Dicom image reading (/thread-24319.html) |
Dicom image reading - smitha - Feb-08-2020 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? 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
Thank you in advance for the help
RE: Dicom image reading - smitha - Feb-09-2020 Thank you for formatting my question on forum. I am using this forum for first time. I will ensure the same next time. I will check the entire error and edit it soon. Apologies. RE: Dicom image reading - Larz60+ - Feb-09-2020 No need for apologies. This was just a friendly reminder. |