Created
March 10, 2019 14:55
-
-
Save javathunderman/a3250eef2fa3d2f77cd79b576f34f053 to your computer and use it in GitHub Desktop.
Script for quickly converting DICOM images to ordered JPG images for machine learning.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script for quickly converting DICOM images to ordered JPG images for machine learning. | |
import os | |
for fileName in os.listdir("."): | |
noe = os.path.splitext(fileName)[0] | |
if(noe == "convert"): | |
continue | |
os.system("convert " + fileName + " " + noe + ".jpg") | |
os.remove(noe+".dcm") | |
for fileName1 in os.listdir("."): | |
noe1 = os.path.splitext(fileName1)[0] | |
if(noe1 == "convert"): | |
continue | |
os.rename(fileName1, fileName1.replace(fileName1, noe1+"-whatever.jpg")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment