<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Dear all,<br> I am trying to write ConnectedThresholdImageFilter in Python (Wrapping) according to the model given in Example folder of ITK 3.12. But when I am running I am getting a black image. I am using Python 2.6.2 and ITK - 3.12.0 . My code is give below.<br>####################################################################<br>import itk<br>from sys import argv<br>itk.auto_progress(2)<br><br>dim = 2<br>IType = itk.Image[itk.F, dim]<br>OIType = itk.Image[itk.UC, dim]<br><br>reader = itk.ImageFileReader[IType].New( FileName=argv[1] )<br><br>smoothing = itk.CurvatureFlowImageFilter[IType, IType].New( reader,NumberOfIterations=5,<br> TimeStep=0.125 )<br><br>myIndex =
itk.Index[2]()<br>myIndex.SetElement(0, int(argv[3]))<br>myIndex.SetElement(1, int(argv[4]))<br>myIndex.GetElement(0)<br>myIndex.GetElement(1)<br><br><br><br>connectedThreshold = itk.ConnectedThresholdImageFilter[IType, IType].New( smoothing)<br>connectedThreshold.AddSeed(myIndex)<br>connectedThreshold.SetlowerThreshold=int(argv[5])<br>connectedThreshold.SetupperThreshold=int(argv[6])<br><br><br>caster = itk.CastImageFilter[IType, IType].New(connectedThreshold )<br>cast = itk.RescaleIntensityImageFilter[IType, OIType].New(caster,OutputMinimum=0,<br> OutputMaximum=255)<br><br>writer = itk.ImageFileWriter[OIType].New( cast, FileName=argv[2] )<br>writer.Update()<br>###############################################################<br>I dont know if I am doing any mistake. If kindly any one help me in this regard.<br>Thanking you<br>abhishek<br></td></tr></table><br>
<!--3--><hr size=1></hr> Explore and discover exciting holidays and getaways with Yahoo! India Travel <a href="http://in.rd.yahoo.com/tagline_Travel_1/*http://in.travel.yahoo.com/"> Click here!</a>