Python Bindings

Since the implemented interpolation and affine transformation methods already work with Python types, the binding to python itself is mainly a task of defining all the combinations of data types, dimensionalities and interpolation orders as well as adding doc strings.

File containing the python bindings of the C++ affine transform functions.

Functions

std::string get_function_description(std::string order, std::string bounds)

Helper function to obtain function docstring.

Parameters:
  • order[in] The order of the interpolation

  • bounds[in] The boundary function used

Returns:

A string containing a docstring for the affine transform function with the appropriate order and bounds.

template<typename T, template<typename> typename Func, typename BoundaryFunc, int MaxDim>
void register_affine_transform(pybind11::module &m, const char *name, const char *description)

Helper function to define affine transform functions in python of up to a given dimension.

Parameters:
  • m[in] The python module for which to define the functions

  • name[in] The name all the functions will share

  • description[in] The doc-string all functions will share

Template Parameters:
  • T – The image data_type

  • Func – The interpolation order

  • BoundaryFunc – The boundary function to use

  • MaxDim – The maximum image dimension up to which to register python functions

PYBIND11_MODULE(_affine_transform, transformation_module)

Function that makes all defined interpolation functions visible to Python.