function [PSNR, y_est] = BM3D(y, z, sigma, profile, print_to_screen,N2,N2_wiener,Ns,Ns_wiener,tau_match)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% BM3D is an algorithm for attenuation of additive white Gaussian noise from
% grayscale images. This algorithm reproduces the results from the article:
%
% [1] K. Dabov, A. Foi, V. Katkovnik, and K. Egiazarian, "Image Denoising
% by Sparse 3D Transform-Domain Collaborative Filtering,"
% IEEE Transactions on Image Processing, vol. 16, no. 8, August, 2007.
% preprint at http://www.cs.tut.fi/~foi/GCF-BM3D.
%
%
% FUNCTION INTERFACE:
%
% [PSNR, y_est] = BM3D(y, z, sigma, profile, print_to_screen)
%
% ! The function can work without any of the input arguments,
% in which case, the internal default ones are used !
%
% BASIC USAGE EXAMPLES:
%
% Case 1) Using the default parameters (i.e., image name, sigma, etc.)
%
% [PSNR, y_est] = BM3D;
%
% Case 2) Using an external noisy image:
1