|
From: Gordon K. <kin...@us...> - 2004-03-30 03:36:53
|
Update of /cvsroot/teem/teem/src/ten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26127 Modified Files: aniso.c enumsTen.c ten.h tendAnplot.c Log Message: changed/added some anisotropy metrics, nothing that any current users will notice Index: aniso.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/aniso.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** aniso.c 23 Feb 2004 02:40:18 -0000 1.26 --- aniso.c 30 Mar 2004 03:25:20 -0000 1.27 *************** *** 92,102 **** B = e0*e1 + e0*e2 + e1*e2; C = -e0*e1*e2; ! /* this is 9*Q, where 2*sqrt(Q) is the actual root radius */ ! c[tenAniso_Q] = A*A - 3*B; ! Q = c[tenAniso_Q]/9.0; ! c[tenAniso_R] = 2*A*A*A - 9*A*B + 27*C; ! R = c[tenAniso_R]/54.0; ! c[tenAniso_S] = sqrt(Q*Q*Q - R*R); ! c[tenAniso_Th] = R/sqrt(Q*Q*Q); c[tenAniso_Cz] = ((e0 + e1)/(tenAnisoSigma + e2) + (e1 + e2)/(tenAnisoSigma + e0) --- 92,100 ---- B = e0*e1 + e0*e2 + e1*e2; C = -e0*e1*e2; ! Q = c[tenAniso_Q] = (A*A - 3*B)/9; ! R = c[tenAniso_R] = (2*A*A*A - 9*A*B + 27*C)/54; ! c[tenAniso_S] = e0*e0 + e1*e1 + e2*e2; ! c[tenAniso_Skew] = R/sqrt(tenAnisoSigma + 2*Q*Q*Q); ! c[tenAniso_Th] = acos(sqrt(2)*c[tenAniso_Skew])/3; c[tenAniso_Cz] = ((e0 + e1)/(tenAnisoSigma + e2) + (e1 + e2)/(tenAnisoSigma + e0) *************** *** 108,112 **** int ! tenAnisoPlot(Nrrd *nout, int aniso, int res, int whole) { char me[]="tenAnisoMap", err[AIR_STRLEN_MED]; float *out, c[TEN_ANISO_MAX+1], tmp; --- 106,110 ---- int ! tenAnisoPlot(Nrrd *nout, int aniso, int res, int whole, int nanout) { char me[]="tenAnisoMap", err[AIR_STRLEN_MED]; float *out, c[TEN_ANISO_MAX+1], tmp; *************** *** 152,155 **** --- 150,158 ---- out[x + res*y] = c[aniso]; } + if (nanout) { + for (x=y+1; x<res; x++) { + out[x + res*y] = AIR_NAN; + } + } } Index: enumsTen.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/enumsTen.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** enumsTen.c 23 Feb 2004 06:03:13 -0000 1.17 --- enumsTen.c 30 Mar 2004 03:25:20 -0000 1.18 *************** *** 42,45 **** --- 42,46 ---- "R", "S", + "Skew", "Th", "Cz", Index: ten.h =================================================================== RCS file: /cvsroot/teem/teem/src/ten/ten.h,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** ten.h 7 Mar 2004 00:48:13 -0000 1.79 --- ten.h 30 Mar 2004 03:25:20 -0000 1.80 *************** *** 56,70 **** tenAniso_FA, /* 12: (Bass+Pier's fractional anisotropy)/sqrt(2) */ tenAniso_VF, /* 13: volume fraction = 1-(Bass+Pier's volume ratio) */ ! tenAniso_Q, /* 14: radius of root circle is 2*sqrt(Q/9) ! (this is 9 times proper Q in cubic solution) */ ! tenAniso_R, /* 15: phase of root circle is acos(R/Q^3) */ ! tenAniso_S, /* 16: sqrt(Q^3 - R^2) */ ! tenAniso_Th, /* 17: R/Q^3 */ ! tenAniso_Cz, /* 18: Zhukov's invariant-based anisotropy metric */ ! tenAniso_Det, /* 19: plain old determinant */ ! tenAniso_Tr, /* 20: plain old trace */ tenAnisoLast }; ! #define TEN_ANISO_MAX 20 /* --- 56,70 ---- tenAniso_FA, /* 12: (Bass+Pier's fractional anisotropy)/sqrt(2) */ tenAniso_VF, /* 13: volume fraction = 1-(Bass+Pier's volume ratio) */ ! tenAniso_Q, /* 14: radius of root circle is 2*sqrt(Q) */ ! tenAniso_R, /* 15: half of third moment of eigenvalues */ ! tenAniso_S, /* 16: frobenius norm, squared */ ! tenAniso_Skew, /* 17: R/sqrt(2*Q^3) */ ! tenAniso_Th, /* 18: acos(sqrt(2)*skew)/3 */ ! tenAniso_Cz, /* 19: Zhukov's invariant-based anisotropy metric */ ! tenAniso_Det, /* 20: plain old determinant */ ! tenAniso_Tr, /* 21: plain old trace */ tenAnisoLast }; ! #define TEN_ANISO_MAX 21 /* *************** *** 459,463 **** TEEM_API float tenAnisoSigma; /* added to denominator in Westin anisos */ TEEM_API void tenAnisoCalc(float c[TEN_ANISO_MAX+1], float eval[3]); ! TEEM_API int tenAnisoPlot(Nrrd *nout, int aniso, int res, int whole); TEEM_API int tenAnisoVolume(Nrrd *nout, Nrrd *nin, int aniso, float thresh); TEEM_API int tenAnisoHistogram(Nrrd *nout, Nrrd *nin, --- 459,464 ---- TEEM_API float tenAnisoSigma; /* added to denominator in Westin anisos */ TEEM_API void tenAnisoCalc(float c[TEN_ANISO_MAX+1], float eval[3]); ! TEEM_API int tenAnisoPlot(Nrrd *nout, int aniso, int res, ! int whole, int nanout); TEEM_API int tenAnisoVolume(Nrrd *nout, Nrrd *nin, int aniso, float thresh); TEEM_API int tenAnisoHistogram(Nrrd *nout, Nrrd *nin, Index: tendAnplot.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/tendAnplot.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tendAnplot.c 7 Jan 2004 15:34:31 -0000 1.9 --- tendAnplot.c 30 Mar 2004 03:25:20 -0000 1.10 *************** *** 35,39 **** airArray *mop; ! int res, aniso, whole; Nrrd *nout; char *outS; --- 35,39 ---- airArray *mop; ! int res, aniso, whole, nanout; Nrrd *nout; char *outS; *************** *** 46,49 **** --- 46,52 ---- "sixth of it in which the eigenvalues have the " "traditional sorted order. "); + hestOptAdd(&hopt, "nan", NULL, airTypeInt, 0, 0, &nanout, NULL, + "set the pixel values outside the triangle to be NaN, " + "instead of 0"); hestOptAdd(&hopt, "a", "aniso", airTypeEnum, 1, 1, &aniso, NULL, "Which anisotropy metric to plot. " TEN_ANISO_DESC, *************** *** 60,64 **** nout = nrrdNew(); airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopAlways); ! if (tenAnisoPlot(nout, aniso, res, whole)) { airMopAdd(mop, err=biffGetDone(TEN), airFree, airMopAlways); fprintf(stderr, "%s: trouble making plot:\n%s\n", me, err); --- 63,67 ---- nout = nrrdNew(); airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopAlways); ! if (tenAnisoPlot(nout, aniso, res, whole, nanout)) { airMopAdd(mop, err=biffGetDone(TEN), airFree, airMopAlways); fprintf(stderr, "%s: trouble making plot:\n%s\n", me, err); |