InsightSoftwareConsortium / InsightSoftwareConsortium/ITK
Class to enable a custom image similarity metric defined in Python
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 748
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 64
Description
## Description
Enable creation of a custom similarity metric in Python. See the discussion here:
https://discourse.itk.org/t/is-there-a-way-to-set-custom-metric-in-itk-registration-in-python/705/7
### Expected behavior
A convenient way to define an image similarity metric in Python that re-uses the ITK image registration frame, i.e. optimizers, transformations, multi-resolution capabilities, regularization.
### Actual behavior
The registration metric must be implemented in C++.
### Additional Information
Possible implementation:
An `itk.PythonImageRegistrationMetricv4` class would be similar to [itk.ImageToImageMetricv4](https://itk.org/Doxygen/html/classitk_1_1ImageToImageMetricv4.html), but it would have additional methods,
- `GetValuePythonCallback`
- `GetDerivativePythonCallback`
- `GetValueAndDerivativePythonCallback`
These methods would be passed Python functions that accept the `ImageToImageMetricv4` as an argument and would need to return required value and derivative values.
See also the class for defining a custom ITK filter in Python:
https://github.com/InsightSoftwareConsortium/ITK/blob/master/Wrapping/Generators/Python/PyUtils/itkPyImageFilter.h
Contributor guide
Assessment
This issue has not been assessed yet.