diff options
author | algol <dkazanc@hotmail.com> | 2018-04-17 13:05:17 +0100 |
---|---|---|
committer | algol <dkazanc@hotmail.com> | 2018-04-17 13:05:17 +0100 |
commit | ec9b5742e243c60f2f7d31f38cd3d561c3ae3394 (patch) | |
tree | 530f73d52c3142b023673f2041ac451bfcab576b | |
parent | d0a33e4f941539ba44a071cfab75d7bf9543990f (diff) | |
download | regularization-ec9b5742e243c60f2f7d31f38cd3d561c3ae3394.tar.gz regularization-ec9b5742e243c60f2f7d31f38cd3d561c3ae3394.tar.bz2 regularization-ec9b5742e243c60f2f7d31f38cd3d561c3ae3394.tar.xz regularization-ec9b5742e243c60f2f7d31f38cd3d561c3ae3394.zip |
TNV demos
-rw-r--r-- | Wrappers/Python/ccpi/filters/regularisers.py | 2 | ||||
-rw-r--r-- | Wrappers/Python/demos/demo_cpu_regularisers.py | 12 | ||||
-rw-r--r-- | Wrappers/Python/src/cpu_regularisers.pyx | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/Wrappers/Python/ccpi/filters/regularisers.py b/Wrappers/Python/ccpi/filters/regularisers.py index 81deea9..e6814e8 100644 --- a/Wrappers/Python/ccpi/filters/regularisers.py +++ b/Wrappers/Python/ccpi/filters/regularisers.py @@ -87,7 +87,7 @@ def FGP_dTV(inputData, refdata, regularisation_parameter, iterations, raise ValueError('Unknown device {0}. Expecting gpu or cpu'\ .format(device)) def TNV(inputData, regularisation_parameter, iterations, tolerance_param): - return TNV_CPU_pyx(inputData, + return TNV_CPU(inputData, regularisation_parameter, iterations, tolerance_param) diff --git a/Wrappers/Python/demos/demo_cpu_regularisers.py b/Wrappers/Python/demos/demo_cpu_regularisers.py index e74fa58..7443b83 100644 --- a/Wrappers/Python/demos/demo_cpu_regularisers.py +++ b/Wrappers/Python/demos/demo_cpu_regularisers.py @@ -247,7 +247,7 @@ print ("__________Total nuclear Variation__________") print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") ## plot -fig = plt.figure(4) +fig = plt.figure(5) plt.suptitle('Performance of TNV regulariser using the CPU') a=fig.add_subplot(1,2,1) a.set_title('Noisy Image') @@ -258,7 +258,7 @@ N = 512 noisyVol = np.zeros((channelsNo,N,N),dtype='float32') idealVol = np.zeros((channelsNo,N,N),dtype='float32') -for i in range (slices): +for i in range (channelsNo): noisyVol[i,:,:] = Im + np.random.normal(loc = 0 , scale = perc * Im , size = np.shape(Im)) idealVol[i,:,:] = Im @@ -321,7 +321,7 @@ print ("_______________ROF-TV (3D)_________________") print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") ## plot -fig = plt.figure(5) +fig = plt.figure(6) plt.suptitle('Performance of ROF-TV regulariser using the CPU') a=fig.add_subplot(1,2,1) a.set_title('Noisy 15th slice of a volume') @@ -361,7 +361,7 @@ print ("_______________FGP-TV (3D)__________________") print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") ## plot -fig = plt.figure(6) +fig = plt.figure(7) plt.suptitle('Performance of FGP-TV regulariser using the CPU') a=fig.add_subplot(1,2,1) a.set_title('Noisy Image') @@ -410,7 +410,7 @@ print ("_______________SB-TV (3D)_________________") print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") ## plot -fig = plt.figure(7) +fig = plt.figure(8) plt.suptitle('Performance of SB-TV regulariser using the CPU') a=fig.add_subplot(1,2,1) a.set_title('Noisy Image') @@ -457,7 +457,7 @@ print ("_______________FGP-dTV (3D)__________________") print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") ## plot -fig = plt.figure(8) +fig = plt.figure(9) plt.suptitle('Performance of FGP-dTV regulariser using the CPU') a=fig.add_subplot(1,2,1) a.set_title('Noisy Image') diff --git a/Wrappers/Python/src/cpu_regularisers.pyx b/Wrappers/Python/src/cpu_regularisers.pyx index 898bb40..abbf3b0 100644 --- a/Wrappers/Python/src/cpu_regularisers.pyx +++ b/Wrappers/Python/src/cpu_regularisers.pyx @@ -21,7 +21,7 @@ cimport numpy as np cdef extern float TV_ROF_CPU_main(float *Input, float *Output, float lambdaPar, int iterationsNumb, float tau, int dimX, int dimY, int dimZ); cdef extern float TV_FGP_CPU_main(float *Input, float *Output, float lambdaPar, int iterationsNumb, float epsil, int methodTV, int nonneg, int printM, int dimX, int dimY, int dimZ); cdef extern float SB_TV_CPU_main(float *Input, float *Output, float lambdaPar, int iterationsNumb, float epsil, int methodTV, int printM, int dimX, int dimY, int dimZ); -cdef extern float TNV_CPU_main(float *Input, float *u, float lambda, int maxIter, float tol, int dimX, int dimY, int dimZ); +cdef extern float TNV_CPU_main(float *Input, float *u, float lambdaPar, int maxIter, float tol, int dimX, int dimY, int dimZ); cdef extern float dTV_FGP_CPU_main(float *Input, float *InputRef, float *Output, float lambdaPar, int iterationsNumb, float epsil, float eta, int methodTV, int nonneg, int printM, int dimX, int dimY, int dimZ); @@ -254,7 +254,7 @@ def dTV_FGP_3D(np.ndarray[np.float32_t, ndim=3, mode="c"] inputData, #****************************************************************# #*********************Total Nuclear Variation********************# #****************************************************************# -def TNV_CPU_pyx(inputData, regularisation_parameter, iterationsNumb, tolerance_param): +def TNV_CPU(inputData, regularisation_parameter, iterationsNumb, tolerance_param): if inputData.ndim == 2: return elif inputData.ndim == 3: |