[Insight-users] ITK on Python : Done !
Luis Ibanez
luis . ibanez at kitware . com
Tue, 24 Jun 2003 16:03:32 -0400
Hi Mauricio
Python wrapping is already available for ITK.
Please update your CVS checkout of the toolkit
and follow the instructions in the file
Insight/Wrapping/CSwig/README
You will have to download "CableSwig", and build
it in your system. Then enable the CMake variable
ITK-CSWIG-PYTHON in the CMake configuration
of ITK. (full instructions are in the README file...)
We are currently translating some of the C++
examples in Insight/Examples to Python .
Please look at
Insight/Examples/Filtering
CurvatureAnisotropicDiffusionImageFilter.py
CurvatureFlowImageFilter.py
GradientAnisotropicDiffusionImageFilter.py
MedianImageFilter.py
SigmoidImageFilter.py
Here is for example
CurvatureAnisotropicDiffusionImageFilter.py
------------------------------------------------------
from InsightToolkit import *
from sys import argv
reader = itkImageFileReaderUS2_New()
writer = itkImageFileWriterUS2_New()
inputCast = itkCastImageFilterUS2F2_New()
outputCast = itkRescaleIntensityImageFilterF2US2_New()
filter = itkCurvatureAnisotropicDiffusionImageFilterF2F2_New()
inputCast.SetInput( reader.GetOutput() )
filter.SetInput( inputCast.GetOutput() )
outputCast.SetInput( filter.GetOutput() )
writer.SetInput( outputCast.GetOutput() )
reader.SetFileName( argv[1] )
writer.SetFileName( argv[2] )
outputCast.SetOutputMinimum( 0 )
outputCast.SetOutputMaximum( 65535 )
numberOfIterations = eval( argv[3] )
timeStep = eval( argv[4] )
conductance = eval( argv[5] )
filter.SetNumberOfIterations( numberOfIterations )
filter.SetTimeStep( timeStep )
filter.SetConductanceParameter( conductance )
writer.Update()
------------------------------------------------------
Please let us know if you encounter any problems
Regards,
Luis
----------------------------------------------------------
mauricio . inforcati at cenpra . gov . br wrote:
>Hi,
>
>When are we going to have itk wrapped to python?
>Thanks all,
>
> Mauricio
>
>---------------------------------------------
>Centro de Pesquisa Renato Archer
>http://www . cenpra . gov . br/
>
>
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk . org
>http://www . itk . org/mailman/listinfo/insight-users
>
>
>