Created
August 28, 2014 18:38
-
-
Save thewtex/80c2855d6644215f7c1c to your computer and use it in GitHub Desktop.
Create a blank SimpleITK image with specified image information.
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 sys | |
import SimpleITK as sitk | |
if len(sys.argv) < 5: | |
print('Usage: ' + sys.argv[0] + ' size0,size1,size2 spacing0,spacing1,spacing2 origin0,origin1,origin2 OutputImage') | |
sys.exit(1) | |
size = [int(ss) for ss in sys.argv[1].split(',')] | |
origin = [float(ss) for ss in sys.argv[2].split(',')] | |
spacing = [float(ss) for ss in sys.argv[3].split(',')] | |
output_image_filename = sys.argv[4] | |
output_image = sitk.Image(size, sitk.sitkInt8) | |
output_image.SetOrigin(origin) | |
output_image.SetSpacing(spacing) | |
sitk.WriteImage(output_image, output_image_filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment