From 2e67930b6df118fb0dca129d3cdcf5515bf4827c Mon Sep 17 00:00:00 2001 From: Daniil Kazantsev Date: Thu, 11 Apr 2019 22:05:35 +0100 Subject: sorting classes fixed --- src/Core/regularisers_CPU/DiffusionMASK_core.c | 88 +++++++++++++------------- 1 file changed, 44 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/Core/regularisers_CPU/DiffusionMASK_core.c b/src/Core/regularisers_CPU/DiffusionMASK_core.c index 9d128bc..dd4b1b4 100644 --- a/src/Core/regularisers_CPU/DiffusionMASK_core.c +++ b/src/Core/regularisers_CPU/DiffusionMASK_core.c @@ -53,17 +53,17 @@ int signNDF_m(float x) { * [2] Black, M.J., Sapiro, G., Marimont, D.H. and Heeger, D., 1998. Robust anisotropic diffusion. IEEE Transactions on image processing, 7(3), pp.421-432. */ -void swapVAL(unsigned char *xp, unsigned char *yp) -{ - unsigned char temp = *xp; - *xp = *yp; - *yp = temp; -} +void swapVAL(unsigned char *xp, unsigned char *yp) +{ + unsigned char temp = *xp; + *xp = *yp; + *yp = temp; +} float DiffusionMASK_CPU_main(float *Input, unsigned char *MASK, unsigned char *MASK_upd, unsigned char *SelClassesList, int SelClassesList_length, float *Output, float *infovector, int classesNumb, int DiffusWindow, float lambdaPar, float sigmaPar, int iterationsNumb, float tau, int penaltytype, float epsil, int dimX, int dimY, int dimZ) { long i,j,k; - int counterG; + int counterG, switcher; float sigmaPar2, *Output_prev=NULL, *Eucl_Vec; int DiffusWindow_tot; sigmaPar2 = sigmaPar/sqrt(2.0f); @@ -76,38 +76,38 @@ float DiffusionMASK_CPU_main(float *Input, unsigned char *MASK, unsigned char *M /* defines the list for all classes in the mask */ ClassesList = (unsigned char*) calloc (classesNumb,sizeof(unsigned char)); - /* indentify all classes in the MASK */ - /* find the smaller class value first */ - /* - unsigned char smallestClass; - smallestClass = MASK[0]; - for(i=0; i MASK_temp[y+1]) { - temp = MASK_temp[y+1]; - MASK_temp[y+1] = MASK_temp[y]; - MASK_temp[y] = temp; - }}} - - //printf("[%u]\n", MASK_temp[0]); - - CurrClass = MASK_temp[0]; ClassesList[0]= MASK_temp[0]; counterG = 0; - for(i=0; i CurrClass) { - CurrClass = MASK_temp[i]; - ClassesList[counterG] = MASK_temp[i]; - printf("[%u]\n", ClassesList[counterG]); - counterG++; } - } + /* find which classes (values) are present in the segmented data */ + CurrClass = MASK[0]; ClassesList[0]= MASK[0]; counterG = 1; + for(i=0; i ClassesList[j+1]) { + temp = ClassesList[j+1]; + ClassesList[j+1] = ClassesList[j]; + ClassesList[j] = temp; + }}} + + for(i=0; i continue */ @@ -343,8 +343,8 @@ float NonLinearDiff_MASK2D(float *Input, unsigned char *MASK, float *Output, flo /********************************************************************/ -int bresenham2D(int i, int j, int i1, int j1, unsigned char *MASK, unsigned char *MASK_upd, long dimX, long dimY) -{ +int bresenham2D(int i, int j, int i1, int j1, unsigned char *MASK, unsigned char *MASK_upd, long dimX, long dimY) +{ int n; int x[] = {i, i1}; int y[] = {j, j1}; @@ -398,7 +398,7 @@ int bresenham2D(int i, int j, int i1, int j1, unsigned char *MASK, unsigned char Y_new[n] = y_n; */ /*printf("[%i][%i][%u]\n", x_n, y_n, MASK[y_n*dimX+x_n]);*/ - // MASK_upd[x_n*dimX+y_n] = 10; + // MASK_upd[x_n*dimX+y_n] = 10; if (MASK[j*dimX+i] != MASK[x_n*dimX+y_n]) MASK_upd[x_n*dimX+y_n] = MASK[j*dimX+i]; } else { -- cgit v1.2.3