How To Extract/view All Frames Of A Multi-frame Dicom File?
Solution 1:
pydicom supports reading pixel data. Refer this documentation.
pydicom tends to be “lazy” in interpreting DICOM data. For example, by default it doesn’t do anything with pixel data except read in the raw bytes:
import dicom ds=dicom.read_file("MR_small.dcm") ds.PixelData '\x89\x03\xfb\x03\xcb\x04\xeb\x04\xf9\x02\x94\x01\x7f ... ...
About pixel_array
A property of Dataset called pixel_array provides more useful pixel data for uncompressed images. The NumPy numerical package must be installed on your system to use this property, because pixel_array returns a NumPy array:
importdicomds=dicom.read_file("MR_small.dcm")ds.pixel_arrayarray([[905,1019,1227,...,302,304,328], [ 628, 770, 907, ..., 298, 331, 355], [ 498, 566, 706, ..., 280, 285, 320],..., [ 334, 400, 431, ..., 1094, 1068, 1083], [ 339, 377, 413, ..., 1318, 1346, 1336], [ 378, 374, 422, ..., 1369, 1129, 862]],dtype=int16)ds.pixel_array.shape(64,64)
Document also explains about viewing images at http://pydicom.readthedocs.io/en/stable/viewing_images.html.
As explained in error message (and by @kritzel_sw in comment) the pydicom does not support the Transfer Syntax of source image yet. Change the Transfer Syntax using some other tool before attempting to extract the frames.
Another helpful blog of Rony http://dicomiseasy.blogspot.in/2012/08/chapter-12-pixel-data.html
Also check this Stack Overflow question; it is about old version but may be helpful.
Post a Comment for "How To Extract/view All Frames Of A Multi-frame Dicom File?"