nipype.interfaces.nipy.utils module

Similarity

Link to code

Bases: NipyBaseInterface

Calculates similarity between two 3D volumes. Both volumes have to be in the same coordinate system, same space within that coordinate system and with the same voxel dimensions.

Deprecated since version 0.10.0: Use nipype.algorithms.metrics.Similarity instead.

Example

>>> from nipype.interfaces.nipy.utils import Similarity
>>> similarity = Similarity()
>>> similarity.inputs.volume1 = 'rc1s1.nii'
>>> similarity.inputs.volume2 = 'rc1s2.nii'
>>> similarity.inputs.mask1 = 'mask.nii'
>>> similarity.inputs.mask2 = 'mask.nii'
>>> similarity.inputs.metric = 'cr'
>>> res = similarity.run() # doctest: +SKIP
volume1 : a pathlike object or string representing an existing file
3D volume.
volume2 : a pathlike object or string representing an existing file
3D volume.
mask1 : a pathlike object or string representing an existing file
3D volume.
mask2 : a pathlike object or string representing an existing file
3D volume.
metric : ‘cc’ or ‘cr’ or ‘crl1’ or ‘mi’ or ‘nmi’ or ‘slr’ or a callable value
Str or callable Cost-function for assessing image similarity. If a string, one of ‘cc’: correlation coefficient, ‘cr’: correlation ratio, ‘crl1’: L1-norm based correlation ratio, ‘mi’: mutual information, ‘nmi’: normalized mutual information, ‘slr’: supervised log-likelihood ratio. If a callable, it should take a two-dimensional array representing the image joint histogram as an input and return a float. (Nipype default value: None)
similarity : a float
Similarity between volume 1 and 2.