0001 function noise_mean = avw_estimate_noise(avw) 0002 0003 0004 0005 [s1,s2,s3] = size(avw.img); 0006 0007 slice_x0 = avw.img(1,:,:); 0008 slice_x0_mean = mean(mean(slice_x0)); 0009 0010 if s1 > 1, 0011 slice_x1 = avw.img(end,:,:); 0012 slice_x1_mean = mean(mean(slice_x1)); 0013 x_mean = mean(slice_x0_mean, slice_x1_mean); 0014 else 0015 x_mean = slice_x0_mean; 0016 end 0017 0018 slice_y0 = avw.img(:,1,:); 0019 slice_y0_mean = mean(mean(slice_y0)); 0020 0021 if s2 > 1, 0022 slice_y1 = avw.img(:,end,:); 0023 slice_y1_mean = mean(mean(slice_y1)); 0024 y_mean = mean(slice_y0_mean, slice_y1_mean); 0025 else 0026 y_mean = slice_y0_mean; 0027 end 0028 0029 slice_z0 = avw.img(:,:,1); 0030 slice_z0_mean = mean(mean(slice_z0)); 0031 0032 if s3 > 1, 0033 slice_z1 = avw.img(:,:,end); 0034 slice_z1_mean = mean(mean(slice_z1)); 0035 z_mean = mean(slice_z0_mean, slice_z1_mean); 0036 else 0037 z_mean = slice_z0_mean; 0038 end 0039 0040 noise_mean = mean([x_mean,y_mean,z_mean]); 0041