From 1ac06b5ce11b247930489b7aa3afa59215e43c91 Mon Sep 17 00:00:00 2001 From: Daniil Kazantsev Date: Tue, 12 Mar 2019 22:14:27 +0000 Subject: readme updates and demos --- demos/SoftwareX_supp/Demo_RealData_Recon_SX.py | 18 +++++++++--------- demos/demoMatlab_3Ddenoise.m | 16 +++++++++++----- 2 files changed, 20 insertions(+), 14 deletions(-) (limited to 'demos') diff --git a/demos/SoftwareX_supp/Demo_RealData_Recon_SX.py b/demos/SoftwareX_supp/Demo_RealData_Recon_SX.py index ca8f1d2..5991989 100644 --- a/demos/SoftwareX_supp/Demo_RealData_Recon_SX.py +++ b/demos/SoftwareX_supp/Demo_RealData_Recon_SX.py @@ -1,15 +1,15 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ -This demo scripts support the following publication: -"CCPi-Regularisation Toolkit for computed tomographic image reconstruction with +This demo scripts support the following publication: +"CCPi-Regularisation Toolkit for computed tomographic image reconstruction with proximal splitting algorithms" by Daniil Kazantsev, Edoardo Pasca, Martin J. Turner, Philip J. Withers; Software X, 2019 ____________________________________________________________________________ * Reads real tomographic data (stored at Zenodo) --- https://doi.org/10.5281/zenodo.2578893 * Reconstructs using TomoRec software -* Saves reconstructed images +* Saves reconstructed images ____________________________________________________________________________ >>>>> Dependencies: <<<<< 1. ASTRA toolbox: conda install -c astra-toolbox astra-toolbox @@ -40,7 +40,7 @@ data_norm = normaliser(dataRaw, flats, darks, log='log') del dataRaw, darks, flats intens_max = 2.3 -plt.figure() +plt.figure() plt.subplot(131) plt.imshow(data_norm[:,150,:],vmin=0, vmax=intens_max) plt.title('2D Projection (analytical)') @@ -72,7 +72,7 @@ FBPrec = RectoolsDIR.FBP(data_norm[0:100,:,det_y_crop]) sliceSel = 50 max_val = 0.003 -plt.figure() +plt.figure() plt.subplot(131) plt.imshow(FBPrec[sliceSel,:,:],vmin=0, vmax=max_val, cmap="gray") plt.title('FBP Reconstruction, axial view') @@ -108,7 +108,7 @@ RectoolsIR = RecToolsIR(DetectorsDimH = np.size(det_y_crop), # DetectorsDimH # DetectorsDimV = 100, # DetectorsDimV # detector dimension (vertical) for 3D case only AnglesVec = angles_rad, # array of angles in radians ObjSize = N_size, # a scalar to define reconstructed object dimensions - datafidelity='LS',# data fidelity, choose LS, PWLS (wip), GH (wip), Student (wip) + datafidelity='LS',# data fidelity, choose LS, PWLS, GH (wip), Students t (wip) nonnegativity='ENABLE', # enable nonnegativity constraint (set to 'ENABLE') OS_number = None, # the number of subsets, NONE/(or > 1) ~ classical / ordered subsets tolerance = 0.0, # tolerance to stop inner (regularisation) iterations earlier @@ -124,7 +124,7 @@ RecADMM_reg_sbtv = RectoolsIR.ADMM(data_norm[0:100,:,det_y_crop], sliceSel = 50 max_val = 0.003 -plt.figure() +plt.figure() plt.subplot(131) plt.imshow(RecADMM_reg_sbtv[sliceSel,:,:],vmin=0, vmax=max_val, cmap="gray") plt.title('3D ADMM-SB-TV Reconstruction, axial view') @@ -164,7 +164,7 @@ RecADMM_reg_rofllt = RectoolsIR.ADMM(data_norm[0:100,:,det_y_crop], sliceSel = 50 max_val = 0.003 -plt.figure() +plt.figure() plt.subplot(131) plt.imshow(RecADMM_reg_rofllt[sliceSel,:,:],vmin=0, vmax=max_val) plt.title('3D ADMM-ROFLLT Reconstruction, axial view') @@ -202,7 +202,7 @@ RecADMM_reg_tgv = RectoolsIR.ADMM(data_norm[0:100,:,det_y_crop], sliceSel = 50 max_val = 0.003 -plt.figure() +plt.figure() plt.subplot(131) plt.imshow(RecADMM_reg_tgv[sliceSel,:,:],vmin=0, vmax=max_val) plt.title('3D ADMM-TGV Reconstruction, axial view') diff --git a/demos/demoMatlab_3Ddenoise.m b/demos/demoMatlab_3Ddenoise.m index ec0fd88..6b21e86 100644 --- a/demos/demoMatlab_3Ddenoise.m +++ b/demos/demoMatlab_3Ddenoise.m @@ -18,9 +18,10 @@ Ideal3D(:,:,i) = Im; end vol3D(vol3D < 0) = 0; figure; imshow(vol3D(:,:,7), [0 1]); title('Noisy image'); -lambda_reg = 0.03; % regularsation parameter for all methods + %% fprintf('Denoise a volume using the ROF-TV model (CPU) \n'); +lambda_reg = 0.03; % regularsation parameter for all methods tau_rof = 0.0025; % time-marching constant iter_rof = 300; % number of ROF iterations epsil_tol = 0.0; % tolerance @@ -31,14 +32,17 @@ fprintf('%s %f \n', 'RMSE error for ROF is:', rmse_rof); figure; imshow(u_rof(:,:,7), [0 1]); title('ROF-TV denoised volume (CPU)'); %% % fprintf('Denoise a volume using the ROF-TV model (GPU) \n'); +% lambda_reg = 0.03; % regularsation parameter for all methods % tau_rof = 0.0025; % time-marching constant % iter_rof = 300; % number of ROF iterations -% tic; u_rofG = ROF_TV_GPU(single(vol3D), lambda_reg, iter_rof, tau_rof); toc; +% epsil_tol = 0.0; % tolerance +% tic; u_rofG = ROF_TV_GPU(single(vol3D), lambda_reg, iter_rof, tau_rof, epsil_tol); toc; % rmse_rofG = (RMSE(Ideal3D(:),u_rofG(:))); % fprintf('%s %f \n', 'RMSE error for ROF is:', rmse_rofG); % figure; imshow(u_rofG(:,:,7), [0 1]); title('ROF-TV denoised volume (GPU)'); %% fprintf('Denoise a volume using the FGP-TV model (CPU) \n'); +lambda_reg = 0.03; % regularsation parameter for all methods iter_fgp = 300; % number of FGP iterations epsil_tol = 0.0; % tolerance tic; [u_fgp,infovec] = FGP_TV(single(vol3D), lambda_reg, iter_fgp, epsil_tol); toc; @@ -47,9 +51,10 @@ rmse_fgp = (RMSE(Ideal3D(:),u_fgp(:))); fprintf('%s %f \n', 'RMSE error for FGP-TV is:', rmse_fgp); figure; imshow(u_fgp(:,:,7), [0 1]); title('FGP-TV denoised volume (CPU)'); %% -% fprintf('Denoise a volume using the FGP-TV model (GPU) \n'); +fprintf('Denoise a volume using the FGP-TV model (GPU) \n'); +% lambda_reg = 0.03; % regularsation parameter for all methods % iter_fgp = 300; % number of FGP iterations -% epsil_tol = 1.0e-05; % tolerance +% epsil_tol = 0.0; % tolerance % tic; u_fgpG = FGP_TV_GPU(single(vol3D), lambda_reg, iter_fgp, epsil_tol); toc; % rmse_fgpG = (RMSE(Ideal3D(:),u_fgpG(:))); % fprintf('%s %f \n', 'RMSE error for FGP-TV is:', rmse_fgpG); @@ -66,7 +71,7 @@ figure; imshow(u_sb(:,:,7), [0 1]); title('SB-TV denoised volume (CPU)'); %% % fprintf('Denoise a volume using the SB-TV model (GPU) \n'); % iter_sb = 150; % number of SB iterations -% epsil_tol = 1.0e-05; % tolerance +% epsil_tol = 0.0; % tolerance % tic; u_sbG = SB_TV_GPU(single(vol3D), lambda_reg, iter_sb, epsil_tol); toc; % rmse_sbG = (RMSE(Ideal3D(:),u_sbG(:))); % fprintf('%s %f \n', 'RMSE error for SB-TV is:', rmse_sbG); @@ -88,6 +93,7 @@ figure; imshow(u_rof_llt(:,:,7), [0 1]); title('ROF-LLT denoised volume (CPU)'); % lambda_LLT = lambda_reg*0.35; % LLT regularisation parameter % iter_LLT = 300; % iterations % tau_rof_llt = 0.0025; % time-marching constant +% epsil_tol = 0.0; % tolerance % tic; u_rof_llt_g = LLT_ROF_GPU(single(vol3D), lambda_ROF, lambda_LLT, iter_LLT, tau_rof_llt, epsil_tol); toc; % rmse_rof_llt = (RMSE(Ideal3D(:),u_rof_llt_g(:))); % fprintf('%s %f \n', 'RMSE error for ROF-LLT is:', rmse_rof_llt); -- cgit v1.2.3