medpy.filter.image.sls#

medpy.filter.image.sls(minuend, subtrahend, metric='ssd', noise='global', signed=True, sn_size=None, sn_footprint=None, sn_mode='reflect', sn_cval=0.0, pn_size=None, pn_footprint=None, pn_mode='reflect', pn_cval=0.0)[source]#

Computes the signed local similarity between two images.

Compares a patch around each voxel of the minuend array to a number of patches centered at the points of a search neighbourhood in the subtrahend. Thus, creates a multi-dimensional measure of patch similarity between the minuend and a corresponding search area in the subtrahend.

This filter can also be used to compute local self-similarity, obtaining a descriptor similar to the one described in [1].

Parameters:
minuendarray_like

Input array from which to subtract the subtrahend.

subtrahendarray_like

Input array to subtract from the minuend.

metric{‘ssd’, ‘mi’, ‘nmi’, ‘ncc’}, optional

The metric parameter determines the metric used to compute the filter output. Default is ‘ssd’.

noise{‘global’, ‘local’}, optional

The noise parameter determines how the noise is handled. If set to ‘global’, the variance determining the noise is a scalar, if set to ‘local’, it is a Gaussian smoothed field of estimated local noise. Default is ‘global’.

signedbool, optional

Whether the filter output should be signed or not. If set to ‘False’, only the absolute values will be returned. Default is ‘True’.

sn_sizescalar or tuple, optional

See sn_footprint, below

sn_footprintarray, optional

The search neighbourhood. Either sn_size or sn_footprint must be defined. sn_size gives the shape that is taken from the input array, at every element position, to define the input to the filter function. sn_footprint is a boolean array that specifies (implicitly) a shape, but also which of the elements within this shape will get passed to the filter function. Thus sn_size=(n,m) is equivalent to sn_footprint=np.ones((n,m)). We adjust sn_size to the number of dimensions of the input array, so that, if the input array is shape (10,10,10), and sn_size is 2, then the actual size used is (2,2,2).

sn_mode{‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’}, optional

The sn_mode parameter determines how the array borders are handled, where sn_cval is the value when mode is equal to ‘constant’. Default is ‘reflect’

sn_cvalscalar, optional

Value to fill past edges of input if sn_mode is ‘constant’. Default is 0.0

pn_sizescalar or tuple, optional

See pn_footprint, below

pn_footprintarray, optional

The patch over which the distance measure is applied. Either pn_size or pn_footprint must be defined. pn_size gives the shape that is taken from the input array, at every element position, to define the input to the filter function. pn_footprint is a boolean array that specifies (implicitly) a shape, but also which of the elements within this shape will get passed to the filter function. Thus pn_size=(n,m) is equivalent of dimensions of the input array, so that, if the input array is shape (10,10,10), and pn_size is 2, then the actual size used is (2,2,2).

pn_mode{‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’}, optional

The pn_mode parameter determines how the array borders are handled, where pn_cval is the value when mode is equal to ‘constant’. Default is ‘reflect’

pn_cvalscalar, optional

Value to fill past edges of input if pn_mode is ‘constant’. Default is 0.0

Returns:
slsndarray

The signed local similarity image between subtrahend and minuend.

References

[1]

Mattias P. Heinrich, Mark Jenkinson, Manav Bhushan, Tahreema Matin, Fergus V. Gleeson, Sir Michael Brady, Julia A. Schnabel MIND: Modality independent neighbourhood descriptor for multi-modal deformable registration Medical Image Analysis, Volume 16, Issue 7, October 2012, Pages 1423-1435, ISSN 1361-8415 http://dx.doi.org/10.1016/j.media.2012.05.008