Purpose

Calculates different similarity measures between two images.

Notes:

  • If available in your context you may consider ImageSimilarityMeasure module which is an alternative version based on the Registration library. It may have newer and better maintained measures, and might have better performance.
  • Former versions of MetaSimilarityMeasure internally converted incoming data to uint16 (which is the default for backward compatibility), which, however, is not recommended any more. See Compute Data Type for details.
  • LCC cannot handle 2-D masks correctly and ignores them. The code for LCC is not optimized. When you need to calculate the similarity value often (e.g. during registration), especially in case of LCC without mask usage, it can take a long time.

Usage

Choose any of the measures shown in Similarity and press Calculate. Similarity Value then display the measured distance. Additionally some of the measures have parameters which can be tuned. Their purpose is described in the section parameters.

Details

The currently implemented similarity measures are:

  • Sum of Squared Differences (SSD): based on grey value differences
  • Normalized Cross Correlation (NCC): based on grey value correlation
  • Mutual Information (MI): based on entropy measures of grey value histograms of the images
  • Normalized Mutual Information (NMI): based on entropy measures of grey value histograms of the images
  • Local Cross Correlation (LCC): based on grey value correlation in multiple small regions of the images
  • Normalized Gradient Field (NGF): based on the angle between image gradients

For details see also Similarity.pdf

References:

  • Sonka, Fitzpatrick: Handbook of Medical Imaging, SPIE press, 2000
  • Netsch et.al.: Towards Real-time Multi-modality 3-D Medical Image Registration, International Conference on Computer Vision, 2001
  • Haber, Modersitzki: Intensity Gradient Based Registration and Fusion of Multi-modal Images, Proceedings of MICCAI, 2006

Tips

The example network shows the usage of MetaSimilarityMeasure module with three inputs. It calculates the similarity of a Reference Image R and Template Image T. It is possible to transform T to see how the similarity value changes. The third input image contains the ROI. It is calculated using a threshold.

Windows

Default Panel

../../../Projects/ImageSimilarity/Modules/mhelp/Images/Screenshots/MetaSimilarityMeasure._default.png

Input Fields

The module needs two input images to calculate their similarity:

  • The Reference Image R
  • Template Image (Floating Image) T

Furthermore it is possible to specify a ROI using the third input. A voxel with value 0 in the third input image means that the corresponding voxel position is excluded from the calculation of the similarity value. If there is no third input image given the similarity value is calculated including all voxel positions.

Affects only the calculation of :field:`similarity` = LCC: In case of Similarity = LCC, the entries in the mask image define the Neighborhood Size (see below), therefore take care to use reasonably low integer values for the mask (0,1,2). Voxel value 0 means no calculation of LCC in this position, voxel value 1 means calculation of LCC including all voxels at distance 1 to current position, voxel value 2 means calculation of LCC including all voxels at distance 2 to current position, …

input0

name: input0, type: Image

The input for the mandatory Reference Image R.

input1

name: input1, type: Image

The input for the mandatory Template Image (Floating Image) T.

input2

name: input2, type: Image

The input for the optional mask/ROI image.

Parameter Fields

Field Index

Bin Size: Integer
Calculate: Trigger
Compute Data Type: Enum
Neighborhood Size: Integer
Similarity: Enum
Similarity Value: Double

Visible Fields

Similarity

name: similarity, type: Enum, default: SSD

Selects the similarity measure to be used: SSD, NCC, MI, NMI, LCC, NGF. See Details for a description of the available measures.

Compute Data Type

name: computeDataType, type: Enum, default: Input0Type

Selects the data type in which data is requested from all three input images. Note that the actual computations are always performed in double, incoming data is cast when necessary. Former version always have buffered incoming data in unsigned 16 bit integer which is not recommended any more since it may cause information loss. Recommended is the smallest voxel type which is large enough to hold all input data types without sign and precision information loss. If all three inputs are of the same type then best use the type form input image 0, because it reduced data conversions.

Bin Size

name: binSize, type: Integer, default: 64, minimum: 2

Affects only the calculation of MI and NMI! For both measures grey value probability density functions (see formulas below) are calculated from grey value histograms. Therefore grey values are merged into bins of the specified bin size. This means the smaller the bin size, the finer the ?resolution? of the histogram.

Neighborhood Size

name: neighborhoodSize, type: Integer, default: 1, minimum: 1, maximum: 5

Affects only the calculation of LCC! In case there is no third input provided, LCC is calculated in every position and the neighbourhood is specified as the area +/- Neighborhood Size in x-, y- and z-direction. In case there is a valid input2 image provided, you must write here the maximum value of the mask image to state the maximum neighbourhood size.

Similarity Value

name: similarityValue, type: Double, default: 0

Displays the result of the most recent similarity calculation or 0 if invalid or outdated.

Calculate

name: calculate, type: Trigger

Starts the similarity calculation.