mutual information entropy


I want to ask that in the metrics class of sklearn package, [mutual_ info_ score] is used to calculate Shannon’s mutual information entropy? If not, is there any way to calculate it? If so, is it accurate? Because I need to calculate the mutual information entropy of two images.

Thank you for your answers.

You should look into MutualInformation and MattesMutualInformation and perhaps other image similarity metrics. To evaluate a metric directly (outside of registration framework), look at this example.

Hello @TJH123456,

Please keep variations of the same question in the same thread (your previous variant rotate the image which was answered there).

Hello, I have an idea, but I don’t know if it can be realized.

I want to import the image into the framework, and only calculate the similarity without other steps. Is this feasible?

Hello @TJH123456,

Yes, this can be done using the MetricEvaluate method. Please see this Jupyter notebook section titled “MetricEvaluate”.

Thank you for your answer. But I found that it has interpolation function, and all I want is to calculate the similarity value of two images. I delete a part of the code, I do not know if the function I achieve after doing so is correct?I hope you can help me to have a look.Thanks.

Hello @TJH123456,
We always use an interpolator as the computation is configured for a generic setting, not one where the two images have been resampled onto each other, which I assume is your case. Given this assumption, you can: (1) set interpolator to nearest neighbor (2) not do sampling, `SetMetricSamplingStrategy(registration_method.NONE) (3) set the transformation to the identity.

1 Like

Thank you very much for your reply!

After reading the link you provided, I also found that the unit of display angle can be set as degree (°), instead of radian. In this way, can I input the value in the unit of angle directly when setting parameters?

Hello @TJH123456,
The angles are always given in radians. If you want to work in degrees simply use numpy.radians to do the conversion.

1 Like

Thank you for your answer! I really appreciate your help. Thank you.