[ITK] CREATE 3D VOLUME
Selwyn Hector
selwyn_hector at yahoo.com
Wed Dec 16 22:37:59 EST 2015
Dear ITK Community,
I am high school senior extremely interested in programming and dedicated my graduating senior project to a SimpleITK program. I have basic understanding of computer science with skills in both python and Java.
I am basically trying to rewrite an ITK example,Create 3D Volume, into a SimpleITK program. Create 3D volume uses the TileImageFilter and DisconnectPipeline methods in order to merge multiple two dimensional images into a three dimensional image. If I follow the example on the site and use InputImageType as a parameter of InputImageType then I receive the error "wrong number or type of argument for overloaded function new_Image". I looked up the function .Image and rewrote the program in a way that fits all parameters. The program is below:
from __future__ import print_function
import SimpleITK as sitkimport sysimport osimport numpyimport matplotlib as plt
if len(sys.argv) != 3: print("Usage: " + sys.argv[0] + "<python.png> <prediction.png> <output.png>") sys.exit(1)
InputDimension = 2OutputDimension = 3
pixelType = sitk.sitkFloat32TInputImage = sitk.Image(32, 32, InputDimension)TOutputImage = sitk.Image(32, 32, OutputDimension)
reader = sitk.ImageFileReader()
tileFilter = sitk.TileImageFilter() layout = [2, 2, 0]defaultvalue = 128
tileFilter.SetLayout(layout)
for ii in range(1, len(sys.argv)-1): reader.SetFileName(sys.argv[ii]) reader.Update()
inputImage = sys.reader.GetOutput() inputImage.DisconnectPipeline()
tileFilter.SetInput(ii-1, inputImage)
tileFilter.SetDefaultPixelValue(defaultvalue)tileFilter.Update()
writer = sitk.ImageFileWriter(TOutputImage).New()writer.SetFileName(sys.argv[-1])writer.SetInput(TileFitler.GetOutput())writer.Update()
This program is also based on the example but I doWhen i run this program through the command prompt along with images I am trying to import I receive the error "AttributeError; type object 'object' has no attribute '__getattr__'.
I would love to complete this program and begin to work on future personal ITK projects so I would appreciate help on this. Please let me know If I have made any formatting mistakes or reached out in the wrong way. Thank you all so much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20151217/7621bd3d/attachment.html>
More information about the Community
mailing list