<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hello Selwyn,<div class=""><br class=""></div><div class="">It sounds like you have an exciting project.</div><div class=""><br class=""></div><div class="">SimpleITK’s interface is a little different that native ITK.</div><div class=""><br class=""></div><div class="">1) There are no “New” methods in SimpleITK. ITK’s is written for C++ and uses smart pointers with the “New” method for memory allocations. On the other hand SimpleITK was designed for scripting languages where memory allocation and management happens automatically with in the language [1].</div><div class=""><br class=""></div><div class="">2) SimpleITK’s filters have an Execute(input1, input2, etc..) method instead of ITK’s pipeline with methods like SetInput, Update, Disconnect, etc… SimpleITK’s uses the “Execute" method for immediate execution which provide a simpler and some time more efficient execution model for image processing.</div><div class=""><br class=""></div><div class="">3) You may want to run through some of the SimpleITK Python Notebooks [2] for a tutorial. It will be well work the time to setup your Python environment to include Notebooks, so that you can interact with the Python interpreter command by command, and get inline help.</div><div class=""><br class=""></div><div class="">HTH,</div><div class="">Brad</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">[1] <a href="https://en.wikipedia.org/wiki/Memory_management" class="">https://en.wikipedia.org/wiki/Memory_management</a></div><div class="">[2] <a href="https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks" class="">https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks</a></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 16, 2015, at 10:37 PM, Selwyn Hector via Community <<a href="mailto:community@itk.org" class="">community@itk.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div class=""><div style="background-color: rgb(255, 255, 255); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 14px;" class=""><div id="yiv1440123354" class=""><div id="yui_3_16_0_1_1450322355316_2682" class=""><div style="background-color: rgb(255, 255, 255);" id="yui_3_16_0_1_1450322355316_2681" class=""><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 14px;" class="">Dear ITK Community,</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 14px;" class=""><br id="yiv1440123354yui_3_16_0_1_1450320492970_9908" class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 14px;" class="">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. </div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 14px;" class=""><br id="yiv1440123354yui_3_16_0_1_1450320492970_9910" class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 14px;" class="">I am basically trying to rewrite an ITK example,<a rel="nofollow" class="yiv1440123354" target="_blank" href="http://itk.org/ITKExamples/src/Filtering/ImageGrid/Create3DVolume/Documentation.html#create-3d-volume" id="yiv1440123354yui_3_16_0_1_1450320492970_9868" style="background-color:rgb(255, 255, 255);">Create 3D Volume</a>, 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:</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 14px;" class=""><br class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">from __future__ import print_function</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""><br id="yui_3_16_0_1_1450322355316_2988" class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">import SimpleITK as sitk</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">import sys</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">import os</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">import numpy</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">import matplotlib as plt</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""><br id="yui_3_16_0_1_1450322355316_2996" class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">if len(sys.argv) != 3:</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""> print("Usage: " + sys.argv[0] + "<python.png> <prediction.png> <output.png>")</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""> sys.exit(1)</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""><br id="yui_3_16_0_1_1450322355316_3002" class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">InputDimension = 2</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">OutputDimension = 3</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""><br id="yui_3_16_0_1_1450322355316_3007" class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">pixelType = sitk.sitkFloat32</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">TInputImage = sitk.Image(32, 32, InputDimension)</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">TOutputImage = sitk.Image(32, 32, OutputDimension)</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""><br id="yui_3_16_0_1_1450322355316_3013" class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">reader = sitk.ImageFileReader()</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""><br id="yui_3_16_0_1_1450322355316_3017" class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">tileFilter = sitk.TileImageFilter()</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""> </div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">layout = [2, 2, 0]</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">defaultvalue = 128</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""><br id="yui_3_16_0_1_1450322355316_3024" class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">tileFilter.SetLayout(layout)</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""><br id="yui_3_16_0_1_1450322355316_3028" class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">for ii in range(1, len(sys.argv)-1):</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""> reader.SetFileName(sys.argv[ii])</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""> reader.Update()</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""><br id="yui_3_16_0_1_1450322355316_3034" class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""> inputImage = sys.reader.GetOutput()</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""> inputImage.DisconnectPipeline()</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""><br id="yui_3_16_0_1_1450322355316_3039" class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""> tileFilter.SetInput(ii-1, inputImage)</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""><br id="yui_3_16_0_1_1450322355316_3043" class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">tileFilter.SetDefaultPixelValue(defaultvalue)</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">tileFilter.Update()</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""><br id="yui_3_16_0_1_1450322355316_3048" class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">writer = sitk.ImageFileWriter(TOutputImage).New()</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">writer.SetFileName(sys.argv[-1])</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">writer.SetInput(TileFitler.GetOutput())</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">writer.Update()</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""><br class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">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__'.</div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class=""><br class=""></div><div id="yiv1440123354yui_3_16_0_1_1450320492970_4303" dir="ltr" class="">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!</div></div></div></div></div></div></div>_______________________________________________<br class="">Community mailing list<br class=""><a href="mailto:Community@itk.org" class="">Community@itk.org</a><br class="">http://public.kitware.com/mailman/listinfo/community<br class=""></div></blockquote></div><br class=""></div></body></html>