tensorflowimage-processingimagenetmedical-imaging

Converting DICOM files to JPEG files for use in Inception V3


I am trying to use the Inception V3 model on a set of medical data images. The problem is the data is in DICOM format and can't be used with the Image classifier. Can anyone please let me know how to use the DICOM files directly with the Inception V3 classifier.

P.s. - I learnt to use the classifier by a tutorial provided by TensorFlow and am relatively new at this.


Solution

  • import os
    import dicom
    import matplotlib.image as image
    
    os.chdir("path/to/dicom.dcm")
    dicom_file = dicom.read_file("dicom.dcm")
    dicom_array = dicom_file.pixel_array
    image.imsave("dicom.jpg", dicom_array)