From 14edd18d07c871c0a355d70e68350a899014dbc7 Mon Sep 17 00:00:00 2001 From: algol Date: Wed, 2 May 2018 13:11:50 +0100 Subject: bugs in NVM fixed --- Wrappers/Python/demos/demo_cpu_inpainters.py | 6 ++++-- Wrappers/Python/src/cpu_regularisers.pyx | 12 ++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'Wrappers/Python') diff --git a/Wrappers/Python/demos/demo_cpu_inpainters.py b/Wrappers/Python/demos/demo_cpu_inpainters.py index 7f452c1..9197e91 100644 --- a/Wrappers/Python/demos/demo_cpu_inpainters.py +++ b/Wrappers/Python/demos/demo_cpu_inpainters.py @@ -55,6 +55,7 @@ plt.imshow(mask) plt.title('Mask') plt.show() #%% +""" print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") print ("___Inpainting using linear diffusion (2D)__") print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") @@ -111,7 +112,7 @@ fig = plt.figure(3) plt.suptitle('Performance of nonlinear diffusion inpainting using the CPU') a=fig.add_subplot(1,2,1) a.set_title('Missing data sinogram') -imgplot = plt.imshow(sino_cut,cmap="gray") +imgplot = plt.imshow(sino_cut_new,cmap="gray") # set parameters pars = {'algorithm' : NDF_INP, \ @@ -148,6 +149,7 @@ a.text(0.15, 0.25, txtstr, transform=a.transAxes, fontsize=14, verticalalignment='top', bbox=props) imgplot = plt.imshow(ndf_inp_nonlinear, cmap="gray") plt.title('{}'.format('Nonlinear diffusion inpainting results')) +""" #%% print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") print ("Inpainting using nonlocal vertical marching") @@ -165,7 +167,7 @@ pars = {'algorithm' : NVM_INP, \ 'input' : sino_cut_new,\ 'maskData' : mask,\ 'SW_increment': 1,\ - 'number_of_iterations' :0 + 'number_of_iterations' : 150 } start_time = timeit.default_timer() diff --git a/Wrappers/Python/src/cpu_regularisers.pyx b/Wrappers/Python/src/cpu_regularisers.pyx index 7c06c28..732b4cb 100644 --- a/Wrappers/Python/src/cpu_regularisers.pyx +++ b/Wrappers/Python/src/cpu_regularisers.pyx @@ -27,7 +27,6 @@ cdef extern float dTV_FGP_CPU_main(float *Input, float *InputRef, float *Output, cdef extern float Diffusion_Inpaint_CPU_main(float *Input, unsigned char *Mask, float *Output, float lambdaPar, float sigmaPar, int iterationsNumb, float tau, int penaltytype, int dimX, int dimY, int dimZ); cdef extern float NonlocalMarching_Inpaint_main(float *Input, unsigned char *M, float *Output, unsigned char *M_upd, int SW_increment, int iterationsNumb, int dimX, int dimY, int dimZ); - #****************************************************************# #********************** Total-variation ROF *********************# #****************************************************************# @@ -374,14 +373,14 @@ def NDF_INP_3D(np.ndarray[np.float32_t, ndim=3, mode="c"] inputData, #*********************Inpainting WITH****************************# #***************Nonlocal Vertical Marching method****************# #****************************************************************# -def NVM_INPAINT_CPU(inputData, maskData, SW_increment, iterations): +def NVM_INPAINT_CPU(inputData, maskData, SW_increment, iterationsNumb): if inputData.ndim == 2: - return NVM_INP_2D(inputData, maskData, SW_increment, iterations) + return NVM_INP_2D(inputData, maskData, SW_increment, iterationsNumb) elif inputData.ndim == 3: return def NVM_INP_2D(np.ndarray[np.float32_t, ndim=2, mode="c"] inputData, - np.ndarray[np.uint8_t, ndim=2, mode="c"] maskData, + np.ndarray[np.uint8_t, ndim=2, mode="c"] maskData, int SW_increment, int iterationsNumb): cdef long dims[2] @@ -395,7 +394,8 @@ def NVM_INP_2D(np.ndarray[np.float32_t, ndim=2, mode="c"] inputData, np.zeros([dims[0],dims[1]], dtype='uint8') # Run Inpaiting by Nonlocal vertical marching method for 2D data - NonlocalMarching_Inpaint_main(&inputData[0,0], &maskData[0,0], &outputData[0,0], &maskData_upd[0,0], - SW_increment, iterationsNumb,dims[1], dims[0], 1) + NonlocalMarching_Inpaint_main(&inputData[0,0], &maskData[0,0], &outputData[0,0], + &maskData_upd[0,0], + SW_increment, iterationsNumb, dims[1], dims[0], 1) return (outputData, maskData_upd) -- cgit v1.2.3