Any itk.Object in Python can be passed a Python callable, i.e. a Python function on a Python class that has a __call__ method to its AddObserver method. AddObserver takes the specific itk.EventObject to be observed along with the command to execute when the event occurs.
Here is an example:
import itk
image = itk.imread('/home/matt/data/aneurism.nrrd')
normalizer = itk.NormalizeImageFilter.New(image)
def my_python_function():
print('hey from a python function')
normalizer.AddObserver(itk.StartEvent(), my_python_function)
normalizer.Update()
The examples are in need of updates
![]()