You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(19) |
Nov
(45) |
Dec
(80) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(58) |
Feb
(127) |
Mar
(74) |
Apr
(34) |
May
(117) |
Jun
(14) |
Jul
(26) |
Aug
(13) |
Sep
(1) |
Oct
(38) |
Nov
(13) |
Dec
(5) |
| 2005 |
Jan
(108) |
Feb
(134) |
Mar
(54) |
Apr
(133) |
May
(16) |
Jun
(54) |
Jul
(128) |
Aug
(99) |
Sep
(157) |
Oct
(182) |
Nov
(236) |
Dec
(212) |
| 2006 |
Jan
(86) |
Feb
(76) |
Mar
(121) |
Apr
(27) |
May
(7) |
Jun
(1) |
Jul
(6) |
Aug
(28) |
Sep
(1) |
Oct
(27) |
Nov
(5) |
Dec
|
| 2007 |
Jan
(32) |
Feb
(22) |
Mar
(22) |
Apr
(11) |
May
(3) |
Jun
(12) |
Jul
(11) |
Aug
(9) |
Sep
(37) |
Oct
(4) |
Nov
(9) |
Dec
(51) |
| 2008 |
Jan
(7) |
Feb
(31) |
Mar
(46) |
Apr
(31) |
May
(5) |
Jun
(27) |
Jul
(12) |
Aug
(5) |
Sep
(13) |
Oct
(24) |
Nov
(112) |
Dec
(15) |
| 2009 |
Jan
(6) |
Feb
(103) |
Mar
(66) |
Apr
(9) |
May
(8) |
Jun
(1) |
Jul
(20) |
Aug
(9) |
Sep
(2) |
Oct
(81) |
Nov
(88) |
Dec
(30) |
| 2010 |
Jan
(65) |
Feb
(57) |
Mar
(22) |
Apr
(12) |
May
(4) |
Jun
(12) |
Jul
(43) |
Aug
(6) |
Sep
(6) |
Oct
(4) |
Nov
(6) |
Dec
(3) |
| 2011 |
Jan
(10) |
Feb
(27) |
Mar
(11) |
Apr
(9) |
May
(69) |
Jun
(73) |
Jul
(67) |
Aug
(116) |
Sep
(40) |
Oct
(11) |
Nov
(34) |
Dec
(19) |
| 2012 |
Jan
|
Feb
(4) |
Mar
(28) |
Apr
(18) |
May
(9) |
Jun
(7) |
Jul
(4) |
Aug
(155) |
Sep
(264) |
Oct
(172) |
Nov
(15) |
Dec
(40) |
| 2013 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
(20) |
Jul
(76) |
Aug
(67) |
Sep
(49) |
Oct
(27) |
Nov
(3) |
Dec
(3) |
| 2014 |
Jan
(7) |
Feb
(7) |
Mar
(16) |
Apr
|
May
(4) |
Jun
(1) |
Jul
(18) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2015 |
Jan
(6) |
Feb
(5) |
Mar
(3) |
Apr
(23) |
May
(5) |
Jun
|
Jul
(2) |
Aug
(4) |
Sep
|
Oct
|
Nov
(2) |
Dec
(4) |
| 2016 |
Jan
(2) |
Feb
(7) |
Mar
(2) |
Apr
(1) |
May
(14) |
Jun
(3) |
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(1) |
Dec
(3) |
| 2017 |
Jan
(6) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(12) |
Sep
(6) |
Oct
|
Nov
(3) |
Dec
|
| 2018 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2019 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(8) |
Oct
|
Nov
(2) |
Dec
(25) |
| 2020 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
(53) |
Nov
(33) |
Dec
|
| 2021 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
(5) |
| 2022 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(93) |
Aug
(206) |
Sep
(39) |
Oct
(19) |
Nov
(11) |
Dec
|
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(150) |
Jul
(124) |
Aug
(14) |
Sep
(5) |
Oct
|
Nov
(1) |
Dec
|
| 2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(62) |
Aug
|
Sep
(7) |
Oct
|
Nov
(7) |
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
(14) |
May
(3) |
Jun
|
Jul
|
Aug
(76) |
Sep
(214) |
Oct
(6) |
Nov
|
Dec
|
|
From: Gordon K. <kin...@us...> - 2004-03-29 21:26:53
|
Update of /cvsroot/teem/teem/src/ell In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23166 Modified Files: GNUmakefile Log Message: little tool to help make diagrams of the eigenwheel Index: GNUmakefile =================================================================== RCS file: /cvsroot/teem/teem/src/ell/GNUmakefile,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GNUmakefile 7 Jan 2004 15:34:29 -0000 1.12 --- GNUmakefile 29 Mar 2004 21:15:16 -0000 1.13 *************** *** 48,52 **** $(L).PRIVATE_HEADERS = $(L).OBJS = cubicEll.o eigen.o miscEll.o vecEll.o mat.o quat.o genmat.o ! $(L).TESTS = test/sort3 test/invert test/tq #### #### --- 48,52 ---- $(L).PRIVATE_HEADERS = $(L).OBJS = cubicEll.o eigen.o miscEll.o vecEll.o mat.o quat.o genmat.o ! $(L).TESTS = test/sort3 test/invert test/tq test/wheel #### #### |
|
From: Gordon K. <kin...@us...> - 2004-03-25 03:24:28
|
Update of /cvsroot/teem/teem/src/mite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12467 Modified Files: ray.c Log Message: fixed bug in setting of Z depth Index: ray.c =================================================================== RCS file: /cvsroot/teem/teem/src/mite/ray.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ray.c 4 Mar 2004 14:04:08 -0000 1.20 --- ray.c 25 Mar 2004 03:13:33 -0000 1.21 *************** *** 39,43 **** mtt->RR = mtt->GG = mtt->BB = 0.0; mtt->TT = 1.0; ! mtt->ZZ = -1.0; ELL_3V_SCALE(mtt->V, -1, rayDirWorld); --- 39,43 ---- mtt->RR = mtt->GG = mtt->BB = 0.0; mtt->TT = 1.0; ! mtt->ZZ = AIR_NAN; ELL_3V_SCALE(mtt->V, -1, rayDirWorld); *************** *** 225,229 **** /* set Z if it hasn't been set already */ ! if (1-mtt->TT >= muu->opacMatters && mtt->ZZ < 0) { mtt->ZZ = rayT; } --- 225,229 ---- /* set Z if it hasn't been set already */ ! if (1-mtt->TT >= muu->opacMatters && !AIR_EXISTS(mtt->ZZ)) { mtt->ZZ = rayT; } *************** *** 245,249 **** A, mtt->ZZ); } else { ! ELL_5V_SET(imgData + 5*idx, 0, 0, 0, 0, -1); } return 0; --- 245,249 ---- A, mtt->ZZ); } else { ! ELL_5V_SET(imgData + 5*idx, 0, 0, 0, 0, AIR_NAN); } return 0; |
|
From: Gordon K. <kin...@us...> - 2004-03-25 03:23:40
|
Update of /cvsroot/teem/teem/src/ell In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12380 Modified Files: cubicEll.c Log Message: renamed variables to be consistent with gage and thesis text Index: cubicEll.c =================================================================== RCS file: /cvsroot/teem/teem/src/ell/cubicEll.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** cubicEll.c 19 Feb 2004 06:45:11 -0000 1.7 --- cubicEll.c 25 Mar 2004 03:12:52 -0000 1.8 *************** *** 44,64 **** ell_cubic(double root[3], double A, double B, double C, int newton) { char me[]="ell_cubic"; ! double epsilon = 1.0E-11, sq_A, p, q, cb_p, D, sqrt_D, der, ! u, v, x, phi, t, sub; ! sub = 1.0/3.0*A; ! sq_A = A*A; ! p = 1.0/3.0*(-1.0/3.0*sq_A + B); ! q = 1.0/2.0*(2.0/27.0*A*sq_A - 1.0/3.0*A*B + C); ! cb_p = p*p*p; ! D = q*q + cb_p; if (D < -epsilon) { /* three distinct roots- this is the most common case, it has been tested the most, its code should go first */ ! phi = 1.0/3.0*acos(-q/sqrt(-cb_p)); ! t = 2*sqrt(-p); ! root[0] = t*cos(phi) - sub; ! root[1] = t*cos(phi + 2*AIR_PI/3.0) - sub; ! root[2] = t*cos(phi - 2*AIR_PI/3.0) - sub; /* if (!AIR_EXISTS(root[0])) { --- 44,64 ---- ell_cubic(double root[3], double A, double B, double C, int newton) { char me[]="ell_cubic"; ! double epsilon = 1.0E-11, AA, Q, R, QQQ, D, sqrt_D, der, ! u, v, x, theta, t, sub; ! sub = A/3.0; ! AA = A*A; ! Q = (AA/3.0 - B)/3.0; ! R = (-2.0*A*AA/27.0 + A*B/3.0 - C)/2.0; ! QQQ = Q*Q*Q; ! D = R*R - QQQ; if (D < -epsilon) { /* three distinct roots- this is the most common case, it has been tested the most, its code should go first */ ! theta = acos(R/sqrt(QQQ))/3.0; ! t = 2*sqrt(Q); ! root[0] = t*cos(theta) - sub; ! root[1] = t*cos(theta + 2*AIR_PI/3.0) - sub; ! root[2] = t*cos(theta - 2*AIR_PI/3.0) - sub; /* if (!AIR_EXISTS(root[0])) { *************** *** 72,77 **** /* one real solution, except maybe also a "rescued" double root */ sqrt_D = sqrt(D); ! u = airCbrt(sqrt_D-q); ! v = -airCbrt(sqrt_D+q); x = u+v - sub; if (!newton) { --- 72,77 ---- /* one real solution, except maybe also a "rescued" double root */ sqrt_D = sqrt(D); ! u = airCbrt(sqrt_D+R); ! v = -airCbrt(sqrt_D-R); x = u+v - sub; if (!newton) { *************** *** 115,121 **** else { /* else D is in the interval [-epsilon, +epsilon] */ ! if (q < -epsilon || q > epsilon) { /* one double root and one single root */ ! u = airCbrt(-q); root[0] = 2*u - sub; root[1] = -u - sub; --- 115,121 ---- else { /* else D is in the interval [-epsilon, +epsilon] */ ! if (R < -epsilon || epsilon < R) { /* one double root and one single root */ ! u = airCbrt(R); root[0] = 2*u - sub; root[1] = -u - sub; |
|
From: Gordon K. <kin...@us...> - 2004-03-25 03:22:34
|
Update of /cvsroot/teem/teem/src/coil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12209 Modified Files: coil.h coreCoil.c enumsCoil.c methodsCoil.c realmethods.c scalarCoil.c tensorCoil.c Log Message: some new stuff Index: coil.h =================================================================== RCS file: /cvsroot/teem/teem/src/coil/coil.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** coil.h 24 Mar 2004 06:48:50 -0000 1.2 --- coil.h 25 Mar 2004 03:11:50 -0000 1.3 *************** *** 204,207 **** --- 204,208 ---- /* scalarCoil.c */ TEEM_API const coilKind *coilKindScalar; + TEEM_API const coilKind *coilKindArray[COIL_KIND_TYPE_MAX+1]; /* tensorCoil.c */ Index: tensorCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/tensorCoil.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tensorCoil.c 24 Mar 2004 06:48:50 -0000 1.2 --- tensorCoil.c 25 Mar 2004 03:11:50 -0000 1.3 *************** *** 21,24 **** --- 21,45 ---- 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; + + a = tensor[1]; + b = tensor[2]; + c = tensor[3]; + d = tensor[4]; + e = tensor[5]; + f = tensor[6]; + ELL_6V_SET(traceGrad, 1, 0, 0, 1, 0, 1); + */ + } + + void _coilKind7TensorFilterTesting(coil_t *delta, coil_t **iv3, double spacing[3], *************** *** 33,45 **** } void _coilKind7TensorFilterHomogeneous(coil_t *delta, coil_t **iv3, double spacing[3], double parm[COIL_PARMS_NUM]) { ! } void ! _coilKindTensorUpdate(coil_t *val, coil_t *delta) { val[0] += delta[0]; /* WARNING: this could change confidence! */ --- 54,97 ---- } + /* + ** x ----> X + ** \ [0][ 0]-[06] [1][ 0] [2][ 0] + ** | \ [0][ 7]-[13] [1][ 7] [2][ 7] + ** | Y [0][14]-[20] [1][14] [2][14] + ** | + ** | [0][21]-[27] [1][21] [2][21] + ** Z [0][28]-[34] [1][28] [2][28] + ** [0][35]-[41] [1][35] [2][35] + ** + ** [0][42]-[48] [1][42] [2][42] + ** [0][49]-[55] [1][49] [2][49] + ** [0][56]-[62] [1][56] [2][56] + */ + + #define LAPL(iv3, vi, rspX, rspY, rspZ) \ + ( rspX*(iv3[0][vi + 7*4] - 2*iv3[1][vi + 7*4] + iv3[2][vi + 7*4]) \ + + rspY*(iv3[1][vi + 7*3] - 2*iv3[1][vi + 7*4] + iv3[1][vi + 7*5]) \ + + rspZ*(iv3[1][vi + 7*1] - 2*iv3[1][vi + 7*4] + iv3[1][vi + 7*7])) + void _coilKind7TensorFilterHomogeneous(coil_t *delta, coil_t **iv3, double spacing[3], double parm[COIL_PARMS_NUM]) { ! coil_t rspX, rspY, rspZ; ! ! rspX = 1.0/(spacing[0]*spacing[0]); ! rspY = 1.0/(spacing[1]*spacing[1]); ! rspZ = 1.0/(spacing[2]*spacing[2]); ! delta[0] = 0; ! delta[1] = parm[0]*LAPL(iv3, 1, rspX, rspY, rspZ); ! delta[2] = parm[0]*LAPL(iv3, 2, rspX, rspY, rspZ); ! delta[3] = parm[0]*LAPL(iv3, 3, rspX, rspY, rspZ); ! delta[4] = parm[0]*LAPL(iv3, 4, rspX, rspY, rspZ); ! delta[5] = parm[0]*LAPL(iv3, 5, rspX, rspY, rspZ); ! delta[6] = parm[0]*LAPL(iv3, 6, rspX, rspY, rspZ); } void ! _coilKind7TensorUpdate(coil_t *val, coil_t *delta) { val[0] += delta[0]; /* WARNING: this could change confidence! */ *************** *** 53,57 **** const coilKind ! _coilKindTensor = { "tensor", 7, --- 105,109 ---- const coilKind ! _coilKind7Tensor = { "tensor", 7, *************** *** 62,68 **** NULL, NULL}, ! _coilKindTensorUpdate }; const coilKind * ! coilKindTensor = &_coilKindTensor; --- 114,120 ---- NULL, NULL}, ! _coilKind7TensorUpdate }; const coilKind * ! coilKind7Tensor = &_coilKind7Tensor; Index: scalarCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/scalarCoil.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** scalarCoil.c 24 Mar 2004 06:48:50 -0000 1.2 --- scalarCoil.c 25 Mar 2004 03:11:50 -0000 1.3 *************** *** 20,23 **** --- 20,38 ---- #include "coil.h" + /* + ** x ----> X + ** \ [0][0] [1][0] [2][0] + ** | \ [0][1] [1][1] [2][1] + ** | Y [0][2] [1][2] [2][2] + ** | + ** | [0][3] [1][3] [2][3] + ** Z [0][4] [1][4] [2][4] + ** [0][5] [1][5] [2][5] + ** + ** [0][6] [1][6] [2][6] + ** [0][7] [1][7] [2][7] + ** [0][8] [1][8] [2][8] + */ + coil_t _coilLaplacian3(coil_t **iv3, double spacing[3]) { *************** *** 43,72 **** } - /* - ** x ----> X - ** \ [0][0] [1][0] [2][0] - ** | \ [0][1] [1][1] [2][1] - ** | Y [0][2] [1][2] [2][2] - ** | - ** | [0][3] [1][3] [2][3] - ** Z [0][4] [1][4] [2][4] - ** [0][5] [1][5] [2][5] - ** - ** [0][6] [1][6] [2][6] - ** [0][7] [1][7] [2][7] - ** [0][8] [1][8] [2][8] - */ - void ! _coilKindScalarFilterPeronaMalik(coil_t *delta, coil_t **i, ! 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; ! ! /* reciprocals of spacings in X, Y, and Z */ ! rspX = 1.0/spacing[0]; ! rspY = 1.0/spacing[1]; ! rspZ = 1.0/spacing[2]; /* gradients at forward and backward X */ --- 58,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 */ *************** *** 94,113 **** backZ[2] = rspZ*(i[1][4] - i[1][1]); /* compute fluxes */ KK = parm[1]*parm[1]; ! /* ! forwX[0] *= 1.0/(1.0 + ELL_3V_DOT(forwX, forwX)/KK); ! forwY[1] *= 1.0/(1.0 + ELL_3V_DOT(forwY, forwY)/KK); ! forwZ[2] *= 1.0/(1.0 + ELL_3V_DOT(forwZ, forwZ)/KK); ! backX[0] *= 1.0/(1.0 + ELL_3V_DOT(backX, backX)/KK); ! backY[1] *= 1.0/(1.0 + ELL_3V_DOT(backY, backY)/KK); ! backZ[2] *= 1.0/(1.0 + ELL_3V_DOT(backZ, backZ)/KK); ! */ ! forwX[0] *= exp(-0.5*ELL_3V_DOT(forwX, forwX)/KK); ! forwY[1] *= exp(-0.5*ELL_3V_DOT(forwY, forwY)/KK); ! forwZ[2] *= exp(-0.5*ELL_3V_DOT(forwZ, forwZ)/KK); ! backX[0] *= exp(-0.5*ELL_3V_DOT(backX, backX)/KK); ! backY[1] *= exp(-0.5*ELL_3V_DOT(backY, backY)/KK); ! backZ[2] *= exp(-0.5*ELL_3V_DOT(backZ, backZ)/KK); delta[0] = parm[0]*(rspX*(forwX[0] - backX[0]) --- 89,129 ---- backZ[2] = rspZ*(i[1][4] - i[1][1]); + return; + } + + #define _COIL_CONDUCT(LL, KK) \ + (exp(-0.5*(LL)/(KK))) + + /* + #define _COIL_CONDUCT(vec, KK) \ + (1.0/(1.0 + (LL)/(KK))) + */ + + 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; + + /* reciprocals of spacings in X, Y, and Z */ + rspX = 1.0/spacing[0]; + rspY = 1.0/spacing[1]; + rspZ = 1.0/spacing[2]; + + _coilKindScalar3x3x3Gradients(forwX, backX, + forwY, backY, + forwZ, backZ, + iv3, + rspX, rspY, rspZ); + /* compute fluxes */ KK = parm[1]*parm[1]; ! forwX[0] *= _COIL_CONDUCT(ELL_3V_DOT(forwX, forwX), KK); ! forwY[1] *= _COIL_CONDUCT(ELL_3V_DOT(forwY, forwY), KK); ! forwZ[2] *= _COIL_CONDUCT(ELL_3V_DOT(forwZ, forwZ), KK); ! backX[0] *= _COIL_CONDUCT(ELL_3V_DOT(backX, backX), KK); ! backY[1] *= _COIL_CONDUCT(ELL_3V_DOT(backY, backY), KK); ! backZ[2] *= _COIL_CONDUCT(ELL_3V_DOT(backZ, backZ), KK); delta[0] = parm[0]*(rspX*(forwX[0] - backX[0]) *************** *** 117,120 **** --- 133,179 ---- 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; + + /* reciprocals of spacings in X, Y, and Z */ + rspX = 1.0/spacing[0]; + rspY = 1.0/spacing[1]; + rspZ = 1.0/spacing[2]; + + _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]); + grad[2] = rspZ*(iv3[1][7] - iv3[1][1]); + gm = ELL_3V_LEN(grad); + + /* compute fluxes */ + eps = 0.000001; + KK = parm[1]*parm[1]; + LL = ELL_3V_DOT(forwX, forwX); + forwX[0] *= _COIL_CONDUCT(LL, KK)/(eps + sqrt(LL)); + LL = ELL_3V_DOT(forwY, forwY); + forwY[1] *= _COIL_CONDUCT(LL, KK)/(eps + sqrt(LL)); + LL = ELL_3V_DOT(forwZ, forwZ); + forwZ[2] *= _COIL_CONDUCT(LL, KK)/(eps + sqrt(LL)); + LL = ELL_3V_DOT(backX, backX); + backX[0] *= _COIL_CONDUCT(LL, KK)/(eps + sqrt(LL)); + LL = ELL_3V_DOT(backY, backY); + backY[1] *= _COIL_CONDUCT(LL, KK)/(eps + sqrt(LL)); + LL = ELL_3V_DOT(backZ, backZ); + backZ[2] *= _COIL_CONDUCT(LL, KK)/(eps + sqrt(LL)); + + delta[0] = gm*parm[0]*(rspX*(forwX[0] - backX[0]) + + rspY*(forwY[1] - backY[1]) + + rspZ*(forwZ[2] - backZ[2])); + } + + void _coilKindScalarUpdate(coil_t *val, coil_t *delta) { *************** *** 130,134 **** _coilKindScalarFilterHomogeneous, _coilKindScalarFilterPeronaMalik, ! NULL, NULL}, _coilKindScalarUpdate --- 189,193 ---- _coilKindScalarFilterHomogeneous, _coilKindScalarFilterPeronaMalik, ! _coilKindScalarFilterModifiedCurvature, NULL}, _coilKindScalarUpdate *************** *** 137,138 **** --- 196,209 ---- const coilKind * coilKindScalar = &_coilKindScalar; + + /* ------------------------------------------ */ + + extern const coilKind _coilKind7Tensor; + + const coilKind* + coilKindArray[COIL_KIND_TYPE_MAX+1] = { + NULL, + &_coilKindScalar, + NULL, + &_coilKind7Tensor + }; Index: realmethods.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/realmethods.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** realmethods.c 24 Mar 2004 06:48:50 -0000 1.3 --- realmethods.c 25 Mar 2004 03:11:50 -0000 1.4 *************** *** 20,23 **** --- 20,24 ---- #include "coil.h" + /* ------------------------------------------ */ const coilMethod _coilMethodTesting = { *************** *** 29,32 **** --- 30,34 ---- coilMethodTesting = &_coilMethodTesting; + /* ------------------------------------------ */ const coilMethod _coilMethodHomogeneous = { *************** *** 38,41 **** --- 40,44 ---- coilMethodHomogeneous = &_coilMethodHomogeneous; + /* ------------------------------------------ */ const coilMethod _coilMethodPeronaMalik = { *************** *** 47,50 **** --- 50,64 ---- coilMethodPeronaMalik = &_coilMethodPeronaMalik; + /* ------------------------------------------ */ + const coilMethod + _coilMethodModifiedCurvature = { + "modified-curvature", + coilMethodTypeModifiedCurvature, + 2 + }; + const coilMethod* + coilMethodModifiedCurvature = &_coilMethodModifiedCurvature; + + /* ------------------------------------------ */ const coilMethod* coilMethodArray[COIL_METHOD_TYPE_MAX+1] = { *************** *** 53,57 **** &_coilMethodHomogeneous, &_coilMethodPeronaMalik, ! NULL, NULL }; --- 67,71 ---- &_coilMethodHomogeneous, &_coilMethodPeronaMalik, ! &_coilMethodModifiedCurvature, NULL }; Index: methodsCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/methodsCoil.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** methodsCoil.c 24 Mar 2004 06:48:50 -0000 1.3 --- methodsCoil.c 25 Mar 2004 03:11:50 -0000 1.4 *************** *** 191,194 **** --- 191,195 ---- coilOutputGet(Nrrd *nout, coilContext *cctx) { char me[]="coilOutputGet", err[AIR_STRLEN_MED]; + int baseDim; if (!(nout && cctx)) { *************** *** 196,200 **** biffAdd(COIL, err); return 1; } ! if (nrrdSlice(nout, cctx->nvol, 0, 0)) { sprintf(err, "%s: trouble slicing to get output", me); biffMove(COIL, err, NRRD); return 1; --- 197,202 ---- biffAdd(COIL, err); return 1; } ! baseDim = (1 == cctx->kind->valLen ? 0 : 1); ! if (nrrdSlice(nout, cctx->nvol, baseDim, 0)) { sprintf(err, "%s: trouble slicing to get output", me); biffMove(COIL, err, NRRD); return 1; Index: enumsCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/enumsCoil.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** enumsCoil.c 24 Mar 2004 06:48:50 -0000 1.2 --- enumsCoil.c 25 Mar 2004 03:11:50 -0000 1.3 *************** *** 93,97 **** "scalar", "3color", ! "7tensor", "" }; --- 93,97 ---- "scalar", "3color", ! "7tensor", "tensor", "" }; *************** *** 101,105 **** coilKindTypeScalar, coilKindType3Color, ! coilKindType7Tensor }; --- 101,105 ---- coilKindTypeScalar, coilKindType3Color, ! coilKindType7Tensor, coilKindType7Tensor }; Index: coreCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/coreCoil.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** coreCoil.c 24 Mar 2004 06:48:50 -0000 1.3 --- coreCoil.c 25 Mar 2004 03:11:50 -0000 1.4 *************** *** 89,92 **** --- 89,104 ---- } + 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 */ + xvi, yvi, zvi; /* volume indices */ + coil_t *tmp; + + _COIL_IV3_FILL(1, 3, 7); + return; + } + int _coilThisZGet(coilTask *task, int doFilter) { *************** *** 188,191 **** --- 200,205 ---- if (1 == cctx->radius && 1 == cctx->kind->valLen) { task->iv3Fill = _coilIv3Fill_1_1; + } else if (1 == cctx->radius && 7 == cctx->kind->valLen) { + task->iv3Fill = _coilIv3Fill_1_7; } else { task->iv3Fill = _coilIv3Fill_R_L; |
|
From: Gordon K. <kin...@us...> - 2004-03-25 03:22:33
|
Update of /cvsroot/teem/teem/src/coil/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12209/test Modified Files: coiler.c Log Message: some new stuff Index: coiler.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/test/coiler.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** coiler.c 24 Mar 2004 06:48:50 -0000 1.4 --- coiler.c 25 Mar 2004 03:11:50 -0000 1.5 *************** *** 29,33 **** airArray *mop; ! int numIters, numThreads, methodType, _parmLen, pi, radius; Nrrd *nin, *nout; coilContext *cctx; --- 29,33 ---- airArray *mop; ! int numIters, numThreads, methodType, kindType, _parmLen, pi, radius; Nrrd *nin, *nout; coilContext *cctx; *************** *** 40,43 **** --- 40,45 ---- hestOptAdd(&hopt, "nt", "# threads", airTypeInt, 1, 1, &numThreads, "5", "number of threads to run"); + hestOptAdd(&hopt, "k", "kind", airTypeEnum, 1, 1, &kindType, NULL, + "what kind of volume is input", NULL, coilKindType); hestOptAdd(&hopt, "m", "method", airTypeEnum, 1, 1, &methodType, "test", "what kind of filtering to perform", NULL, coilMethodType); *************** *** 71,75 **** } if (coilContextAllSet(cctx, nin, ! coilKindScalar, coilMethodArray[methodType], radius, numThreads, 1 /* verbose */, parm) --- 73,77 ---- } if (coilContextAllSet(cctx, nin, ! coilKindArray[kindType], coilMethodArray[methodType], radius, numThreads, 1 /* verbose */, parm) |
|
From: Gordon K. <kin...@us...> - 2004-03-25 03:16:50
|
Update of /cvsroot/teem/teem/src/ten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11408 Modified Files: tendPoint.c Log Message: mathematica-friendly matrix coff list output Index: tendPoint.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/tendPoint.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tendPoint.c 7 Jan 2004 15:34:31 -0000 1.7 --- tendPoint.c 25 Mar 2004 03:06:07 -0000 1.8 *************** *** 70,73 **** --- 70,75 ---- fprintf(stderr, "confidence = %g\n", tdata[0]); fprintf(stderr, "tensor =\n"); + fprintf(stderr, "{%.7f,%.7f,%.7f,%.7f,%.7f,%.7f} = \n", + tdata[1], tdata[2], tdata[3], tdata[4], tdata[5], tdata[6]); fprintf(stderr, "% 15.7f % 15.7f % 15.7f\n", tdata[1], tdata[2], tdata[3]); fprintf(stderr, "% 15.7f % 15.7f % 15.7f\n", tdata[2], tdata[4], tdata[5]); |
|
From: Gordon K. <kin...@us...> - 2004-03-25 01:48:31
|
Update of /cvsroot/teem/teem/src/gage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29006 Modified Files: vecGage.c Log Message: made the vector kind row-major compliant Index: vecGage.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/vecGage.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** vecGage.c 13 Feb 2004 23:12:52 -0000 1.15 --- vecGage.c 25 Mar 2004 01:37:45 -0000 1.16 *************** *** 30,34 **** {gageVecDivergence, 1, 1, {gageVecJacobian, -1, -1, -1, -1}, -1, -1}, {gageVecCurl, 3, 1, {gageVecJacobian, -1, -1, -1, -1}, -1, -1}, ! /* HEY: if teem matrices go to row-major, these will change to sub-items */ {gageVecGradient0, 3, 1, {gageVecJacobian, -1, -1, -1, -1}, -1, -1}, {gageVecGradient1, 3, 1, {gageVecJacobian, -1, -1, -1, -1}, -1, -1}, --- 30,34 ---- {gageVecDivergence, 1, 1, {gageVecJacobian, -1, -1, -1, -1}, -1, -1}, {gageVecCurl, 3, 1, {gageVecJacobian, -1, -1, -1, -1}, -1, -1}, ! /* HEY: these should change to sub-items!!! */ {gageVecGradient0, 3, 1, {gageVecJacobian, -1, -1, -1, -1}, -1, -1}, {gageVecGradient1, 3, 1, {gageVecJacobian, -1, -1, -1, -1}, -1, -1}, *************** *** 86,97 **** } - if (pvl->needD[1]) { - /* because we operated component-at-a-time, and because matrices are - in column order, the 1st column currently contains the three - derivatives of the X component; this should be the 1st row, and - likewise for the 2nd and 3rd column/rows. */ - ELL_3M_TRANSPOSE_IP(jac, tmp); - } - return; } --- 86,89 ---- *************** *** 126,132 **** /* done if doV1 */ /* ! 0:dv_x/dx 3:dv_x/dy 6:dv_x/dz ! 1:dv_y/dx 4:dv_y/dy 7:dv_y/dz ! 2:dv_z/dx 5:dv_z/dy 8:dv_z/dz */ if (ctx->verbose) { --- 118,124 ---- /* done if doV1 */ /* ! 0:dv_x/dx 1:dv_x/dy 2:dv_x/dz ! 3:dv_y/dx 4:dv_y/dy 5:dv_y/dz ! 6:dv_z/dx 7:dv_z/dy 8:dv_z/dz */ if (ctx->verbose) { *************** *** 145,168 **** if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecCurl)) { ELL_3V_SET(pvl->directAnswer[gageVecCurl], ! jacAns[5] - jacAns[7], ! jacAns[6] - jacAns[2], ! jacAns[1] - jacAns[3]); } if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecGradient0)) { ELL_3V_SET(pvl->directAnswer[gageVecGradient0], jacAns[0], ! jacAns[3], ! jacAns[6]); } if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecGradient1)) { ELL_3V_SET(pvl->directAnswer[gageVecGradient1], ! jacAns[1], jacAns[4], ! jacAns[7]); } if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecGradient2)) { ELL_3V_SET(pvl->directAnswer[gageVecGradient2], ! jacAns[2], ! jacAns[5], jacAns[8]); } --- 137,160 ---- if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecCurl)) { ELL_3V_SET(pvl->directAnswer[gageVecCurl], ! jacAns[7] - jacAns[5], ! jacAns[2] - jacAns[6], ! jacAns[3] - jacAns[1]); } if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecGradient0)) { ELL_3V_SET(pvl->directAnswer[gageVecGradient0], jacAns[0], ! jacAns[1], ! jacAns[2]); } if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecGradient1)) { ELL_3V_SET(pvl->directAnswer[gageVecGradient1], ! jacAns[3], jacAns[4], ! jacAns[5]); } if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecGradient2)) { ELL_3V_SET(pvl->directAnswer[gageVecGradient2], ! jacAns[6], ! jacAns[7], jacAns[8]); } |
|
From: Gordon K. <kin...@us...> - 2004-03-24 06:59:24
|
Update of /cvsroot/teem/teem/src/coil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15148 Modified Files: coil.h coreCoil.c enumsCoil.c methodsCoil.c realmethods.c scalarCoil.c tensorCoil.c Log Message: better load balancing, better conductance, just friggen better Index: coil.h =================================================================== RCS file: /cvsroot/teem/teem/src/coil/coil.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** coil.h 22 Mar 2004 21:40:11 -0000 1.1 --- coil.h 24 Mar 2004 06:48:50 -0000 1.2 *************** *** 72,77 **** coilMethodTypeUnknown, /* 0 */ coilMethodTypeTesting, /* 1: basically a no-op */ ! coilMethodTypeIsotropic, /* 2 */ ! coilMethodTypeAnisotropic, /* 3 */ coilMethodTypeModifiedCurvature, /* 4 */ coilMethodTypeCurvatureFlow, /* 5 */ --- 72,77 ---- coilMethodTypeUnknown, /* 0 */ coilMethodTypeTesting, /* 1: basically a no-op */ ! coilMethodTypeHomogeneous, /* 2 */ ! coilMethodTypePeronaMalik, /* 3 */ coilMethodTypeModifiedCurvature, /* 4 */ coilMethodTypeCurvatureFlow, /* 5 */ *************** *** 124,128 **** 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]); --- 124,128 ---- 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]); *************** *** 140,149 **** struct coilContext_t *cctx; /* parent's context */ airThread *thread; /* my thread */ ! int threadIdx, /* which thread am I */ ! startZ, endZ; /* my index range (inclusive) of slices */ ! coil_t *iv3; /* cache of local values, ordering same ! as in gage: any multiple values per ! voxel are the slowest axis, not the ! fastest */ void *returnPtr; /* for airThreadJoin */ } coilTask; --- 140,152 ---- struct coilContext_t *cctx; /* parent's context */ airThread *thread; /* my thread */ ! int threadIdx; /* which thread am I */ ! 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; *************** *** 174,185 **** filtering result, and (2nd) the update values from the current iteration */ ! int finished; /* used to signal all threads to return */ coilTask **task; /* dynamically allocated array of tasks */ ! airThreadBarrier *filterBarrier, /* for when filtering is done, and the ! "update" values have been set */ ! *updateBarrier, /* after the update values have been ! applied to current values */ ! *finishBarrier; /* so that thread 0 can see if filtering should go onward, and set "finished" */ } coilContext; --- 177,195 ---- 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; Index: tensorCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/tensorCoil.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tensorCoil.c 22 Mar 2004 21:40:11 -0000 1.1 --- tensorCoil.c 24 Mar 2004 06:48:50 -0000 1.2 *************** *** 21,25 **** void ! _coilKind7TensorFilterTesting(coil_t *delta, coil_t *iv3, double spacing[3], double parm[COIL_PARMS_NUM]) { --- 21,25 ---- void ! _coilKind7TensorFilterTesting(coil_t *delta, coil_t **iv3, double spacing[3], double parm[COIL_PARMS_NUM]) { *************** *** 34,40 **** void ! _coilKind7TensorFilterIsotropic(coil_t *delta, coil_t *iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { } --- 34,40 ---- void ! _coilKind7TensorFilterHomogeneous(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { } *************** *** 58,62 **** {NULL, _coilKind7TensorFilterTesting, ! _coilKind7TensorFilterIsotropic, NULL, NULL, --- 58,62 ---- {NULL, _coilKind7TensorFilterTesting, ! _coilKind7TensorFilterHomogeneous, NULL, NULL, Index: scalarCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/scalarCoil.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** scalarCoil.c 22 Mar 2004 21:40:11 -0000 1.1 --- scalarCoil.c 24 Mar 2004 06:48:50 -0000 1.2 *************** *** 20,48 **** #include "coil.h" - /* - ** x ----> X - ** \ 0 1 2 - ** | \ 3 4 5 - ** | Y 6 7 8 - ** | - ** | 9 10 11 - ** Z 12 13 14 - ** 15 16 17 - ** - ** 18 19 20 - ** 21 22 23 - ** 24 25 26 - */ - coil_t ! _coilLaplacian3(coil_t *iv3, double spacing[3]) { ! return ((iv3[12] - 2*iv3[13] + iv3[14])/(spacing[0]*spacing[0]) ! + (iv3[10] - 2*iv3[13] + iv3[16])/(spacing[1]*spacing[1]) ! + (iv3[ 4] - 2*iv3[13] + iv3[22])/(spacing[2]*spacing[2])); } void ! _coilKindScalarFilterTesting(coil_t *delta, coil_t *iv3, double spacing[3], double parm[COIL_PARMS_NUM]) { --- 20,33 ---- #include "coil.h" coil_t ! _coilLaplacian3(coil_t **iv3, double spacing[3]) { ! 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]) { *************** *** 51,61 **** void ! _coilKindScalarFilterIsotropic(coil_t *delta, coil_t *iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { ! coil_t lapl; ! lapl = _coilLaplacian3(iv3, spacing); ! delta[0] = parm[0]*lapl; } --- 36,117 ---- void ! _coilKindScalarFilterHomogeneous(coil_t *delta, coil_t **iv3, ! double spacing[3], ! double parm[COIL_PARMS_NUM]) { ! ! delta[0] = parm[0]*_coilLaplacian3(iv3, spacing); ! } ! /* ! ** x ----> X ! ** \ [0][0] [1][0] [2][0] ! ** | \ [0][1] [1][1] [2][1] ! ** | Y [0][2] [1][2] [2][2] ! ** | ! ** | [0][3] [1][3] [2][3] ! ** Z [0][4] [1][4] [2][4] ! ** [0][5] [1][5] [2][5] ! ** ! ** [0][6] [1][6] [2][6] ! ** [0][7] [1][7] [2][7] ! ** [0][8] [1][8] [2][8] ! */ ! ! void ! _coilKindScalarFilterPeronaMalik(coil_t *delta, coil_t **i, ! 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; ! ! /* reciprocals of spacings in X, Y, and Z */ ! rspX = 1.0/spacing[0]; ! rspY = 1.0/spacing[1]; ! rspZ = 1.0/spacing[2]; ! ! /* gradients at forward and backward X */ ! forwX[0] = rspX*(i[2][4] - i[1][4]); ! forwX[1] = rspY*(i[1][5] + i[2][5] - i[1][3] - i[2][3])/2; ! forwX[2] = rspZ*(i[1][7] + i[2][7] - i[1][1] - i[2][1])/2; ! backX[0] = rspX*(i[1][4] - i[0][4]); ! backX[1] = rspY*(i[0][5] + i[1][5] - i[0][3] - i[1][3])/2; ! backX[2] = rspZ*(i[0][7] + i[1][7] - i[0][1] - i[1][1])/2; ! ! /* gradients at forward and backward Y */ ! forwY[0] = rspX*(i[2][4] + i[2][5] - i[0][4] - i[0][5])/2; ! forwY[1] = rspY*(i[1][5] - i[1][4]); ! forwY[2] = rspZ*(i[1][7] + i[1][8] - i[1][1] - i[1][2])/2; ! backY[0] = rspX*(i[2][3] + i[2][4] - i[0][3] - i[0][4])/2; ! backY[1] = rspY*(i[1][4] - i[1][3]); ! backY[2] = rspZ*(i[1][6] + i[1][7] - i[1][0] - i[1][1])/2; ! ! /* gradients at forward and backward Z */ ! forwZ[0] = rspX*(i[2][4] + i[2][7] - i[0][4] - i[0][7])/2; ! forwZ[1] = rspY*(i[1][5] + i[1][8] - i[1][3] - i[1][6])/2; ! forwZ[2] = rspZ*(i[1][7] - i[1][4]); ! backZ[0] = rspX*(i[2][1] + i[2][4] - i[0][1] - i[0][4])/2; ! backZ[1] = rspY*(i[1][2] + i[1][5] - i[1][0] - i[1][3])/2; ! backZ[2] = rspZ*(i[1][4] - i[1][1]); ! ! /* compute fluxes */ ! KK = parm[1]*parm[1]; ! /* ! forwX[0] *= 1.0/(1.0 + ELL_3V_DOT(forwX, forwX)/KK); ! forwY[1] *= 1.0/(1.0 + ELL_3V_DOT(forwY, forwY)/KK); ! forwZ[2] *= 1.0/(1.0 + ELL_3V_DOT(forwZ, forwZ)/KK); ! backX[0] *= 1.0/(1.0 + ELL_3V_DOT(backX, backX)/KK); ! backY[1] *= 1.0/(1.0 + ELL_3V_DOT(backY, backY)/KK); ! backZ[2] *= 1.0/(1.0 + ELL_3V_DOT(backZ, backZ)/KK); ! */ ! forwX[0] *= exp(-0.5*ELL_3V_DOT(forwX, forwX)/KK); ! forwY[1] *= exp(-0.5*ELL_3V_DOT(forwY, forwY)/KK); ! forwZ[2] *= exp(-0.5*ELL_3V_DOT(forwZ, forwZ)/KK); ! backX[0] *= exp(-0.5*ELL_3V_DOT(backX, backX)/KK); ! backY[1] *= exp(-0.5*ELL_3V_DOT(backY, backY)/KK); ! backZ[2] *= exp(-0.5*ELL_3V_DOT(backZ, backZ)/KK); ! ! delta[0] = parm[0]*(rspX*(forwX[0] - backX[0]) ! + rspY*(forwY[1] - backY[1]) ! + rspZ*(forwZ[2] - backZ[2])); } *************** *** 72,77 **** {NULL, _coilKindScalarFilterTesting, ! _coilKindScalarFilterIsotropic, ! NULL, NULL, NULL}, --- 128,133 ---- {NULL, _coilKindScalarFilterTesting, ! _coilKindScalarFilterHomogeneous, ! _coilKindScalarFilterPeronaMalik, NULL, NULL}, Index: realmethods.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/realmethods.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** realmethods.c 23 Mar 2004 01:18:40 -0000 1.2 --- realmethods.c 24 Mar 2004 06:48:50 -0000 1.3 *************** *** 29,41 **** coilMethodTesting = &_coilMethodTesting; - const coilMethod ! _coilMethodIsotropic = { ! "isotropic", ! coilMethodTypeIsotropic, 1 }; const coilMethod* ! coilMethodIsotropic = &_coilMethodIsotropic; const coilMethod* --- 29,49 ---- coilMethodTesting = &_coilMethodTesting; const coilMethod ! _coilMethodHomogeneous = { ! "homogeneous", ! coilMethodTypeHomogeneous, 1 }; const coilMethod* ! coilMethodHomogeneous = &_coilMethodHomogeneous; ! ! const coilMethod ! _coilMethodPeronaMalik = { ! "perona-malik", ! coilMethodTypePeronaMalik, ! 2 ! }; ! const coilMethod* ! coilMethodPeronaMalik = &_coilMethodPeronaMalik; const coilMethod* *************** *** 43,48 **** NULL, &_coilMethodTesting, ! &_coilMethodIsotropic, ! NULL, NULL, NULL --- 51,56 ---- NULL, &_coilMethodTesting, ! &_coilMethodHomogeneous, ! &_coilMethodPeronaMalik, NULL, NULL Index: methodsCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/methodsCoil.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** methodsCoil.c 23 Mar 2004 01:18:40 -0000 1.2 --- methodsCoil.c 24 Mar 2004 06:48:50 -0000 1.3 *************** *** 57,61 **** cctx->finished = AIR_FALSE; cctx->task = NULL; ! cctx->finishBarrier = NULL; cctx->filterBarrier = NULL; cctx->updateBarrier = NULL; --- 57,61 ---- cctx->finished = AIR_FALSE; cctx->task = NULL; ! cctx->nextSliceMutex = NULL; cctx->filterBarrier = NULL; cctx->updateBarrier = NULL; *************** *** 207,210 **** --- 207,211 ---- if (cctx) { + /* thread machinery destroyed with coilFinish() */ cctx->nvol = nrrdNuke(cctx->nvol); cctx = airFree(cctx); Index: enumsCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/enumsCoil.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** enumsCoil.c 22 Mar 2004 21:40:11 -0000 1.1 --- enumsCoil.c 24 Mar 2004 06:48:50 -0000 1.2 *************** *** 24,29 **** "(unknown_method)", "testing", ! "isotropic", ! "anisotropic", "modified curvature", "curvature flow" --- 24,29 ---- "(unknown_method)", "testing", ! "homogeneous", ! "perona-malik", "modified curvature", "curvature flow" *************** *** 34,39 **** "unknown_method", "nothing, actually, just here for testing", ! "isotropic diffusion (Gaussian blurring)", ! "anisotropic diffusion (Perona-Malik)", "modified curvature diffusion", "curvature flow" --- 34,39 ---- "unknown_method", "nothing, actually, just here for testing", ! "homogenous isotropic diffusion (Gaussian blurring)", ! "Perona-Malik", "modified curvature diffusion", "curvature flow" *************** *** 43,48 **** _coilMethodTypeStrEqv[][AIR_STRLEN_SMALL] = { "test", "testing", ! "iso", "isotropic", ! "aniso", "anisotropic", "mcde", "flow", --- 43,48 ---- _coilMethodTypeStrEqv[][AIR_STRLEN_SMALL] = { "test", "testing", ! "homog", "homogeneous", ! "pm", "perona-malik", "mcde", "flow", *************** *** 53,58 **** _coilMethodTypeValEqv[] = { coilMethodTypeTesting, coilMethodTypeTesting, ! coilMethodTypeIsotropic, coilMethodTypeIsotropic, ! coilMethodTypeAnisotropic, coilMethodTypeAnisotropic, coilMethodTypeModifiedCurvature, coilMethodTypeCurvatureFlow --- 53,58 ---- _coilMethodTypeValEqv[] = { coilMethodTypeTesting, coilMethodTypeTesting, ! coilMethodTypeHomogeneous, coilMethodTypeHomogeneous, ! coilMethodTypePeronaMalik, coilMethodTypePeronaMalik, coilMethodTypeModifiedCurvature, coilMethodTypeCurvatureFlow Index: coreCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/coreCoil.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** coreCoil.c 23 Mar 2004 01:18:40 -0000 1.2 --- coreCoil.c 24 Mar 2004 06:48:50 -0000 1.3 *************** *** 20,58 **** #include "coil.h" /* ** ** iv3 is: diam x diam x diam x valLen */ void ! _coilIv3Fill(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 */ xvi, yvi, zvi; /* volume indices */ - /* this should be parameterized on both radius and valLen */ - /* this should shuffle values within iv3 when possible */ diam = 1 + 2*radius; ! for (zni=0; zni<diam; zni++) { ! 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 + diam*(yni + diam*(zni + diam*vi))] = ! here[vi + valLen*(0 + 2*(xvi + sizeX*(yvi + sizeY*zvi)))]; ! } ! } } } ! return; } void _coilProcess(coilTask *task, int doFilter) { ! int xi, yi, zi, sizeX, sizeY, sizeZ, valLen, radius; coil_t *here; ! void (*filter)(coil_t *delta, coil_t *iv3, double spacing[3], double parm[COIL_PARMS_NUM]); --- 20,128 ---- #include "coil.h" + #define _COIL_IV3_FILL(radius, diam, valLen) \ + if (0 && x0) { \ + /* cycle through slices */ \ + tmp = iv3[0]; \ + for (xni=0; xni<diam-1; xni++) { \ + iv3[xni] = iv3[xni+1]; \ + } \ + iv3[diam-1] = tmp; \ + /* refill only newest one */ \ + xni = diam-1; \ + xvi = AIR_CLAMP(0, xni-radius+x0, sizeX-1) - x0; \ + for (zni=0; zni<diam; zni++) { \ + 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)))]; \ + } \ + } \ + } \ + } else { \ + /* have to re-fill entire thing */ \ + for (zni=0; zni<diam; zni++) { \ + 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)))]; \ + } \ + } \ + } \ + } \ + } + /* ** ** iv3 is: diam x diam x diam x valLen + ** + ** this should be parameterized on both radius and valLen */ 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 */ xvi, yvi, zvi; /* volume indices */ + coil_t *tmp; diam = 1 + 2*radius; ! _COIL_IV3_FILL(radius, diam, valLen); ! return; ! } ! ! 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 */ ! xvi, yvi, zvi; /* volume indices */ ! coil_t *tmp; ! ! _COIL_IV3_FILL(1, 3, 1); ! return; ! } ! ! int ! _coilThisZGet(coilTask *task, int doFilter) { ! int thisZ, *thisFlag, *thatFlag; ! ! if (doFilter) { ! thisFlag = &(task->cctx->todoFilter); ! thatFlag = &(task->cctx->todoUpdate); ! } else { ! thisFlag = &(task->cctx->todoUpdate); ! thatFlag = &(task->cctx->todoFilter); ! } ! ! airThreadMutexLock(task->cctx->nextSliceMutex); ! if (task->cctx->nextSlice == task->cctx->size[2] ! && *thisFlag) { ! /* we're the first thread to start this phase */ ! task->cctx->nextSlice = 0; ! *thisFlag = AIR_FALSE; ! } ! thisZ = task->cctx->nextSlice; ! if (task->cctx->nextSlice < task->cctx->size[2]) { ! task->cctx->nextSlice++; ! if (task->cctx->nextSlice == task->cctx->size[2]) { ! /* we just grabbed the last slice of this phase */ ! *thatFlag = AIR_TRUE; } } ! airThreadMutexUnlock(task->cctx->nextSliceMutex); ! return thisZ; } void _coilProcess(coilTask *task, int doFilter) { ! int xi, yi, sizeX, sizeY, thisZ, sizeZ, valLen, radius; coil_t *here; ! void (*filter)(coil_t *delta, coil_t **iv3, double spacing[3], double parm[COIL_PARMS_NUM]); *************** *** 64,76 **** radius = task->cctx->radius; filter = task->cctx->kind->filter[task->cctx->method->type]; - here = (coil_t*)(task->cctx->nvol->data); - here += 2*valLen*sizeX*sizeY*task->startZ; if (doFilter) { ! for (zi=task->startZ; zi<=task->endZ; zi++) { for (yi=0; yi<sizeY; yi++) { for (xi=0; xi<sizeX; xi++) { ! _coilIv3Fill(task->iv3, here + 0*valLen, radius, valLen, ! xi, yi, zi, sizeX, sizeY, sizeZ); ! filter(here + 1*valLen, task->iv3, task->cctx->spacing, task->cctx->parm); here += 2*valLen; } --- 134,150 ---- radius = task->cctx->radius; filter = task->cctx->kind->filter[task->cctx->method->type]; if (doFilter) { ! while (1) { ! 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; } *************** *** 78,82 **** } } else { ! for (zi=task->startZ; zi<=task->endZ; zi++) { for (yi=0; yi<sizeY; yi++) { for (xi=0; xi<sizeX; xi++) { --- 152,161 ---- } } else { ! while (1) { ! 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++) { *************** *** 91,97 **** coilTask * ! _coilTaskNew(coilContext *cctx, int threadIdx, int sizeZ) { coilTask *task; ! int len, diam; len = cctx->kind->valLen; --- 170,176 ---- coilTask * ! _coilTaskNew(coilContext *cctx, int threadIdx) { coilTask *task; ! int len, diam, xi; len = cctx->kind->valLen; *************** *** 101,108 **** task->cctx = cctx; task->thread = airThreadNew(); - task->startZ = threadIdx*sizeZ/cctx->numThreads; - task->endZ = (threadIdx+1)*sizeZ/cctx->numThreads - 1; task->threadIdx = threadIdx; ! task->iv3 = (coil_t*)calloc(len*diam*diam*diam, sizeof(coil_t)); task->returnPtr = NULL; } --- 180,194 ---- task->cctx = cctx; task->thread = airThreadNew(); task->threadIdx = threadIdx; ! task->_iv3 = (coil_t*)calloc(len*diam*diam*diam, sizeof(coil_t)); ! task->iv3 = (coil_t**)calloc(diam, sizeof(coil_t*)); ! for (xi=0; xi<diam; xi++) { ! task->iv3[xi] = task->_iv3 + xi*len*diam*diam; ! } ! if (1 == cctx->radius && 1 == cctx->kind->valLen) { ! task->iv3Fill = _coilIv3Fill_1_1; ! } else { ! task->iv3Fill = _coilIv3Fill_R_L; ! } task->returnPtr = NULL; } *************** *** 115,118 **** --- 201,205 ---- if (task) { task->thread = airThreadNix(task->thread); + task->_iv3 = airFree(task->_iv3); task->iv3 = airFree(task->iv3); free(task); *************** *** 130,161 **** while (1) { /* wait until parent has set cctx->finished */ ! if (task->cctx->verbose) { fprintf(stderr, "%s(%d): waiting to check finished\n", me, task->threadIdx); } ! airThreadBarrierWait(task->cctx->finishBarrier); if (task->cctx->finished) { ! if (task->cctx->verbose) { fprintf(stderr, "%s(%d): done!\n", me, task->threadIdx); } break; } ! /* else there's work */ /* first: filter */ ! if (task->cctx->verbose) { fprintf(stderr, "%s(%d): filtering ... \n", me, task->threadIdx); } _coilProcess(task, AIR_TRUE); - airThreadBarrierWait(task->cctx->filterBarrier); /* second: update */ ! if (task->cctx->verbose) { fprintf(stderr, "%s(%d): updating ... \n", me, task->threadIdx); } _coilProcess(task, AIR_FALSE); ! airThreadBarrierWait(task->cctx->updateBarrier); } --- 217,248 ---- while (1) { /* wait until parent has set cctx->finished */ ! 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; } ! /* else there's work to do ... */ /* first: filter */ ! if (task->cctx->verbose > 1) { fprintf(stderr, "%s(%d): filtering ... \n", me, task->threadIdx); } _coilProcess(task, AIR_TRUE); /* second: update */ ! airThreadBarrierWait(task->cctx->updateBarrier); ! if (task->cctx->verbose > 1) { fprintf(stderr, "%s(%d): updating ... \n", me, task->threadIdx); } _coilProcess(task, AIR_FALSE); ! } *************** *** 182,186 **** cctx->task[0] = NULL; for (tidx=0; tidx<cctx->numThreads; tidx++) { ! cctx->task[tidx] = _coilTaskNew(cctx, tidx, cctx->size[2]); if (!(cctx->task[tidx])) { sprintf(err, "%s: couldn't allocate task %d", me, tidx); --- 269,273 ---- cctx->task[0] = NULL; for (tidx=0; tidx<cctx->numThreads; tidx++) { ! cctx->task[tidx] = _coilTaskNew(cctx, tidx); if (!(cctx->task[tidx])) { sprintf(err, "%s: couldn't allocate task %d", me, tidx); *************** *** 191,213 **** cctx->finished = AIR_FALSE; if (cctx->numThreads > 1) { ! cctx->finishBarrier = airThreadBarrierNew(cctx->numThreads); cctx->filterBarrier = airThreadBarrierNew(cctx->numThreads); cctx->updateBarrier = airThreadBarrierNew(cctx->numThreads); } - /* start threads 1 and up running (they won't get far) */ - if (cctx->verbose) { - fprintf(stderr, "%s: parent doing slices Z=[%d,%d]\n", me, - cctx->task[0]->startZ, cctx->task[0]->endZ); - } - for (tidx=1; tidx<cctx->numThreads; tidx++) { - if (cctx->verbose) { - fprintf(stderr, "%s: spawning thread %d (Z=[%d,%d])\n", me, tidx, - cctx->task[tidx]->startZ, cctx->task[tidx]->endZ); - } - airThreadStart(cctx->task[tidx]->thread, _coilWorker, - (void *)(cctx->task[tidx])); - } - /* initialize the values in cctx->nvol */ val = (coil_t*)(cctx->nvol->data); --- 278,286 ---- cctx->finished = AIR_FALSE; if (cctx->numThreads > 1) { ! cctx->nextSliceMutex = airThreadMutexNew(); cctx->filterBarrier = airThreadBarrierNew(cctx->numThreads); cctx->updateBarrier = airThreadBarrierNew(cctx->numThreads); } /* initialize the values in cctx->nvol */ val = (coil_t*)(cctx->nvol->data); *************** *** 226,243 **** } ! return 0; ! } ! ! int ! _coilPause(int huge) { ! int i, j, num; ! ! num = 0; ! for (i=1; i<huge; i++) { ! for (j=0; j<huge; j++) { ! num *= i; } } ! return num; } --- 299,317 ---- } ! /* start threads 1 and up running; they'll all hit filterBarrier */ ! for (tidx=1; tidx<cctx->numThreads; tidx++) { ! if (cctx->verbose > 1) { ! fprintf(stderr, "%s: spawning thread %d\n", me, tidx); } + airThreadStart(cctx->task[tidx]->thread, _coilWorker, + (void *)(cctx->task[tidx])); } ! ! /* set things as though we've just finished an update phase */ ! cctx->nextSlice = cctx->size[2]; ! cctx->todoFilter = AIR_TRUE; ! cctx->todoUpdate = AIR_FALSE; ! ! return 0; } *************** *** 253,256 **** --- 327,331 ---- char me[]="coilIterate", err[AIR_STRLEN_MED]; int iter; + double time0, time1; if (!cctx) { *************** *** 259,288 **** } for (iter=0; iter<numIterations; iter++) { if (cctx->verbose) { ! fprintf(stderr, "%s: starting iter %d\n", me, iter); } cctx->finished = AIR_FALSE; if (cctx->numThreads > 1) { ! airThreadBarrierWait(cctx->finishBarrier); } /* first: filter */ ! if (cctx->verbose) { fprintf(stderr, "%s: filtering ... \n", me); } _coilProcess(cctx->task[0], AIR_TRUE); - if (cctx->numThreads > 1) { - airThreadBarrierWait(cctx->filterBarrier); - } /* second: update */ ! if (cctx->verbose) { fprintf(stderr, "%s: updating ... \n", me); } - _coilProcess(cctx->task[0], AIR_FALSE); if (cctx->numThreads > 1) { airThreadBarrierWait(cctx->updateBarrier); } } return 0; --- 334,368 ---- } + time0 = airTime(); for (iter=0; iter<numIterations; iter++) { if (cctx->verbose) { ! fprintf(stderr, "%s: starting iter %d (of %d)\n", me, iter, ! numIterations); } cctx->finished = AIR_FALSE; if (cctx->numThreads > 1) { ! airThreadBarrierWait(cctx->filterBarrier); } /* first: filter */ ! if (cctx->verbose > 1) { fprintf(stderr, "%s: filtering ... \n", me); } _coilProcess(cctx->task[0], AIR_TRUE); /* second: update */ ! if (cctx->verbose > 1) { fprintf(stderr, "%s: updating ... \n", me); } if (cctx->numThreads > 1) { airThreadBarrierWait(cctx->updateBarrier); } + _coilProcess(cctx->task[0], AIR_FALSE); + + } + time1 = airTime(); + if (cctx->verbose) { + fprintf(stderr, "%s: elapsed time = %g (%g/iter)\n", me, + time1 - time0, (time1 - time0)/numIterations); } return 0; *************** *** 299,308 **** } ! if (cctx->verbose) { fprintf(stderr, "%s: finishing workers\n", me); } cctx->finished = AIR_TRUE; if (cctx->numThreads > 1) { ! airThreadBarrierWait(cctx->finishBarrier); } for (tidx=1; tidx<cctx->numThreads; tidx++) { --- 379,388 ---- } ! if (cctx->verbose > 1) { fprintf(stderr, "%s: finishing workers\n", me); } cctx->finished = AIR_TRUE; if (cctx->numThreads > 1) { ! airThreadBarrierWait(cctx->filterBarrier); } for (tidx=1; tidx<cctx->numThreads; tidx++) { *************** *** 315,318 **** --- 395,404 ---- cctx->task = airFree(cctx->task); + if (cctx->numThreads > 1) { + cctx->nextSliceMutex = airThreadMutexNix(cctx->nextSliceMutex); + cctx->filterBarrier = airThreadBarrierNix(cctx->filterBarrier); + cctx->updateBarrier = airThreadBarrierNix(cctx->updateBarrier); + } + return 0; } |
|
From: Gordon K. <kin...@us...> - 2004-03-24 06:59:24
|
Update of /cvsroot/teem/teem/src/coil/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15148/test Modified Files: coiler.c Log Message: better load balancing, better conductance, just friggen better Index: coiler.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/test/coiler.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** coiler.c 23 Mar 2004 01:18:40 -0000 1.3 --- coiler.c 24 Mar 2004 06:48:50 -0000 1.4 *************** *** 72,76 **** if (coilContextAllSet(cctx, nin, coilKindScalar, coilMethodArray[methodType], ! radius, numThreads, AIR_TRUE, parm) || coilStart(cctx) --- 72,76 ---- if (coilContextAllSet(cctx, nin, coilKindScalar, coilMethodArray[methodType], ! radius, numThreads, 1 /* verbose */, parm) || coilStart(cctx) |
|
From: Gordon K. <kin...@us...> - 2004-03-23 01:29:02
|
Update of /cvsroot/teem/teem/src/coil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17006 Modified Files: coreCoil.c methodsCoil.c realmethods.c Log Message: we now have a revolutionary new way to do isotropic blurring! Index: realmethods.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/realmethods.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** realmethods.c 22 Mar 2004 21:40:11 -0000 1.1 --- realmethods.c 23 Mar 2004 01:18:40 -0000 1.2 *************** *** 34,38 **** "isotropic", coilMethodTypeIsotropic, ! 0 }; const coilMethod* --- 34,38 ---- "isotropic", coilMethodTypeIsotropic, ! 1 }; const coilMethod* Index: coreCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/coreCoil.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** coreCoil.c 22 Mar 2004 21:40:11 -0000 1.1 --- coreCoil.c 23 Mar 2004 01:18:40 -0000 1.2 *************** *** 35,46 **** diam = 1 + 2*radius; for (zni=0; zni<diam; zni++) { ! zvi = AIR_CLAMP(0, zni-radius+z0, sizeZ-1); for (yni=0; yni<diam; yni++) { ! yvi = AIR_CLAMP(0, yni-radius+y0, sizeY-1); for (xni=0; xni<diam; xni++) { ! xvi = AIR_CLAMP(0, xni-radius+x0, sizeX-1); for (vi=0; vi<valLen; vi++) { iv3[xni + diam*(yni + diam*(zni + diam*vi))] = ! here[vi + valLen*(xvi + sizeX*(yvi + sizeY*zvi))]; } } --- 35,46 ---- diam = 1 + 2*radius; for (zni=0; zni<diam; zni++) { ! 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 + diam*(yni + diam*(zni + diam*vi))] = ! here[vi + valLen*(0 + 2*(xvi + sizeX*(yvi + sizeY*zvi)))]; } } *************** *** 51,57 **** void ! _coilProcess(coilTask *task, int filter) { int xi, yi, zi, sizeX, sizeY, sizeZ, valLen, radius; coil_t *here; sizeX = task->cctx->size[0]; --- 51,60 ---- void ! _coilProcess(coilTask *task, int doFilter) { int xi, yi, zi, sizeX, sizeY, sizeZ, valLen, radius; coil_t *here; + void (*filter)(coil_t *delta, coil_t *iv3, + double spacing[3], + double parm[COIL_PARMS_NUM]); sizeX = task->cctx->size[0]; *************** *** 60,72 **** valLen = task->cctx->kind->valLen; radius = task->cctx->radius; here = (coil_t*)(task->cctx->nvol->data); here += 2*valLen*sizeX*sizeY*task->startZ; ! if (filter) { for (zi=task->startZ; zi<=task->endZ; zi++) { for (yi=0; yi<sizeY; yi++) { for (xi=0; xi<sizeX; xi++) { ! _coilIv3Fill(task->iv3, here, radius, valLen, xi, yi, zi, sizeX, sizeY, sizeZ); ! /* filter */ here += 2*valLen; } --- 63,76 ---- valLen = task->cctx->kind->valLen; radius = task->cctx->radius; + filter = task->cctx->kind->filter[task->cctx->method->type]; here = (coil_t*)(task->cctx->nvol->data); here += 2*valLen*sizeX*sizeY*task->startZ; ! if (doFilter) { for (zi=task->startZ; zi<=task->endZ; zi++) { for (yi=0; yi<sizeY; yi++) { for (xi=0; xi<sizeX; xi++) { ! _coilIv3Fill(task->iv3, here + 0*valLen, radius, valLen, xi, yi, zi, sizeX, sizeY, sizeZ); ! filter(here + 1*valLen, task->iv3, task->cctx->spacing, task->cctx->parm); here += 2*valLen; } *************** *** 186,192 **** cctx->finished = AIR_FALSE; ! cctx->finishBarrier = airThreadBarrierNew(cctx->numThreads); ! cctx->filterBarrier = airThreadBarrierNew(cctx->numThreads); ! cctx->updateBarrier = airThreadBarrierNew(cctx->numThreads); /* start threads 1 and up running (they won't get far) */ --- 190,198 ---- cctx->finished = AIR_FALSE; ! if (cctx->numThreads > 1) { ! cctx->finishBarrier = airThreadBarrierNew(cctx->numThreads); ! cctx->filterBarrier = airThreadBarrierNew(cctx->numThreads); ! cctx->updateBarrier = airThreadBarrierNew(cctx->numThreads); ! } /* start threads 1 and up running (they won't get far) */ *************** *** 258,262 **** } cctx->finished = AIR_FALSE; ! airThreadBarrierWait(cctx->finishBarrier); /* first: filter */ --- 264,270 ---- } cctx->finished = AIR_FALSE; ! if (cctx->numThreads > 1) { ! airThreadBarrierWait(cctx->finishBarrier); ! } /* first: filter */ *************** *** 265,269 **** } _coilProcess(cctx->task[0], AIR_TRUE); ! airThreadBarrierWait(cctx->filterBarrier); /* second: update */ --- 273,279 ---- } _coilProcess(cctx->task[0], AIR_TRUE); ! if (cctx->numThreads > 1) { ! airThreadBarrierWait(cctx->filterBarrier); ! } /* second: update */ *************** *** 272,276 **** } _coilProcess(cctx->task[0], AIR_FALSE); ! airThreadBarrierWait(cctx->updateBarrier); } return 0; --- 282,288 ---- } _coilProcess(cctx->task[0], AIR_FALSE); ! if (cctx->numThreads > 1) { ! airThreadBarrierWait(cctx->updateBarrier); ! } } return 0; *************** *** 291,300 **** } cctx->finished = AIR_TRUE; ! airThreadBarrierWait(cctx->finishBarrier); for (tidx=1; tidx<cctx->numThreads; tidx++) { airThreadJoin(cctx->task[tidx]->thread, &(cctx->task[tidx]->returnPtr)); cctx->task[tidx]->thread = airThreadNix(cctx->task[tidx]->thread); } cctx->task[0]->thread = airThreadNix(cctx->task[0]->thread); return 0; --- 303,317 ---- } cctx->finished = AIR_TRUE; ! if (cctx->numThreads > 1) { ! airThreadBarrierWait(cctx->finishBarrier); ! } for (tidx=1; tidx<cctx->numThreads; tidx++) { airThreadJoin(cctx->task[tidx]->thread, &(cctx->task[tidx]->returnPtr)); cctx->task[tidx]->thread = airThreadNix(cctx->task[tidx]->thread); + cctx->task[tidx] = _coilTaskNix(cctx->task[tidx]); } cctx->task[0]->thread = airThreadNix(cctx->task[0]->thread); + cctx->task[0] = _coilTaskNix(cctx->task[0]); + cctx->task = airFree(cctx->task); return 0; Index: methodsCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/methodsCoil.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** methodsCoil.c 22 Mar 2004 21:40:11 -0000 1.1 --- methodsCoil.c 23 Mar 2004 01:18:40 -0000 1.2 *************** *** 74,77 **** --- 74,78 ---- airArray *mop; + cctx->verbose = verbose; if (!( cctx && nin && kind && method )) { sprintf(err, "%s: got NULL pointer", me); *************** *** 147,150 **** --- 148,155 ---- } ELL_3V_SET(cctx->spacing, xsp, ysp, zsp); + if (cctx->verbose) { + fprintf(stderr, "%s: spacings: %g %g %g\n", me, + cctx->spacing[0], cctx->spacing[1], cctx->spacing[2]); + } /* allocate nvol */ *************** *** 166,170 **** cctx->radius = radius; cctx->numThreads = numThreads; - cctx->verbose = verbose; airMopOkay(mop); --- 171,174 ---- |
|
From: Gordon K. <kin...@us...> - 2004-03-23 01:29:02
|
Update of /cvsroot/teem/teem/src/coil/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17006/test Modified Files: coiler.c Log Message: we now have a revolutionary new way to do isotropic blurring! Index: coiler.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/test/coiler.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** coiler.c 22 Mar 2004 21:50:12 -0000 1.2 --- coiler.c 23 Mar 2004 01:18:40 -0000 1.3 *************** *** 29,36 **** airArray *mop; ! int numIters, numThreads, methodType; Nrrd *nin, *nout; coilContext *cctx; ! double parm[COIL_PARMS_NUM]; mop = airMopNew(); --- 29,36 ---- airArray *mop; ! int numIters, numThreads, methodType, _parmLen, pi, radius; Nrrd *nin, *nout; coilContext *cctx; ! double *_parm, parm[COIL_PARMS_NUM]; mop = airMopNew(); *************** *** 42,45 **** --- 42,49 ---- hestOptAdd(&hopt, "m", "method", airTypeEnum, 1, 1, &methodType, "test", "what kind of filtering to perform", NULL, coilMethodType); + hestOptAdd(&hopt, "p", "parms", airTypeDouble, 1, -1, &_parm, NULL, + "all the parameters required for filtering method", &_parmLen); + hestOptAdd(&hopt, "r", "radius", airTypeInt, 1, 1, &radius, "1", + "radius of filtering neighborhood"); hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &(nin), "", "input volume to filter", NULL, NULL, nrrdHestNrrd); *************** *** 56,62 **** airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopAlways); if (coilContextAllSet(cctx, nin, coilKindScalar, coilMethodArray[methodType], ! 3, numThreads, AIR_TRUE, parm) || coilStart(cctx) --- 60,76 ---- airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopAlways); + if (_parmLen != coilMethodArray[methodType]->numParm) { + fprintf(stderr, "%s: %s method wants %d parms, but got %d\n", me, + coilMethodArray[methodType]->name, + coilMethodArray[methodType]->numParm, _parmLen); + airMopError(mop); + return 1; + } + for (pi=0; pi<_parmLen; pi++) { + parm[pi] = _parm[pi]; + } if (coilContextAllSet(cctx, nin, coilKindScalar, coilMethodArray[methodType], ! radius, numThreads, AIR_TRUE, parm) || coilStart(cctx) |
|
From: Gordon K. <kin...@us...> - 2004-03-22 22:00:32
|
Update of /cvsroot/teem/teem/src/coil/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5016/test Modified Files: coiler.c Log Message: debugging ... Index: coiler.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/test/coiler.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** coiler.c 22 Mar 2004 21:40:11 -0000 1.1 --- coiler.c 22 Mar 2004 21:50:12 -0000 1.2 *************** *** 31,38 **** int numIters, numThreads, methodType; Nrrd *nin, *nout; - mop = airMopNew(); coilContext *cctx; double parm[COIL_PARMS_NUM]; me = argv[0]; hestOptAdd(&hopt, "iter", "# iters", airTypeInt, 1, 1, &numIters, "5", --- 31,38 ---- int numIters, numThreads, methodType; Nrrd *nin, *nout; coilContext *cctx; double parm[COIL_PARMS_NUM]; + mop = airMopNew(); me = argv[0]; hestOptAdd(&hopt, "iter", "# iters", airTypeInt, 1, 1, &numIters, "5", |
|
From: Gordon K. <kin...@us...> - 2004-03-22 22:00:14
|
Update of /cvsroot/teem/teem/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4904 Modified Files: GNUmakefile Log Message: added coil to teem lib list Index: GNUmakefile =================================================================== RCS file: /cvsroot/teem/teem/src/GNUmakefile,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** GNUmakefile 26 Feb 2004 06:27:32 -0000 1.52 --- GNUmakefile 22 Mar 2004 21:49:54 -0000 1.53 *************** *** 96,102 **** ## {R}NUM/LIBS: used for craziness below ## ! LIBS = air hest biff nrrd ell unrrdu dye moss gage bane limn hoover alan echo ten mite ! NUMS = 0 1 2 3 4 5 6 7 8 9 A B C D E F ! RNUMS = F E D C B A 9 8 7 6 5 4 3 2 1 0 #LIBS = air hest biff nrrd ell unrrdu dye moss gage bane limn hoover alan echo ten #NUMS = 0 1 2 3 4 5 6 7 8 9 A B C D E --- 96,102 ---- ## {R}NUM/LIBS: used for craziness below ## ! LIBS = air hest biff nrrd ell unrrdu dye moss gage bane limn hoover alan echo ten mite coil ! NUMS = 0 1 2 3 4 5 6 7 8 9 A B C D E F G ! RNUMS = G F E D C B A 9 8 7 6 5 4 3 2 1 0 #LIBS = air hest biff nrrd ell unrrdu dye moss gage bane limn hoover alan echo ten #NUMS = 0 1 2 3 4 5 6 7 8 9 A B C D E |
Update of /cvsroot/teem/teem/src/coil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3054 Added Files: coil.h GNUmakefile coreCoil.c defaultsCoil.c enumsCoil.c methodsCoil.c realmethods.c scalarCoil.c tensorCoil.c Log Message: this is the last teem library that Gordon will write while he does not have a PhD --- NEW FILE: defaultsCoil.c --- /* teem: Gordon Kindlmann's research software Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "coil.h" const char * coilBiffKey = "coil"; int coilDefaultRadius = 1; --- NEW FILE: GNUmakefile --- # # teem: Gordon Kindlmann's research software # Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # #### Library name #### #### L := coil #### #### #### # boilerplate: default targets and include tricks TEEM_ROOT ?= ../.. TEEM_SRC ?= .. ifeq (,$(DEF_TARGETS)) DEF_TARGETS = true dev : $(L)/dev install : $(L)/install clean : $(L)/clean clobber : $(L)/clobber include ../GNUmakefile endif ifeq (,$($(L).SEEN)) $(L).SEEN := true #### Describe library here #### (ell for macros) #### $(L).NEED = ten gage ell nrrd biff air $(L).PUBLIC_HEADERS = coil.h $(L).PRIVATE_HEADERS = $(L).OBJS = defaultsCoil.o enumsCoil.o scalarCoil.o tensorCoil.o \ realmethods.o methodsCoil.o coreCoil.o $(L).TESTS = test/coiler #### #### #### # boilerplate: declare rules for this library include $(TEEM_SRC)/make/template.mk endif ifeq (,$(INCLUDED)) include $(TEEM_SRC)/bin/GNUmakefile endif --- NEW FILE: coil.h --- /* teem: Gordon Kindlmann's research software Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef COIL_HAS_BEEN_INCLUDED #define COIL_HAS_BEEN_INCLUDED #include <teem/air.h> #include <teem/biff.h> #include <teem/ell.h> #include <teem/nrrd.h> #include <teem/gage.h> #include <teem/ten.h> #ifdef __cplusplus extern "C" { #endif #define COIL coilBiffKey /* ******** coil_t ** ** this is the very crude means by which you can control the type ** of values that coil works with: "float" or "double". It is an ** unfortunate but greatly simplifying restriction that this type ** is used for all kinds of volumes, and all methods of filtering ** ** So: choose double by defining TEEM_COIL_TYPE_DOUBLE and float ** otherwise. */ #ifdef TEEM_COIL_TYPE_DOUBLE typedef double coil_t; #define coil_nrrdType nrrdTypeDouble #define COIL_TYPE_FLOAT 0 #else typedef float coil_t; #define coil_nrrdType nrrdTypeFloat #define COIL_TYPE_FLOAT 1 #endif /* ******** #define COIL_PARMS_NUM ** ** maximum number of parameters that may be needed by any coil-driven ** filtering method */ #define COIL_PARMS_NUM 5 /* ******** coilMethodType* enum ** ** enumerated possibilities for different filtering methods */ enum { coilMethodTypeUnknown, /* 0 */ coilMethodTypeTesting, /* 1: basically a no-op */ coilMethodTypeIsotropic, /* 2 */ coilMethodTypeAnisotropic, /* 3 */ coilMethodTypeModifiedCurvature, /* 4 */ coilMethodTypeCurvatureFlow, /* 5 */ coilMethodTypeLast }; #define COIL_METHOD_TYPE_MAX 5 /* ******** coilMethod struct ** ** someday, there will be total orthogonality between kind and method. ** until then, this will have only a portion of the things relating to ** running one method, regardless of kind */ typedef struct { char name[AIR_STRLEN_SMALL]; int type; /* from coilMethodType* enum */ int numParm; /* number of parameters we need */ } coilMethod; /* ******** coilKindType* enum ** ** enumerated possibilities for different kinds */ enum { coilKindTypeUnknown, /* 0 */ coilKindTypeScalar, /* 1 */ coilKindType3Color, /* 2 */ coilKindType7Tensor, /* 3 */ coilKindTypeLast }; #define COIL_KIND_TYPE_MAX 3 /* ******** coilKind struct ** ** yes, there is some redunancy with the gageKind, but the the main ** reason is that its significantly easier to implement meaningful ** per-sample filtering of various quantities, than it is to do ** gage-style convolution-based measurements at arbitrary locations. ** So, there will probably be significantly more coilKinds than ** there are gageKinds. The two kind systems may play closer together ** at some point in the future where appropriate. */ typedef struct { 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; struct coilContext_t; /* ******** coilTask ** ** passed to all worker threads */ typedef struct { struct coilContext_t *cctx; /* parent's context */ airThread *thread; /* my thread */ int threadIdx, /* which thread am I */ startZ, endZ; /* my index range (inclusive) of slices */ coil_t *iv3; /* cache of local values, ordering same as in gage: any multiple values per voxel are the slowest axis, not the fastest */ void *returnPtr; /* for airThreadJoin */ } coilTask; /* ******** coilContext struct ** ** bag of stuff relating to filtering one volume */ typedef struct coilContext_t { /* ---------- input */ const Nrrd *nin; /* input volume, converted to coil_t nvol */ 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 */ coilTask **task; /* dynamically allocated array of tasks */ airThreadBarrier *filterBarrier, /* for when filtering is done, and the "update" values have been set */ *updateBarrier, /* after the update values have been applied to current values */ *finishBarrier; /* so that thread 0 can see if filtering should go onward, and set "finished" */ } coilContext; /* defaultsCoil.c */ TEEM_API const char *coilBiffKey; TEEM_API int coilDefaultRadius; /* enumsCoil.c */ TEEM_API airEnum *coilMethodType; TEEM_API airEnum *coilKindType; /* scalarCoil.c */ TEEM_API const coilKind *coilKindScalar; /* tensorCoil.c */ TEEM_API const coilKind *coilKindTensor; /* realmethods.c */ TEEM_API const coilMethod *coilMethodTesting; TEEM_API const coilMethod *coilMethodIsotropic; TEEM_API const coilMethod *coilMethodArray[COIL_METHOD_TYPE_MAX+1]; /* methodsCoil.c (sorry, confusing name!) */ TEEM_API coilContext *coilContextNew(); 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); /* coreCoil.c */ TEEM_API int coilStart(coilContext *cctx); TEEM_API int coilIterate(coilContext *cctx, int numIterations); TEEM_API int coilFinish(coilContext *cctx); #ifdef __cplusplus } #endif #endif /* COIL_HAS_BEEN_INCLUDED */ --- NEW FILE: tensorCoil.c --- /* teem: Gordon Kindlmann's research software Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "coil.h" void _coilKind7TensorFilterTesting(coil_t *delta, coil_t *iv3, double spacing[3], double parm[COIL_PARMS_NUM]) { delta[0] = 0; delta[1] = 0; delta[2] = 0; delta[3] = 0; delta[4] = 0; delta[5] = 0; delta[6] = 0; } void _coilKind7TensorFilterIsotropic(coil_t *delta, coil_t *iv3, double spacing[3], double parm[COIL_PARMS_NUM]) { } void _coilKindTensorUpdate(coil_t *val, coil_t *delta) { val[0] += delta[0]; /* WARNING: this could change confidence! */ val[1] += delta[1]; val[2] += delta[2]; val[3] += delta[3]; val[4] += delta[4]; val[5] += delta[5]; val[6] += delta[6]; } const coilKind _coilKindTensor = { "tensor", 7, {NULL, _coilKind7TensorFilterTesting, _coilKind7TensorFilterIsotropic, NULL, NULL, NULL}, _coilKindTensorUpdate }; const coilKind * coilKindTensor = &_coilKindTensor; --- NEW FILE: scalarCoil.c --- /* teem: Gordon Kindlmann's research software Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "coil.h" /* ** x ----> X ** \ 0 1 2 ** | \ 3 4 5 ** | Y 6 7 8 ** | ** | 9 10 11 ** Z 12 13 14 ** 15 16 17 ** ** 18 19 20 ** 21 22 23 ** 24 25 26 */ coil_t _coilLaplacian3(coil_t *iv3, double spacing[3]) { return ((iv3[12] - 2*iv3[13] + iv3[14])/(spacing[0]*spacing[0]) + (iv3[10] - 2*iv3[13] + iv3[16])/(spacing[1]*spacing[1]) + (iv3[ 4] - 2*iv3[13] + iv3[22])/(spacing[2]*spacing[2])); } void _coilKindScalarFilterTesting(coil_t *delta, coil_t *iv3, double spacing[3], double parm[COIL_PARMS_NUM]) { delta[0] = 0; } void _coilKindScalarFilterIsotropic(coil_t *delta, coil_t *iv3, double spacing[3], double parm[COIL_PARMS_NUM]) { coil_t lapl; lapl = _coilLaplacian3(iv3, spacing); delta[0] = parm[0]*lapl; } void _coilKindScalarUpdate(coil_t *val, coil_t *delta) { val[0] += delta[0]; } const coilKind _coilKindScalar = { "scalar", 1, {NULL, _coilKindScalarFilterTesting, _coilKindScalarFilterIsotropic, NULL, NULL, NULL}, _coilKindScalarUpdate }; const coilKind * coilKindScalar = &_coilKindScalar; --- NEW FILE: realmethods.c --- /* teem: Gordon Kindlmann's research software Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "coil.h" const coilMethod _coilMethodTesting = { "testing", coilMethodTypeTesting, 0 }; const coilMethod* coilMethodTesting = &_coilMethodTesting; const coilMethod _coilMethodIsotropic = { "isotropic", coilMethodTypeIsotropic, 0 }; const coilMethod* coilMethodIsotropic = &_coilMethodIsotropic; const coilMethod* coilMethodArray[COIL_METHOD_TYPE_MAX+1] = { NULL, &_coilMethodTesting, &_coilMethodIsotropic, NULL, NULL, NULL }; --- NEW FILE: coreCoil.c --- /* teem: Gordon Kindlmann's research software Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "coil.h" /* ** ** iv3 is: diam x diam x diam x valLen */ void _coilIv3Fill(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 */ xvi, yvi, zvi; /* volume indices */ /* this should be parameterized on both radius and valLen */ /* this should shuffle values within iv3 when possible */ diam = 1 + 2*radius; for (zni=0; zni<diam; zni++) { zvi = AIR_CLAMP(0, zni-radius+z0, sizeZ-1); for (yni=0; yni<diam; yni++) { yvi = AIR_CLAMP(0, yni-radius+y0, sizeY-1); for (xni=0; xni<diam; xni++) { xvi = AIR_CLAMP(0, xni-radius+x0, sizeX-1); for (vi=0; vi<valLen; vi++) { iv3[xni + diam*(yni + diam*(zni + diam*vi))] = here[vi + valLen*(xvi + sizeX*(yvi + sizeY*zvi))]; } } } } return; } void _coilProcess(coilTask *task, int filter) { int xi, yi, zi, sizeX, sizeY, sizeZ, valLen, radius; coil_t *here; sizeX = task->cctx->size[0]; sizeY = task->cctx->size[1]; sizeZ = task->cctx->size[2]; valLen = task->cctx->kind->valLen; radius = task->cctx->radius; here = (coil_t*)(task->cctx->nvol->data); here += 2*valLen*sizeX*sizeY*task->startZ; if (filter) { for (zi=task->startZ; zi<=task->endZ; zi++) { for (yi=0; yi<sizeY; yi++) { for (xi=0; xi<sizeX; xi++) { _coilIv3Fill(task->iv3, here, radius, valLen, xi, yi, zi, sizeX, sizeY, sizeZ); /* filter */ here += 2*valLen; } } } } else { for (zi=task->startZ; zi<=task->endZ; zi++) { 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; } } } } return; } coilTask * _coilTaskNew(coilContext *cctx, int threadIdx, int sizeZ) { coilTask *task; int len, diam; len = cctx->kind->valLen; diam = 1 + 2*cctx->radius; task = (coilTask *)calloc(1, sizeof(coilTask)); if (task) { task->cctx = cctx; task->thread = airThreadNew(); task->startZ = threadIdx*sizeZ/cctx->numThreads; task->endZ = (threadIdx+1)*sizeZ/cctx->numThreads - 1; task->threadIdx = threadIdx; task->iv3 = (coil_t*)calloc(len*diam*diam*diam, sizeof(coil_t)); task->returnPtr = NULL; } return task; } coilTask * _coilTaskNix(coilTask *task) { if (task) { task->thread = airThreadNix(task->thread); task->iv3 = airFree(task->iv3); free(task); } return NULL; } void * _coilWorker(void *_task) { char me[]="_coilWorker"; coilTask *task; task = (coilTask *)_task; while (1) { /* wait until parent has set cctx->finished */ if (task->cctx->verbose) { fprintf(stderr, "%s(%d): waiting to check finished\n", me, task->threadIdx); } airThreadBarrierWait(task->cctx->finishBarrier); if (task->cctx->finished) { if (task->cctx->verbose) { fprintf(stderr, "%s(%d): done!\n", me, task->threadIdx); } break; } /* else there's work */ /* first: filter */ if (task->cctx->verbose) { fprintf(stderr, "%s(%d): filtering ... \n", me, task->threadIdx); } _coilProcess(task, AIR_TRUE); airThreadBarrierWait(task->cctx->filterBarrier); /* second: update */ if (task->cctx->verbose) { fprintf(stderr, "%s(%d): updating ... \n", me, task->threadIdx); } _coilProcess(task, AIR_FALSE); airThreadBarrierWait(task->cctx->updateBarrier); } return _task; } int coilStart(coilContext *cctx) { char me[]="coilStart", err[AIR_STRLEN_MED]; int tidx, elIdx, valIdx, valLen; coil_t (*lup)(const void*, size_t), *val; if (!cctx) { sprintf(err, "%s: got NULL pointer", me); biffAdd(COIL, err); return 1; } cctx->task = (coilTask **)calloc(cctx->numThreads, sizeof(coilTask *)); if (!(cctx->task)) { sprintf(err, "%s: couldn't allocate array of tasks", me); biffAdd(COIL, err); return 1; } /* we create tasks for ALL threads, including me, thread 0 */ cctx->task[0] = NULL; for (tidx=0; tidx<cctx->numThreads; tidx++) { cctx->task[tidx] = _coilTaskNew(cctx, tidx, cctx->size[2]); if (!(cctx->task[tidx])) { sprintf(err, "%s: couldn't allocate task %d", me, tidx); biffAdd(COIL, err); return 1; } } cctx->finished = AIR_FALSE; cctx->finishBarrier = airThreadBarrierNew(cctx->numThreads); cctx->filterBarrier = airThreadBarrierNew(cctx->numThreads); cctx->updateBarrier = airThreadBarrierNew(cctx->numThreads); /* start threads 1 and up running (they won't get far) */ if (cctx->verbose) { fprintf(stderr, "%s: parent doing slices Z=[%d,%d]\n", me, cctx->task[0]->startZ, cctx->task[0]->endZ); } for (tidx=1; tidx<cctx->numThreads; tidx++) { if (cctx->verbose) { fprintf(stderr, "%s: spawning thread %d (Z=[%d,%d])\n", me, tidx, cctx->task[tidx]->startZ, cctx->task[tidx]->endZ); } airThreadStart(cctx->task[tidx]->thread, _coilWorker, (void *)(cctx->task[tidx])); } /* initialize the values in cctx->nvol */ val = (coil_t*)(cctx->nvol->data); valLen = cctx->kind->valLen; #if COIL_TYPE_FLOAT lup = nrrdFLookup[cctx->nin->type]; #else lup = nrrdDLookup[cctx->nin->type]; #endif for (elIdx=0; elIdx<cctx->size[0]*cctx->size[1]*cctx->size[2]; elIdx++) { for (valIdx=0; valIdx<valLen; valIdx++) { val[valIdx + 0*valLen] = lup(cctx->nin->data, valIdx + valLen*elIdx); val[valIdx + 1*valLen] = 0; } val += 2*valLen; } return 0; } int _coilPause(int huge) { int i, j, num; num = 0; for (i=1; i<huge; i++) { for (j=0; j<huge; j++) { num *= i; } } return num; } /* ******** coilIterate ** ** (documentation) ** ** NB: this implements the body of thread 0 */ int coilIterate(coilContext *cctx, int numIterations) { char me[]="coilIterate", err[AIR_STRLEN_MED]; int iter; if (!cctx) { sprintf(err, "%s: got NULL pointer", me); biffAdd(COIL, err); return 1; } for (iter=0; iter<numIterations; iter++) { if (cctx->verbose) { fprintf(stderr, "%s: starting iter %d\n", me, iter); } cctx->finished = AIR_FALSE; airThreadBarrierWait(cctx->finishBarrier); /* first: filter */ if (cctx->verbose) { fprintf(stderr, "%s: filtering ... \n", me); } _coilProcess(cctx->task[0], AIR_TRUE); airThreadBarrierWait(cctx->filterBarrier); /* second: update */ if (cctx->verbose) { fprintf(stderr, "%s: updating ... \n", me); } _coilProcess(cctx->task[0], AIR_FALSE); airThreadBarrierWait(cctx->updateBarrier); } return 0; } int coilFinish(coilContext *cctx) { char me[]="coilFinish", err[AIR_STRLEN_MED]; int tidx; if (!cctx) { sprintf(err, "%s: got NULL pointer", me); biffAdd(COIL, err); return 1; } if (cctx->verbose) { fprintf(stderr, "%s: finishing workers\n", me); } cctx->finished = AIR_TRUE; airThreadBarrierWait(cctx->finishBarrier); for (tidx=1; tidx<cctx->numThreads; tidx++) { airThreadJoin(cctx->task[tidx]->thread, &(cctx->task[tidx]->returnPtr)); cctx->task[tidx]->thread = airThreadNix(cctx->task[tidx]->thread); } cctx->task[0]->thread = airThreadNix(cctx->task[0]->thread); return 0; } --- NEW FILE: enumsCoil.c --- /* teem: Gordon Kindlmann's research software Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "coil.h" char _coilMethodTypeStr[COIL_METHOD_TYPE_MAX+1][AIR_STRLEN_SMALL] = { "(unknown_method)", "testing", "isotropic", "anisotropic", "modified curvature", "curvature flow" }; char _coilMethodTypeDesc[COIL_METHOD_TYPE_MAX+1][AIR_STRLEN_MED] = { "unknown_method", "nothing, actually, just here for testing", "isotropic diffusion (Gaussian blurring)", "anisotropic diffusion (Perona-Malik)", "modified curvature diffusion", "curvature flow" }; char _coilMethodTypeStrEqv[][AIR_STRLEN_SMALL] = { "test", "testing", "iso", "isotropic", "aniso", "anisotropic", "mcde", "flow", "" }; int _coilMethodTypeValEqv[] = { coilMethodTypeTesting, coilMethodTypeTesting, coilMethodTypeIsotropic, coilMethodTypeIsotropic, coilMethodTypeAnisotropic, coilMethodTypeAnisotropic, coilMethodTypeModifiedCurvature, coilMethodTypeCurvatureFlow }; airEnum _coilMethodType = { "method", COIL_METHOD_TYPE_MAX, _coilMethodTypeStr, NULL, _coilMethodTypeDesc, _coilMethodTypeStrEqv, _coilMethodTypeValEqv, AIR_FALSE }; airEnum * coilMethodType = &_coilMethodType; /* -------------------------------------------------- */ char _coilKindTypeStr[COIL_KIND_TYPE_MAX+1][AIR_STRLEN_SMALL] = { "(unknown_kind)", "scalar", "3color", "7tensor" }; char _coilKindTypeDesc[COIL_KIND_TYPE_MAX+1][AIR_STRLEN_MED] = { "unknown_kind", "plain old scalar quantities", "3-component color", "ten-style 7-valued tensor" }; char _coilKindTypeStrEqv[][AIR_STRLEN_SMALL] = { "scalar", "3color", "7tensor", "" }; int _coilKindTypeValEqv[] = { coilKindTypeScalar, coilKindType3Color, coilKindType7Tensor }; airEnum _coilKindType = { "kind", COIL_KIND_TYPE_MAX, _coilKindTypeStr, NULL, _coilKindTypeDesc, _coilKindTypeStrEqv, _coilKindTypeValEqv, AIR_FALSE }; airEnum * coilKindType = &_coilKindType; --- NEW FILE: methodsCoil.c --- /* teem: Gordon Kindlmann's research software Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "coil.h" int coilVolumeCheck(const Nrrd *nin, const coilKind *kind) { char me[]="coilVolumeCheck", err[AIR_STRLEN_MED]; int baseDim; if (!(nin && kind)) { sprintf(err, "%s: got NULL pointer", me); biffAdd(COIL, err); return 1; } if (nrrdTypeBlock == nin->type) { sprintf(err, "%s: can only operate on scalar types, not %s", me, airEnumStr(nrrdType, nrrdTypeBlock)); biffAdd(COIL, err); return 1; } baseDim = (1 == kind->valLen ? 0 : 1); 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; } return 0; } coilContext * coilContextNew() { coilContext *cctx; cctx = (coilContext *)calloc(1, sizeof(coilContext)); if (cctx) { cctx->nin = NULL; cctx->radius = coilDefaultRadius; cctx->numThreads = 1; ELL_3V_SET(cctx->spacing, AIR_NAN, AIR_NAN, AIR_NAN); cctx->nvol = NULL; cctx->finished = AIR_FALSE; cctx->task = NULL; cctx->finishBarrier = NULL; cctx->filterBarrier = NULL; cctx->updateBarrier = NULL; } return cctx; } 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; double xsp, ysp, zsp; airArray *mop; if (!( cctx && nin && kind && method )) { sprintf(err, "%s: got NULL pointer", me); biffAdd(COIL, err); return 1; } if (coilVolumeCheck(nin, kind)) { sprintf(err, "%s: input volume not usable as %s", me, kind->name); biffAdd(COIL, err); return 1; } 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; } 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; } /* warn if we can't do the multiple threads user wants */ if (numThreads > 1 && !airThreadCapable && airThreadNoopWarning) { fprintf(stderr, "%s: WARNING: this teem not thread capable: using 1 " "thread, not %d\n", me, numThreads); numThreads = 1; } mop = airMopNew(); /* set parms */ for (pi=0; pi<method->numParm; pi++) { 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; } cctx->parm[pi] = parm[pi]; } /* set sizes and spacings */ baseDim = (1 == kind->valLen ? 0 : 1); sx = nin->axis[0 + baseDim].size; sy = nin->axis[1 + baseDim].size; sz = nin->axis[2 + baseDim].size; 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; } ELL_3V_SET(cctx->size, sx, sy, sz); xsp = nin->axis[0 + baseDim].spacing; ysp = nin->axis[1 + baseDim].spacing; zsp = nin->axis[2 + baseDim].spacing; someExist = AIR_EXISTS(xsp) || AIR_EXISTS(ysp) || AIR_EXISTS(zsp); allExist = AIR_EXISTS(xsp) && AIR_EXISTS(ysp) && AIR_EXISTS(zsp); if (!( someExist )) { fprintf(stderr, "%s: WARNING: assuming unit spacing for all axes\n", me); xsp = 1; ysp = 1; zsp = 1; } else { if ( !allExist ) { sprintf(err, "%s: spacings (%g,%g,%g) not uniformly existant", me, xsp, ysp, zsp); biffAdd(COIL, err); airMopError(mop); return 1; } } ELL_3V_SET(cctx->spacing, xsp, ysp, zsp); /* allocate nvol */ if (0 == baseDim) { ELL_4V_SET(size, 2, sx, sy, sz); } else { ELL_5V_SET(size, kind->valLen, 2, sx, sy, sz); } cctx->nvol = nrrdNew(); if (nrrdMaybeAlloc_nva(cctx->nvol, coil_nrrdType, 4 + baseDim, size)) { sprintf(err, "%s: couldn't allocate internal processing volume", me); biffMove(COIL, err, NRRD); airMopError(mop); return 1; } airMopAdd(mop, cctx->nvol, (airMopper)nrrdNuke, airMopOnError); cctx->nin = nin; cctx->kind = kind; cctx->method = method; cctx->radius = radius; cctx->numThreads = numThreads; cctx->verbose = verbose; airMopOkay(mop); return 0; } /* ******** coilOutputGet ** ** slice the present intermediate volume to get an output. ** ** No, this does not do quantization or rounding to match the input ** type (of cctx->nin). The reason is that after filtering, it is often ** the case that subtle differences in values emerge, and it may be ** reckless to dump them back into the limited type or value range ** that they started with. That sort of operation should be under ** explicit user control. */ int coilOutputGet(Nrrd *nout, coilContext *cctx) { char me[]="coilOutputGet", err[AIR_STRLEN_MED]; if (!(nout && cctx)) { sprintf(err, "%s: got NULL pointer", me); biffAdd(COIL, err); return 1; } if (nrrdSlice(nout, cctx->nvol, 0, 0)) { sprintf(err, "%s: trouble slicing to get output", me); biffMove(COIL, err, NRRD); return 1; } return 0; } coilContext * coilContextNix(coilContext *cctx) { if (cctx) { cctx->nvol = nrrdNuke(cctx->nvol); cctx = airFree(cctx); } return NULL; } |
|
From: Gordon K. <kin...@us...> - 2004-03-22 21:50:30
|
Update of /cvsroot/teem/teem/src/coil/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3054/test Added Files: coiler.c Log Message: this is the last teem library that Gordon will write while he does not have a PhD --- NEW FILE: coiler.c --- /* teem: Gordon Kindlmann's research software Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../coil.h" char *info = ("Test program for coil library."); int main(int argc, char *argv[]) { char *me, *err, *outS; hestOpt *hopt=NULL; airArray *mop; int numIters, numThreads, methodType; Nrrd *nin, *nout; mop = airMopNew(); coilContext *cctx; double parm[COIL_PARMS_NUM]; me = argv[0]; hestOptAdd(&hopt, "iter", "# iters", airTypeInt, 1, 1, &numIters, "5", "number of iterations to do processing for"); hestOptAdd(&hopt, "nt", "# threads", airTypeInt, 1, 1, &numThreads, "5", "number of threads to run"); hestOptAdd(&hopt, "m", "method", airTypeEnum, 1, 1, &methodType, "test", "what kind of filtering to perform", NULL, coilMethodType); hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &(nin), "", "input volume to filter", NULL, NULL, nrrdHestNrrd); hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-", "output file to save filtering result into"); hestParseOrDie(hopt, argc-1, argv+1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE); airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways); airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways); cctx = coilContextNew(); airMopAdd(mop, cctx, (airMopper)coilContextNix, airMopAlways); nout = nrrdNew(); airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopAlways); if (coilContextAllSet(cctx, nin, coilKindScalar, coilMethodArray[methodType], 3, numThreads, AIR_TRUE, parm) || coilStart(cctx) || coilIterate(cctx, numIters) || coilFinish(cctx) || coilOutputGet(nout, cctx)) { airMopAdd(mop, err = biffGetDone(COIL), airFree, airMopAlways); fprintf(stderr, "%s: trouble with coil:\n%s\n", me, err); airMopError(mop); return 1; } if (nrrdSave(outS, nout, NULL)) { airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways); fprintf(stderr, "%s: couldn't save output:\n%s\n", me, err); airMopError(mop); return 1; } airMopOkay(mop); return 0; } |
|
From: Gordon K. <kin...@us...> - 2004-03-22 21:48:48
|
Update of /cvsroot/teem/teem/src/coil/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2670/test Log Message: Directory /cvsroot/teem/teem/src/coil/test added to the repository |
|
From: Gordon K. <kin...@us...> - 2004-03-22 21:48:07
|
Update of /cvsroot/teem/teem/src/coil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2489/coil Log Message: Directory /cvsroot/teem/teem/src/coil added to the repository |
|
From: <kin...@us...> - 2004-03-15 03:16:46
|
Update of /cvsroot/teem/teem/src/nrrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26704 Modified Files: nrrd.h write.c Log Message: these functions did not meet standard teem naming conventions Index: nrrd.h =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/nrrd.h,v retrieving revision 1.134 retrieving revision 1.135 diff -C2 -d -r1.134 -r1.135 *** nrrd.h 26 Feb 2004 20:59:45 -0000 1.134 --- nrrd.h 15 Mar 2004 03:07:41 -0000 1.135 *************** *** 602,612 **** /* write.c */ TEEM_API int nrrdIoStateSet(NrrdIoState *io, int parm, int value); ! TEEM_API int nrrdIoStateSetEncoding(NrrdIoState *io, const NrrdEncoding *encoding); ! TEEM_API int nrrdIoStateSetFormat(NrrdIoState *io, const NrrdFormat *format); TEEM_API int nrrdIoStateGet(NrrdIoState *io, int parm); ! TEEM_API const NrrdEncoding *nrrdIoStateGetEncoding(NrrdIoState *io); ! TEEM_API const NrrdFormat *nrrdIoStateBetFormat(NrrdIoState *io); TEEM_API int nrrdSave(const char *filename, const Nrrd *nrrd, NrrdIoState *io); TEEM_API int nrrdWrite(FILE *file, const Nrrd *nrrd, NrrdIoState *io); --- 602,612 ---- /* write.c */ TEEM_API int nrrdIoStateSet(NrrdIoState *io, int parm, int value); ! TEEM_API int nrrdIoStateEncodingSet(NrrdIoState *io, const NrrdEncoding *encoding); ! TEEM_API int nrrdIoStateFormatSet(NrrdIoState *io, const NrrdFormat *format); TEEM_API int nrrdIoStateGet(NrrdIoState *io, int parm); ! TEEM_API const NrrdEncoding *nrrdIoStateEncodingGet(NrrdIoState *io); ! TEEM_API const NrrdFormat *nrrdIoStateFormatGet(NrrdIoState *io); TEEM_API int nrrdSave(const char *filename, const Nrrd *nrrd, NrrdIoState *io); TEEM_API int nrrdWrite(FILE *file, const Nrrd *nrrd, NrrdIoState *io); Index: write.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/write.c,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** write.c 7 Jan 2004 15:34:30 -0000 1.88 --- write.c 15 Mar 2004 03:07:41 -0000 1.89 *************** *** 96,101 **** int ! nrrdIoStateSetEncoding (NrrdIoState *nio, const NrrdEncoding *encoding) { ! char me[]="nrrdIoStateSetEncoding", err[AIR_STRLEN_MED]; if (!( nio && encoding )) { --- 96,101 ---- int ! nrrdIoStateEncodingSet (NrrdIoState *nio, const NrrdEncoding *encoding) { ! char me[]="nrrdIoStateEncodingSet", err[AIR_STRLEN_MED]; if (!( nio && encoding )) { *************** *** 117,122 **** int ! nrrdIoStateSetFormat (NrrdIoState *nio, const NrrdFormat *format) { ! char me[]="nrrdIoStateSetFormat", err[AIR_STRLEN_MED]; if (!( nio && format )) { --- 117,122 ---- int ! nrrdIoStateFormatSet (NrrdIoState *nio, const NrrdFormat *format) { ! char me[]="nrrdIoStateFormatSet", err[AIR_STRLEN_MED]; if (!( nio && format )) { *************** *** 191,195 **** */ const NrrdEncoding * ! nrrdIoStateGetEncoding (NrrdIoState *nio) { return nio ? nio->encoding : nrrdEncodingUnknown; --- 191,195 ---- */ const NrrdEncoding * ! nrrdIoStateEncodingGet (NrrdIoState *nio) { return nio ? nio->encoding : nrrdEncodingUnknown; *************** *** 200,204 **** */ const NrrdFormat * ! nrrdIoStateGetFormat (NrrdIoState *nio) { return nio ? nio->format : nrrdFormatUnknown; --- 200,204 ---- */ const NrrdFormat * ! nrrdIoStateFormatGet (NrrdIoState *nio) { return nio ? nio->format : nrrdFormatUnknown; |
|
From: <kin...@us...> - 2004-03-13 20:12:30
|
Update of /cvsroot/teem/teem/src/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26582/bin Modified Files: mrender.c talkweb.c Log Message: killed off AIR_FREE and AIR_FCLOSE macros- they were just way too cute for their own good Index: mrender.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/mrender.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** mrender.c 19 Feb 2004 11:15:13 -0000 1.32 --- mrender.c 13 Mar 2004 20:03:08 -0000 1.33 *************** *** 125,129 **** if (uu) { airMopOkay(uu->mrmop); ! AIR_FREE(uu); } return NULL; --- 125,129 ---- if (uu) { airMopOkay(uu->mrmop); ! uu = airFree(uu); } return NULL; *************** *** 301,305 **** mrendThreadEnd(mrendThread *tt, mrendRender *rr, mrendUser *uu) { ! AIR_FREE(tt->val); return 0; --- 301,305 ---- mrendThreadEnd(mrendThread *tt, mrendRender *rr, mrendUser *uu) { ! tt->val = airFree(tt->val); return 0; *************** *** 333,337 **** newLen = AIR_ROUNDUP(rayLen/tt->rayStep) + 1; if (!tt->val || newLen > tt->valLen) { ! AIR_FREE(tt->val); tt->valLen = newLen; tt->val = (float*)calloc(newLen, sizeof(float)); --- 333,337 ---- newLen = AIR_ROUNDUP(rayLen/tt->rayStep) + 1; if (!tt->val || newLen > tt->valLen) { ! tt->val = airFree(tt->val); tt->valLen = newLen; tt->val = (float*)calloc(newLen, sizeof(float)); Index: talkweb.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/talkweb.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** talkweb.c 7 Jan 2004 15:34:28 -0000 1.7 --- talkweb.c 13 Mar 2004 20:03:08 -0000 1.8 *************** *** 78,85 **** tkwbSlideNix(tkwbSlide *slide) { ! AIR_FREE(slide->title); ! AIR_FREE(slide->image); ! AIR_FREE(slide->text); ! AIR_FREE(slide); return NULL; } --- 78,85 ---- tkwbSlideNix(tkwbSlide *slide) { ! slide->title = airFree(slide->title); ! slide->image = airFree(slide->image); ! slide->text = airFree(slide->text); ! slide = airFree(slide); return NULL; } |
|
From: <kin...@us...> - 2004-03-13 20:12:30
|
Update of /cvsroot/teem/teem/src/air In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26582/air Modified Files: air.h string.c Log Message: killed off AIR_FREE and AIR_FCLOSE macros- they were just way too cute for their own good Index: air.h =================================================================== RCS file: /cvsroot/teem/teem/src/air/air.h,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** air.h 19 Feb 2004 06:45:11 -0000 1.39 --- air.h 13 Mar 2004 20:03:08 -0000 1.40 *************** *** 621,633 **** /* - ******** AIR_FREE, AIR_FCLOSE - ** - ** just to help you set all pointers to free'd data and fclose'd files to NULL - */ - #define AIR_FREE(x) (x) = airFree((x)) - #define AIR_FCLOSE(f) (f) = airFclose((f)) - - - /* ******** AIR_IN_OP(a,b,c), AIR_IN_CL(a,b,c) ** --- 621,624 ---- Index: string.c =================================================================== RCS file: /cvsroot/teem/teem/src/air/string.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** string.c 7 Jan 2004 15:34:27 -0000 1.7 --- string.c 13 Mar 2004 20:03:08 -0000 1.8 *************** *** 132,136 **** t = airStrtok(NULL, ct, &l); } ! AIR_FREE(s); } return n; --- 132,136 ---- t = airStrtok(NULL, ct, &l); } ! s = airFree(s); } return n; |
|
From: <kin...@us...> - 2004-03-13 20:12:04
|
Update of /cvsroot/teem/teem/src/nrrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26582/nrrd Modified Files: axis.c formatNRRD.c formatPNG.c gzio.c histogram.c keyvalue.c measure.c methodsNrrd.c read.c reorder.c resampleNrrd.c simple.c Log Message: killed off AIR_FREE and AIR_FCLOSE macros- they were just way too cute for their own good Index: axis.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/axis.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** axis.c 7 Jan 2004 15:34:30 -0000 1.5 --- axis.c 13 Mar 2004 20:03:10 -0000 1.6 *************** *** 30,35 **** axis->spacing = AIR_NAN; axis->min = axis->max = AIR_NAN; ! AIR_FREE(axis->label); ! AIR_FREE(axis->unit); axis->center = nrrdCenterUnknown; } --- 30,35 ---- axis->spacing = AIR_NAN; axis->min = axis->max = AIR_NAN; ! axis->label = airFree(axis->label); ! axis->unit = airFree(axis->unit); axis->center = nrrdCenterUnknown; } *************** *** 53,59 **** if (axis) { ! AIR_FREE(axis->label); ! AIR_FREE(axis->unit); ! AIR_FREE(axis); } return NULL; --- 53,59 ---- if (axis) { ! axis->label = airFree(axis->label); ! axis->unit = airFree(axis->unit); ! axis = airFree(axis); } return NULL; *************** *** 83,87 **** if (!(NRRD_AXIS_INFO_LABEL_BIT & bitflag)) { if (dest->label != src->label) { ! AIR_FREE(dest->label); dest->label = airStrdup(src->label); } --- 83,87 ---- if (!(NRRD_AXIS_INFO_LABEL_BIT & bitflag)) { if (dest->label != src->label) { ! dest->label = airFree(dest->label); dest->label = airStrdup(src->label); } *************** *** 89,93 **** if (!(NRRD_AXIS_INFO_UNIT_BIT & bitflag)) { if (dest->unit != src->unit) { ! AIR_FREE(dest->unit); dest->unit = airStrdup(src->unit); } --- 89,93 ---- if (!(NRRD_AXIS_INFO_UNIT_BIT & bitflag)) { if (dest->unit != src->unit) { ! dest->unit = airFree(dest->unit); dest->unit = airStrdup(src->unit); } *************** *** 185,193 **** break; case nrrdAxisInfoLabel: ! AIR_FREE(nrrd->axis[d].label); nrrd->axis[d].label = airStrdup(info.CP[d]); break; case nrrdAxisInfoUnit: ! AIR_FREE(nrrd->axis[d].unit); nrrd->axis[d].unit = airStrdup(info.CP[d]); break; --- 185,193 ---- break; case nrrdAxisInfoLabel: ! nrrd->axis[d].label = airFree(nrrd->axis[d].label); nrrd->axis[d].label = airStrdup(info.CP[d]); break; case nrrdAxisInfoUnit: ! nrrd->axis[d].unit = airFree(nrrd->axis[d].unit); nrrd->axis[d].unit = airStrdup(info.CP[d]); break; Index: formatNRRD.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/formatNRRD.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** formatNRRD.c 7 Jan 2004 15:34:30 -0000 1.5 --- formatNRRD.c 13 Mar 2004 20:03:10 -0000 1.6 *************** *** 285,289 **** } else { if (nio->detachedHeader) { ! AIR_FCLOSE(nio->dataFile); /* fprintf(stderr, "!%s: nio->dataFile = %p\n", me, nio->dataFile); */ } else { --- 285,289 ---- } else { if (nio->detachedHeader) { ! nio->dataFile = airFclose(nio->dataFile); /* fprintf(stderr, "!%s: nio->dataFile = %p\n", me, nio->dataFile); */ } else { *************** *** 380,384 **** } if (nio->detachedHeader) { ! AIR_FCLOSE(nio->dataFile); } else { nio->dataFile = NULL; --- 380,384 ---- } if (nio->detachedHeader) { ! nio->dataFile = airFclose(nio->dataFile); } else { nio->dataFile = NULL; Index: formatPNG.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/formatPNG.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** formatPNG.c 7 Jan 2004 15:34:30 -0000 1.5 --- formatPNG.c 13 Mar 2004 20:03:10 -0000 1.6 *************** *** 311,315 **** descriptor did NOT come from a line of text as read by _nrrdOneLine */ ! AIR_FREE(nio->line); nio->line = airStrdup(txt[i].text); ret = _nrrdReadNrrdParseField(nrrd, nio, AIR_FALSE); --- 311,315 ---- descriptor did NOT come from a line of text as read by _nrrdOneLine */ ! nio->line = airFree(nio->line); nio->line = airStrdup(txt[i].text); ret = _nrrdReadNrrdParseField(nrrd, nio, AIR_FALSE); *************** *** 366,370 **** png_read_end(png, info); /* clean up */ ! AIR_FREE(row); png_destroy_read_struct(&png, &info, NULL); --- 366,370 ---- png_read_end(png, info); /* clean up */ ! row = airFree(row); png_destroy_read_struct(&png, &info, NULL); *************** *** 515,521 **** /* clean up */ for (i=0; i<numtxt; i++) { ! AIR_FREE(txt[i].text); } ! AIR_FREE(row); png_destroy_write_struct(&png, &info); --- 515,521 ---- /* clean up */ for (i=0; i<numtxt; i++) { ! txt[i].text = airFree(txt[i].text); } ! row = airFree(row); png_destroy_write_struct(&png, &info); Index: gzio.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/gzio.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** gzio.c 7 Jan 2004 15:34:30 -0000 1.15 --- gzio.c 13 Mar 2004 20:03:10 -0000 1.16 *************** *** 556,560 **** return 1; } ! AIR_FREE(s->msg); if (s->stream.state != NULL) { if (s->mode == 'w') { --- 556,560 ---- return 1; } ! s->msg = airFree(s->msg); if (s->stream.state != NULL) { if (s->mode == 'w') { *************** *** 573,579 **** biffAdd(NRRD, err); } ! AIR_FREE(s->inbuf); ! AIR_FREE(s->outbuf); ! AIR_FREE(s); return error != Z_OK; } --- 573,579 ---- biffAdd(NRRD, err); } ! s->inbuf = airFree(s->inbuf); ! s->outbuf = airFree(s->outbuf); ! s = airFree(s); return error != Z_OK; } Index: histogram.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/histogram.c,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** histogram.c 7 Jan 2004 15:34:30 -0000 1.48 --- histogram.c 13 Mar 2004 20:03:10 -0000 1.49 *************** *** 138,142 **** biffAdd(NRRD, err); airMopError(mop); return 1; } ! AIR_FREE(nout->axis[0].label); nout->axis[0].label = airStrdup(nout->content); --- 138,142 ---- biffAdd(NRRD, err); airMopError(mop); return 1; } ! nout->axis[0].label = airFree(nout->axis[0].label); nout->axis[0].label = airStrdup(nout->content); *************** *** 188,192 **** nout->axis[0].center = nout->axis[1].center = nrrdCenterCell; nout->axis[0].label = airStrdup(nin->axis[0].label); ! AIR_FREE(nout->axis[1].label); nrrdPeripheralInit(nout); pgmData = nout->data; --- 188,192 ---- nout->axis[0].center = nout->axis[1].center = nrrdCenterCell; nout->axis[0].label = airStrdup(nin->axis[0].label); ! nout->axis[1].label = airFree(nout->axis[1].label); nrrdPeripheralInit(nout); pgmData = nout->data; *************** *** 506,510 **** } } else { ! AIR_FREE(nout->axis[d].label); totalContentStrlen += 2; } --- 506,510 ---- } } else { ! nout->axis[d].label = airFree(nout->axis[d].label); totalContentStrlen += 2; } Index: keyvalue.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/keyvalue.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** keyvalue.c 13 Feb 2004 03:40:58 -0000 1.7 --- keyvalue.c 13 Mar 2004 20:03:10 -0000 1.8 *************** *** 93,98 **** nk = nrrd->kvpArr->len; for (ki=0; ki<nk; ki++) { ! AIR_FREE(nrrd->kvp[0 + 2*ki]); ! AIR_FREE(nrrd->kvp[1 + 2*ki]); } airArraySetLen(nrrd->kvpArr, 0); --- 93,98 ---- nk = nrrd->kvpArr->len; for (ki=0; ki<nk; ki++) { ! nrrd->kvp[0 + 2*ki] = airFree(nrrd->kvp[0 + 2*ki]); ! nrrd->kvp[1 + 2*ki] = airFree(nrrd->kvp[1 + 2*ki]); } airArraySetLen(nrrd->kvpArr, 0); *************** *** 113,118 **** return 0; } ! AIR_FREE(nrrd->kvp[0 + 2*ki]); ! AIR_FREE(nrrd->kvp[1 + 2*ki]); nk = nrrd->kvpArr->len; for (; ki<nk-1; ki++) { --- 113,118 ---- return 0; } ! nrrd->kvp[0 + 2*ki] = airFree(nrrd->kvp[0 + 2*ki]); ! nrrd->kvp[1 + 2*ki] = airFree(nrrd->kvp[1 + 2*ki]); nk = nrrd->kvpArr->len; for (; ki<nk-1; ki++) { *************** *** 144,148 **** } if (-1 != (ki = _nrrdKeyValueIdxFind(nrrd, key))) { ! AIR_FREE(nrrd->kvp[1 + 2*ki]); nrrd->kvp[1 + 2*ki] = airStrdup(value); } else { --- 144,148 ---- } if (-1 != (ki = _nrrdKeyValueIdxFind(nrrd, key))) { ! nrrd->kvp[1 + 2*ki] = airFree(nrrd->kvp[1 + 2*ki]); nrrd->kvp[1 + 2*ki] = airStrdup(value); } else { Index: measure.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/measure.c,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** measure.c 7 Jan 2004 15:34:30 -0000 1.46 --- measure.c 13 Mar 2004 20:03:10 -0000 1.47 *************** *** 878,882 **** nrrdPeripheralInit(nout); ! AIR_FREE(_line); return 0; } --- 878,882 ---- nrrdPeripheralInit(nout); ! _line = airFree(_line); return 0; } Index: methodsNrrd.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/methodsNrrd.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** methodsNrrd.c 16 Jan 2004 17:35:12 -0000 1.39 --- methodsNrrd.c 13 Mar 2004 20:03:10 -0000 1.40 *************** *** 28,35 **** if (nio) { ! AIR_FREE(nio->path); ! AIR_FREE(nio->base); ! AIR_FREE(nio->dataFN); ! AIR_FREE(nio->line); nio->lineLen = 0; nio->pos = 0; --- 28,35 ---- if (nio) { ! nio->path = airFree(nio->path); ! nio->base = airFree(nio->base); ! nio->dataFN = airFree(nio->dataFN); ! nio->line = airFree(nio->line); nio->lineLen = 0; nio->pos = 0; *************** *** 77,86 **** NrrdIoState * nrrdIoStateNix (NrrdIoState *nio) { ! ! AIR_FREE(nio->path); ! AIR_FREE(nio->base); ! AIR_FREE(nio->dataFN); ! AIR_FREE(nio->line); ! AIR_FREE(nio); /* the NrrdIoState never owned nio->oldData; we don't free it */ return NULL; --- 77,86 ---- NrrdIoState * nrrdIoStateNix (NrrdIoState *nio) { ! ! nio->path = airFree(nio->path); ! nio->base = airFree(nio->base); ! nio->dataFN = airFree(nio->dataFN); ! nio->line = airFree(nio->line); ! nio = airFree(nio); /* the NrrdIoState never owned nio->oldData; we don't free it */ return NULL; *************** *** 126,130 **** nrrdResampleInfoNix (NrrdResampleInfo *info) { ! AIR_FREE(info); return NULL; } --- 126,130 ---- nrrdResampleInfoNix (NrrdResampleInfo *info) { ! info = airFree(info); return NULL; } *************** *** 150,154 **** nrrdKernelSpecNix (NrrdKernelSpec *ksp) { ! AIR_FREE(ksp); return NULL; } --- 150,154 ---- nrrdKernelSpecNix (NrrdKernelSpec *ksp) { ! ksp = airFree(ksp); return NULL; } *************** *** 200,204 **** if (nrrd) { ! AIR_FREE(nrrd->data); nrrd->type = nrrdTypeUnknown; nrrd->dim = 0; --- 200,204 ---- if (nrrd) { ! nrrd->data = airFree(nrrd->data); nrrd->type = nrrdTypeUnknown; nrrd->dim = 0; *************** *** 208,212 **** } ! AIR_FREE(nrrd->content); nrrd->blockSize = 0; nrrd->oldMin = nrrd->oldMax = AIR_NAN; --- 208,212 ---- } ! nrrd->content = airFree(nrrd->content); nrrd->blockSize = 0; nrrd->oldMin = nrrd->oldMax = AIR_NAN; *************** *** 284,291 **** if (nrrd) { ! AIR_FREE(nrrd->content); /* HEY: this is a symptom of some stupidity, no? */ for (i=0; i<NRRD_DIM_MAX; i++) { ! AIR_FREE(nrrd->axis[i].label); } nrrdCommentClear(nrrd); --- 284,291 ---- if (nrrd) { ! nrrd->content = airFree(nrrd->content); /* HEY: this is a symptom of some stupidity, no? */ for (i=0; i<NRRD_DIM_MAX; i++) { ! nrrd->axis[i].label = airFree(nrrd->axis[i].label); } nrrdCommentClear(nrrd); *************** *** 293,297 **** nrrdKeyValueClear(nrrd); nrrd->kvpArr = airArrayNix(nrrd->kvpArr); ! AIR_FREE(nrrd); } return NULL; --- 293,297 ---- nrrdKeyValueClear(nrrd); nrrd->kvpArr = airArrayNix(nrrd->kvpArr); ! nrrd = airFree(nrrd); } return NULL; *************** *** 309,313 **** if (nrrd) { ! AIR_FREE(nrrd->data); nrrdInit(nrrd); } --- 309,313 ---- if (nrrd) { ! nrrd->data = airFree(nrrd->data); nrrdInit(nrrd); } *************** *** 482,486 **** /* HEY: shouldn't this be handled with nrrdPeripheralCopy() */ ! AIR_FREE(nout->content); nout->content = airStrdup(nin->content); if (nin->content && !nout->content) { --- 482,486 ---- /* HEY: shouldn't this be handled with nrrdPeripheralCopy() */ ! nout->content = airFree(nout->content); nout->content = airStrdup(nin->content); if (nin->content && !nout->content) { *************** *** 553,557 **** nrrd->type = type; ! AIR_FREE(nrrd->data); nrrd->dim = dim; if (_nrrdSizeCheck(dim, size, AIR_TRUE)) { --- 553,557 ---- nrrd->type = type; ! nrrd->data = airFree(nrrd->data); nrrd->dim = dim; if (_nrrdSizeCheck(dim, size, AIR_TRUE)) { Index: read.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/read.c,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** read.c 13 Feb 2004 03:40:58 -0000 1.87 --- read.c 13 Mar 2004 20:03:10 -0000 1.88 *************** *** 137,141 **** memset(nrrd->data, 0, needDataSize); } else { ! AIR_FREE(nrrd->data); nrrd->data = calloc(nrrdElementNumber(nrrd), nrrdElementSize(nrrd)); if (!nrrd->data) { --- 137,141 ---- memset(nrrd->data, 0, needDataSize); } else { ! nrrd->data = airFree(nrrd->data); nrrd->data = calloc(nrrdElementNumber(nrrd), nrrdElementSize(nrrd)); if (!nrrd->data) { *************** *** 312,316 **** /* free prior memory if we didn't end up using it */ if (nio->oldData != nrrd->data) { ! AIR_FREE(nio->oldData); nio->oldDataSize = 0; } --- 312,316 ---- /* free prior memory if we didn't end up using it */ if (nio->oldData != nrrd->data) { ! nio->oldData = airFree(nio->oldData); nio->oldDataSize = 0; } *************** *** 336,343 **** if (dirP) { ! AIR_FREE(*dirP); } if (baseP) { ! AIR_FREE(*baseP); } where = strrchr(name, '/'); --- 336,343 ---- if (dirP) { ! *dirP = airFree(*dirP); } if (baseP) { ! *baseP = airFree(*baseP); } where = strrchr(name, '/'); Index: reorder.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/reorder.c,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** reorder.c 7 Jan 2004 15:34:30 -0000 1.55 --- reorder.c 13 Mar 2004 20:03:10 -0000 1.56 *************** *** 435,439 **** nout->axis[axis].min = nin->axis[axis].max; nout->axis[axis].max = nin->axis[axis].min; ! AIR_FREE(perm); return 0; } --- 435,439 ---- nout->axis[axis].min = nin->axis[axis].max; nout->axis[axis].max = nin->axis[axis].min; ! perm = airFree(perm); return 0; } Index: resampleNrrd.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/resampleNrrd.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** resampleNrrd.c 7 Jan 2004 15:34:30 -0000 1.19 --- resampleNrrd.c 13 Mar 2004 20:03:10 -0000 1.20 *************** *** 673,677 **** } else { airMopSub(mop, array[pass-1], airFree); ! AIR_FREE(array[pass-1]); /* printf("%s: pass %d: freeing array[%d]\n", me, pass, pass-1); --- 673,677 ---- } else { airMopSub(mop, array[pass-1], airFree); ! array[pass-1] = airFree(array[pass-1]); /* printf("%s: pass %d: freeing array[%d]\n", me, pass, pass-1); *************** *** 770,776 **** airMopSub(mop, index, airFree); airMopSub(mop, inVec, airFree); ! AIR_FREE(weight); ! AIR_FREE(index); ! AIR_FREE(inVec); } --- 770,776 ---- airMopSub(mop, index, airFree); airMopSub(mop, inVec, airFree); ! weight = airFree(weight); ! index = airFree(index); ! inVec = airFree(inVec); } *************** *** 778,782 **** if (passes > 1) { airMopSub(mop, array[passes-1], airFree); ! AIR_FREE(array[passes-1]); /* printf("%s: now freeing array[%d]\n", me, passes-1); --- 778,782 ---- if (passes > 1) { airMopSub(mop, array[passes-1], airFree); ! array[passes-1] = airFree(array[passes-1]); /* printf("%s: now freeing array[%d]\n", me, passes-1); Index: simple.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/simple.c,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** simple.c 7 Jan 2004 15:34:30 -0000 1.59 --- simple.c 13 Mar 2004 20:03:10 -0000 1.60 *************** *** 118,122 **** biffAdd(NRRD, err); return 1; } ! AIR_FREE(nout->content); /* we are currently praying that this won't overflow the "buff" array */ --- 118,122 ---- biffAdd(NRRD, err); return 1; } ! nout->content = airFree(nout->content); /* we are currently praying that this won't overflow the "buff" array */ *************** *** 134,142 **** if (!nout->content) { sprintf(err, "%s: couln't alloc output content!", me); ! biffAdd(NRRD, err); AIR_FREE(buff); return 1; } sprintf(nout->content, "%s(%s%s%s)", func, content, airStrlen(buff) ? "," : "", buff); ! AIR_FREE(buff); return 0; } --- 134,142 ---- if (!nout->content) { sprintf(err, "%s: couln't alloc output content!", me); ! biffAdd(NRRD, err); buff = airFree(buff); return 1; } sprintf(nout->content, "%s(%s%s%s)", func, content, airStrlen(buff) ? "," : "", buff); ! buff = airFree(buff); return 0; } *************** *** 184,188 **** if (nrrdStateDisableContent) { /* we kill content always */ ! AIR_FREE(nout->content); return 0; } --- 184,188 ---- if (nrrdStateDisableContent) { /* we kill content always */ ! nout->content = airFree(nout->content); return 0; } *************** *** 190,194 **** /* there's no input content, and we're not supposed to invent any content, so after freeing nout's content we're done */ ! AIR_FREE(nout->content); return 0; } --- 190,194 ---- /* there's no input content, and we're not supposed to invent any content, so after freeing nout's content we're done */ ! nout->content = airFree(nout->content); return 0; } |
|
From: <kin...@us...> - 2004-03-13 20:12:04
|
Update of /cvsroot/teem/teem/src/unrrdu In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26582/unrrdu Modified Files: axinfo.c axinsert.c flotsam.c join.c make.c Log Message: killed off AIR_FREE and AIR_FCLOSE macros- they were just way too cute for their own good Index: axinfo.c =================================================================== RCS file: /cvsroot/teem/teem/src/unrrdu/axinfo.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** axinfo.c 7 Jan 2004 15:34:31 -0000 1.3 --- axinfo.c 13 Mar 2004 20:03:11 -0000 1.4 *************** *** 81,85 **** if (strlen(label)) { ! AIR_FREE(nout->axis[axis].label); nout->axis[axis].label = airStrdup(label); } --- 81,85 ---- if (strlen(label)) { ! nout->axis[axis].label = airFree(nout->axis[axis].label); nout->axis[axis].label = airStrdup(label); } Index: axinsert.c =================================================================== RCS file: /cvsroot/teem/teem/src/unrrdu/axinsert.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** axinsert.c 7 Jan 2004 15:34:31 -0000 1.4 --- axinsert.c 13 Mar 2004 20:03:11 -0000 1.5 *************** *** 59,63 **** } if (strlen(label)) { ! AIR_FREE(nout->axis[axis].label); nout->axis[axis].label = airStrdup(label); } --- 59,63 ---- } if (strlen(label)) { ! nout->axis[axis].label = airFree(nout->axis[axis].label); nout->axis[axis].label = airStrdup(label); } Index: flotsam.c =================================================================== RCS file: /cvsroot/teem/teem/src/unrrdu/flotsam.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** flotsam.c 7 Jan 2004 15:34:31 -0000 1.16 --- flotsam.c 13 Mar 2004 20:03:11 -0000 1.17 *************** *** 324,328 **** file = _file; if (stdin != file) { ! AIR_FCLOSE(file); } return NULL; --- 324,328 ---- file = _file; if (stdin != file) { ! file = airFclose(file); } return NULL; Index: join.c =================================================================== RCS file: /cvsroot/teem/teem/src/unrrdu/join.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** join.c 7 Jan 2004 15:34:31 -0000 1.22 --- join.c 13 Mar 2004 20:03:11 -0000 1.23 *************** *** 81,85 **** } if (strlen(label)) { ! AIR_FREE(nout->axis[axis].label); nout->axis[axis].label = airStrdup(label); } --- 81,85 ---- } if (strlen(label)) { ! nout->axis[axis].label = airFree(nout->axis[axis].label); nout->axis[axis].label = airStrdup(label); } Index: make.c =================================================================== RCS file: /cvsroot/teem/teem/src/unrrdu/make.c,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** make.c 7 Jan 2004 15:34:31 -0000 1.48 --- make.c 13 Mar 2004 20:03:11 -0000 1.49 *************** *** 58,74 **** if (nrrdLineSkip(nio)) { sprintf(err, "%s: couldn't skip lines", me); ! AIR_FCLOSE(nio->dataFile); biffMove(me, err, NRRD); return 1; } if (!nio->encoding->isCompression) { if (nrrdByteSkip(nrrd, nio)) { sprintf(err, "%s: couldn't skip bytes", me); ! AIR_FCLOSE(nio->dataFile); biffMove(me, err, NRRD); return 1; } } if (nio->encoding->read(nrrd, nio)) { sprintf(err, "%s: error reading data", me); ! AIR_FCLOSE(nio->dataFile); biffMove(me, err, NRRD); return 1; } ! AIR_FCLOSE(nio->dataFile); return 0; } --- 58,77 ---- if (nrrdLineSkip(nio)) { sprintf(err, "%s: couldn't skip lines", me); ! nio->dataFile = airFclose(nio->dataFile); ! biffMove(me, err, NRRD); return 1; } if (!nio->encoding->isCompression) { if (nrrdByteSkip(nrrd, nio)) { sprintf(err, "%s: couldn't skip bytes", me); ! nio->dataFile = airFclose(nio->dataFile); ! biffMove(me, err, NRRD); return 1; } } if (nio->encoding->read(nrrd, nio)) { sprintf(err, "%s: error reading data", me); ! nio->dataFile = airFclose(nio->dataFile); ! biffMove(me, err, NRRD); return 1; } ! nio->dataFile = airFclose(nio->dataFile); return 0; } |
|
From: <kin...@us...> - 2004-03-13 20:12:02
|
Update of /cvsroot/teem/teem/src/moss In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26582/moss Modified Files: methodsMoss.c sampler.c Log Message: killed off AIR_FREE and AIR_FCLOSE macros- they were just way too cute for their own good Index: methodsMoss.c =================================================================== RCS file: /cvsroot/teem/teem/src/moss/methodsMoss.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** methodsMoss.c 7 Jan 2004 15:34:30 -0000 1.8 --- methodsMoss.c 13 Mar 2004 20:03:10 -0000 1.9 *************** *** 75,83 **** if (smplr) { ! AIR_FREE(smplr->ivc); ! AIR_FREE(smplr->xFslw); ! AIR_FREE(smplr->yFslw); ! AIR_FREE(smplr->xIdx); ! AIR_FREE(smplr->yIdx); smplr->fdiam = 0; smplr->ncol = 0; --- 75,83 ---- if (smplr) { ! smplr->ivc = airFree(smplr->ivc); ! smplr->xFslw = airFree(smplr->xFslw); ! smplr->yFslw = airFree(smplr->yFslw); ! smplr->xIdx = airFree(smplr->xIdx); ! smplr->yIdx = airFree(smplr->yIdx); smplr->fdiam = 0; smplr->ncol = 0; *************** *** 91,95 **** if (smplr) { mossSamplerEmpty(smplr); ! AIR_FREE(smplr->bg); free(smplr); } --- 91,95 ---- if (smplr) { mossSamplerEmpty(smplr); ! smplr->bg = airFree(smplr->bg); free(smplr); } Index: sampler.c =================================================================== RCS file: /cvsroot/teem/teem/src/moss/sampler.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** sampler.c 16 Jan 2004 17:40:14 -0000 1.10 --- sampler.c 13 Mar 2004 20:03:10 -0000 1.11 *************** *** 37,41 **** smplr->flag[mossFlagImage] = AIR_TRUE; ncol = MOSS_NCOL(image); ! AIR_FREE(smplr->bg); smplr->bg = (float*)calloc(ncol, sizeof(float)); if (bg) { --- 37,41 ---- smplr->flag[mossFlagImage] = AIR_TRUE; ncol = MOSS_NCOL(image); ! smplr->bg = airFree(smplr->bg); smplr->bg = (float*)calloc(ncol, sizeof(float)); if (bg) { |
|
From: <kin...@us...> - 2004-03-13 20:12:02
|
Update of /cvsroot/teem/teem/src/ten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26582/ten Modified Files: bimod.c epireg.c tendEval.c tendEvec.c tensor.c Log Message: killed off AIR_FREE and AIR_FCLOSE macros- they were just way too cute for their own good Index: bimod.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/bimod.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** bimod.c 7 Mar 2004 00:46:42 -0000 1.7 --- bimod.c 13 Mar 2004 20:03:11 -0000 1.8 *************** *** 47,53 **** if (biparm) { ! AIR_FREE(biparm->histo); ! AIR_FREE(biparm->pp1); ! AIR_FREE(biparm->pp2); } return airFree(biparm); --- 47,53 ---- if (biparm) { ! biparm->histo = airFree(biparm->histo); ! biparm->pp1 = airFree(biparm->pp1); ! biparm->pp2 = airFree(biparm->pp2); } return airFree(biparm); Index: epireg.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/epireg.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** epireg.c 8 Mar 2004 14:41:24 -0000 1.27 --- epireg.c 13 Mar 2004 20:03:11 -0000 1.28 *************** *** 588,601 **** gB[1] - pxfr[SCALE]*gA[1], gB[2] - pxfr[SCALE]*gA[2], ! gB[0] - pxfr[SCALE]*gA[0], ! gB[1] - pxfr[SCALE]*gA[1], ! gB[2] - pxfr[SCALE]*gA[2], ! gB[0] - pxfr[SCALE]*gA[0], ! gB[1] - pxfr[SCALE]*gA[1], ! gB[2] - pxfr[SCALE]*gA[2]); ! /* ! gB[0]*gB[0] - pxfr[SCALE]*gA[0]*gA[0], ! gB[1]*gB[1] - pxfr[SCALE]*gA[1]*gA[1], ! gB[2]*gB[2] - pxfr[SCALE]*gA[2]*gA[2], gB[0]*gB[1] - pxfr[SCALE]*gA[0]*gA[1], gB[0]*gB[2] - pxfr[SCALE]*gA[0]*gA[2], --- 588,597 ---- gB[1] - pxfr[SCALE]*gA[1], gB[2] - pxfr[SCALE]*gA[2], ! gB[0]*gB[0]*gB[0] - pxfr[SCALE]*gA[0]*gA[0]*gA[0], ! gB[1]*gB[1]*gB[1] - pxfr[SCALE]*gA[1]*gA[1]*gA[1], ! gB[2]*gB[2]*gB[2] - pxfr[SCALE]*gA[2]*gA[2]*gA[2], ! gB[0]*gB[1]*gB[2] - pxfr[SCALE]*gA[0]*gA[1]*gA[2], ! 1, 1); ! /* gB[0]*gB[1] - pxfr[SCALE]*gA[0]*gA[1], gB[0]*gB[2] - pxfr[SCALE]*gA[0]*gA[2], *************** *** 624,630 **** } } - - /* ------ find Hx, Hy, Hz per slice */ vec = (double *)(nvec->data); for (z=0; z<sz; z++) { if (nrrdHasNonExist(nmat[z])) { --- 620,626 ---- } } vec = (double *)(nvec->data); + + /* ------ find Sx, Sy, Sz per slice */ for (z=0; z<sz; z++) { if (nrrdHasNonExist(nmat[z])) { *************** *** 638,647 **** if (A == B) continue; pxfr = (double *)(npxfr->data) + 0 + 5*(z + sz*(A + ninLen*B)); ! vec[ri] = pxfr[SHEAR]; ri += 1; } } if (ell_Nm_mul(nans, ninv[z], nvec)) { ! sprintf(err, "%s: trouble estimating model (slice %d): Hx, Hy, Hz", me, z); biffMove(TEN, err, ELL); airMopError(mop); return 1; --- 634,643 ---- if (A == B) continue; pxfr = (double *)(npxfr->data) + 0 + 5*(z + sz*(A + ninLen*B)); ! vec[ri] = pxfr[SCALE] - 1; ri += 1; } } if (ell_Nm_mul(nans, ninv[z], nvec)) { ! sprintf(err, "%s: trouble estimating model (slice %d): Sx, Sy, Sz", me, z); biffMove(TEN, err, ELL); airMopError(mop); return 1; *************** *** 649,659 **** ans = (double *)(nans->data); if (1 == order) { ! ELL_3V_COPY(hst + 0*3, ans); } else { ! ELL_9V_COPY(hst + 0*9, ans); } } ! /* ------ find Sx, Sy, Sz per slice */ for (z=0; z<sz; z++) { if (nrrdHasNonExist(nmat[z])) { --- 645,655 ---- ans = (double *)(nans->data); if (1 == order) { ! ELL_3V_COPY(hst + 1*3, ans); } else { ! ELL_9V_COPY(hst + 1*9, ans); } } ! /* ------ find Hx, Hy, Hz per slice */ for (z=0; z<sz; z++) { if (nrrdHasNonExist(nmat[z])) { *************** *** 667,676 **** if (A == B) continue; pxfr = (double *)(npxfr->data) + 0 + 5*(z + sz*(A + ninLen*B)); ! vec[ri] = pxfr[SCALE] - 1; ri += 1; } } if (ell_Nm_mul(nans, ninv[z], nvec)) { ! sprintf(err, "%s: trouble estimating model (slice %d): Sx, Sy, Sz", me, z); biffMove(TEN, err, ELL); airMopError(mop); return 1; --- 663,672 ---- if (A == B) continue; pxfr = (double *)(npxfr->data) + 0 + 5*(z + sz*(A + ninLen*B)); ! vec[ri] = pxfr[SHEAR]; ri += 1; } } if (ell_Nm_mul(nans, ninv[z], nvec)) { ! sprintf(err, "%s: trouble estimating model (slice %d): Hx, Hy, Hz", me, z); biffMove(TEN, err, ELL); airMopError(mop); return 1; *************** *** 678,684 **** ans = (double *)(nans->data); if (1 == order) { ! ELL_3V_COPY(hst + 1*3, ans); } else { ! ELL_9V_COPY(hst + 1*9, ans); } } --- 674,680 ---- ans = (double *)(nans->data); if (1 == order) { ! ELL_3V_COPY(hst + 0*3, ans); } else { ! ELL_9V_COPY(hst + 0*9, ans); } } *************** *** 829,833 **** int reference, int ni, int zi, Nrrd *npxfr, Nrrd *nhst, Nrrd *ngrad) { ! double *xfr, *hst, *_grad, grad[9]; /* big enough for 2nd order */ int sz, ninLen; --- 825,829 ---- int reference, int ni, int zi, Nrrd *npxfr, Nrrd *nhst, Nrrd *ngrad) { ! double *xfr, *hst, *_g, grad[9]; /* big enough for 2nd order */ int sz, ninLen; *************** *** 843,860 **** /* we use the estimated H,S,T vectors to determine distortion as a function of gradient direction, and then invert this */ ! _grad = (double*)(ngrad->data) + 0 + 3*ni; if (1 == order) { hst = (double*)(nhst->data) + 0 + 9*zi; ! *hhP = ELL_3V_DOT(_grad, hst + 0*3); ! *ssP = 1 + ELL_3V_DOT(_grad, hst + 1*3); ! *ttP = ELL_3V_DOT(_grad, hst + 2*3); } else { hst = (double*)(nhst->data) + 0 + 27*zi; ! ELL_9V_SET(grad, _grad[0], _grad[1], _grad[2], ! _grad[0], _grad[1], _grad[2], ! _grad[0], _grad[1], _grad[2]); /* ! _grad[0]*_grad[0], _grad[1]*_grad[1], _grad[2]*_grad[2], ! _grad[0]*_grad[1], _grad[0]*_grad[2], _grad[1]*_grad[2]); */ *hhP = ELL_9V_DOT(grad, hst + 0*9); --- 839,856 ---- /* we use the estimated H,S,T vectors to determine distortion as a function of gradient direction, and then invert this */ ! _g = (double*)(ngrad->data) + 0 + 3*ni; if (1 == order) { hst = (double*)(nhst->data) + 0 + 9*zi; ! *hhP = ELL_3V_DOT(_g, hst + 0*3); ! *ssP = 1 + ELL_3V_DOT(_g, hst + 1*3); ! *ttP = ELL_3V_DOT(_g, hst + 2*3); } else { hst = (double*)(nhst->data) + 0 + 27*zi; ! ELL_9V_SET(grad, _g[0], _g[1], _g[2], ! _g[0]*_g[0]*_g[0], _g[1]*_g[1]*_g[1], _g[2]*_g[2]*_g[2], ! _g[0]*_g[1]*_g[2], ! 0, 0); /* ! _g[0]*_g[1], _g[0]*_g[2], _g[1]*_g[2]); */ *hhP = ELL_9V_DOT(grad, hst + 0*9); Index: tendEval.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/tendEval.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tendEval.c 7 Jan 2004 15:34:31 -0000 1.14 --- tendEval.c 13 Mar 2004 20:03:11 -0000 1.15 *************** *** 113,117 **** } if (1 != compLen) { ! AIR_FREE(nout->axis[0].label); } --- 113,117 ---- } if (1 != compLen) { ! nout->axis[0].label = airFree(nout->axis[0].label); } Index: tendEvec.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/tendEvec.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tendEvec.c 7 Jan 2004 15:34:31 -0000 1.15 --- tendEvec.c 13 Mar 2004 20:03:11 -0000 1.16 *************** *** 110,114 **** airMopError(mop); return 1; } ! AIR_FREE(nout->axis[0].label); if (nrrdSave(outS, nout, NULL)) { --- 110,114 ---- airMopError(mop); return 1; } ! nout->axis[0].label = airFree(nout->axis[0].label); if (nrrdSave(outS, nout, NULL)) { Index: tensor.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/tensor.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tensor.c 1 Mar 2004 21:59:03 -0000 1.28 --- tensor.c 13 Mar 2004 20:03:11 -0000 1.29 *************** *** 110,114 **** biffMove(TEN, err, NRRD); return 1; } ! AIR_FREE(nout->axis[0].label); nout->axis[0].label = airStrdup("matrix"); --- 110,114 ---- biffMove(TEN, err, NRRD); return 1; } ! nout->axis[0].label = airFree(nout->axis[0].label); nout->axis[0].label = airStrdup("matrix"); *************** *** 172,176 **** biffMove(TEN, err, NRRD); return 1; } ! AIR_FREE(tseven->axis[0].label); tseven->axis[0].label = airStrdup("tensor"); --- 172,176 ---- biffMove(TEN, err, NRRD); return 1; } ! tseven->axis[0].label = airFree(tseven->axis[0].label); tseven->axis[0].label = airStrdup("tensor"); *************** *** 389,393 **** biffMove(TEN, err, NRRD); return 1; } ! AIR_FREE(nout->axis[0].label); nout->axis[0].label = airStrdup("tensor"); --- 389,393 ---- biffMove(TEN, err, NRRD); return 1; } ! nout->axis[0].label = airFree(nout->axis[0].label); nout->axis[0].label = airStrdup("tensor"); |
|
From: <kin...@us...> - 2004-03-13 20:12:02
|
Update of /cvsroot/teem/teem/src/limn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26582/limn Modified Files: splineMethods.c Log Message: killed off AIR_FREE and AIR_FCLOSE macros- they were just way too cute for their own good Index: splineMethods.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/splineMethods.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** splineMethods.c 7 Jan 2004 15:34:30 -0000 1.4 --- splineMethods.c 13 Mar 2004 20:03:10 -0000 1.5 *************** *** 214,219 **** if (spline) { spline->ncpt = nrrdNuke(spline->ncpt); ! AIR_FREE(spline->time); ! AIR_FREE(spline); } return NULL; --- 214,219 ---- if (spline) { spline->ncpt = nrrdNuke(spline->ncpt); ! spline->time = airFree(spline->time); ! spline = airFree(spline); } return NULL; |