From 37ae2bdb0a15298f312e9f6545a465d4d20c57f1 Mon Sep 17 00:00:00 2001 From: Daniil Kazantsev Date: Wed, 2 May 2018 15:47:19 +0100 Subject: bugs of NVM are fixed --- .../inpainters_CPU/NonlocalMarching_Inpaint_core.c | 100 ++++++++++----------- .../inpainters_CPU/NonlocalMarching_Inpaint_core.h | 2 +- .../regularisers_CPU/NonlocalMarching_Inpaint.c | 2 +- Wrappers/Python/src/cpu_regularisers.pyx | 4 +- 4 files changed, 54 insertions(+), 54 deletions(-) diff --git a/Core/inpainters_CPU/NonlocalMarching_Inpaint_core.c b/Core/inpainters_CPU/NonlocalMarching_Inpaint_core.c index a197375..66be15c 100644 --- a/Core/inpainters_CPU/NonlocalMarching_Inpaint_core.c +++ b/Core/inpainters_CPU/NonlocalMarching_Inpaint_core.c @@ -30,7 +30,7 @@ * 1. 2D image or sinogram with horizontal or inclined regions of missing data * 2. Mask of the same size as A in 'unsigned char' format (ones mark the region to inpaint, zeros belong to the data) * 3. Linear increment to increase searching window size in iterations, values from 1-3 is a good choice - + * * Output: * 1. Inpainted image or a sinogram * 2. updated mask @@ -38,11 +38,11 @@ * Reference: TBA */ -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) +float NonlocalMarching_Inpaint_main(float *Input, unsigned char *M, float *Output, unsigned char *M_upd, int SW_increment, int iterationsNumb, int trigger, int dimX, int dimY, int dimZ) { int i, j, i_m, j_m, counter, iter, iterations_number, W_fullsize, switchmask, switchcurr, counterElements; float *Gauss_weights; - + /* copying M to M_upd */ copyIm_unchar(M, M_upd, dimX, dimY, 1); @@ -54,11 +54,11 @@ float NonlocalMarching_Inpaint_main(float *Input, unsigned char *M, float *Outpu iterations_number = 0; for (i=0; i dimX) iterations_number = dimX; + } + if ((int)(iterations_number/dimY) > dimX) iterations_number = dimX; } - else iterations_number = iterationsNumb; - + else iterations_number = iterationsNumb; + if (iterations_number == 0) printf("%s \n", "Nothing to inpaint, zero mask!"); else { @@ -83,54 +83,54 @@ float NonlocalMarching_Inpaint_main(float *Input, unsigned char *M, float *Outpu } if (trigger == 0) { - /*Matlab*/ - #pragma omp parallel for shared(Output, M_upd, Gauss_weights) private(i, j, switchmask, switchcurr) - for(j=0; j