Search code examples
pythondicompydicom

Convert DICOM to TIFF


I'm new to Python so forgive my ignorance If I don't have all the info correct. I'm trying raster through a directory and convert all the DICOM files within to TIFF files. I have gotten the search functionality to work, but I am having a hard time saving the images as TIFFs. I'm using the pydicom libraries to read in the DICOM and manipulate the header information. Also, I have tried using the save_as function in pydicom to save to TIFF, but I would rather use the save function in PIL to properly set the compression of the TIFF. I think the problem is that I can't/don't understand how to extract the actual image data from a DICOM and place it in a new image.Any Help would be greatly appreciated ... Cheers

Python 2.7 PIL 1.1.7 Pydicom 0.9.6


Solution

  • If you know how to use PIL to save image data as .tiff, this example should help you to pass image data from pydicom to PIL (there is more here in the comments).