19 import InsightToolkit
as itk
22 reader = itk.itkImageFileReaderF2_New()
23 reader.SetFileName( sys.argv[1] )
25 diffusion = itk.itkGradientAnisotropicDiffusionImageFilterF2F2_New()
26 diffusion.SetInput(reader.GetOutput())
27 diffusion.SetTimeStep(0.0625)
28 diffusion.SetConductanceParameter(9.0)
29 diffusion.SetNumberOfIterations( 5 );
31 gradient = itk.itkGradientMagnitudeImageFilterF2F2_New()
32 gradient.SetInput(diffusion.GetOutput())
34 watershed = itk.itkWatershedImageFilterF2_New()
35 watershed.SetInput(gradient.GetOutput())
36 watershed.SetThreshold(0.01)
37 watershed.SetLevel(0.2)
39 writer = itk.itkImageFileWriterUL2_New()
40 writer.SetFileName( sys.argv[2] )
41 writer.SetInput( watershed.GetOutput() )