ants.ops.denoise_image
- denoise_image(image, mask=None, shrink_factor=1, p=1, r=2, noise_model='Rician', v=0)[source]
Denoise an image using a spatially adaptive filter originally described in J. V. Manjon, P. Coupe, Luis Marti-Bonmati, D. L. Collins, and M. Robles. Adaptive Non-Local Means Denoising of MR Images With Spatially Varying Noise Levels, Journal of Magnetic Resonance Imaging, 31:192-203, June 2010.
ANTsR function: denoiseImage
- Parameters:
image (
ants.core.ANTsImage) – scalar image to denoise.mask (
ants.core.ANTsImage) – to limit the denoise region.shrink_factor (
scalar) – downsampling level performed within the algorithm.p (
intorcharacterof format'2x2'where the x separates vector entries) – patch radius for local sample.r (
intorcharacterof format'2x2'where the x separates vector entries) – search radius from which to choose extra local samples.noise_model (
str) – ‘Rician’ or ‘Gaussian’
- Return type:
ants.core.ANTsImage
Example
>>> import ants >>> import numpy as np >>> image = ants.image_read(ants.get_ants_data('r16')) >>> # add fairly large salt and pepper noise >>> imagenoise = image + np.random.randn(*image.shape).astype('float32')*5 >>> imagedenoise = ants.denoise_image(imagenoise, ants.get_mask(image))