www.gusucode.com > 瑞利信道下噪声能量的估计源码程序 > 瑞利信道下噪声能量的估计源码程序/MSP_estimate_version1/ReferenceMethods/Aja_second_order_moment_granularity.m

    % Noise estimation based on the local second-order moment of Rayleigh
% distribution denoted as Aja's method #1 based on eq. 17 in 
% S. Aja-Fernandez, et al., Noise and Signal Estimation in Magnitude MRI and Rician Distributed Images: 
% A LMMSE Approach, IEEE Transactions on Image Processing, vol. 17, no. 8, 2008, pp. 1383-1398
%
% 27/12/2013
% 
% Tomasz Pieciak
% AGH university of Science and Technology, Krakow, Poland
% pieciak@agh.edu.pl, http://home.agh.edu.pl/pieciak/
%
% ARGUMENTS
%   data - single-coil MRI data
%   window - sliding window size
%   granularity - histogram granularity
%
% FUNCTION RETURNS
%   sigma - estimated noise level (sigma)
%
% USAGE
%    sigma_estimated = Aja_second_order_moment_granularity(data, [7, 7], 5)

function [sigma] = Aja_second_order_moment_granularity(data, window, granularity)

N = window(1) * window(2);
FUNCTION = @(x)( (1/(N-1))*sum(x.^2) ); % function calculates second-order moment; according to eq. 16
EX2 = colfilt(data, window, 'sliding', FUNCTION);

% calculate histogram
[histogram_x, histogram_p] = CalculateHistogram(EX2(:), granularity);
[value, index] = max(histogram_p);

sigma = sqrt(0.5*index); % estimation according to eq. 17