Created
October 11, 2019 09:18
-
-
Save dnlcrl/b92cc71d53f61e49f113c0cadb5af8d6 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
import SimpleITK as sitk | |
import sys, os | |
if len ( sys.argv ) < 3: | |
print( "Usage: DicomSeriesReader <input_directory> <output_file>" ) | |
sys.exit ( 1 ) | |
print( "Reading Dicom directory:", sys.argv[1] ) | |
reader = sitk.ImageSeriesReader() | |
dicom_names = reader.GetGDCMSeriesFileNames( sys.argv[1] ) | |
reader.SetFileNames(dicom_names) | |
image = reader.Execute() | |
size = image.GetSize() | |
print( "Image size:", size[0], size[1], size[2] ) | |
print( "Writing image:", sys.argv[2] ) | |
sitk.WriteImage(image, sys.argv[2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment