|(14 intermediate revisions by 4 users not shown)|
ITK itself is written in C++, however a tool called CableSwig can be used to generate bindings for other languages. This allows you to use the same runtime (running in optimised C++ code) but develop in a scripting language (and take advantage of all the attendant benefits).
be for the .
The following languages are supported via the bindings:
* '''Tcl''' : http://www.tcl.tk/ (see TclLanguage)
* '''Python''' : http://www.python.org/ (see PythonLanguage)
* '''Java''' : http://java.sun.com/ (see JavaLanguage)
In order to build the bindings, you will need to:
# Build and install CableSwig ([http://www.itk.org/HTML/CableSwig.html more info])
# Ensure you have installed both the runtime '''and''' the development versions of your chosen language
# Build ITK using the appropriate settings for your platform, and enable the CABLE_* option for your language
# Install ITK as per normal
== Tcl Bindings ==
Tcl (Tool Command Language) is a very simple language for writing scripts.
== Python Bindings ==
Python is a very elegant and powerful language.
Here is some example Python code for ITK (taken from `Insight/Examples/Filtering`):
#!/usr/ bin/ env python
from InsightToolkit import *
from sys import argv
reader = itkImageFileReaderUS2_New()
writer = itkImageFileWriterUS2_New()
filter = itkBinaryThresholdImageFilterUS2US2_New()
filter.SetInput( reader.GetOutput() )
writer.SetInput( filter.GetOutput() )
reader.SetFileName( argv )
writer.SetFileName( argv )
filter.SetLowerThreshold( eval( argv ) )
filter.SetUpperThreshold( eval( argv ) )
filter.SetOutsideValue( eval( argv ) )
filter.SetInsideValue( eval( argv ) )
== Java Bindings ==
Java is a modern object-oriented language.