medpy.filter.noise.immerkaer#

medpy.filter.noise.immerkaer(input, mode='reflect', cval=0.0)[source]#

Estimate the global noise.

The input image is assumed to have additive zero mean Gaussian noise. Using a convolution with a Laplacian operator and a subsequent averaging the standard deviation sigma of this noise is estimated. This estimation is global i.e. the noise is assumed to be globally homogeneous over the image.

Implementation based on [1].

Immerkaer suggested a Laplacian-based 2D kernel:

[[ 1, -2,  1],
 [-2,  4, -1],
 [ 1, -2, 1]]

, which is separable and can therefore be applied by consecutive convolutions with the one dimensional kernel [1, -2, 1].

We generalize from this 1D-kernel to an ND-kernel by applying N consecutive convolutions with the 1D-kernel along all N dimensions.

This is equivalent with convolving the image with an ND-kernel constructed by calling

>>> kernel1d = numpy.asarray([1, -2, 1])
>>> kernel = kernel1d.copy()
>>> for _ in range(input.ndim):
>>>     kernel = numpy.tensordot(kernel, kernel1d, 0)
Parameters:
inputarray_like

Array of which to estimate the noise.

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

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

cvalscalar, optional

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

Returns:
sigmafloat

The estimated standard deviation of the images Gaussian noise.

See also

immerkaer_local

Notes

Does not take the voxel spacing into account. Works good with medium to strong noise. Tends to underestimate for low noise levels.

References

[1]

John Immerkaer, “Fast Noise Variance Estimation”, Computer Vision and Image Understanding, Volume 64, Issue 2, September 1996, Pages 300-302, ISSN 1077-3142