Open thewtex opened 4 years ago
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.
Hi developers, for my thesis I would like to perform registration with my own custom metric (Frechet distance function). I have looked around online and this issue seems to be the only place that really mentions anything close to what I want. Though I have been using SimpleITK and not ITK itself. I see that this has been on the backlog for some years, do you think that this will by any chance be finished soon? Or if not, does anyone have a suggestion on an alternative method I could use?
Hello @JaroKuiken,
This discussion describes how to add a metric to ITK and then to SimpleITK. Unfortunately, it requires implementation in C++ and you appear to be looking for a path forward in Python. If you are able to implement it in C++ then you have an immediate path forward. If not, I don't think the timeline for this feature will be short enough so that you can use it in your work. I may be wrong here, @thewtex will have a better idea with respect to timeline for ITK 6.0.0.
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, 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