summaryrefslogtreecommitdiffstats
path: root/Wrappers/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Wrappers/Python')
-rw-r--r--Wrappers/Python/demos/demo_cpu_inpainters.py6
-rw-r--r--Wrappers/Python/src/cpu_regularisers.pyx12
2 files changed, 10 insertions, 8 deletions
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)