diff options
author | Daniil Kazantsev <dkazanc@hotmail.com> | 2018-04-12 10:25:21 +0100 |
---|---|---|
committer | Daniil Kazantsev <dkazanc@hotmail.com> | 2018-04-12 10:25:21 +0100 |
commit | 58f5ce047b063d53906e38047b6ae744ccdbd4eb (patch) | |
tree | 611d46727147c2473f81c35174a6c105e830e94c /Wrappers/Matlab/demos | |
parent | aa99eb8a9bd47ecd6e4d3d1e8c9f0cfbefb4f7bb (diff) | |
download | regularization-58f5ce047b063d53906e38047b6ae744ccdbd4eb.tar.gz regularization-58f5ce047b063d53906e38047b6ae744ccdbd4eb.tar.bz2 regularization-58f5ce047b063d53906e38047b6ae744ccdbd4eb.tar.xz regularization-58f5ce047b063d53906e38047b6ae744ccdbd4eb.zip |
dTV method added
Diffstat (limited to 'Wrappers/Matlab/demos')
-rw-r--r-- | Wrappers/Matlab/demos/demoMatlab_3Ddenoise.m | 45 | ||||
-rw-r--r-- | Wrappers/Matlab/demos/demoMatlab_denoise.m | 37 |
2 files changed, 71 insertions, 11 deletions
diff --git a/Wrappers/Matlab/demos/demoMatlab_3Ddenoise.m b/Wrappers/Matlab/demos/demoMatlab_3Ddenoise.m index 71082e7..dc49d9c 100644 --- a/Wrappers/Matlab/demos/demoMatlab_3Ddenoise.m +++ b/Wrappers/Matlab/demos/demoMatlab_3Ddenoise.m @@ -1,5 +1,6 @@ % Volume (3D) denoising demo using CCPi-RGL - +clear +close all addpath('../mex_compile/installed'); addpath('../../../data/'); @@ -14,31 +15,65 @@ vol3D(vol3D < 0) = 0; figure; imshow(vol3D(:,:,15), [0 1]); title('Noisy image'); %% -fprintf('Denoise using ROF-TV model (CPU) \n'); +fprintf('Denoise a volume using the ROF-TV model (CPU) \n'); lambda_rof = 0.03; % regularisation parameter tau_rof = 0.0025; % time-marching constant iter_rof = 300; % number of ROF iterations tic; u_rof = ROF_TV(single(vol3D), lambda_rof, iter_rof, tau_rof); toc; figure; imshow(u_rof(:,:,15), [0 1]); title('ROF-TV denoised volume (CPU)'); %% -% fprintf('Denoise using ROF-TV model (GPU) \n'); +% fprintf('Denoise a volume using the ROF-TV model (GPU) \n'); % lambda_rof = 0.03; % regularisation parameter % tau_rof = 0.0025; % time-marching constant % iter_rof = 300; % number of ROF iterations % tic; u_rofG = ROF_TV_GPU(single(vol3D), lambda_rof, iter_rof, tau_rof); toc; % figure; imshow(u_rofG(:,:,15), [0 1]); title('ROF-TV denoised volume (GPU)'); %% -fprintf('Denoise using FGP-TV model (CPU) \n'); +fprintf('Denoise a volume using the FGP-TV model (CPU) \n'); lambda_fgp = 0.03; % regularisation parameter iter_fgp = 300; % number of FGP iterations epsil_tol = 1.0e-05; % tolerance tic; u_fgp = FGP_TV(single(vol3D), lambda_fgp, iter_fgp, epsil_tol); toc; figure; imshow(u_fgp(:,:,15), [0 1]); title('FGP-TV denoised volume (CPU)'); %% -% fprintf('Denoise using FGP-TV model (GPU) \n'); +% fprintf('Denoise a volume using the FGP-TV model (GPU) \n'); % lambda_fgp = 0.03; % regularisation parameter % iter_fgp = 300; % number of FGP iterations % epsil_tol = 1.0e-05; % tolerance % tic; u_fgpG = FGP_TV_GPU(single(vol3D), lambda_fgp, iter_fgp, epsil_tol); toc; % figure; imshow(u_fgpG(:,:,15), [0 1]); title('FGP-TV denoised volume (GPU)'); %% +fprintf('Denoise a volume using the FGP-dTV model (CPU) \n'); + +% create another volume (reference) with slightly less amount of noise +vol3D_ref = zeros(N,N,slices, 'single'); +for i = 1:slices +vol3D_ref(:,:,i) = Im + .01*randn(size(Im)); +end +vol3D_ref(vol3D_ref < 0) = 0; +% vol3D_ref = zeros(size(Im),'single'); % pass zero reference (dTV -> TV) + +lambda_fgp = 0.03; % regularisation parameter +iter_fgp = 300; % number of FGP iterations +epsil_tol = 1.0e-05; % tolerance +eta = 0.2; % Reference image gradient smoothing constant +tic; u_fgp_dtv = FGP_dTV(single(vol3D), single(vol3D_ref), lambda_fgp, iter_fgp, epsil_tol, eta); toc; +figure; imshow(u_fgp_dtv(:,:,15), [0 1]); title('FGP-dTV denoised volume (CPU)'); +%% +fprintf('Denoise a volume using the FGP-dTV model (GPU) \n'); + +% create another volume (reference) with slightly less amount of noise +vol3D_ref = zeros(N,N,slices, 'single'); +for i = 1:slices +vol3D_ref(:,:,i) = Im + .01*randn(size(Im)); +end +vol3D_ref(vol3D_ref < 0) = 0; +% vol3D_ref = zeros(size(Im),'single'); % pass zero reference (dTV -> TV) + +lambda_fgp = 0.03; % regularisation parameter +iter_fgp = 300; % number of FGP iterations +epsil_tol = 1.0e-05; % tolerance +eta = 0.2; % Reference image gradient smoothing constant +tic; u_fgp_dtv_g = FGP_dTV_GPU(single(vol3D), single(vol3D_ref), lambda_fgp, iter_fgp, epsil_tol, eta); toc; +figure; imshow(u_fgp_dtv_g(:,:,15), [0 1]); title('FGP-dTV denoised volume (GPU)'); +%%
\ No newline at end of file diff --git a/Wrappers/Matlab/demos/demoMatlab_denoise.m b/Wrappers/Matlab/demos/demoMatlab_denoise.m index 7f87fbb..145f2ff 100644 --- a/Wrappers/Matlab/demos/demoMatlab_denoise.m +++ b/Wrappers/Matlab/demos/demoMatlab_denoise.m @@ -1,5 +1,6 @@ % Image (2D) denoising demo using CCPi-RGL - +clear +close all addpath('../mex_compile/installed'); addpath('../../../data/'); @@ -8,31 +9,55 @@ u0 = Im + .05*randn(size(Im)); u0(u0 < 0) = 0; figure; imshow(u0, [0 1]); title('Noisy image'); %% -fprintf('Denoise using ROF-TV model (CPU) \n'); +fprintf('Denoise using the ROF-TV model (CPU) \n'); lambda_rof = 0.03; % regularisation parameter tau_rof = 0.0025; % time-marching constant iter_rof = 2000; % number of ROF iterations tic; u_rof = ROF_TV(single(u0), lambda_rof, iter_rof, tau_rof); toc; figure; imshow(u_rof, [0 1]); title('ROF-TV denoised image (CPU)'); %% -% fprintf('Denoise using ROF-TV model (GPU) \n'); +% fprintf('Denoise using the ROF-TV model (GPU) \n'); % lambda_rof = 0.03; % regularisation parameter % tau_rof = 0.0025; % time-marching constant % iter_rof = 2000; % number of ROF iterations % tic; u_rofG = ROF_TV_GPU(single(u0), lambda_rof, iter_rof, tau_rof); toc; % figure; imshow(u_rofG, [0 1]); title('ROF-TV denoised image (GPU)'); %% -fprintf('Denoise using FGP-TV model (CPU) \n'); +fprintf('Denoise using the FGP-TV model (CPU) \n'); lambda_fgp = 0.03; % regularisation parameter iter_fgp = 1000; % number of FGP iterations -epsil_tol = 1.0e-05; % tolerance +epsil_tol = 1.0e-06; % tolerance tic; u_fgp = FGP_TV(single(u0), lambda_fgp, iter_fgp, epsil_tol); toc; figure; imshow(u_fgp, [0 1]); title('FGP-TV denoised image (CPU)'); %% -% fprintf('Denoise using FGP-TV model (GPU) \n'); +% fprintf('Denoise using the FGP-TV model (GPU) \n'); % lambda_fgp = 0.03; % regularisation parameter % iter_fgp = 1000; % number of FGP iterations % epsil_tol = 1.0e-05; % tolerance % tic; u_fgpG = FGP_TV_GPU(single(u0), lambda_fgp, iter_fgp, epsil_tol); toc; % figure; imshow(u_fgpG, [0 1]); title('FGP-TV denoised image (GPU)'); %% +fprintf('Denoise using the FGP-dTV model (CPU) \n'); +% create another image (reference) with slightly less amount of noise +u_ref = Im + .01*randn(size(Im)); u_ref(u_ref < 0) = 0; +% u_ref = zeros(size(Im),'single'); % pass zero reference (dTV -> TV) + +lambda_fgp = 0.03; % regularisation parameter +iter_fgp = 1000; % number of FGP iterations +epsil_tol = 1.0e-06; % tolerance +eta = 0.2; % Reference image gradient smoothing constant +tic; u_fgp_dtv = FGP_dTV(single(u0), single(u_ref), lambda_fgp, iter_fgp, epsil_tol, eta); toc; +figure; imshow(u_fgp_dtv, [0 1]); title('FGP-dTV denoised image (CPU)'); +%% +% fprintf('Denoise using the FGP-dTV model (GPU) \n'); +% % create another image (reference) with slightly less amount of noise +% u_ref = Im + .01*randn(size(Im)); u_ref(u_ref < 0) = 0; +% % u_ref = zeros(size(Im),'single'); % pass zero reference (dTV -> TV) +% +% lambda_fgp = 0.03; % regularisation parameter +% iter_fgp = 1000; % number of FGP iterations +% epsil_tol = 1.0e-06; % tolerance +% eta = 0.2; % Reference image gradient smoothing constant +% tic; u_fgp_dtvG = FGP_dTV_GPU(single(u0), single(u_ref), lambda_fgp, iter_fgp, epsil_tol, eta); toc; +% figure; imshow(u_fgp_dtvG, [0 1]); title('FGP-dTV denoised image (GPU)'); +%% |