ITK metrics direct application

Hey Guys!

I’d like to hear form you if it is possible to apply itk similarity metrics (derived from itkImagetoImageMetric.h) directly for two images.

The thing is: I’d like to used different similarity metrics to measure the similarity degree between tow images registered with different techniques.

I tried something like creating a metric, setting moving image and fixed image, and triggering Update(), but did not work.

Any clue?
Thanks

How about calling GetValue()?

I tried… But did not work…
In fact, ImageToImageMetrics do no have Update() methods.
I then called GetValue() directly.
It outputs the following error:

terminate called after throwing an instance of 'itk::ExceptionObject'
what():  /home/leonardo/General-Sources/ITK- 
5.0.0/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetric.hxx:415:
itk::ERROR: MachadoMutualInformationImageToImageMetricv4(0x3155770): m_VirtualImage is 
undefined. Cannot return region. 
The program has unexpectedly finished.

You might need to set some transform(s), even if it is identity.

Also these topics might be interesting:

1 Like

The Compute Mean Squares Metric Between Two Images example may be helpful.

2 Likes

Great!!!
I guess that is exactly what I was looking for.

Thanks guys!

1 Like

It worked… Uhul!

In the RegistrationV4 examples, usually, they do not set interpolator. Does the default interpolator is the linear one?

Linear interpolator is the default one, if there is a default.

2 Likes