Ask Robin Ince (CCed). He is the expert and has a great toolbox.
> On 19 Oct 2018, at 12:41, Aran Garcia <[log in to unmask]> wrote:
>
> Dear SPM experts,
>
> We are trying to obtain the value of the Normalised Mutual Information(nmi) between two images and we have not achieved it yet.
>
> We've found a script in the forum which was coded to do so but we have found some differences between it and the spm_coreg function and we don't know which to use since they give us different outputs.
>
> cg_hist2d_img.m - Script from the forum
>
> H = H/(sum(H(:))+eps);
> s1 = sum(Hmi,1);
> s2 = sum(Hmi,2);
> H = H.*log2((H+eps)./(s2*s1+eps));
> mi = sum(H(:));
>
>
> spm_coreg
>
> H = H+eps;
> sh = sum(H(:));
> H = H/sh;
> s1 = sum(H,1);
> s2 = sum(H,2);
> H = H.*log2(H./(s2*s1));
> mi = sum(H(:));
>
> nmi = (sum(s1.*log2(s1))+sum(s2.*log2(s2)))/sum(sum(H.*log2(H)));
>
> When we apply it using as input the same image twice, we get a value above 1,
> while we believe it should be 1 (or 0.998).
>
> Are the values of NMI supposed to be between 0 and 1?
>
> Any insight given will be gratefull
>
>
> Thanks
>
>
> Aran
|