From: Gordon K. <kin...@us...> - 2004-10-06 09:41:20
|
Update of /cvsroot/teem/teem/src/coil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3128/coil Modified Files: coil.h coreCoil.c methodsCoil.c scalarCoil.c tensorCoil.c Log Message: converted all tabs to spaces Index: scalarCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/scalarCoil.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** scalarCoil.c 12 Aug 2004 04:27:21 -0000 1.6 --- scalarCoil.c 6 Oct 2004 09:40:25 -0000 1.7 *************** *** 39,50 **** return ( (iv3[0][4] - 2*iv3[1][4] + iv3[2][4])/(spacing[0]*spacing[0]) ! + (iv3[1][3] - 2*iv3[1][4] + iv3[1][5])/(spacing[1]*spacing[1]) ! + (iv3[1][1] - 2*iv3[1][4] + iv3[1][7])/(spacing[2]*spacing[2])); } void _coilKindScalarFilterTesting(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { delta[0] = 0; } --- 39,50 ---- return ( (iv3[0][4] - 2*iv3[1][4] + iv3[2][4])/(spacing[0]*spacing[0]) ! + (iv3[1][3] - 2*iv3[1][4] + iv3[1][5])/(spacing[1]*spacing[1]) ! + (iv3[1][1] - 2*iv3[1][4] + iv3[1][7])/(spacing[2]*spacing[2])); } void _coilKindScalarFilterTesting(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { delta[0] = 0; } *************** *** 52,57 **** void _coilKindScalarFilterHomogeneous(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { delta[0] = parm[0]*_coilLaplacian3(iv3, spacing); --- 52,57 ---- void _coilKindScalarFilterHomogeneous(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { delta[0] = parm[0]*_coilLaplacian3(iv3, spacing); *************** *** 60,67 **** void _coilKindScalar3x3x3Gradients(coil_t *forwX, coil_t *backX, ! coil_t *forwY, coil_t *backY, ! coil_t *forwZ, coil_t *backZ, ! coil_t **i, ! coil_t rspX, coil_t rspY, coil_t rspZ) { /* gradients at forward and backward X */ --- 60,67 ---- void _coilKindScalar3x3x3Gradients(coil_t *forwX, coil_t *backX, ! coil_t *forwY, coil_t *backY, ! coil_t *forwZ, coil_t *backZ, ! coil_t **i, ! coil_t rspX, coil_t rspY, coil_t rspZ) { /* gradients at forward and backward X */ *************** *** 102,107 **** void _coilKindScalarFilterPeronaMalik(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { coil_t forwX[3], backX[3], forwY[3], backY[3], forwZ[3], backZ[3], KK, rspX, rspY, rspZ; --- 102,107 ---- void _coilKindScalarFilterPeronaMalik(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { coil_t forwX[3], backX[3], forwY[3], backY[3], forwZ[3], backZ[3], KK, rspX, rspY, rspZ; *************** *** 113,120 **** _coilKindScalar3x3x3Gradients(forwX, backX, ! forwY, backY, ! forwZ, backZ, ! iv3, ! rspX, rspY, rspZ); /* compute fluxes */ --- 113,120 ---- _coilKindScalar3x3x3Gradients(forwX, backX, ! forwY, backY, ! forwZ, backZ, ! iv3, ! rspX, rspY, rspZ); /* compute fluxes */ *************** *** 128,139 **** delta[0] = parm[0]*(rspX*(forwX[0] - backX[0]) ! + rspY*(forwY[1] - backY[1]) ! + rspZ*(forwZ[2] - backZ[2])); } void _coilKindScalarFilterModifiedCurvature(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { coil_t forwX[3], backX[3], forwY[3], backY[3], forwZ[3], backZ[3], grad[3], gm, eps, KK, LL, rspX, rspY, rspZ, lerp; --- 128,139 ---- delta[0] = parm[0]*(rspX*(forwX[0] - backX[0]) ! + rspY*(forwY[1] - backY[1]) ! + rspZ*(forwZ[2] - backZ[2])); } void _coilKindScalarFilterModifiedCurvature(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { coil_t forwX[3], backX[3], forwY[3], backY[3], forwZ[3], backZ[3], grad[3], gm, eps, KK, LL, rspX, rspY, rspZ, lerp; *************** *** 145,152 **** _coilKindScalar3x3x3Gradients(forwX, backX, ! forwY, backY, ! forwZ, backZ, ! iv3, ! rspX, rspY, rspZ); grad[0] = rspX*(iv3[2][4] - iv3[0][4]); grad[1] = rspY*(iv3[1][5] - iv3[1][3]); --- 145,152 ---- _coilKindScalar3x3x3Gradients(forwX, backX, ! forwY, backY, ! forwZ, backZ, ! iv3, ! rspX, rspY, rspZ); grad[0] = rspX*(iv3[2][4] - iv3[0][4]); grad[1] = rspY*(iv3[1][5] - iv3[1][3]); *************** *** 172,178 **** lerp = parm[2]; delta[0] = (lerp*_coilLaplacian3(iv3, spacing) ! + (1-lerp)*gm*(rspX*(forwX[0] - backX[0]) ! + rspY*(forwY[1] - backY[1]) ! + rspZ*(forwZ[2] - backZ[2]))); delta[0] *= parm[0]; } --- 172,178 ---- lerp = parm[2]; delta[0] = (lerp*_coilLaplacian3(iv3, spacing) ! + (1-lerp)*gm*(rspX*(forwX[0] - backX[0]) ! + rspY*(forwY[1] - backY[1]) ! + rspZ*(forwZ[2] - backZ[2]))); delta[0] *= parm[0]; } Index: coreCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/coreCoil.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** coreCoil.c 25 Mar 2004 03:11:50 -0000 1.4 --- coreCoil.c 6 Oct 2004 09:40:25 -0000 1.5 *************** *** 34,42 **** zvi = AIR_CLAMP(0, zni-radius+z0, sizeZ-1) - z0; \ for (yni=0; yni<diam; yni++) { \ ! yvi = AIR_CLAMP(0, yni-radius+y0, sizeY-1) - y0; \ ! for (vi=0; vi<valLen; vi++) { \ ! iv3[xni][vi + valLen*(yni + diam*zni)] = \ ! here[vi + valLen*(0 + 2*(xvi + sizeX*(yvi + sizeY*zvi)))]; \ ! } \ } \ } \ --- 34,42 ---- zvi = AIR_CLAMP(0, zni-radius+z0, sizeZ-1) - z0; \ for (yni=0; yni<diam; yni++) { \ ! yvi = AIR_CLAMP(0, yni-radius+y0, sizeY-1) - y0; \ ! for (vi=0; vi<valLen; vi++) { \ ! iv3[xni][vi + valLen*(yni + diam*zni)] = \ ! here[vi + valLen*(0 + 2*(xvi + sizeX*(yvi + sizeY*zvi)))]; \ ! } \ } \ } \ *************** *** 46,57 **** zvi = AIR_CLAMP(0, zni-radius+z0, sizeZ-1) - z0; \ for (yni=0; yni<diam; yni++) { \ ! yvi = AIR_CLAMP(0, yni-radius+y0, sizeY-1) - y0; \ ! for (xni=0; xni<diam; xni++) { \ ! xvi = AIR_CLAMP(0, xni-radius+x0, sizeX-1) - x0; \ ! for (vi=0; vi<valLen; vi++) { \ ! iv3[xni][vi + valLen*(yni + diam*zni)] = \ ! here[vi + valLen*(0 + 2*(xvi + sizeX*(yvi + sizeY*zvi)))]; \ ! } \ ! } \ } \ } \ --- 46,57 ---- zvi = AIR_CLAMP(0, zni-radius+z0, sizeZ-1) - z0; \ for (yni=0; yni<diam; yni++) { \ ! yvi = AIR_CLAMP(0, yni-radius+y0, sizeY-1) - y0; \ ! for (xni=0; xni<diam; xni++) { \ ! xvi = AIR_CLAMP(0, xni-radius+x0, sizeX-1) - x0; \ ! for (vi=0; vi<valLen; vi++) { \ ! iv3[xni][vi + valLen*(yni + diam*zni)] = \ ! here[vi + valLen*(0 + 2*(xvi + sizeX*(yvi + sizeY*zvi)))]; \ ! } \ ! } \ } \ } \ *************** *** 66,70 **** void _coilIv3Fill_R_L(coil_t **iv3, coil_t *here, int radius, int valLen, ! int x0, int y0, int z0, int sizeX, int sizeY, int sizeZ) { int diam, vi, /* value index */ xni, yni, zni, /* neighborhood (iv3) indices */ --- 66,70 ---- void _coilIv3Fill_R_L(coil_t **iv3, coil_t *here, int radius, int valLen, ! int x0, int y0, int z0, int sizeX, int sizeY, int sizeZ) { int diam, vi, /* value index */ xni, yni, zni, /* neighborhood (iv3) indices */ *************** *** 79,83 **** void _coilIv3Fill_1_1(coil_t **iv3, coil_t *here, int radius, int valLen, ! int x0, int y0, int z0, int sizeX, int sizeY, int sizeZ) { int vi, /* value index */ xni, yni, zni, /* neighborhood (iv3) indices */ --- 79,83 ---- void _coilIv3Fill_1_1(coil_t **iv3, coil_t *here, int radius, int valLen, ! int x0, int y0, int z0, int sizeX, int sizeY, int sizeZ) { int vi, /* value index */ xni, yni, zni, /* neighborhood (iv3) indices */ *************** *** 91,95 **** void _coilIv3Fill_1_7(coil_t **iv3, coil_t *here, int radius, int valLen, ! int x0, int y0, int z0, int sizeX, int sizeY, int sizeZ) { int vi, /* value index */ xni, yni, zni, /* neighborhood (iv3) indices */ --- 91,95 ---- void _coilIv3Fill_1_7(coil_t **iv3, coil_t *here, int radius, int valLen, ! int x0, int y0, int z0, int sizeX, int sizeY, int sizeZ) { int vi, /* value index */ xni, yni, zni, /* neighborhood (iv3) indices */ *************** *** 137,142 **** coil_t *here; void (*filter)(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]); sizeX = task->cctx->size[0]; --- 137,142 ---- coil_t *here; void (*filter)(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]); sizeX = task->cctx->size[0]; *************** *** 150,164 **** thisZ = _coilThisZGet(task, doFilter); if (thisZ == sizeZ) { ! break; } here = (coil_t*)(task->cctx->nvol->data) + 2*valLen*sizeX*sizeY*thisZ; for (yi=0; yi<sizeY; yi++) { ! for (xi=0; xi<sizeX; xi++) { ! task->iv3Fill(task->iv3, here + 0*valLen, radius, valLen, ! xi, yi, thisZ, sizeX, sizeY, sizeZ); ! filter(here + 1*valLen, task->iv3, ! task->cctx->spacing, task->cctx->parm); ! here += 2*valLen; ! } } } --- 150,164 ---- thisZ = _coilThisZGet(task, doFilter); if (thisZ == sizeZ) { ! break; } here = (coil_t*)(task->cctx->nvol->data) + 2*valLen*sizeX*sizeY*thisZ; for (yi=0; yi<sizeY; yi++) { ! for (xi=0; xi<sizeX; xi++) { ! task->iv3Fill(task->iv3, here + 0*valLen, radius, valLen, ! xi, yi, thisZ, sizeX, sizeY, sizeZ); ! filter(here + 1*valLen, task->iv3, ! task->cctx->spacing, task->cctx->parm); ! here += 2*valLen; ! } } } *************** *** 167,178 **** thisZ = _coilThisZGet(task, doFilter); if (thisZ == sizeZ) { ! break; } here = (coil_t*)(task->cctx->nvol->data) + 2*valLen*sizeX*sizeY*thisZ; for (yi=0; yi<sizeY; yi++) { ! for (xi=0; xi<sizeX; xi++) { ! task->cctx->kind->update(here + 0*valLen, here + 1*valLen); ! here += 2*valLen; ! } } } --- 167,178 ---- thisZ = _coilThisZGet(task, doFilter); if (thisZ == sizeZ) { ! break; } here = (coil_t*)(task->cctx->nvol->data) + 2*valLen*sizeX*sizeY*thisZ; for (yi=0; yi<sizeY; yi++) { ! for (xi=0; xi<sizeX; xi++) { ! task->cctx->kind->update(here + 0*valLen, here + 1*valLen); ! here += 2*valLen; ! } } } *************** *** 233,242 **** if (task->cctx->verbose > 1) { fprintf(stderr, "%s(%d): waiting to check finished\n", ! me, task->threadIdx); } airThreadBarrierWait(task->cctx->filterBarrier); if (task->cctx->finished) { if (task->cctx->verbose > 1) { ! fprintf(stderr, "%s(%d): done!\n", me, task->threadIdx); } break; --- 233,242 ---- if (task->cctx->verbose > 1) { fprintf(stderr, "%s(%d): waiting to check finished\n", ! me, task->threadIdx); } airThreadBarrierWait(task->cctx->filterBarrier); if (task->cctx->finished) { if (task->cctx->verbose > 1) { ! fprintf(stderr, "%s(%d): done!\n", me, task->threadIdx); } break; *************** *** 247,251 **** if (task->cctx->verbose > 1) { fprintf(stderr, "%s(%d): filtering ... \n", ! me, task->threadIdx); } _coilProcess(task, AIR_TRUE); --- 247,251 ---- if (task->cctx->verbose > 1) { fprintf(stderr, "%s(%d): filtering ... \n", ! me, task->threadIdx); } _coilProcess(task, AIR_TRUE); *************** *** 255,259 **** if (task->cctx->verbose > 1) { fprintf(stderr, "%s(%d): updating ... \n", ! me, task->threadIdx); } _coilProcess(task, AIR_FALSE); --- 255,259 ---- if (task->cctx->verbose > 1) { fprintf(stderr, "%s(%d): updating ... \n", ! me, task->threadIdx); } _coilProcess(task, AIR_FALSE); *************** *** 319,323 **** } airThreadStart(cctx->task[tidx]->thread, _coilWorker, ! (void *)(cctx->task[tidx])); } --- 319,323 ---- } airThreadStart(cctx->task[tidx]->thread, _coilWorker, ! (void *)(cctx->task[tidx])); } *************** *** 352,356 **** if (cctx->verbose) { fprintf(stderr, "%s: starting iter %d (of %d)\n", me, iter, ! numIterations); } cctx->finished = AIR_FALSE; --- 352,356 ---- if (cctx->verbose) { fprintf(stderr, "%s: starting iter %d (of %d)\n", me, iter, ! numIterations); } cctx->finished = AIR_FALSE; *************** *** 378,382 **** if (cctx->verbose) { fprintf(stderr, "%s: elapsed time = %g (%g/iter)\n", me, ! time1 - time0, (time1 - time0)/numIterations); } return 0; --- 378,382 ---- if (cctx->verbose) { fprintf(stderr, "%s: elapsed time = %g (%g/iter)\n", me, ! time1 - time0, (time1 - time0)/numIterations); } return 0; Index: methodsCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/methodsCoil.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** methodsCoil.c 2 May 2004 21:43:02 -0000 1.5 --- methodsCoil.c 6 Oct 2004 09:40:25 -0000 1.6 *************** *** 31,35 **** if (nrrdTypeBlock == nin->type) { sprintf(err, "%s: can only operate on scalar types, not %s", me, ! airEnumStr(nrrdType, nrrdTypeBlock)); biffAdd(COIL, err); return 1; } --- 31,35 ---- if (nrrdTypeBlock == nin->type) { sprintf(err, "%s: can only operate on scalar types, not %s", me, ! airEnumStr(nrrdType, nrrdTypeBlock)); biffAdd(COIL, err); return 1; } *************** *** 37,41 **** if (3 + baseDim != nin->dim) { sprintf(err, "%s: dim of input must be 3+%d (3 + baseDim), not %d", ! me, baseDim, nin->dim); biffAdd(COIL, err); return 1; } --- 37,41 ---- if (3 + baseDim != nin->dim) { sprintf(err, "%s: dim of input must be 3+%d (3 + baseDim), not %d", ! me, baseDim, nin->dim); biffAdd(COIL, err); return 1; } *************** *** 66,72 **** int coilContextAllSet(coilContext *cctx, const Nrrd *nin, ! const coilKind *kind, const coilMethod *method, ! int radius, int numThreads, int verbose, ! double parm[COIL_PARMS_NUM]) { char me[]="coilContextAllSet", err[AIR_STRLEN_MED]; int size[NRRD_DIM_MAX], sx, sy, sz, someExist, allExist, baseDim, pi; --- 66,72 ---- int coilContextAllSet(coilContext *cctx, const Nrrd *nin, ! const coilKind *kind, const coilMethod *method, ! int radius, int numThreads, int verbose, ! double parm[COIL_PARMS_NUM]) { char me[]="coilContextAllSet", err[AIR_STRLEN_MED]; int size[NRRD_DIM_MAX], sx, sy, sz, someExist, allExist, baseDim, pi; *************** *** 85,93 **** if (!( radius >= 1 && numThreads >= 1 )) { sprintf(err, "%s: radius (%d) not >= 1 or numThreads (%d) not >= 1", me, ! radius, numThreads); biffAdd(COIL, err); return 1; } if (!( AIR_IN_OP(coilMethodTypeUnknown, method->type, ! coilMethodTypeLast) )) { sprintf(err, "%s: method->type %d not valid", me, method->type); biffAdd(COIL, err); return 1; --- 85,93 ---- if (!( radius >= 1 && numThreads >= 1 )) { sprintf(err, "%s: radius (%d) not >= 1 or numThreads (%d) not >= 1", me, ! radius, numThreads); biffAdd(COIL, err); return 1; } if (!( AIR_IN_OP(coilMethodTypeUnknown, method->type, ! coilMethodTypeLast) )) { sprintf(err, "%s: method->type %d not valid", me, method->type); biffAdd(COIL, err); return 1; *************** *** 96,100 **** if (!kind->filter[method->type]) { sprintf(err, "%s: sorry, %s filtering not available on %s kind", ! me, method->name, kind->name); biffAdd(COIL, err); return 1; } --- 96,100 ---- if (!kind->filter[method->type]) { sprintf(err, "%s: sorry, %s filtering not available on %s kind", ! me, method->name, kind->name); biffAdd(COIL, err); return 1; } *************** *** 103,107 **** if (numThreads > 1 && !airThreadCapable && airThreadNoopWarning) { fprintf(stderr, "%s: WARNING: this teem not thread capable: using 1 " ! "thread, not %d\n", me, numThreads); numThreads = 1; } --- 103,107 ---- if (numThreads > 1 && !airThreadCapable && airThreadNoopWarning) { fprintf(stderr, "%s: WARNING: this teem not thread capable: using 1 " ! "thread, not %d\n", me, numThreads); numThreads = 1; } *************** *** 113,117 **** if (!AIR_EXISTS(parm[pi])) { sprintf(err, "%s: parm[%d] (need %d) doesn't exist", ! me, pi, method->numParm); biffAdd(COIL, err); airMopError(mop); return 1; } --- 113,117 ---- if (!AIR_EXISTS(parm[pi])) { sprintf(err, "%s: parm[%d] (need %d) doesn't exist", ! me, pi, method->numParm); biffAdd(COIL, err); airMopError(mop); return 1; } *************** *** 126,130 **** if (sz < numThreads) { fprintf(stderr, "%s: wanted %d threads but volume only has %d slices, " ! "using %d threads instead\n", me, numThreads, sz, sz); numThreads = sz; } --- 126,130 ---- if (sz < numThreads) { fprintf(stderr, "%s: wanted %d threads but volume only has %d slices, " ! "using %d threads instead\n", me, numThreads, sz, sz); numThreads = sz; } *************** *** 143,147 **** if ( !allExist ) { sprintf(err, "%s: spacings (%g,%g,%g) not uniformly existant", ! me, xsp, ysp, zsp); biffAdd(COIL, err); airMopError(mop); return 1; } --- 143,147 ---- if ( !allExist ) { sprintf(err, "%s: spacings (%g,%g,%g) not uniformly existant", ! me, xsp, ysp, zsp); biffAdd(COIL, err); airMopError(mop); return 1; } *************** *** 150,154 **** if (cctx->verbose) { fprintf(stderr, "%s: spacings: %g %g %g\n", me, ! cctx->spacing[0], cctx->spacing[1], cctx->spacing[2]); } --- 150,154 ---- if (cctx->verbose) { fprintf(stderr, "%s: spacings: %g %g %g\n", me, ! cctx->spacing[0], cctx->spacing[1], cctx->spacing[2]); } Index: coil.h =================================================================== RCS file: /cvsroot/teem/teem/src/coil/coil.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** coil.h 12 Aug 2004 04:27:21 -0000 1.6 --- coil.h 6 Oct 2004 09:40:24 -0000 1.7 *************** *** 123,132 **** char name[AIR_STRLEN_SMALL]; /* short identifying string for kind */ int valLen; /* number of scalars per data point ! 1 for plain scalars (baseDim=0), ! or something else (baseDim=1) */ /* all the available methods */ void (*filter[COIL_METHOD_TYPE_MAX+1])(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]); void (*update)(coil_t *val, coil_t *delta); /* how to apply update */ } coilKind; --- 123,132 ---- char name[AIR_STRLEN_SMALL]; /* short identifying string for kind */ int valLen; /* number of scalars per data point ! 1 for plain scalars (baseDim=0), ! or something else (baseDim=1) */ /* all the available methods */ void (*filter[COIL_METHOD_TYPE_MAX+1])(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]); void (*update)(coil_t *val, coil_t *delta); /* how to apply update */ } coilKind; *************** *** 145,154 **** coil_t *_iv3, /* underlying value cache */ **iv3; /* short array of pointers into 2-D value ! caches, in which the order is based on ! the volume order: ! values, then Y, then Z */ /* how to fill iv3 */ void (*iv3Fill)(coil_t **iv3, coil_t *here, int radius, int valLen, ! int x0, int y0, int z0, int sizeX, int sizeY, int sizeZ); void *returnPtr; /* for airThreadJoin */ } coilTask; --- 145,154 ---- coil_t *_iv3, /* underlying value cache */ **iv3; /* short array of pointers into 2-D value ! caches, in which the order is based on ! the volume order: ! values, then Y, then Z */ /* how to fill iv3 */ void (*iv3Fill)(coil_t **iv3, coil_t *here, int radius, int valLen, ! int x0, int y0, int z0, int sizeX, int sizeY, int sizeZ); void *returnPtr; /* for airThreadJoin */ } coilTask; *************** *** 162,198 **** /* ---------- input */ const Nrrd *nin; /* input volume (converted to type coil_t ! in nvol, below) */ const coilKind *kind; /* what kind of volume is nin */ const coilMethod *method; /* what method of filtering to use */ int radius, /* how big a neighborhood to look at when ! doing filtering (use 1 for 3x3x3 size) */ numThreads, /* number of threads to enlist */ verbose; /* blah blah blah */ double parm[COIL_PARMS_NUM]; /* all the parameters used to control the ! action of the filtering. The timestep is ! probably the first value. */ /* ---------- internal */ int size[3]; /* size of volume */ double spacing[3]; /* sample spacings we'll use- we perhaps ! should be using a gageShape, but this is ! actually all we really need... */ Nrrd *nvol; /* an interleaved volume of (1st) the last ! filtering result, and (2nd) the update ! values from the current iteration */ int finished, /* used to signal all threads to return */ nextSlice, /* global indicator of next slice needing ! to be processed, either in filter or ! in update stage. Stage is done when ! nextSlice == size[2] */ todoFilter, todoUpdate; /* flags to signal which is scheduled to ! come next, used as part of doling out ! slices to workers */ airThreadMutex *nextSliceMutex; /* mutex around nextSlice (and effectively, ! also the "todo" flags above) */ coilTask **task; /* dynamically allocated array of tasks */ airThreadBarrier *filterBarrier, /* so that thread 0 can see if filtering ! should go onward, and set "finished" */ *updateBarrier; /* after the update values have been ! applied to current values */ } coilContext; --- 162,198 ---- /* ---------- input */ const Nrrd *nin; /* input volume (converted to type coil_t ! in nvol, below) */ const coilKind *kind; /* what kind of volume is nin */ const coilMethod *method; /* what method of filtering to use */ int radius, /* how big a neighborhood to look at when ! doing filtering (use 1 for 3x3x3 size) */ numThreads, /* number of threads to enlist */ verbose; /* blah blah blah */ double parm[COIL_PARMS_NUM]; /* all the parameters used to control the ! action of the filtering. The timestep is ! probably the first value. */ /* ---------- internal */ int size[3]; /* size of volume */ double spacing[3]; /* sample spacings we'll use- we perhaps ! should be using a gageShape, but this is ! actually all we really need... */ Nrrd *nvol; /* an interleaved volume of (1st) the last ! filtering result, and (2nd) the update ! values from the current iteration */ int finished, /* used to signal all threads to return */ nextSlice, /* global indicator of next slice needing ! to be processed, either in filter or ! in update stage. Stage is done when ! nextSlice == size[2] */ todoFilter, todoUpdate; /* flags to signal which is scheduled to ! come next, used as part of doling out ! slices to workers */ airThreadMutex *nextSliceMutex; /* mutex around nextSlice (and effectively, ! also the "todo" flags above) */ coilTask **task; /* dynamically allocated array of tasks */ airThreadBarrier *filterBarrier, /* so that thread 0 can see if filtering ! should go onward, and set "finished" */ *updateBarrier; /* after the update values have been ! applied to current values */ } coilContext; *************** *** 221,227 **** TEEM_API int coilVolumeCheck(const Nrrd *nin, const coilKind *kind); TEEM_API int coilContextAllSet(coilContext *cctx, const Nrrd *nin, ! const coilKind *kind, const coilMethod *method, ! int radius, int numThreads, int verbose, ! double parm[COIL_PARMS_NUM]); TEEM_API int coilOutputGet(Nrrd *nout, coilContext *cctx); TEEM_API coilContext *coilContextNix(coilContext *cctx); --- 221,227 ---- TEEM_API int coilVolumeCheck(const Nrrd *nin, const coilKind *kind); TEEM_API int coilContextAllSet(coilContext *cctx, const Nrrd *nin, ! const coilKind *kind, const coilMethod *method, ! int radius, int numThreads, int verbose, ! double parm[COIL_PARMS_NUM]); TEEM_API int coilOutputGet(Nrrd *nout, coilContext *cctx); TEEM_API coilContext *coilContextNix(coilContext *cctx); Index: tensorCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/tensorCoil.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tensorCoil.c 12 Aug 2004 04:27:21 -0000 1.8 --- tensorCoil.c 6 Oct 2004 09:40:25 -0000 1.9 *************** *** 22,31 **** void _coilKind7TensorTangents(coil_t traceGrad[6], ! coil_t varianceGrad[6], ! coil_t skewGrad[6], ! coil_t rot0Grad[6], ! coil_t rot1Grad[6], ! coil_t rot2Grad[6], ! coil_t tensor[7]) { /* coil_t a, b, c, d, e, f; --- 22,31 ---- void _coilKind7TensorTangents(coil_t traceGrad[6], ! coil_t varianceGrad[6], ! coil_t skewGrad[6], ! coil_t rot0Grad[6], ! coil_t rot1Grad[6], ! coil_t rot2Grad[6], ! coil_t tensor[7]) { /* coil_t a, b, c, d, e, f; *************** *** 43,48 **** void _coilKind7TensorFilterTesting(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { delta[0] = 0; delta[1] = 0; --- 43,48 ---- void _coilKind7TensorFilterTesting(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { delta[0] = 0; delta[1] = 0; *************** *** 73,106 **** #define TENS(ten, iv3) \ TEN_T_SET(ten, \ ! IND(iv3,0,1,1,1), \ ! IND(iv3,1,1,1,1), IND(iv3,2,1,1,1), IND(iv3,3,1,1,1), \ ! IND(iv3,4,1,1,1), IND(iv3,5,1,1,1), \ ! IND(iv3,6,1,1,1)) #define TENGRAD(tengrad, iv3, rspX, rspY, rspZ) ( \ TEN_T_SET(tengrad + 0*7, \ 1.0, \ ! rspX*(IND(iv3,1,2,1,1) - IND(iv3,1,0,1,1))/2, \ ! rspX*(IND(iv3,2,2,1,1) - IND(iv3,2,0,1,1))/2, \ ! rspX*(IND(iv3,3,2,1,1) - IND(iv3,3,0,1,1))/2, \ ! rspX*(IND(iv3,4,2,1,1) - IND(iv3,4,0,1,1))/2, \ ! rspX*(IND(iv3,5,2,1,1) - IND(iv3,5,0,1,1))/2, \ ! rspX*(IND(iv3,6,2,1,1) - IND(iv3,6,0,1,1))/2), \ TEN_T_SET(tengrad + 1*7, \ ! 1.0, \ ! rspY*(IND(iv3,1,1,2,1) - IND(iv3,1,1,0,1))/2, \ ! rspY*(IND(iv3,2,1,2,1) - IND(iv3,2,1,0,1))/2, \ ! rspY*(IND(iv3,3,1,2,1) - IND(iv3,3,1,0,1))/2, \ ! rspY*(IND(iv3,4,1,2,1) - IND(iv3,4,1,0,1))/2, \ ! rspY*(IND(iv3,5,1,2,1) - IND(iv3,5,1,0,1))/2, \ ! rspY*(IND(iv3,6,1,2,1) - IND(iv3,6,1,0,1))/2), \ TEN_T_SET(tengrad + 2*7, \ ! 1.0, \ ! rspZ*(IND(iv3,1,1,1,2) - IND(iv3,1,1,1,0))/2, \ ! rspZ*(IND(iv3,2,1,1,2) - IND(iv3,2,1,1,0))/2, \ ! rspZ*(IND(iv3,3,1,1,2) - IND(iv3,3,1,1,0))/2, \ ! rspZ*(IND(iv3,4,1,1,2) - IND(iv3,4,1,1,0))/2, \ ! rspZ*(IND(iv3,5,1,1,2) - IND(iv3,5,1,1,0))/2, \ ! rspZ*(IND(iv3,6,1,1,2) - IND(iv3,6,1,1,0))/2)) #define LAPL(iv3, vi, rspsqX, rspsqY, rspsqZ) \ --- 73,106 ---- #define TENS(ten, iv3) \ TEN_T_SET(ten, \ ! IND(iv3,0,1,1,1), \ ! IND(iv3,1,1,1,1), IND(iv3,2,1,1,1), IND(iv3,3,1,1,1), \ ! IND(iv3,4,1,1,1), IND(iv3,5,1,1,1), \ ! IND(iv3,6,1,1,1)) #define TENGRAD(tengrad, iv3, rspX, rspY, rspZ) ( \ TEN_T_SET(tengrad + 0*7, \ 1.0, \ ! rspX*(IND(iv3,1,2,1,1) - IND(iv3,1,0,1,1))/2, \ ! rspX*(IND(iv3,2,2,1,1) - IND(iv3,2,0,1,1))/2, \ ! rspX*(IND(iv3,3,2,1,1) - IND(iv3,3,0,1,1))/2, \ ! rspX*(IND(iv3,4,2,1,1) - IND(iv3,4,0,1,1))/2, \ ! rspX*(IND(iv3,5,2,1,1) - IND(iv3,5,0,1,1))/2, \ ! rspX*(IND(iv3,6,2,1,1) - IND(iv3,6,0,1,1))/2), \ TEN_T_SET(tengrad + 1*7, \ ! 1.0, \ ! rspY*(IND(iv3,1,1,2,1) - IND(iv3,1,1,0,1))/2, \ ! rspY*(IND(iv3,2,1,2,1) - IND(iv3,2,1,0,1))/2, \ ! rspY*(IND(iv3,3,1,2,1) - IND(iv3,3,1,0,1))/2, \ ! rspY*(IND(iv3,4,1,2,1) - IND(iv3,4,1,0,1))/2, \ ! rspY*(IND(iv3,5,1,2,1) - IND(iv3,5,1,0,1))/2, \ ! rspY*(IND(iv3,6,1,2,1) - IND(iv3,6,1,0,1))/2), \ TEN_T_SET(tengrad + 2*7, \ ! 1.0, \ ! rspZ*(IND(iv3,1,1,1,2) - IND(iv3,1,1,1,0))/2, \ ! rspZ*(IND(iv3,2,1,1,2) - IND(iv3,2,1,1,0))/2, \ ! rspZ*(IND(iv3,3,1,1,2) - IND(iv3,3,1,1,0))/2, \ ! rspZ*(IND(iv3,4,1,1,2) - IND(iv3,4,1,1,0))/2, \ ! rspZ*(IND(iv3,5,1,1,2) - IND(iv3,5,1,1,0))/2, \ ! rspZ*(IND(iv3,6,1,1,2) - IND(iv3,6,1,1,0))/2)) #define LAPL(iv3, vi, rspsqX, rspsqY, rspsqZ) \ *************** *** 111,116 **** void _coilKind7TensorFilterHomogeneous(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { coil_t rspsqX, rspsqY, rspsqZ; --- 111,116 ---- void _coilKind7TensorFilterHomogeneous(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { coil_t rspsqX, rspsqY, rspsqZ; *************** *** 148,153 **** void _coilKind7TensorFilterSelf(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { coil_t hess[7], rspX, rspY, rspZ; float eval[3], evec[9], tens[7], lin; --- 148,153 ---- void _coilKind7TensorFilterSelf(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { coil_t hess[7], rspX, rspY, rspZ; float eval[3], evec[9], tens[7], lin; *************** *** 171,176 **** void _coilKind7TensorFilterFinish(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { coil_t rspX, rspY, rspZ, rspsqX, rspsqY, rspsqZ; --- 171,176 ---- void _coilKind7TensorFilterFinish(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { coil_t rspX, rspY, rspZ, rspsqX, rspsqY, rspsqZ; *************** *** 187,199 **** tenEigensolve_d(eval, evec, tens); tenInvariantGradients_d(dmu1, ! dmu2, &mu2Norm, ! dskw, &skwNorm, ! tens); tenRotationTangents_d(NULL, NULL, phi3, evec); /* \midhat{\nabla} \mu_1 ----------------- */ ELL_3V_SET(grad, ! TEN_T_DOT(dmu1, tengrad + 0*7), ! TEN_T_DOT(dmu1, tengrad + 1*7), ! TEN_T_DOT(dmu1, tengrad + 2*7)); LL = ELL_3V_DOT(grad,grad); KK = parm[1]*parm[1]; --- 187,199 ---- tenEigensolve_d(eval, evec, tens); tenInvariantGradients_d(dmu1, ! dmu2, &mu2Norm, ! dskw, &skwNorm, ! tens); tenRotationTangents_d(NULL, NULL, phi3, evec); /* \midhat{\nabla} \mu_1 ----------------- */ ELL_3V_SET(grad, ! TEN_T_DOT(dmu1, tengrad + 0*7), ! TEN_T_DOT(dmu1, tengrad + 1*7), ! TEN_T_DOT(dmu1, tengrad + 2*7)); LL = ELL_3V_DOT(grad,grad); KK = parm[1]*parm[1]; *************** *** 201,207 **** /* \midhat{\nabla} \mu_2 ----------------- */ ELL_3V_SET(grad, ! TEN_T_DOT(dmu2, tengrad + 0*7), ! TEN_T_DOT(dmu2, tengrad + 1*7), ! TEN_T_DOT(dmu2, tengrad + 2*7)); LL = ELL_3V_DOT(grad,grad); KK = parm[2]*parm[2]; --- 201,207 ---- /* \midhat{\nabla} \mu_2 ----------------- */ ELL_3V_SET(grad, ! TEN_T_DOT(dmu2, tengrad + 0*7), ! TEN_T_DOT(dmu2, tengrad + 1*7), ! TEN_T_DOT(dmu2, tengrad + 2*7)); LL = ELL_3V_DOT(grad,grad); KK = parm[2]*parm[2]; *************** *** 209,220 **** /* \midhat{\nabla} \skw and twist! ----------------- */ ELL_3V_SET(grad, ! TEN_T_DOT(dskw, tengrad + 0*7), ! TEN_T_DOT(dskw, tengrad + 1*7), ! TEN_T_DOT(dskw, tengrad + 2*7)); LL = ELL_3V_DOT(grad,grad); ELL_3V_SET(grad, ! TEN_T_DOT(phi3, tengrad + 0*7), ! TEN_T_DOT(phi3, tengrad + 1*7), ! TEN_T_DOT(phi3, tengrad + 2*7)); LL += ELL_3V_DOT(grad,grad); KK = parm[3]*parm[3]; --- 209,220 ---- /* \midhat{\nabla} \skw and twist! ----------------- */ ELL_3V_SET(grad, ! TEN_T_DOT(dskw, tengrad + 0*7), ! TEN_T_DOT(dskw, tengrad + 1*7), ! TEN_T_DOT(dskw, tengrad + 2*7)); LL = ELL_3V_DOT(grad,grad); ELL_3V_SET(grad, ! TEN_T_DOT(phi3, tengrad + 0*7), ! TEN_T_DOT(phi3, tengrad + 1*7), ! TEN_T_DOT(phi3, tengrad + 2*7)); LL += ELL_3V_DOT(grad,grad); KK = parm[3]*parm[3]; |