[Insight-users] Problem with ConnectedThresholdImageFilter in Python

Abhishek Banerjee a.banerjee at ymail.com
Sun May 31 09:12:14 EDT 2009


Dear all,
                 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.
####################################################################
import itk
from sys import argv
itk.auto_progress(2)

dim = 2
IType = itk.Image[itk.F, dim]
OIType = itk.Image[itk.UC, dim]

reader = itk.ImageFileReader[IType].New( FileName=argv[1] )

smoothing  = itk.CurvatureFlowImageFilter[IType, IType].New( reader,NumberOfIterations=5,
                TimeStep=0.125 )

myIndex = itk.Index[2]()
myIndex.SetElement(0, int(argv[3]))
myIndex.SetElement(1, int(argv[4]))
myIndex.GetElement(0)
myIndex.GetElement(1)



connectedThreshold = itk.ConnectedThresholdImageFilter[IType, IType].New( smoothing)
connectedThreshold.AddSeed(myIndex)
connectedThreshold.SetlowerThreshold=int(argv[5])
connectedThreshold.SetupperThreshold=int(argv[6])


caster  = itk.CastImageFilter[IType, IType].New(connectedThreshold )
cast = itk.RescaleIntensityImageFilter[IType, OIType].New(caster,OutputMinimum=0,
                OutputMaximum=255)

writer = itk.ImageFileWriter[OIType].New( cast, FileName=argv[2] )
writer.Update()
###############################################################
I dont know if I am doing any mistake. If kindly any one help me in this regard.
Thanking you
abhishek



      From Chandigarh to Chennai - find friends all over India. Go to http://in.promos.yahoo.com/groups/citygroups/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090531/d7b585f1/attachment.htm>


More information about the Insight-users mailing list