summaryrefslogtreecommitdiffstats
path: root/Wrappers
diff options
context:
space:
mode:
Diffstat (limited to 'Wrappers')
-rw-r--r--Wrappers/Matlab/demos/demoMatlab_3Ddenoise.m6
-rw-r--r--Wrappers/Matlab/demos/demoMatlab_denoise.m4
-rw-r--r--Wrappers/Python/demos/demo_cpu_regularisers.py2
-rw-r--r--Wrappers/Python/demos/demo_cpu_regularisers3D.py9
-rw-r--r--Wrappers/Python/demos/demo_cpu_vs_gpu_regularisers.py8
-rw-r--r--Wrappers/Python/demos/demo_gpu_regularisers.py2
-rw-r--r--Wrappers/Python/demos/demo_gpu_regularisers3D.py2
-rw-r--r--Wrappers/Python/src/cpu_regularisers.pyx4
8 files changed, 17 insertions, 20 deletions
diff --git a/Wrappers/Matlab/demos/demoMatlab_3Ddenoise.m b/Wrappers/Matlab/demos/demoMatlab_3Ddenoise.m
index ccd47f1..33dfb95 100644
--- a/Wrappers/Matlab/demos/demoMatlab_3Ddenoise.m
+++ b/Wrappers/Matlab/demos/demoMatlab_3Ddenoise.m
@@ -78,7 +78,7 @@ fprintf('Denoise using Fourth-order anisotropic diffusion model (CPU) \n');
iter_diff = 300; % number of diffusion iterations
lambda_regDiff = 3.5; % regularisation for the diffusivity
sigmaPar = 0.02; % edge-preserving parameter
-tau_param = 0.0025; % time-marching constant
+tau_param = 0.0015; % time-marching constant
tic; u_diff4 = Diffusion_4thO(single(vol3D), lambda_regDiff, sigmaPar, iter_diff, tau_param); toc;
figure; imshow(u_diff4(:,:,15), [0 1]); title('Diffusion 4thO denoised volume (CPU)');
%%
@@ -86,7 +86,7 @@ figure; imshow(u_diff4(:,:,15), [0 1]); title('Diffusion 4thO denoised volume (C
% iter_diff = 300; % number of diffusion iterations
% lambda_regDiff = 3.5; % regularisation for the diffusivity
% sigmaPar = 0.02; % edge-preserving parameter
-% tau_param = 0.0025; % time-marching constant
+% tau_param = 0.0015; % time-marching constant
% tic; u_diff4_g = Diffusion_4thO_GPU(single(vol3D), lambda_regDiff, sigmaPar, iter_diff, tau_param); toc;
% figure; imshow(u_diff4_g(:,:,15), [0 1]); title('Diffusion 4thO denoised volume (GPU)');
%%
@@ -123,4 +123,4 @@ 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_reg, 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 30ad79d..df47bdc 100644
--- a/Wrappers/Matlab/demos/demoMatlab_denoise.m
+++ b/Wrappers/Matlab/demos/demoMatlab_denoise.m
@@ -71,7 +71,7 @@ fprintf('Denoise using Fourth-order anisotropic diffusion model (CPU) \n');
iter_diff = 800; % number of diffusion iterations
lambda_regDiff = 3.5; % regularisation for the diffusivity
sigmaPar = 0.02; % edge-preserving parameter
-tau_param = 0.005; % time-marching constant
+tau_param = 0.0015; % time-marching constant
tic; u_diff4 = Diffusion_4thO(single(u0), lambda_regDiff, sigmaPar, iter_diff, tau_param); toc;
figure; imshow(u_diff4, [0 1]); title('Diffusion 4thO denoised image (CPU)');
%%
@@ -79,7 +79,7 @@ figure; imshow(u_diff4, [0 1]); title('Diffusion 4thO denoised image (CPU)');
% iter_diff = 800; % number of diffusion iterations
% lambda_regDiff = 3.5; % regularisation for the diffusivity
% sigmaPar = 0.02; % edge-preserving parameter
-% tau_param = 0.005; % time-marching constant
+% tau_param = 0.0015; % time-marching constant
% tic; u_diff4_g = Diffusion_4thO_GPU(single(u0), lambda_regDiff, sigmaPar, iter_diff, tau_param); toc;
% figure; imshow(u_diff4_g, [0 1]); title('Diffusion 4thO denoised image (GPU)');
%%
diff --git a/Wrappers/Python/demos/demo_cpu_regularisers.py b/Wrappers/Python/demos/demo_cpu_regularisers.py
index 51e7fb5..ff500ae 100644
--- a/Wrappers/Python/demos/demo_cpu_regularisers.py
+++ b/Wrappers/Python/demos/demo_cpu_regularisers.py
@@ -271,7 +271,7 @@ pars = {'algorithm' : DIFF4th, \
'regularisation_parameter':3.5, \
'edge_parameter':0.02,\
'number_of_iterations' :500 ,\
- 'time_marching_parameter':0.005
+ 'time_marching_parameter':0.0015
}
print ("#############DIFF4th CPU################")
diff --git a/Wrappers/Python/demos/demo_cpu_regularisers3D.py b/Wrappers/Python/demos/demo_cpu_regularisers3D.py
index 0f47ea9..8ee157e 100644
--- a/Wrappers/Python/demos/demo_cpu_regularisers3D.py
+++ b/Wrappers/Python/demos/demo_cpu_regularisers3D.py
@@ -12,7 +12,7 @@ import matplotlib.pyplot as plt
import numpy as np
import os
import timeit
-from ccpi.filters.regularisers import ROF_TV, FGP_TV, SB_TV, FGP_dTV, TNV, NDF, DIFF4th
+from ccpi.filters.regularisers import ROF_TV, FGP_TV, SB_TV, FGP_dTV, NDF, DIFF4th
from qualitymetrics import rmse
###############################################################################
def printParametersToString(pars):
@@ -68,9 +68,6 @@ Im2[:,0:M] = Im[:,0:M]
Im = Im2
del Im2
"""
-
-# Uncomment to test 3D regularisation performance
-#%%
slices = 20
noisyVol = np.zeros((slices,N,M),dtype='float32')
@@ -82,7 +79,7 @@ for i in range (slices):
noisyRef[i,:,:] = Im + np.random.normal(loc = 0 , scale = 0.01 * Im , size = np.shape(Im))
idealVol[i,:,:] = Im
-
+#%%
print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
print ("_______________ROF-TV (3D)_________________")
print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
@@ -283,7 +280,7 @@ pars = {'algorithm' : DIFF4th, \
'regularisation_parameter':3.5, \
'edge_parameter':0.02,\
'number_of_iterations' :300 ,\
- 'time_marching_parameter':0.005
+ 'time_marching_parameter':0.0015
}
print ("#############DIFF4th CPU################")
diff --git a/Wrappers/Python/demos/demo_cpu_vs_gpu_regularisers.py b/Wrappers/Python/demos/demo_cpu_vs_gpu_regularisers.py
index 2910c65..4611522 100644
--- a/Wrappers/Python/demos/demo_cpu_vs_gpu_regularisers.py
+++ b/Wrappers/Python/demos/demo_cpu_vs_gpu_regularisers.py
@@ -408,12 +408,12 @@ pars = {'algorithm' : DIFF4th, \
'regularisation_parameter':3.5, \
'edge_parameter':0.02,\
'number_of_iterations' :500 ,\
- 'time_marching_parameter':0.005
+ 'time_marching_parameter':0.001
}
print ("#############Diff4th CPU####################")
start_time = timeit.default_timer()
-diff4th_cpu = Diff4th(pars['input'],
+diff4th_cpu = DIFF4th(pars['input'],
pars['regularisation_parameter'],
pars['edge_parameter'],
pars['number_of_iterations'],
@@ -437,7 +437,7 @@ plt.title('{}'.format('CPU results'))
print ("##############Diff4th GPU##################")
start_time = timeit.default_timer()
-diff4th_gpu = Diff4th(pars['input'],
+diff4th_gpu = DIFF4th(pars['input'],
pars['regularisation_parameter'],
pars['edge_parameter'],
pars['number_of_iterations'],
@@ -445,7 +445,7 @@ diff4th_gpu = Diff4th(pars['input'],
rms = rmse(Im, diff4th_gpu)
pars['rmse'] = rms
-pars['algorithm'] = Diff4th
+pars['algorithm'] = DIFF4th
txtstr = printParametersToString(pars)
txtstr += "%s = %.3fs" % ('elapsed time',timeit.default_timer() - start_time)
print (txtstr)
diff --git a/Wrappers/Python/demos/demo_gpu_regularisers.py b/Wrappers/Python/demos/demo_gpu_regularisers.py
index 8432696..3179428 100644
--- a/Wrappers/Python/demos/demo_gpu_regularisers.py
+++ b/Wrappers/Python/demos/demo_gpu_regularisers.py
@@ -269,7 +269,7 @@ pars = {'algorithm' : DIFF4th, \
'regularisation_parameter':3.5, \
'edge_parameter':0.02,\
'number_of_iterations' :500 ,\
- 'time_marching_parameter':0.005
+ 'time_marching_parameter':0.0015
}
print ("#############DIFF4th CPU################")
diff --git a/Wrappers/Python/demos/demo_gpu_regularisers3D.py b/Wrappers/Python/demos/demo_gpu_regularisers3D.py
index 022df95..13c4e7b 100644
--- a/Wrappers/Python/demos/demo_gpu_regularisers3D.py
+++ b/Wrappers/Python/demos/demo_gpu_regularisers3D.py
@@ -285,7 +285,7 @@ pars = {'algorithm' : DIFF4th, \
'regularisation_parameter':3.5, \
'edge_parameter':0.02,\
'number_of_iterations' :300 ,\
- 'time_marching_parameter':0.005
+ 'time_marching_parameter':0.0015
}
print ("#############DIFF4th CPU################")
diff --git a/Wrappers/Python/src/cpu_regularisers.pyx b/Wrappers/Python/src/cpu_regularisers.pyx
index 7dc3396..549b046 100644
--- a/Wrappers/Python/src/cpu_regularisers.pyx
+++ b/Wrappers/Python/src/cpu_regularisers.pyx
@@ -328,9 +328,9 @@ def NDF_3D(np.ndarray[np.float32_t, ndim=3, mode="c"] inputData,
#****************************************************************#
def Diff4th_CPU(inputData, regularisation_parameter, edge_parameter, iterationsNumb, time_marching_parameter):
if inputData.ndim == 2:
- return Diff4th_2D(inputData, regularisation_parameter, edge_parameter, iterationsNumb, time_marching_parameter, penalty_type)
+ return Diff4th_2D(inputData, regularisation_parameter, edge_parameter, iterationsNumb, time_marching_parameter)
elif inputData.ndim == 3:
- return Diff4th_3D(inputData, regularisation_parameter, edge_parameter, iterationsNumb, time_marching_parameter, penalty_type)
+ return Diff4th_3D(inputData, regularisation_parameter, edge_parameter, iterationsNumb, time_marching_parameter)
def Diff4th_2D(np.ndarray[np.float32_t, ndim=2, mode="c"] inputData,
float regularisation_parameter,