ITK/Python Wrapping

From KitwarePublic
< ITK
Jump to navigationJump to search

Python Wrapping

This section describes how to wrap ITK classes for being used from Python.

Step 1: Make sure the python headers are installed

Python will need to be installed along with the Python development headers (Python.h).

If you need to specify a specific Python version or a custom location of the headers, the following CMake configuration variables can be modified:

  • PYTHON_INCLUDE_DIR
  • PYTHON_LIBRARY
  • PYTHON_EXECUTABLE
  • PY_SITE_PACKAGES_PATH

Step 2: Turn on Python wrapping in the ITK configuration

Turn ON the CMake configuration ITK_WRAP_PYTHON.

Step 3: Select the pixel types and dimensions to build

You can choose what pixel types and dimensions to build into the wrapped interface. There is a trade-off between the number of pixel types and images dimensions supported and the amount of compilation time required and the size of the wrapping libraries.

For the dimensions to support, set the CMake configuration variable ITK_WRAP_DIMS. This is a semi-colon delimited string containing the dimensions to support (Image dimensions, etc). The default is 2;3.

The pixel types to support are boolean variables in the pattern ITK_WRAP_<pixel type>. For instance,

  • ITK_WRAP_float
  • ITK_WRAP_rgb_unsigned_char
  • ITK_WRAP_vector_double
  • ITK_WRAP_complex_double




ITK: [Welcome | Site Map]