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-04-01 19:41:35
|
Update of /cvsroot/teem/teem/src/nrrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22810 Modified Files: axis.c enumsNrrd.c nrrdEnums.h Log Message: fixed nrrdKind list to handle all 8 kinds of 2D and 3D tensors Index: axis.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/axis.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** axis.c 30 Mar 2004 19:25:09 -0000 1.7 --- axis.c 1 Apr 2004 19:29:34 -0000 1.8 *************** *** 91,94 **** --- 91,95 ---- break; case nrrdKindComplex: + case nrrdKind2Vector: ret = 2; break; *************** *** 102,115 **** ret = 4; break; ! case nrrdKind6Tensor: ret = 6; break; ! case nrrdKind7Tensor: ret = 7; break; ! case nrrdKind9Tensor: ! case nrrdKind9Matrix: ret = 9; break; default: fprintf(stderr, "%s: PANIC: nrrdKind %d not implemented!\n", me, kind); --- 103,130 ---- ret = 4; break; ! case nrrdKind2DSymTensor: ! ret = 3; ! break; ! case nrrdKind2DMaskedSymTensor: ! ret = 4; ! break; ! case nrrdKind2DTensor: ! ret = 4; ! break; ! case nrrdKind2DMaskedTensor: ! ret = 5; ! break; ! case nrrdKind3DSymTensor: ret = 6; break; ! case nrrdKind3DMaskedSymTensor: ret = 7; break; ! case nrrdKind3DTensor: ret = 9; break; + case nrrdKind3DMaskedTensor: + ret = 10; + break; default: fprintf(stderr, "%s: PANIC: nrrdKind %d not implemented!\n", me, kind); Index: nrrdEnums.h =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/nrrdEnums.h,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** nrrdEnums.h 31 Mar 2004 17:56:48 -0000 1.44 --- nrrdEnums.h 1 Apr 2004 19:29:35 -0000 1.45 *************** *** 183,204 **** enum { nrrdKindUnknown, ! nrrdKindDomain, /* 1: "It makes sense to resample along here" */ ! nrrdKindList, /* 2: "It makes NO sense to resample along here" */ ! nrrdKindStub, /* 3: axis with one sample */ ! nrrdKindScalar, /* 4: same as a stub */ ! nrrdKindComplex, /* 5: real and imaginary components of a number */ ! nrrdKind3Color, /* 6: ANY 3-component color value */ ! nrrdKind4Color, /* 7: ANY 4-component color value */ ! nrrdKind3Vector, /* 8: any 3-vector */ ! nrrdKind3Normal, /* 9: 3-vectors which are assumed normalized */ ! nrrdKind4Vector, /* 10: any 4-vector */ ! nrrdKind6Tensor, /* 11: the 6 unique elements of a symmetric 3x3 tensor */ ! nrrdKind7Tensor, /* 12: some scalar "confidence" or "valid" value, and ! the 6 unique elements of a symmetric 3x3 tensor */ ! nrrdKind9Tensor, /* 13: all 9 elements of a 3x3 tensor */ ! nrrdKind9Matrix, /* 14: all 9 elements of a 3x3 matrix */ nrrdKindLast }; ! #define NRRD_KIND_MAX 14 /* --- 183,208 ---- enum { nrrdKindUnknown, ! nrrdKindDomain, /* 1: "Yes, you can resample me" */ ! nrrdKindList, /* 2: "No, it is goofy to resample me" */ ! nrrdKindStub, /* 3: axis with one sample (a placeholder) */ ! nrrdKindScalar, /* 4: effectively, same as a stub */ ! nrrdKindComplex, /* 5: real and imaginary components */ ! nrrdKind2Vector, /* 6: 2 component vector */ ! nrrdKind3Color, /* 7: ANY 3-component color value */ ! nrrdKind4Color, /* 8: ANY 4-component color value */ ! nrrdKind3Vector, /* 9: 3 component vector */ ! nrrdKind3Normal, /* 10: 3 component vector, assumed normalized */ ! nrrdKind4Vector, /* 11: 4 component vector */ ! nrrdKind2DSymTensor, /* 12: Txx Txy Tyy */ ! nrrdKind2DMaskedSymTensor, /* 13: mask Txx Txy Tyy */ ! nrrdKind2DTensor, /* 14: Txx Txy Tyx Tyy */ ! nrrdKind2DMaskedTensor, /* 15: mask Txx Txy Tyx Tyy */ ! nrrdKind3DSymTensor, /* 16: Txx Txy Txz Tyy Tyz Tzz */ ! nrrdKind3DMaskedSymTensor, /* 17: mask Txx Txy Txz Tyy Tyz Tzz */ ! nrrdKind3DTensor, /* 18: Txx Txy Txz Tyx Tyy Tyz Tzx Tzy Tzz */ ! nrrdKind3DMaskedTensor, /* 19: mask Txx Txy Txz Tyx Tyy Tyz Tzx Tzy Tzz */ nrrdKindLast }; ! #define NRRD_KIND_MAX 19 /* Index: enumsNrrd.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/enumsNrrd.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** enumsNrrd.c 30 Mar 2004 19:25:09 -0000 1.32 --- enumsNrrd.c 1 Apr 2004 19:29:34 -0000 1.33 *************** *** 272,275 **** --- 272,296 ---- /* ------------------------ nrrdKind ------------------------- */ + /* + nrrdKindDomain, 1: "Yes, you can resample me" + nrrdKindList, 2: "No, it is goofy to resample me" + nrrdKindStub, 3: axis with one sample (a placeholder) + nrrdKindScalar, 4: effectively, same as a stub + nrrdKindComplex, 5: real and imaginary components + nrrdKind2Vector, 6: 2 component vector + nrrdKind3Color, 7: ANY 3-component color value + nrrdKind4Color, 8: ANY 4-component color value + nrrdKind3Vector, 9: 3 component vector + nrrdKind3Normal, 10: 3 component vector, assumed normalized + nrrdKind4Vector, 11: 4 component vector + nrrdKind2DSymTensor, 12: Txx Txy Tyy + nrrdKind2DMaskedSymTensor, 13: mask Txx Txy Tyy + nrrdKind2DTensor, 14: Txx Txy Tyx Tyy + nrrdKind2DMaskedTensor, 15: mask Txx Txy Tyx Tyy + nrrdKind3DSymTensor, 16: Txx Txy Txz Tyy Tyz Tzz + nrrdKind3DMaskedSymTensor, 17: mask Txx Txy Txz Tyy Tyz Tzz + nrrdKind3DTensor, 18: Txx Txy Txz Tyx Tyy Tyz Tzx Tzy Tzz + nrrdKind3DMaskedTensor, 19: mask Txx Txy Txz Tyx Tyy Tyz Tzx Tzy Tzz + */ char *************** *** 281,292 **** "scalar", "complex", "3-color", "4-color", "3-vector", "3-normal", ! "6-tensor", ! "7-tensor", ! "9-tensor", ! "9-matrix" }; --- 302,319 ---- "scalar", "complex", + "2-vector", "3-color", "4-color", "3-vector", "3-normal", ! "4-vector", ! "2D-symmetric-tensor", ! "2D-masked-symmetric-tensor", ! "2D-tensor", ! "2D-masked-tensor", ! "3D-symmetric-tensor", ! "3D-masked-symmetric-tensor", ! "3D-tensor", ! "3D-masked-tensor" }; *************** *** 295,311 **** "unknown kind", "a domain variable of the function which the nrrd samples", ! "a list of attributes; it makes no sense to resample along these", "a place-holder axis with a single sample", "axis used to indicate that the nrrd contains a scalar value", "real and imaginary parts of a value", "any 3-component color value", "any 4-component color value", ! "any 3-element vector", "a 3-element vector which is assumed normalized", ! "any 4-element vector", ! "6 unique elements of a symmetric tensor", ! "\"confidence\" plus 6 unique elements of a symmetric tensor", ! "9 elements of a 3x3 tensor", ! "9 elements of a 3x3 matrix" }; --- 322,343 ---- "unknown kind", "a domain variable of the function which the nrrd samples", ! "some list of attributes; it makes no sense to resample along these", "a place-holder axis with a single sample", "axis used to indicate that the nrrd contains a scalar value", "real and imaginary parts of a value", + "a 2-component vector", "any 3-component color value", "any 4-component color value", ! "a 3-element vector", "a 3-element vector which is assumed normalized", ! "a 4-element vector", ! "3 elements of 2D symmetric tensor: Txx Txy Tyy", ! "mask plus 3 elements of 2D symmetric tensor: mask Txx Txy Tyy", ! "4 elements of general 2D tensor: Txx Txy Tyx Tyy", ! "mask plus 4 elements of general 2D tensor: mask Txx Txy Tyx Tyy", ! "6 elements of 3D symmetric tensor: Txx Txy Txz Tyy Tyz Tzz", ! "mask plus 6 elements of 3D symmetric tensor: mask Txx Txy Txz Tyy Tyz Tzz", ! "9 elements of general 3D tensor: Txx Txy Txz Tyx Tyy Tyz Tzx Tzy Tzz", ! "mask plus 9 elements of general 3D tensor: mask Txx Txy Txz Tyx Tyy Tyz Tzx Tzy Tzz" }; *************** *** 317,328 **** "scalar", "complex", "3-color", "3color", "4-color", "4color", "3-vector", "3vector", "3-normal", "3normal", ! "6-tensor", "6tensor", ! "7-tensor", "7tensor", ! "9-tensor", "9tensor", ! "9-matrix", "9matrix", "" }; --- 349,366 ---- "scalar", "complex", + "2-vector", "2vector", "3-color", "3color", "4-color", "4color", "3-vector", "3vector", "3-normal", "3normal", ! "4-vector", "4vector", ! "2D-sym-tensor", "2Dsymtensor", ! "2D-mask-sym-tensor", "2Dmasksymtensor", ! "2D-tensor", "2Dtensor", ! "2D-mask-tensor", "2Dmasktensor", ! "3D-sym-tensor", "3Dsymtensor", ! "3D-mask-sym-tensor", "3Dmasksymtensor", ! "3D-tensor", "3Dtensor", ! "3D-mask-tensor", "3Dmasktensor", "" }; *************** *** 335,346 **** nrrdKindScalar, nrrdKindComplex, nrrdKind3Color, nrrdKind3Color, nrrdKind4Color, nrrdKind4Color, nrrdKind3Vector, nrrdKind3Vector, nrrdKind3Normal, nrrdKind3Normal, ! nrrdKind6Tensor, nrrdKind6Tensor, ! nrrdKind7Tensor, nrrdKind7Tensor, ! nrrdKind9Tensor, nrrdKind9Tensor, ! nrrdKind9Matrix, nrrdKind9Matrix }; --- 373,390 ---- nrrdKindScalar, nrrdKindComplex, + nrrdKind2Vector, nrrdKind3Color, nrrdKind3Color, nrrdKind4Color, nrrdKind4Color, nrrdKind3Vector, nrrdKind3Vector, nrrdKind3Normal, nrrdKind3Normal, ! nrrdKind4Vector, nrrdKind4Vector, ! nrrdKind2DSymTensor, nrrdKind2DSymTensor, ! nrrdKind2DMaskedSymTensor, nrrdKind2DMaskedSymTensor, ! nrrdKind2DTensor, nrrdKind2DTensor, ! nrrdKind2DMaskedTensor, nrrdKind2DMaskedTensor, ! nrrdKind3DSymTensor, nrrdKind3DSymTensor, ! nrrdKind3DMaskedSymTensor, nrrdKind3DMaskedSymTensor, ! nrrdKind3DTensor, nrrdKind3DTensor, ! nrrdKind3DMaskedTensor, nrrdKind3DMaskedTensor }; |
|
From: Gordon K. <kin...@us...> - 2004-04-01 18:42:40
|
Update of /cvsroot/teem/teem/src/hest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10671 Modified Files: hest.h parseHest.c Log Message: added more error checking to _hestPanic Index: parseHest.c =================================================================== RCS file: /cvsroot/teem/teem/src/hest/parseHest.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** parseHest.c 13 Mar 2004 20:03:09 -0000 1.14 --- parseHest.c 1 Apr 2004 18:30:40 -0000 1.15 *************** *** 172,175 **** --- 172,182 ---- return 1; } + if (!( opt[op].valueP )) { + if (err) + sprintf(err, "%s!!!!!! opt[%d]'s valueP is NULL!", ME, op); + else + fprintf(stderr, "%s: panic 0.5\n", me); + return 1; + } if (-1 == opt[op].kind) { if (err) Index: hest.h =================================================================== RCS file: /cvsroot/teem/teem/src/hest/hest.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** hest.h 19 Feb 2004 03:44:07 -0000 1.36 --- hest.h 1 Apr 2004 18:30:40 -0000 1.37 *************** *** 184,188 **** char **errP, hestParm *parm); TEEM_API void *hestParseFree(hestOpt *opt); ! TEEM_API void hestParseOrDie(hestOpt *opt, int argc, char **argv, hestParm *parm, char *me, char *info, int doInfo, int doUsage, int doGlossary); --- 184,189 ---- char **errP, hestParm *parm); TEEM_API void *hestParseFree(hestOpt *opt); ! TEEM_API void hestParseOrDie(hestOpt *opt, int argc, char **argv, ! hestParm *parm, char *me, char *info, int doInfo, int doUsage, int doGlossary); |
|
From: Gordon K. <kin...@us...> - 2004-04-01 16:01:39
|
Update of /cvsroot/teem/teem/src/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12117 Modified Files: nrrdSanity.c Log Message: added output of available formats Index: nrrdSanity.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/nrrdSanity.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** nrrdSanity.c 7 Jan 2004 15:34:28 -0000 1.7 --- nrrdSanity.c 1 Apr 2004 15:49:40 -0000 1.8 *************** *** 25,29 **** main(int argc, char *argv[]) { char *me, *err; ! int enc; me = argv[0]; --- 25,29 ---- main(int argc, char *argv[]) { char *me, *err; ! int enc, form; me = argv[0]; *************** *** 41,44 **** --- 41,49 ---- nrrdEncodingArray[enc]->available() ? "yes" : "not available"); } + printf("%s: formats supported in this build:\n", me); + for (form=nrrdFormatTypeUnknown+1; form<nrrdFormatTypeLast; form++) { + printf("%s: %s\n", airEnumStr(nrrdFormatType, form), + nrrdFormatArray[form]->available() ? "yes" : "not available"); + } } |
|
From: Gordon K. <kin...@us...> - 2004-04-01 15:14:46
|
Update of /cvsroot/teem/teem/src/ell In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1306 Modified Files: cubicEll.c eigen.c Log Message: based on recent observations, the task of sorting the cubic roots has been seen to be pretty trivial, so now the sorting is done in ell_cubic Index: cubicEll.c =================================================================== RCS file: /cvsroot/teem/teem/src/ell/cubicEll.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** cubicEll.c 25 Mar 2004 03:12:52 -0000 1.8 --- cubicEll.c 1 Apr 2004 15:02:47 -0000 1.9 *************** *** 35,41 **** ** ellCubicRootTriple: root[0] == root[1] == root[2] ** ellCubicRootSingleDouble: single root[0]; double root[1] == root[2] ** ellCubicRootThree: root[0], root[1], root[2] ** ! ** The values stored in root[] are NOT SORTED in anyway. ** ** This does NOT use biff --- 35,43 ---- ** ellCubicRootTriple: root[0] == root[1] == root[2] ** ellCubicRootSingleDouble: single root[0]; double root[1] == root[2] + ** or double root[0] == root[1], single root[2] ** ellCubicRootThree: root[0], root[1], root[2] ** ! ** The values stored in root[] are, in a change from the past, sorted ! ** in descending order! No need to sort them any more! ** ** This does NOT use biff *************** *** 58,64 **** 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])) { --- 60,68 ---- theta = acos(R/sqrt(QQQ))/3.0; t = 2*sqrt(Q); + /* yes, these are sorted, because the C definition of acos says + that it returns values in in [0, pi] */ 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])) { *************** *** 107,113 **** fprintf(stderr, "%s: rescued double root:% 20.15f\n", me, nr); } ! root[0] = x; ! root[1] = nr; ! root[2] = nr; return ell_cubic_root_single_double; } --- 111,123 ---- fprintf(stderr, "%s: rescued double root:% 20.15f\n", me, nr); } ! if (x > nr) { ! root[0] = x; ! root[1] = nr; ! root[2] = nr; ! } else { ! root[0] = nr; ! root[1] = nr; ! root[2] = x; ! } return ell_cubic_root_single_double; } *************** *** 118,124 **** /* one double root and one single root */ u = airCbrt(R); ! root[0] = 2*u - sub; ! root[1] = -u - sub; ! root[2] = -u - sub; return ell_cubic_root_single_double; } --- 128,140 ---- /* one double root and one single root */ u = airCbrt(R); ! if (u > 0) { ! root[0] = 2*u - sub; ! root[1] = -u - sub; ! root[2] = -u - sub; ! } else { ! root[0] = -u - sub; ! root[1] = -u - sub; ! root[2] = 2*u - sub; ! } return ell_cubic_root_single_double; } *************** *** 136,141 **** - - - - --- 152,153 ---- Index: eigen.c =================================================================== RCS file: /cvsroot/teem/teem/src/ell/eigen.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** eigen.c 1 Mar 2004 21:58:55 -0000 1.19 --- eigen.c 1 Apr 2004 15:02:47 -0000 1.20 *************** *** 194,201 **** + (m[3]*m[1] - m[0]*m[4])*m[8]; roots = ell_cubic(eval, A, B, C, newton); ! if (ell_cubic_root_three == roots ! || ell_cubic_root_single_double == roots) { ! ELL_SORT3(eval[0], eval[1], eval[2], tmp); ! } ELL_3V_SCALE(_eval, 1.0/scale, eval); return roots; --- 194,198 ---- + (m[3]*m[1] - m[0]*m[4])*m[8]; roots = ell_cubic(eval, A, B, C, newton); ! /* no longer need to sort here */ ELL_3V_SCALE(_eval, 1.0/scale, eval); return roots; *************** *** 245,249 **** switch (roots) { case ell_cubic_root_three: - ELL_SORT3(e0, e1, e2, t); /* if (ell_debug) { printf("ell_3m_eigensolve: evals: %20.15f %20.15f %20.15f\n", --- 242,245 ---- |
|
From: Gordon K. <kin...@us...> - 2004-04-01 07:19:31
|
Update of /cvsroot/teem/teem/src/gage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7913 Modified Files: gage.h miscGage.c vecGage.c Log Message: passing vecGage baton to xavier Index: gage.h =================================================================== RCS file: /cvsroot/teem/teem/src/gage/gage.h,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** gage.h 28 Feb 2004 17:01:53 -0000 1.62 --- gage.h 1 Apr 2004 07:07:35 -0000 1.63 *************** *** 274,278 **** ** ** The strings gives one of the gageVec airEnum identifiers, and GT[x] ! ** says how many scalars are associated with this scalar. */ enum { --- 274,278 ---- ** ** The strings gives one of the gageVec airEnum identifiers, and GT[x] ! ** says how many scalars are associated with this value. */ enum { *************** *** 287,300 **** gageVecDivergence, /* 4: "d", divergence (based on Jacobian): GT[1] */ gageVecCurl, /* 5: "c", curl (based on Jacobian): GT[3] */ ! gageVecGradient0, /* 6: "g0", gradient of 1st component of vector: GT[3] */ ! gageVecGradient1, /* 7: "g1", gradient of 2nd component of vector: GT[3] */ ! gageVecGradient2, /* 8: "g2", gradient of 3rd component of vector: GT[3] */ ! gageVecMultiGrad, /* 9: "mg", sum of outer products of gradients: GT[9] */ ! gageVecMGFrob, /* 10: "mgfrob", frob norm of multi-gradient: GT[1] */ ! gageVecMGEval, /* 11: "mgeval", eigenvalues of multi-gradient: GT[3] */ ! gageVecMGEvec, /* 12: "mgevec", eigenvectors of multi-gradient: GT[9] */ gageVecLast }; ! #define GAGE_VEC_ITEM_MAX 12 struct gageKind_t; /* dumb forward declaraction, ignore */ --- 287,308 ---- gageVecDivergence, /* 4: "d", divergence (based on Jacobian): GT[1] */ gageVecCurl, /* 5: "c", curl (based on Jacobian): GT[3] */ ! gageVecHelicity, /* 6: "h", helicity: vec . curl: GT[1] */ ! gageVecNormHelicity,/* 7: "nh", normalized helicity: GT[1] */ ! gageVecLambda2, /* 8: "lmabda2", lambda2 criterion: GT[1] */ ! gageVecHessian, /* 9: "vh", second-order derivative: GT[27] */ ! gageVecCurlGradient,/*10: "cg", curl gradient: GT[9] */ ! gageVecHelGradient,/* 11: "hg", helicity gradient: GT[3] */ ! gageVecDirHelDeriv,/* 12: "dhd", directional derivative of helicity: GT[1] */ ! gageVecProjHelGradient,/* 13: "phg", projected helicity gradient: GT[3] */ ! gageVecGradient0, /* 14: "g0", gradient of 1st component of vector: GT[3] */ ! gageVecGradient1, /* 15: "g1", gradient of 2nd component of vector: GT[3] */ ! gageVecGradient2, /* 16: "g2", gradient of 3rd component of vector: GT[3] */ ! gageVecMultiGrad, /* 17: "mg", sum of outer products of gradients: GT[9] */ ! gageVecMGFrob, /* 18: "mgfrob", frob norm of multi-gradient: GT[1] */ ! gageVecMGEval, /* 19: "mgeval", eigenvalues of multi-gradient: GT[3] */ ! gageVecMGEvec, /* 20: "mgevec", eigenvectors of multi-gradient: GT[9] */ gageVecLast }; ! #define GAGE_VEC_ITEM_MAX 20 struct gageKind_t; /* dumb forward declaraction, ignore */ Index: vecGage.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/vecGage.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** vecGage.c 30 Mar 2004 04:26:01 -0000 1.17 --- vecGage.c 1 Apr 2004 07:07:35 -0000 1.18 *************** *** 30,33 **** --- 30,43 ---- {gageVecDivergence, 1, 1, {gageVecJacobian, -1, -1, -1, -1}, -1, -1}, {gageVecCurl, 3, 1, {gageVecJacobian, -1, -1, -1, -1}, -1, -1}, + {gageVecHelicity, 1, 1, {gageVecVector, gageVecCurl, -1, -1, -1}, -1, -1}, + {gageVecNormHelicity, 1, 1, {gageVecNormalized, gageVecCurl, -1, -1, -1}, -1, -1}, + {gageVecLambda2, 1, 1, {gageVecJacobian, -1, -1, -1, -1}, -1, -1}, + {gageVecHessian, 27, 2, {-1, -1, -1, -1, -1}, -1, -1}, + {gageVecCurlGradient, 9, 2, {gageVecHessian, -1, -1, -1, -1}, -1, -1}, + {gageVecHelGradient, 3, 2, {gageVecVector, gageVecJacobian, gageVecCurl, + gageVecCurlGradient, -1}, -1, -1}, + {gageVecDirHelDeriv, 1, 2, {gageVecNormalized, gageVecHelGradient, -1, -1, -1}, -1, -1}, + {gageVecProjHelGradient, 3,2, {gageVecNormalized, gageVecHelGradient, gageVecDirHelDeriv, + -1, -1}, -1, -1}, /* HEY: these should change to sub-items!!! */ {gageVecGradient0, 3, 1, {gageVecJacobian, -1, -1, -1, -1}, -1, -1}, *************** *** 43,47 **** _gageVecFilter (gageContext *ctx, gagePerVolume *pvl) { char me[]="_gageVecFilter"; ! gage_t *fw00, *fw11, *fw22, *vec, *jac; int fd; --- 53,57 ---- _gageVecFilter (gageContext *ctx, gagePerVolume *pvl) { char me[]="_gageVecFilter"; ! gage_t *fw00, *fw11, *fw22, *vec, *jac, *hes; int fd; *************** *** 49,52 **** --- 59,63 ---- vec = pvl->directAnswer[gageVecVector]; jac = pvl->directAnswer[gageVecJacobian]; + hes = pvl->directAnswer[gageVecHessian]; if (!ctx->parm.k3pack) { fprintf(stderr, "!%s: sorry, 6pack filtering not implemented\n", me); *************** *** 62,67 **** gageScl3PFilter2(pvl->iv3 + J*8, pvl->iv2 + J*4, pvl->iv1 + J*2, \ fw00, fw11, fw22, \ ! vec + J, jac + J*3, NULL, \ ! pvl->needD[0], pvl->needD[1], AIR_FALSE) DOIT_2(0); DOIT_2(1); DOIT_2(2); break; --- 73,79 ---- gageScl3PFilter2(pvl->iv3 + J*8, pvl->iv2 + J*4, pvl->iv1 + J*2, \ fw00, fw11, fw22, \ ! vec + J, jac + J*3, hes + J*9, \ ! pvl->needD[0], pvl->needD[1], pvl->needD[2]) ! /* 2nd order derivative computation with this scheme is no good idea */ DOIT_2(0); DOIT_2(1); DOIT_2(2); break; *************** *** 70,75 **** gageScl3PFilter4(pvl->iv3 + J*64, pvl->iv2 + J*16, pvl->iv1 + J*4, \ fw00, fw11, fw22, \ ! vec + J, jac + J*3, NULL, \ ! pvl->needD[0], pvl->needD[1], AIR_FALSE) DOIT_4(0); DOIT_4(1); DOIT_4(2); break; --- 82,87 ---- gageScl3PFilter4(pvl->iv3 + J*64, pvl->iv2 + J*16, pvl->iv1 + J*4, \ fw00, fw11, fw22, \ ! vec + J, jac + J*3, hes + J*9, \ ! pvl->needD[0], pvl->needD[1], pvl->needD[2]) DOIT_4(0); DOIT_4(1); DOIT_4(2); break; *************** *** 80,85 **** pvl->iv2 + J*fd*fd, pvl->iv1 + J*fd, \ fw00, fw11, fw22, \ ! vec + J, jac + J*3, NULL, \ ! pvl->needD[0], pvl->needD[1], AIR_FALSE) DOIT_N(0); DOIT_N(1); DOIT_N(2); break; --- 92,97 ---- pvl->iv2 + J*fd*fd, pvl->iv1 + J*fd, \ fw00, fw11, fw22, \ ! vec + J, jac + J*3, hes + J*9, \ ! pvl->needD[0], pvl->needD[1], pvl->needD[2]) DOIT_N(0); DOIT_N(1); DOIT_N(2); break; *************** *** 92,101 **** _gageVecAnswer (gageContext *ctx, gagePerVolume *pvl) { char me[]="_gageVecAnswer"; ! double tmpMat[9], mgevec[9], mgeval[3]; ! gage_t *vecAns, *normAns, *jacAns; - vecAns = pvl->directAnswer[gageVecVector]; - jacAns = pvl->directAnswer[gageVecJacobian]; - normAns = pvl->directAnswer[gageVecNormalized]; if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecVector)) { /* done if doV */ --- 104,122 ---- _gageVecAnswer (gageContext *ctx, gagePerVolume *pvl) { char me[]="_gageVecAnswer"; ! double cmag, tmpMat[9], mgevec[9], mgeval[3]; ! double symm[9], asym[9], tran[9], eval[3]; ! gage_t *vecAns, *normAns, *jacAns, *curlAns, *hesAns, *curlGradAns, ! *helGradAns, *dirHelDirAns; ! int asw; ! ! vecAns = pvl->directAnswer[gageVecVector]; ! normAns = pvl->directAnswer[gageVecNormalized]; ! jacAns = pvl->directAnswer[gageVecJacobian]; ! curlAns = pvl->directAnswer[gageVecCurl]; ! hesAns = pvl->directAnswer[gageVecHessian]; ! curlGradAns = pvl->directAnswer[gageVecCurlGradient]; ! helGradAns = pvl->directAnswer[gageVecHelGradient]; ! dirHelDirAns = pvl->directAnswer[gageVecDirHelDeriv]; if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecVector)) { /* done if doV */ *************** *** 109,113 **** } if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecNormalized)) { ! if (pvl->directAnswer[gageVecLength]) { ELL_3V_SCALE(normAns, 1.0/pvl->directAnswer[gageVecLength][0], vecAns); } else { --- 130,134 ---- } if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecNormalized)) { ! if (pvl->directAnswer[gageVecLength][0]) { ELL_3V_SCALE(normAns, 1.0/pvl->directAnswer[gageVecLength][0], vecAns); } else { *************** *** 116,120 **** } if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecJacobian)) { ! /* done if doV1 */ /* 0:dv_x/dx 1:dv_x/dy 2:dv_x/dz --- 137,141 ---- } if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecJacobian)) { ! /* done if doD1 */ /* 0:dv_x/dx 1:dv_x/dy 2:dv_x/dz *************** *** 136,144 **** } 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], --- 157,274 ---- } if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecCurl)) { ! ELL_3V_SET(curlAns, jacAns[7] - jacAns[5], jacAns[2] - jacAns[6], jacAns[3] - jacAns[1]); } + if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecHelicity)) { + pvl->directAnswer[gageVecHelicity][0] = + ELL_3V_DOT(vecAns, curlAns); + } + if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecNormHelicity)) { + cmag = ELL_3V_LEN(curlAns); + pvl->directAnswer[gageVecNormHelicity][0] = + cmag ? ELL_3V_DOT(normAns, curlAns)/cmag : 0; + } + if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecLambda2)) { + ELL_3M_TRANSPOSE(tran, jacAns); + // symmetric part + ELL_3M_SCALE_ADD2(symm, 0.5, jacAns, 0.5, tran); + // antisymmetric part + ELL_3M_SCALE_ADD2(asym, 0.5, jacAns, -0.5, tran); + // square symmetric part + ELL_3M_MUL(tmpMat, symm, symm); + ELL_3M_COPY(symm, tmpMat); + // square antisymmetric part + ELL_3M_MUL(tmpMat, asym, asym); + // sum of both + ELL_3M_ADD2(symm, symm, tmpMat); + asw = ell_3m_eigenvalues_d(eval, symm, AIR_TRUE); + if (asw == ell_cubic_root_triple) + pvl->directAnswer[gageVecLambda2][0] = eval[0]; + else if (asw == ell_cubic_root_single_double) + pvl->directAnswer[gageVecLambda2][0] = eval[1]; + else if (asw == ell_cubic_root_three) + { + if (eval[0]<=eval[1]) + if (eval[1]<=eval[2]) + pvl->directAnswer[gageVecLambda2][0] = eval[1]; + else + if (eval[0]<=eval[2]) + pvl->directAnswer[gageVecLambda2][0] = eval[2]; + else + pvl->directAnswer[gageVecLambda2][0] = eval[0]; + else + if (eval[2]<=eval[1]) + pvl->directAnswer[gageVecLambda2][0] = eval[1]; + else + if (eval[0]<=eval[2]) + pvl->directAnswer[gageVecLambda2][0] = eval[0]; + else + pvl->directAnswer[gageVecLambda2][0] = eval[2]; + } + } + /* 2nd order vector derivative continued */ + if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecHessian)) { + /* done if doD2 */ + /* the ordering is induced by the scalar hessian computation : + 0:d2v_x/dxdx 1:d2v_x/dxdy 2:d2v_x/dxdz + 3:d2v_x/dydx 4:d2v_x/dydy 5:d2v_x/dydz + 6:d2v_x/dzdx 7:d2v_x/dzdy 8:d2v_x/dzdz + 9:d2v_y/dxdx [...] + [...] + 24:dv2_z/dzdx 25:d2v_z/dzdy 26:d2v_z/dzdz + */ + if (ctx->verbose) { + fprintf(stderr, "%s: hes = \n", me); + ell_3m_PRINT(stderr, hesAns); /* ?? */ + } + } + if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecCurlGradient)) { + pvl->directAnswer[gageVecCurlGradient][0] = hesAns[21]-hesAns[15]; + pvl->directAnswer[gageVecCurlGradient][1] = hesAns[22]-hesAns[16]; + pvl->directAnswer[gageVecCurlGradient][2] = hesAns[23]-hesAns[17]; + pvl->directAnswer[gageVecCurlGradient][3] = hesAns[ 6]-hesAns[18]; + pvl->directAnswer[gageVecCurlGradient][4] = hesAns[ 7]-hesAns[19]; + pvl->directAnswer[gageVecCurlGradient][5] = hesAns[ 8]-hesAns[20]; + pvl->directAnswer[gageVecCurlGradient][6] = hesAns[ 9]-hesAns[ 1]; + pvl->directAnswer[gageVecCurlGradient][7] = hesAns[10]-hesAns[ 2]; + pvl->directAnswer[gageVecCurlGradient][8] = hesAns[11]-hesAns[ 3]; + } + if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecHelGradient)) { + pvl->directAnswer[gageVecHelGradient][0] = + jacAns[0]*curlAns[0]+ + jacAns[3]*curlAns[1]+ + jacAns[6]*curlAns[2]+ + curlGradAns[0]*vecAns[0]+ + curlGradAns[3]*vecAns[1]+ + curlGradAns[6]*vecAns[2]; + pvl->directAnswer[gageVecHelGradient][1] = + jacAns[1]*curlAns[0]+ + jacAns[4]*curlAns[1]+ + jacAns[7]*curlAns[2]+ + curlGradAns[1]*vecAns[0]+ + curlGradAns[4]*vecAns[1]+ + curlGradAns[7]*vecAns[2]; + pvl->directAnswer[gageVecHelGradient][0] = + jacAns[2]*curlAns[0]+ + jacAns[5]*curlAns[1]+ + jacAns[8]*curlAns[2]+ + curlGradAns[2]*vecAns[0]+ + curlGradAns[5]*vecAns[1]+ + curlGradAns[8]*vecAns[2]; + } + if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecDirHelDeriv)) { + pvl->directAnswer[gageVecDirHelDeriv][0] = + ELL_3V_DOT(normAns, helGradAns); + } + if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecProjHelGradient)) { + pvl->directAnswer[gageVecDirHelDeriv][0] = + helGradAns[0]-dirHelDirAns[0]*normAns[0]; + pvl->directAnswer[gageVecDirHelDeriv][1] = + helGradAns[1]-dirHelDirAns[0]*normAns[1]; + pvl->directAnswer[gageVecDirHelDeriv][2] = + helGradAns[2]-dirHelDirAns[0]*normAns[2]; + } if (GAGE_QUERY_ITEM_TEST(pvl->query, gageVecGradient0)) { ELL_3V_SET(pvl->directAnswer[gageVecGradient0], *************** *** 197,200 **** --- 327,338 ---- "divergence", "curl", + "helicity", + "normalized helicity", + "lambda2", + "vector hessian", + "curl gradient", + "helicity gradient", + "directional helicity derivative", + "projected helicity gradient", "gradient0", "gradient1", *************** *** 215,218 **** --- 353,364 ---- "divergence", "curl", + "helicity: dot(vector,curl)", + "normalized helicity", + "lambda2 value for vortex characterization", + "3x3x3 second-order vector derivative", + "3x3 derivative of curl", + "gradient of helicity", + "directional derivative of helicity along flow", + "projection of the helicity gradient onto plane orthogonal to flow", "gradient of 1st component of vector", "gradient of 2nd component of vector", *************** *** 233,236 **** --- 379,390 ---- gageVecDivergence, gageVecCurl, + gageVecHelicity, + gageVecNormHelicity, + gageVecLambda2, + gageVecHessian, + gageVecCurlGradient, + gageVecHelGradient, + gageVecDirHelDeriv, + gageVecProjHelGradient, gageVecGradient0, gageVecGradient1, *************** *** 248,251 **** --- 402,413 ---- #define GV_D gageVecDivergence #define GV_C gageVecCurl + #define GV_H gageVecHelicity + #define GV_NH gageVecNormHelicity + #define GV_LB gageVecLambda2 + #define GV_VH gageVecHessian + #define GV_CG gageVecCurlGradient + #define GV_HG gageVecHelGradient + #define GV_DH gageVecDirHelDeriv + #define GV_PH gageVecProjHelGradient #define GV_G0 gageVecGradient0 #define GV_G1 gageVecGradient1 *************** *** 264,267 **** --- 426,437 ---- "divergence", "div", "d", "curl", "c", + "h", "hel", "hell", + "nh", "nhel", "normhel", "normhell", + "lbda2", "lambda2", + "vh", "vhes", "vhessian", "vector hessian", + "cg", "curlgrad", "curlg", "curljac", "curl gradient", + "hg", "helg", "helgrad", "helicity gradient", + "dirhelderiv", "dhd", "ddh", "directional helicity derivative", + "phg", "projhel", "projhelgrad", "projected helicity gradient", "g0", "grad0", "gradient0", "g1", "grad1", "gradient1", *************** *** 282,285 **** --- 452,463 ---- GV_D, GV_D, GV_D, GV_C, GV_C, + GV_H, GV_H, GV_H, + GV_NH, GV_NH, GV_NH, GV_NH, + GV_LB, GV_LB, + GV_VH, GV_VH, GV_VH, GV_VH, + GV_CG, GV_CG, GV_CG, GV_CG, GV_CG, + GV_HG, GV_HG, GV_HG, GV_HG, + GV_DH, GV_DH, GV_DH, GV_DH, + GV_PH, GV_PH, GV_PH, GV_PH, GV_G0, GV_G0, GV_G0, GV_G1, GV_G1, GV_G1, Index: miscGage.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/miscGage.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** miscGage.c 13 Mar 2004 20:03:09 -0000 1.11 --- miscGage.c 1 Apr 2004 07:07:35 -0000 1.12 *************** *** 36,40 **** */ gage_t ! gageZeroNormal[3] = {1,0,0}; char --- 36,40 ---- */ gage_t ! gageZeroNormal[3] = {0,0,0}; char |
|
From: Gordon K. <kin...@us...> - 2004-03-31 18:08:39
|
Update of /cvsroot/teem/teem/src/nrrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28802 Modified Files: arraysNrrd.c nrrdEnums.h resampleNrrd.c Log Message: removed debugging messages, fixed serious bug of not updating nrrdField-related arrays Index: resampleNrrd.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/resampleNrrd.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** resampleNrrd.c 30 Mar 2004 19:25:09 -0000 1.21 --- resampleNrrd.c 31 Mar 2004 17:56:49 -0000 1.22 *************** *** 801,806 **** | NRRD_AXIS_INFO_KIND_BIT)); for (d=0; d<dim; d++) { - fprintf(stderr, "%s: nin->axis[%d].kind = %s\n", me, d, - airEnumStr(nrrdKind, nin->axis[d].kind)); if (info->kernel[d]) { nout->axis[d].min = info->min[d]; --- 801,804 ---- *************** *** 814,819 **** nout->axis[d].kind = nin->axis[d].kind; } - fprintf(stderr, "%s: nout->axis[%d].kind = %s\n", me, d, - airEnumStr(nrrdKind, nout->axis[d].kind)); } /* HEY: need to create textual representation of resampling parameters */ --- 812,815 ---- Index: arraysNrrd.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/arraysNrrd.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** arraysNrrd.c 7 Jan 2004 15:34:30 -0000 1.15 --- arraysNrrd.c 31 Mar 2004 17:56:48 -0000 1.16 *************** *** 171,174 **** --- 171,175 ---- 1, /* nrrdField_axis_maxs */ 1, /* nrrdField_centers */ + 1, /* nrrdField_kinds */ 1, /* nrrdField_labels */ 1, /* nrrdField_units */ *************** *** 203,206 **** --- 204,208 ---- 1, /* nrrdField_axis_maxs */ 1, /* nrrdField_centers */ + 1, /* nrrdField_kinds */ 1, /* nrrdField_labels */ 1, /* nrrdField_units */ *************** *** 238,241 **** --- 240,244 ---- 1, /* nrrdField_axis_maxs */ 1, /* nrrdField_centers */ + 1, /* nrrdField_kinds */ 1, /* nrrdField_labels */ 1, /* nrrdField_units */ *************** *** 271,274 **** --- 274,278 ---- 0, /* nrrdField_axis maxs */ 0, /* nrrdField_centers */ + 0, /* nrrdField_kinds */ 0, /* nrrdField_labels */ 0, /* nrrdField_units */ Index: nrrdEnums.h =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/nrrdEnums.h,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** nrrdEnums.h 30 Mar 2004 19:25:09 -0000 1.43 --- nrrdEnums.h 31 Mar 2004 17:56:48 -0000 1.44 *************** *** 246,249 **** --- 246,256 ---- ** ** the various fields we can parse in a NRRD header + ** + ** other things which must be kept in sync: + ** arraysNrrd.c: + ** _nrrdFieldValidInImage[] + ** _nrrdFieldOnePerAxis[] + ** _nrrdFieldValidInText[] + ** _nrrdFieldRequired[] */ enum { |
|
From: Gordon K. <kin...@us...> - 2004-03-30 19:37:40
|
Update of /cvsroot/teem/teem/src/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6688/bin Modified Files: ilk.c qbert.c Log Message: Two major changes, which were done simultaneously: 1) Some renamings related to NrrdAxis, nrrdAxisInfo, and so on 2) Addition of the nrrdKind information to the NrrdAxisInfo struct In detail: 1) Some renamings related to NrrdAxis, nrrdAxisInfo, and so on: struct: NrrdAxis --> NrrdAxisInfo (NB: Nrrd struct still has field "axis") functions: nrrdAxisPos() --> nrrdAxisInfoPos() nrrdAxisIdx() --> nrrdAxisInfoIdx() nrrdAxisPosRange() --> nrrdAxisInfoPosRange() nrrdAxisIdxRange() --> nrrdAxisInfoIdxRange() nrrdAxisSpacingSet() --> nrrdAxisInfoSpacingSet() nrrdAxisMinMaxSet() --> nrrdAxisInfoMinMaxSet() Now, ANYTHING having to do with setting, getting, or manipulating the meta-information about the axes starts with "nrrdAxisInfo". The single exception to this is that the Nrrd struct's "axis" field was not renamed to "axisInfo", since this seemed more annoying that it was worth. Also, (this isn't new) ANYTHING having to do the set of axes, the shape of the array, or the per-axis ordering of samples, starts with "nrrdAxes". The nrrdAxes functions are NOT merely for manipulating the per-axis meta information-- something about the array as a whole, or the set of axes as a whole, is changing. Yes, this means that there's a function called "nrrdAxesInsert", even though it only inserts a single axis, but I figured the consistency generated by strict adherence to the nrrdAxes and nrrdAxisInfo prefixes would be better in the long run. 2) Addition of the nrrdKind information to the NrrdAxisInfo struct This is nrrd's latest and probably most dangerous step towards putting real semantic information in the array representation (that is, the "nearly raw" philosophy is getting stretched). The best way to think about this is that its a *hint*: an extra bit of information, kind of like the label or the unit, that you may want to associated with the axis, and which has a sufficiently general nature to warrent direct representation. So, new to the (newly renamed) NrrdAxisInfo struct: int kind; /* what kind of information is along this axis (from the nrrdKind* enum) */ Accordingly, there is change to the file format, which of course means that the magic is once again incremented. If you write a nrrd with known kinds on any axis, the magic will be "NRRD0003". The new kinds field looks like (for-example) kinds: 3-color domain domain for an RGB image. Like other per-axis fields, its specification is plural (its "kinds:", not "kind:"), and like centering, you use "???" to mean, "I don't know", for example: kinds: ??? domain domain To make this hint more useful, there's a new function nrrdKindSize() which returns what nrrd thinks is the suggested axis size for the different nrrdKind's. This function will return 0 to indicate "I have no advice for you on how big this axis should be". The reason for using 0 instead of -1 is that someday nrrd may change the axis size type from int to unsigned int. To offer some control of the nrrdKind behavior, there is a new global "state" variable: nrrdStateKindNoop. Currently, this is AIR_TRUE by defaul. You can set it to AIR_FALSE to enable some minimal cleverness on the part of nrrd. The nature of that minimal cleverness is almost certainly likely to change with time. Due to the nature of nrrdAxisInfoCopy, anything which doesn't explicitly ask the axis information NOT to be copied, will have it be copied. For example, nrrdSlice will propogate through the kinds on the axes that it didn't touch, same with nrrdAxesPermute, and the like. Regardless of NrrdKindStateNoop, the output of these functions will set nrrdKindUnknown on all the axes that experienced a non-trivial change: nrrdAxesSplit, nrrdAxesMerge, nrrdReshape, nrrdReshape_nva, nrrdUnblock, nrrdJoin, nrrdApply1DLut, nrrdApply1DRegMap, and nrrdApply1DIrregMap. These functions respect nrrdKindStateNoop: nrrdCrop, nrrdPad, nrrdShuffle, nrrdFlip, nrrdSpatialResample: if (nrrdKindStateNoop) { If the axis operated on was not a nrrdKindDomain or nrrdKindList, the resulting kind is nrrdKindUnknown Else, the resulting kind is the same as the input kind. This is implemented through _nrrdKindAltered() } else { output kind is a copy of the input kind } nrrdHisto, nrrdHistoAxis, nrrdHistoJoint: if (nrrdKindStateNoop) { histogram axes are nrrdKindDomain } else { histogram axes are nrrdKindUnknown } nrrdAxisInsert: if (nrrdKindStateNoop) { new axis is nrrdKindStub } else { new axis is nrrdKindUnknown } For the record, this is what this change entailed: added: - global int nrrdStateKindNoop - nrrdKindSize() - airEnum *nrrdKind (maps between strings like "3color" and nrrdKind* values) - NRRD_KIND_MAX #define augmented: - NrrdAxisInfo struct (now has "kind" field) - _nrrdFieldInteresting(), _nrrdSprintFieldInfo(), _nrrdFormatNRRD_write() with things relating to new field ("kinds:") and magic ("NRRD0003") - _nrrdReadNrrdParseInfo[] parser callback, with new _nrrdReadNrrdParse_kinds() - airEnum *nrrdField - nrrdAxisInfo C enum (for passing to nrrdAxisInfo{Set,Get}) - nrrdField* C enum - nrrdStateGetenv(): looks for NRRD_STATE_KIND_NOOP" environment variable One annoying bit: I didn't add a new flag to "unu make" to learn the axis kinds because I *can't*. This is a basic limitation in hest which is gotten pretty annoying: there is direct way to see if an option was given on the command line or not. Every option has to have a value supplied, either via the command-line or via the default value string, but once its all been parsed, you don't know where it came from, and nor can you tell hest "this option is really really optional, there is no default, and its okay if the user never gives you a value." This will only be fixed with a hest re-write. Index: qbert.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/qbert.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** qbert.c 13 Feb 2004 23:01:12 -0000 1.20 --- qbert.c 30 Mar 2004 19:24:59 -0000 1.21 *************** *** 609,619 **** } if (!AIR_EXISTS(nin->axis[0].spacing)) { ! nrrdAxisSpacingSet(nin, 0); } if (!AIR_EXISTS(nin->axis[1].spacing)) { ! nrrdAxisSpacingSet(nin, 1); } if (!AIR_EXISTS(nin->axis[2].spacing)) { ! nrrdAxisSpacingSet(nin, 2); } --- 609,619 ---- } if (!AIR_EXISTS(nin->axis[0].spacing)) { ! nrrdAxisInfoSpacingSet(nin, 0); } if (!AIR_EXISTS(nin->axis[1].spacing)) { ! nrrdAxisInfoSpacingSet(nin, 1); } if (!AIR_EXISTS(nin->axis[2].spacing)) { ! nrrdAxisInfoSpacingSet(nin, 2); } Index: ilk.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/ilk.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ilk.c 30 Mar 2004 04:23:33 -0000 1.11 --- ilk.c 30 Mar 2004 19:24:58 -0000 1.12 *************** *** 134,142 **** if (!( AIR_EXISTS(nin->axis[ax0+0].min) && AIR_EXISTS(nin->axis[ax0+0].max))) { ! nrrdAxisMinMaxSet(nin, ax0+0, mossDefCenter); } if (!( AIR_EXISTS(nin->axis[ax0+1].min) && AIR_EXISTS(nin->axis[ax0+1].max))) { ! nrrdAxisMinMaxSet(nin, ax0+1, mossDefCenter); } min[0] = AIR_EXISTS(min[0]) ? min[0] : nin->axis[ax0+0].min; --- 134,142 ---- if (!( AIR_EXISTS(nin->axis[ax0+0].min) && AIR_EXISTS(nin->axis[ax0+0].max))) { ! nrrdAxisInfoMinMaxSet(nin, ax0+0, mossDefCenter); } if (!( AIR_EXISTS(nin->axis[ax0+1].min) && AIR_EXISTS(nin->axis[ax0+1].max))) { ! nrrdAxisInfoMinMaxSet(nin, ax0+1, mossDefCenter); } min[0] = AIR_EXISTS(min[0]) ? min[0] : nin->axis[ax0+0].min; *************** *** 183,190 **** if (!AIR_EXISTS(nin->axis[ax0+0].min) || !AIR_EXISTS(nin->axis[ax0+0].max)) { ! nrrdAxisMinMaxSet(nin, ax0+0, mossDefCenter); } if (!AIR_EXISTS(nin->axis[ax0+1].min) || !AIR_EXISTS(nin->axis[ax0+1].max)) { ! nrrdAxisMinMaxSet(nin, ax0+1, mossDefCenter); } if (mossLinearTransform(nout, nin, bkg, --- 183,190 ---- if (!AIR_EXISTS(nin->axis[ax0+0].min) || !AIR_EXISTS(nin->axis[ax0+0].max)) { ! nrrdAxisInfoMinMaxSet(nin, ax0+0, mossDefCenter); } if (!AIR_EXISTS(nin->axis[ax0+1].min) || !AIR_EXISTS(nin->axis[ax0+1].max)) { ! nrrdAxisInfoMinMaxSet(nin, ax0+1, mossDefCenter); } if (mossLinearTransform(nout, nin, bkg, |
|
From: Gordon K. <kin...@us...> - 2004-03-30 19:37:25
|
Update of /cvsroot/teem/teem/src/ten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6688/ten Modified Files: aniso.c enumsTen.c miscTen.c ten.h Log Message: Two major changes, which were done simultaneously: 1) Some renamings related to NrrdAxis, nrrdAxisInfo, and so on 2) Addition of the nrrdKind information to the NrrdAxisInfo struct In detail: 1) Some renamings related to NrrdAxis, nrrdAxisInfo, and so on: struct: NrrdAxis --> NrrdAxisInfo (NB: Nrrd struct still has field "axis") functions: nrrdAxisPos() --> nrrdAxisInfoPos() nrrdAxisIdx() --> nrrdAxisInfoIdx() nrrdAxisPosRange() --> nrrdAxisInfoPosRange() nrrdAxisIdxRange() --> nrrdAxisInfoIdxRange() nrrdAxisSpacingSet() --> nrrdAxisInfoSpacingSet() nrrdAxisMinMaxSet() --> nrrdAxisInfoMinMaxSet() Now, ANYTHING having to do with setting, getting, or manipulating the meta-information about the axes starts with "nrrdAxisInfo". The single exception to this is that the Nrrd struct's "axis" field was not renamed to "axisInfo", since this seemed more annoying that it was worth. Also, (this isn't new) ANYTHING having to do the set of axes, the shape of the array, or the per-axis ordering of samples, starts with "nrrdAxes". The nrrdAxes functions are NOT merely for manipulating the per-axis meta information-- something about the array as a whole, or the set of axes as a whole, is changing. Yes, this means that there's a function called "nrrdAxesInsert", even though it only inserts a single axis, but I figured the consistency generated by strict adherence to the nrrdAxes and nrrdAxisInfo prefixes would be better in the long run. 2) Addition of the nrrdKind information to the NrrdAxisInfo struct This is nrrd's latest and probably most dangerous step towards putting real semantic information in the array representation (that is, the "nearly raw" philosophy is getting stretched). The best way to think about this is that its a *hint*: an extra bit of information, kind of like the label or the unit, that you may want to associated with the axis, and which has a sufficiently general nature to warrent direct representation. So, new to the (newly renamed) NrrdAxisInfo struct: int kind; /* what kind of information is along this axis (from the nrrdKind* enum) */ Accordingly, there is change to the file format, which of course means that the magic is once again incremented. If you write a nrrd with known kinds on any axis, the magic will be "NRRD0003". The new kinds field looks like (for-example) kinds: 3-color domain domain for an RGB image. Like other per-axis fields, its specification is plural (its "kinds:", not "kind:"), and like centering, you use "???" to mean, "I don't know", for example: kinds: ??? domain domain To make this hint more useful, there's a new function nrrdKindSize() which returns what nrrd thinks is the suggested axis size for the different nrrdKind's. This function will return 0 to indicate "I have no advice for you on how big this axis should be". The reason for using 0 instead of -1 is that someday nrrd may change the axis size type from int to unsigned int. To offer some control of the nrrdKind behavior, there is a new global "state" variable: nrrdStateKindNoop. Currently, this is AIR_TRUE by defaul. You can set it to AIR_FALSE to enable some minimal cleverness on the part of nrrd. The nature of that minimal cleverness is almost certainly likely to change with time. Due to the nature of nrrdAxisInfoCopy, anything which doesn't explicitly ask the axis information NOT to be copied, will have it be copied. For example, nrrdSlice will propogate through the kinds on the axes that it didn't touch, same with nrrdAxesPermute, and the like. Regardless of NrrdKindStateNoop, the output of these functions will set nrrdKindUnknown on all the axes that experienced a non-trivial change: nrrdAxesSplit, nrrdAxesMerge, nrrdReshape, nrrdReshape_nva, nrrdUnblock, nrrdJoin, nrrdApply1DLut, nrrdApply1DRegMap, and nrrdApply1DIrregMap. These functions respect nrrdKindStateNoop: nrrdCrop, nrrdPad, nrrdShuffle, nrrdFlip, nrrdSpatialResample: if (nrrdKindStateNoop) { If the axis operated on was not a nrrdKindDomain or nrrdKindList, the resulting kind is nrrdKindUnknown Else, the resulting kind is the same as the input kind. This is implemented through _nrrdKindAltered() } else { output kind is a copy of the input kind } nrrdHisto, nrrdHistoAxis, nrrdHistoJoint: if (nrrdKindStateNoop) { histogram axes are nrrdKindDomain } else { histogram axes are nrrdKindUnknown } nrrdAxisInsert: if (nrrdKindStateNoop) { new axis is nrrdKindStub } else { new axis is nrrdKindUnknown } For the record, this is what this change entailed: added: - global int nrrdStateKindNoop - nrrdKindSize() - airEnum *nrrdKind (maps between strings like "3color" and nrrdKind* values) - NRRD_KIND_MAX #define augmented: - NrrdAxisInfo struct (now has "kind" field) - _nrrdFieldInteresting(), _nrrdSprintFieldInfo(), _nrrdFormatNRRD_write() with things relating to new field ("kinds:") and magic ("NRRD0003") - _nrrdReadNrrdParseInfo[] parser callback, with new _nrrdReadNrrdParse_kinds() - airEnum *nrrdField - nrrdAxisInfo C enum (for passing to nrrdAxisInfo{Set,Get}) - nrrdField* C enum - nrrdStateGetenv(): looks for NRRD_STATE_KIND_NOOP" environment variable One annoying bit: I didn't add a new flag to "unu make" to learn the axis kinds because I *can't*. This is a basic limitation in hest which is gotten pretty annoying: there is direct way to see if an option was given on the command line or not. Every option has to have a value supplied, either via the command-line or via the default value string, but once its all been parsed, you don't know where it came from, and nor can you tell hest "this option is really really optional, there is no default, and its okay if the user never gives you a value." This will only be fixed with a hest re-write. Index: miscTen.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/miscTen.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** miscTen.c 7 Mar 2004 00:48:13 -0000 1.23 --- miscTen.c 30 Mar 2004 19:25:14 -0000 1.24 *************** *** 280,284 **** } ! *valP = nrrdAxisPos(nhist, 0, AIR_AFFINE(0, tweak, 1, maxbb, bb)); airMopOkay(mop); --- 280,284 ---- } ! *valP = nrrdAxisInfoPos(nhist, 0, AIR_AFFINE(0, tweak, 1, maxbb, bb)); airMopOkay(mop); Index: aniso.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/aniso.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** aniso.c 30 Mar 2004 03:25:20 -0000 1.27 --- aniso.c 30 Mar 2004 19:25:14 -0000 1.28 *************** *** 24,27 **** --- 24,32 ---- /* + ** learned: don't take sqrt(FLT_EPSILON) and expect it to still be + ** negligible + */ + + /* ******** tenAnisoCalc ** *************** *** 53,59 **** /* first version of cl, cp, cs */ ! cl = (e0 - e1)/(tenAnisoSigma + sum); c[tenAniso_Cl1] = cl; ! cp = 2*(e1 - e2)/(tenAnisoSigma + sum); c[tenAniso_Cp1] = cp; ca = cl + cp; --- 58,64 ---- /* first version of cl, cp, cs */ ! cl = (e0 - e1)/(FLT_EPSILON + sum); c[tenAniso_Cl1] = cl; ! cp = 2*(e1 - e2)/(FLT_EPSILON + sum); c[tenAniso_Cp1] = cp; ca = cl + cp; *************** *** 62,68 **** c[tenAniso_Ct1] = ca ? cp/ca : 0; /* second version of cl, cp, cs */ ! cl = (e0 - e1)/(tenAnisoSigma + e0); c[tenAniso_Cl2] = cl; ! cp = (e1 - e2)/(tenAnisoSigma + e0); c[tenAniso_Cp2] = cp; ca = cl + cp; --- 67,73 ---- c[tenAniso_Ct1] = ca ? cp/ca : 0; /* second version of cl, cp, cs */ ! cl = (e0 - e1)/(FLT_EPSILON + e0); c[tenAniso_Cl2] = cl; ! cp = (e1 - e2)/(FLT_EPSILON + e0); c[tenAniso_Cp2] = cp; ca = cl + cp; *************** *** 75,81 **** + (mean-e1)*(mean-e1) + (mean-e2)*(mean-e2)); ! ra = stdv/(tenAnisoSigma + mean*sqrt(6.0)); ra = AIR_CLAMP(0.0, ra, 1.0); c[tenAniso_RA] = ra; ! denom = tenAnisoSigma + 2.0*(e0*e0 + e1*e1 + e2*e2); if (denom) { fa = stdv*sqrt(3.0/denom); --- 80,87 ---- + (mean-e1)*(mean-e1) + (mean-e2)*(mean-e2)); ! ra = stdv/(FLT_EPSILON + mean*sqrt(6.0)); ! ra = AIR_CLAMP(0.0, ra, 1.0); c[tenAniso_RA] = ra; ! denom = 2.0*(e0*e0 + e1*e1 + e2*e2); if (denom) { fa = stdv*sqrt(3.0/denom); *************** *** 90,105 **** A = (-e0 - e1 - e2); ! 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) ! + (e0 + e2)/(tenAnisoSigma + e1))/6; c[tenAniso_Det] = e0*e1*e2; ! c[tenAniso_Tr] = sum; return; } --- 96,111 ---- A = (-e0 - e1 - e2); ! B = c[tenAniso_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/(FLT_EPSILON + sqrt(2*Q*Q*Q)); c[tenAniso_Th] = acos(sqrt(2)*c[tenAniso_Skew])/3; ! c[tenAniso_Cz] = ((e0 + e1)/(FLT_EPSILON + e2) ! + (e1 + e2)/(FLT_EPSILON + e0) ! + (e0 + e2)/(FLT_EPSILON + e1))/6; c[tenAniso_Det] = e0*e1*e2; ! c[tenAniso_Tr] = e0 + e1 + e2; return; } Index: enumsTen.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/enumsTen.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** enumsTen.c 30 Mar 2004 03:25:20 -0000 1.18 --- enumsTen.c 30 Mar 2004 19:25:14 -0000 1.19 *************** *** 39,42 **** --- 39,43 ---- "FA", "VF", + "B", "Q", "R", Index: ten.h =================================================================== RCS file: /cvsroot/teem/teem/src/ten/ten.h,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** ten.h 30 Mar 2004 03:25:20 -0000 1.80 --- ten.h 30 Mar 2004 19:25:14 -0000 1.81 *************** *** 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 /* --- 56,71 ---- tenAniso_FA, /* 12: (Bass+Pier's fractional anisotropy)/sqrt(2) */ tenAniso_VF, /* 13: volume fraction = 1-(Bass+Pier's volume ratio) */ ! tenAniso_B, /* 14: linear term in cubic characteristic polynomial */ ! tenAniso_Q, /* 15: radius of root circle is 2*sqrt(Q) */ ! tenAniso_R, /* 16: half of third moment of eigenvalues */ ! tenAniso_S, /* 17: frobenius norm, squared */ ! tenAniso_Skew, /* 18: R/sqrt(2*Q^3) */ ! tenAniso_Th, /* 19: acos(sqrt(2)*skew)/3 */ ! tenAniso_Cz, /* 20: Zhukov's invariant-based anisotropy metric */ ! tenAniso_Det, /* 21: plain old determinant */ ! tenAniso_Tr, /* 22: plain old trace */ tenAnisoLast }; ! #define TEN_ANISO_MAX 22 /* |
|
From: Gordon K. <kin...@us...> - 2004-03-30 19:37:24
|
Update of /cvsroot/teem/teem/src/nrrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6688/nrrd Modified Files: axis.c defaultsNrrd.c enumsNrrd.c formatEPS.c formatNRRD.c histogram.c nrrd.h nrrdEnums.h parseNrrd.c privateNrrd.h reorder.c resampleNrrd.c subset.c superset.c write.c Log Message: Two major changes, which were done simultaneously: 1) Some renamings related to NrrdAxis, nrrdAxisInfo, and so on 2) Addition of the nrrdKind information to the NrrdAxisInfo struct In detail: 1) Some renamings related to NrrdAxis, nrrdAxisInfo, and so on: struct: NrrdAxis --> NrrdAxisInfo (NB: Nrrd struct still has field "axis") functions: nrrdAxisPos() --> nrrdAxisInfoPos() nrrdAxisIdx() --> nrrdAxisInfoIdx() nrrdAxisPosRange() --> nrrdAxisInfoPosRange() nrrdAxisIdxRange() --> nrrdAxisInfoIdxRange() nrrdAxisSpacingSet() --> nrrdAxisInfoSpacingSet() nrrdAxisMinMaxSet() --> nrrdAxisInfoMinMaxSet() Now, ANYTHING having to do with setting, getting, or manipulating the meta-information about the axes starts with "nrrdAxisInfo". The single exception to this is that the Nrrd struct's "axis" field was not renamed to "axisInfo", since this seemed more annoying that it was worth. Also, (this isn't new) ANYTHING having to do the set of axes, the shape of the array, or the per-axis ordering of samples, starts with "nrrdAxes". The nrrdAxes functions are NOT merely for manipulating the per-axis meta information-- something about the array as a whole, or the set of axes as a whole, is changing. Yes, this means that there's a function called "nrrdAxesInsert", even though it only inserts a single axis, but I figured the consistency generated by strict adherence to the nrrdAxes and nrrdAxisInfo prefixes would be better in the long run. 2) Addition of the nrrdKind information to the NrrdAxisInfo struct This is nrrd's latest and probably most dangerous step towards putting real semantic information in the array representation (that is, the "nearly raw" philosophy is getting stretched). The best way to think about this is that its a *hint*: an extra bit of information, kind of like the label or the unit, that you may want to associated with the axis, and which has a sufficiently general nature to warrent direct representation. So, new to the (newly renamed) NrrdAxisInfo struct: int kind; /* what kind of information is along this axis (from the nrrdKind* enum) */ Accordingly, there is change to the file format, which of course means that the magic is once again incremented. If you write a nrrd with known kinds on any axis, the magic will be "NRRD0003". The new kinds field looks like (for-example) kinds: 3-color domain domain for an RGB image. Like other per-axis fields, its specification is plural (its "kinds:", not "kind:"), and like centering, you use "???" to mean, "I don't know", for example: kinds: ??? domain domain To make this hint more useful, there's a new function nrrdKindSize() which returns what nrrd thinks is the suggested axis size for the different nrrdKind's. This function will return 0 to indicate "I have no advice for you on how big this axis should be". The reason for using 0 instead of -1 is that someday nrrd may change the axis size type from int to unsigned int. To offer some control of the nrrdKind behavior, there is a new global "state" variable: nrrdStateKindNoop. Currently, this is AIR_TRUE by defaul. You can set it to AIR_FALSE to enable some minimal cleverness on the part of nrrd. The nature of that minimal cleverness is almost certainly likely to change with time. Due to the nature of nrrdAxisInfoCopy, anything which doesn't explicitly ask the axis information NOT to be copied, will have it be copied. For example, nrrdSlice will propogate through the kinds on the axes that it didn't touch, same with nrrdAxesPermute, and the like. Regardless of NrrdKindStateNoop, the output of these functions will set nrrdKindUnknown on all the axes that experienced a non-trivial change: nrrdAxesSplit, nrrdAxesMerge, nrrdReshape, nrrdReshape_nva, nrrdUnblock, nrrdJoin, nrrdApply1DLut, nrrdApply1DRegMap, and nrrdApply1DIrregMap. These functions respect nrrdKindStateNoop: nrrdCrop, nrrdPad, nrrdShuffle, nrrdFlip, nrrdSpatialResample: if (nrrdKindStateNoop) { If the axis operated on was not a nrrdKindDomain or nrrdKindList, the resulting kind is nrrdKindUnknown Else, the resulting kind is the same as the input kind. This is implemented through _nrrdKindAltered() } else { output kind is a copy of the input kind } nrrdHisto, nrrdHistoAxis, nrrdHistoJoint: if (nrrdKindStateNoop) { histogram axes are nrrdKindDomain } else { histogram axes are nrrdKindUnknown } nrrdAxisInsert: if (nrrdKindStateNoop) { new axis is nrrdKindStub } else { new axis is nrrdKindUnknown } For the record, this is what this change entailed: added: - global int nrrdStateKindNoop - nrrdKindSize() - airEnum *nrrdKind (maps between strings like "3color" and nrrdKind* values) - NRRD_KIND_MAX #define augmented: - NrrdAxisInfo struct (now has "kind" field) - _nrrdFieldInteresting(), _nrrdSprintFieldInfo(), _nrrdFormatNRRD_write() with things relating to new field ("kinds:") and magic ("NRRD0003") - _nrrdReadNrrdParseInfo[] parser callback, with new _nrrdReadNrrdParse_kinds() - airEnum *nrrdField - nrrdAxisInfo C enum (for passing to nrrdAxisInfo{Set,Get}) - nrrdField* C enum - nrrdStateGetenv(): looks for NRRD_STATE_KIND_NOOP" environment variable One annoying bit: I didn't add a new flag to "unu make" to learn the axis kinds because I *can't*. This is a basic limitation in hest which is gotten pretty annoying: there is direct way to see if an option was given on the command line or not. Every option has to have a value supplied, either via the command-line or via the default value string, but once its all been parsed, you don't know where it came from, and nor can you tell hest "this option is really really optional, there is no default, and its okay if the user never gives you a value." This will only be fixed with a hest re-write. Index: reorder.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/reorder.c,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** reorder.c 13 Mar 2004 20:03:10 -0000 1.56 --- reorder.c 30 Mar 2004 19:25:09 -0000 1.57 *************** *** 63,66 **** --- 63,70 ---- /* the ONLY thing we can say about the new axis is its size */ _nrrdAxisInfoInit(&(nout->axis[ax])); + if (!nrrdStateKindNoop) { + /* except maybe the kind */ + nout->axis[ax].kind = nrrdKindStub; + } nout->axis[ax].size = 1; if (nrrdContentSet(nout, func, nin, "%d", ax)) { *************** *** 364,367 **** --- 368,372 ---- /* the min and max along the shuffled axis are now meaningless */ nout->axis[axis].min = nout->axis[axis].max = AIR_NAN; + nout->axis[axis].kind = _nrrdKindAltered(nin->axis[axis].kind); nrrdPeripheralCopy(nout, nin); strcpy(buff1, ""); Index: parseNrrd.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/parseNrrd.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** parseNrrd.c 7 Jan 2004 15:34:30 -0000 1.21 --- parseNrrd.c 30 Mar 2004 19:25:09 -0000 1.22 *************** *** 247,250 **** --- 247,283 ---- } + int + _nrrdReadNrrdParse_kinds (Nrrd *nrrd, NrrdIoState *nio, int useBiff) { + char me[]="_nrrdReadNrrdParse_kinds", err[AIR_STRLEN_MED]; + int i; + char *tok; + char *info, *last; + + info = nio->line + nio->pos; + _CHECK_HAVE_DIM; + for (i=0; i<=nrrd->dim-1; i++) { + tok = airStrtok(!i ? info : NULL, _nrrdFieldSep, &last); + if (!tok) { + sprintf(err, "%s: couldn't extract string for kind %d of %d", + me, i+1, nrrd->dim); + biffMaybeAdd(NRRD, err, useBiff); return 1; + } + if (!strcmp(tok, NRRD_UNKNOWN)) { + nrrd->axis[i].kind = nrrdKindUnknown; + continue; + } + if (!(nrrd->axis[i].kind = airEnumVal(nrrdKind, tok))) { + sprintf(err, "%s: couldn't parse \"%s\" kind %d of %d", + me, tok, i+1, nrrd->dim); + biffMaybeAdd(NRRD, err, useBiff); return 1; + } + /* + fprintf(stderr, "!%s: nrrd->axis[%d].kind = %d\n", + me, i, nrrd->axis[i].kind); + */ + } + return 0; + } + char * _nrrdGetQuotedString(char **hP, int useBiff) { *************** *** 577,580 **** --- 610,614 ---- _nrrdReadNrrdParse_axis_maxs, _nrrdReadNrrdParse_centers, + _nrrdReadNrrdParse_kinds, _nrrdReadNrrdParse_labels, _nrrdReadNrrdParse_units, Index: axis.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/axis.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** axis.c 13 Mar 2004 20:03:10 -0000 1.6 --- axis.c 30 Mar 2004 19:25:09 -0000 1.7 *************** *** 24,28 **** void ! _nrrdAxisInfoInit(NrrdAxis *axis) { if (axis) { --- 24,28 ---- void ! _nrrdAxisInfoInit(NrrdAxisInfo *axis) { if (axis) { *************** *** 33,36 **** --- 33,37 ---- axis->unit = airFree(axis->unit); axis->center = nrrdCenterUnknown; + axis->kind = nrrdKindUnknown; } } *************** *** 40,44 **** nrrdAxisInfo *axis; ! axis = calloc(1, sizeof(NrrdAxis)); axis->label = NULL; axis->unit = NULL; --- 41,45 ---- nrrdAxisInfo *axis; ! axis = calloc(1, sizeof(NrrdAxisInfo)); axis->label = NULL; axis->unit = NULL; *************** *** 49,54 **** } ! NrrdAxis * ! nrrdAxisInfoNix(NrrdAxis *axis) { if (axis) { --- 50,55 ---- } ! NrrdAxisInfo * ! nrrdAxisInfoNix(NrrdAxisInfo *axis) { if (axis) { *************** *** 63,68 **** /* ------------------------------------------------------------ */ void ! _nrrdAxisInfoCopy(NrrdAxis *dest, const NrrdAxis *src, int bitflag) { if (!(NRRD_AXIS_INFO_SIZE_BIT & bitflag)) { --- 64,142 ---- /* ------------------------------------------------------------ */ + + /* + ******** nrrdKindSize + ** + ** returns suggested size (length) of an axis with the given kind, or, + ** 0 if there is no suggested size, or the kind was invalid + */ + int + nrrdKindSize(int kind) { + char me[]="nrrdKindSize"; + int ret; + + if (!( AIR_IN_OP(nrrdKindUnknown, kind, nrrdKindLast) )) { + /* they gave us invalid or unknown kind */ + return 0; + } + + switch (kind) { + case nrrdKindDomain: + case nrrdKindList: + ret = 0; + break; + case nrrdKindStub: + case nrrdKindScalar: + ret = 1; + break; + case nrrdKindComplex: + ret = 2; + break; + case nrrdKind3Color: + case nrrdKind3Vector: + case nrrdKind3Normal: + ret = 3; + break; + case nrrdKind4Color: + case nrrdKind4Vector: + ret = 4; + break; + case nrrdKind6Tensor: + ret = 6; + break; + case nrrdKind7Tensor: + ret = 7; + break; + case nrrdKind9Tensor: + case nrrdKind9Matrix: + ret = 9; + break; + default: + fprintf(stderr, "%s: PANIC: nrrdKind %d not implemented!\n", me, kind); + exit(1); + } + + return ret; + } + + int + _nrrdKindAltered(int kindIn) { + int kindOut; + + if (nrrdStateKindNoop) { + kindOut = nrrdKindUnknown; + } else { + if (nrrdKindDomain == kindIn + || nrrdKindList == kindIn) { + kindOut = kindIn; + } else { + kindOut = nrrdKindUnknown; + } + } + return kindOut; + } + void ! _nrrdAxisInfoCopy(NrrdAxisInfo *dest, const NrrdAxisInfo *src, int bitflag) { if (!(NRRD_AXIS_INFO_SIZE_BIT & bitflag)) { *************** *** 81,84 **** --- 155,161 ---- dest->center = src->center; } + if (!(NRRD_AXIS_INFO_KIND_BIT & bitflag)) { + dest->kind = src->kind; + } if (!(NRRD_AXIS_INFO_LABEL_BIT & bitflag)) { if (dest->label != src->label) { *************** *** 184,187 **** --- 261,267 ---- nrrd->axis[d].center = info.I[d]; break; + case nrrdAxisInfoKind: + nrrd->axis[d].kind = info.I[d]; + break; case nrrdAxisInfoLabel: nrrd->axis[d].label = airFree(nrrd->axis[d].label); *************** *** 226,229 **** --- 306,310 ---- break; case nrrdAxisInfoCenter: + case nrrdAxisInfoKind: info.I[d] = va_arg(ap, int); /* *************** *** 304,307 **** --- 385,391 ---- info.I[d] = nrrd->axis[d].center; break; + case nrrdAxisInfoKind: + info.I[d] = nrrd->axis[d].kind; + break; case nrrdAxisInfoLabel: /* note airStrdup()! */ *************** *** 351,354 **** --- 435,439 ---- break; case nrrdAxisInfoCenter: + case nrrdAxisInfoKind: *((int*)ptr) = info.I[d]; /* printf("!%s: got int[%d] = %d\n", *************** *** 405,409 **** /* ! ******** nrrdAxisPos() ** ** given a nrrd, an axis, and a (floating point) index space position, --- 490,494 ---- /* ! ******** nrrdAxisInfoPos() ** ** given a nrrd, an axis, and a (floating point) index space position, *************** *** 414,418 **** */ double ! nrrdAxisPos(const Nrrd *nrrd, int ax, double idx) { int center, size; double min, max; --- 499,503 ---- */ double ! nrrdAxisInfoPos(const Nrrd *nrrd, int ax, double idx) { int center, size; double min, max; *************** *** 430,434 **** /* ! ******** nrrdAxisIdx() ** ** given a nrrd, an axis, and a (floating point) world space position, --- 515,519 ---- /* ! ******** nrrdAxisInfoIdx() ** ** given a nrrd, an axis, and a (floating point) world space position, *************** *** 439,443 **** */ double ! nrrdAxisIdx(const Nrrd *nrrd, int ax, double pos) { int center, size; double min, max; --- 524,528 ---- */ double ! nrrdAxisInfoIdx(const Nrrd *nrrd, int ax, double pos) { int center, size; double min, max; *************** *** 455,459 **** /* ! ******** nrrdAxisPosRange() ** ** given a nrrd, an axis, and two (floating point) index space positions, --- 540,544 ---- /* ! ******** nrrdAxisInfoPosRange() ** ** given a nrrd, an axis, and two (floating point) index space positions, *************** *** 462,468 **** */ void ! nrrdAxisPosRange(double *loP, double *hiP, ! const Nrrd *nrrd, int ax, ! double loIdx, double hiIdx) { int center, size, flip = 0; double min, max, tmp; --- 547,553 ---- */ void ! nrrdAxisInfoPosRange(double *loP, double *hiP, ! const Nrrd *nrrd, int ax, ! double loIdx, double hiIdx) { int center, size, flip = 0; double min, max, tmp; *************** *** 496,500 **** /* ! ******** nrrdAxisIdxRange() ** ** given a nrrd, an axis, and two (floating point) world space positions, --- 581,585 ---- /* ! ******** nrrdAxisInfoIdxRange() ** ** given a nrrd, an axis, and two (floating point) world space positions, *************** *** 513,519 **** */ void ! nrrdAxisIdxRange(double *loP, double *hiP, ! const Nrrd *nrrd, int ax, ! double loPos, double hiPos) { int center, size, flip = 0; double min, max, tmp; --- 598,604 ---- */ void ! nrrdAxisInfoIdxRange(double *loP, double *hiP, ! const Nrrd *nrrd, int ax, ! double loPos, double hiPos) { int center, size, flip = 0; double min, max, tmp; *************** *** 552,556 **** void ! nrrdAxisSpacingSet(Nrrd *nrrd, int ax) { int sign; double min, max, tmp; --- 637,641 ---- void ! nrrdAxisInfoSpacingSet(Nrrd *nrrd, int ax) { int sign; double min, max, tmp; *************** *** 584,588 **** void ! nrrdAxisMinMaxSet(Nrrd *nrrd, int ax, int defCenter) { int center; double spacing; --- 669,673 ---- void ! nrrdAxisInfoMinMaxSet(Nrrd *nrrd, int ax, int defCenter) { int center; double spacing; Index: superset.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/superset.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** superset.c 7 Jan 2004 15:34:30 -0000 1.15 --- superset.c 30 Mar 2004 19:25:09 -0000 1.16 *************** *** 402,407 **** } for (d=0; d<dim; d++) { ! nrrdAxisPosRange(&(nout->axis[d].min), &(nout->axis[d].max), ! nin, d, min[d], max[d]); } strcpy(buff1, ""); --- 402,408 ---- } for (d=0; d<dim; d++) { ! nrrdAxisInfoPosRange(&(nout->axis[d].min), &(nout->axis[d].max), ! nin, d, min[d], max[d]); ! nout->axis[d].kind = _nrrdKindAltered(nin->axis[d].kind); } strcpy(buff1, ""); Index: resampleNrrd.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/resampleNrrd.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** resampleNrrd.c 13 Mar 2004 20:03:10 -0000 1.20 --- resampleNrrd.c 30 Mar 2004 19:25:09 -0000 1.21 *************** *** 81,85 **** /* set the min/max for this axis if not already set to something */ if (!( AIR_EXISTS(nin->axis[d].min) && AIR_EXISTS(nin->axis[d].max) )) ! nrrdAxisMinMaxSet(nin, d, nrrdDefCenter); info->min[d] = nin->axis[d].min; info->max[d] = nin->axis[d].max; --- 81,85 ---- /* set the min/max for this axis if not already set to something */ if (!( AIR_EXISTS(nin->axis[d].min) && AIR_EXISTS(nin->axis[d].max) )) ! nrrdAxisInfoMinMaxSet(nin, d, nrrdDefCenter); info->min[d] = nin->axis[d].min; info->max[d] = nin->axis[d].max; *************** *** 795,812 **** airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopOnError); nrrdAxisInfoCopy(nout, nin, NULL, ! (NRRD_AXIS_INFO_SIZE_BIT | ! NRRD_AXIS_INFO_MIN_BIT | ! NRRD_AXIS_INFO_MAX_BIT | ! NRRD_AXIS_INFO_SPACING_BIT)); for (d=0; d<dim; d++) { if (info->kernel[d]) { nout->axis[d].min = info->min[d]; nout->axis[d].max = info->max[d]; nout->axis[d].spacing = nin->axis[d].spacing/ratios[d]; } else { nout->axis[d].min = nin->axis[d].min; nout->axis[d].max = nin->axis[d].max; nout->axis[d].spacing = nin->axis[d].spacing; } } /* HEY: need to create textual representation of resampling parameters */ --- 795,819 ---- airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopOnError); nrrdAxisInfoCopy(nout, nin, NULL, ! (NRRD_AXIS_INFO_SIZE_BIT ! | NRRD_AXIS_INFO_MIN_BIT ! | NRRD_AXIS_INFO_MAX_BIT ! | NRRD_AXIS_INFO_SPACING_BIT ! | NRRD_AXIS_INFO_KIND_BIT)); for (d=0; d<dim; d++) { + fprintf(stderr, "%s: nin->axis[%d].kind = %s\n", me, d, + airEnumStr(nrrdKind, nin->axis[d].kind)); if (info->kernel[d]) { nout->axis[d].min = info->min[d]; nout->axis[d].max = info->max[d]; nout->axis[d].spacing = nin->axis[d].spacing/ratios[d]; + nout->axis[d].kind = _nrrdKindAltered(nin->axis[d].kind); } else { nout->axis[d].min = nin->axis[d].min; nout->axis[d].max = nin->axis[d].max; nout->axis[d].spacing = nin->axis[d].spacing; + nout->axis[d].kind = nin->axis[d].kind; } + fprintf(stderr, "%s: nout->axis[%d].kind = %s\n", me, d, + airEnumStr(nrrdKind, nout->axis[d].kind)); } /* HEY: need to create textual representation of resampling parameters */ Index: defaultsNrrd.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/defaultsNrrd.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** defaultsNrrd.c 7 Jan 2004 15:34:30 -0000 1.15 --- defaultsNrrd.c 30 Mar 2004 19:25:09 -0000 1.16 *************** *** 70,73 **** --- 70,74 ---- /* there is no sane reason to change this default initialization */ int nrrdStateKeyValueReturnInternalPointers = AIR_FALSE; + int nrrdStateKindNoop = AIR_TRUE; /* should the acceptance (or not) of malformed NRRD header fields *************** *** 99,102 **** --- 100,107 ---- int valI; + if ((envS = getenv("NRRD_STATE_KIND_NOOP")) + && (-1 != (valI = airEnumVal(airBool, envS)))) { + nrrdStateKindNoop = valI; + } if ((envS = getenv("NRRD_STATE_VERBOSE_IO")) && (-1 != (valI = airEnumVal(airBool, envS)))) { Index: enumsNrrd.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/enumsNrrd.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** enumsNrrd.c 30 Mar 2004 03:26:12 -0000 1.31 --- enumsNrrd.c 30 Mar 2004 19:25:09 -0000 1.32 *************** *** 270,273 **** --- 270,360 ---- nrrdCenter = &_nrrdCenter_enum; + /* ------------------------ nrrdKind ------------------------- */ + + + char + _nrrdKindStr[NRRD_KIND_MAX+1][AIR_STRLEN_SMALL] = { + "(unknown_kind)", + "domain", + "list", + "stub", + "scalar", + "complex", + "3-color", + "4-color", + "3-vector", + "3-normal", + "6-tensor", + "7-tensor", + "9-tensor", + "9-matrix" + }; + + char + _nrrdKindDesc[NRRD_KIND_MAX+1][AIR_STRLEN_MED] = { + "unknown kind", + "a domain variable of the function which the nrrd samples", + "a list of attributes; it makes no sense to resample along these", + "a place-holder axis with a single sample", + "axis used to indicate that the nrrd contains a scalar value", + "real and imaginary parts of a value", + "any 3-component color value", + "any 4-component color value", + "any 3-element vector", + "a 3-element vector which is assumed normalized", + "any 4-element vector", + "6 unique elements of a symmetric tensor", + "\"confidence\" plus 6 unique elements of a symmetric tensor", + "9 elements of a 3x3 tensor", + "9 elements of a 3x3 matrix" + }; + + char + _nrrdKindStr_Eqv[][AIR_STRLEN_SMALL] = { + "domain", + "list", + "stub", + "scalar", + "complex", + "3-color", "3color", + "4-color", "4color", + "3-vector", "3vector", + "3-normal", "3normal", + "6-tensor", "6tensor", + "7-tensor", "7tensor", + "9-tensor", "9tensor", + "9-matrix", "9matrix", + "" + }; + + int + _nrrdKindVal_Eqv[] = { + nrrdKindDomain, + nrrdKindList, + nrrdKindStub, + nrrdKindScalar, + nrrdKindComplex, + nrrdKind3Color, nrrdKind3Color, + nrrdKind4Color, nrrdKind4Color, + nrrdKind3Vector, nrrdKind3Vector, + nrrdKind3Normal, nrrdKind3Normal, + nrrdKind6Tensor, nrrdKind6Tensor, + nrrdKind7Tensor, nrrdKind7Tensor, + nrrdKind9Tensor, nrrdKind9Tensor, + nrrdKind9Matrix, nrrdKind9Matrix + }; + + airEnum + _nrrdKind_enum = { + "kind", + NRRD_KIND_MAX, + _nrrdKindStr, NULL, + _nrrdKindDesc, + _nrrdKindStr_Eqv, _nrrdKindVal_Eqv, + AIR_FALSE + }; + airEnum * + nrrdKind = &_nrrdKind_enum; + /* ------------------------ nrrdField ------------------------- */ *************** *** 286,289 **** --- 373,377 ---- "axis maxs", "centers", + "kinds", "labels", "units", *************** *** 314,317 **** --- 402,406 ---- "list of maximum positions associated with each axis", "list of sample centerings for each axis", + "list of kinds for each axis", "list of short descriptions for each axis", "list of units in which each axes' spacing is measured", *************** *** 341,344 **** --- 430,434 ---- "axis maxs", "axismaxs", "centers", + "kinds", "labels", "units", *************** *** 369,372 **** --- 459,463 ---- nrrdField_axis_maxs, nrrdField_axis_maxs, nrrdField_centers, + nrrdField_kinds, nrrdField_labels, nrrdField_units, Index: write.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/write.c,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** write.c 15 Mar 2004 03:07:41 -0000 1.89 --- write.c 30 Mar 2004 19:25:09 -0000 1.90 *************** *** 261,264 **** --- 261,269 ---- } break; + case nrrdField_kinds: + for (d=0; d<nrrd->dim; d++) { + ret |= (nrrdKindUnknown != nrrd->axis[d].kind); + } + break; case nrrdField_labels: for (d=0; d<nrrd->dim; d++) { *************** *** 414,417 **** --- 419,433 ---- } break; + case nrrdField_kinds: + *strP = malloc(fslen + D*10); + sprintf(*strP, "%s%s:", prefix, fs); + for (i=0; i<D; i++) { + sprintf(buff, " %s", + (nrrd->axis[i].kind + ? airEnumStr(nrrdKind, nrrd->axis[i].kind) + : NRRD_UNKNOWN)); + strcat(*strP, buff); + } + break; case nrrdField_labels: fdlen = 0; Index: privateNrrd.h =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/privateNrrd.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** privateNrrd.h 7 Jan 2004 15:34:30 -0000 1.30 --- privateNrrd.h 30 Mar 2004 19:25:09 -0000 1.31 *************** *** 107,113 **** /* axis.c */ ! extern void _nrrdAxisInfoCopy(NrrdAxis *dest, const NrrdAxis *src, int bitflag); ! extern void _nrrdAxisInfoInit(NrrdAxis *axis); extern int _nrrdCenter(int center); extern int _nrrdCenter2(int center, int def); --- 107,114 ---- /* axis.c */ ! extern int _nrrdKindAltered(int kindIn); ! extern void _nrrdAxisInfoCopy(NrrdAxisInfo *dest, const NrrdAxisInfo *src, int bitflag); ! extern void _nrrdAxisInfoInit(NrrdAxisInfo *axis); extern int _nrrdCenter(int center); extern int _nrrdCenter2(int center, int def); Index: formatNRRD.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/formatNRRD.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** formatNRRD.c 13 Mar 2004 20:03:10 -0000 1.6 --- formatNRRD.c 30 Mar 2004 19:25:09 -0000 1.7 *************** *** 24,27 **** --- 24,28 ---- #define MAGIC1 "NRRD0001" #define MAGIC2 "NRRD0002" + #define MAGIC3 "NRRD0003" int *************** *** 60,63 **** --- 61,65 ---- || !strcmp(MAGIC1, nio->line) || !strcmp(MAGIC2, nio->line) + || !strcmp(MAGIC3, nio->line) ); } *************** *** 330,337 **** } } ! ! /* currently, which magic we use depends only on whether there are ! key/value pairs */ ! fprintf(file, "%s\n", nrrdKeyValueSize(nrrd) ? MAGIC2 : MAGIC1); /* this is where the majority of the header printing happens */ --- 332,343 ---- } } ! ! /* we try to use the oldest format that will old the nrrd */ ! fprintf(file, "%s\n", ! (_nrrdFieldInteresting(nrrd, nio, nrrdField_kinds) ! ? MAGIC3 ! : (nrrdKeyValueSize(nrrd) ! ? MAGIC2 ! : MAGIC1))); /* this is where the majority of the header printing happens */ Index: formatEPS.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/formatEPS.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** formatEPS.c 7 Jan 2004 15:34:30 -0000 1.4 --- formatEPS.c 30 Mar 2004 19:25:09 -0000 1.5 *************** *** 161,164 **** --- 161,171 ---- fprintf(file, "%%%%Page: 1 1\n"); fprintf(file, "gsave\n"); + fprintf(file, "%g %g moveto\n", minX, minY); + fprintf(file, "%g %g lineto\n", maxX, minY); + fprintf(file, "%g %g lineto\n", maxX, maxY); + fprintf(file, "%g %g lineto\n", minX, maxY); + fprintf(file, "closepath\n"); + fprintf(file, "clip\n"); + fprintf(file, "gsave newpath\n"); fprintf(file, "%g %g translate\n", minX, minY); fprintf(file, "%g %g scale\n", sx*scale, sy*scale); *************** *** 172,175 **** --- 179,183 ---- fprintf(file, "\n"); fprintf(file, "grestore\n"); + fprintf(file, "grestore\n"); airMopError(mop); Index: histogram.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/histogram.c,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** histogram.c 13 Mar 2004 20:03:10 -0000 1.49 --- histogram.c 30 Mar 2004 19:25:09 -0000 1.50 *************** *** 140,143 **** --- 140,146 ---- nout->axis[0].label = airFree(nout->axis[0].label); nout->axis[0].label = airStrdup(nout->content); + if (!nrrdStateKindNoop) { + nout->axis[0].kind = nrrdKindDomain; + } airMopOkay(mop); *************** *** 253,257 **** if (!E) E |= nrrdCommentAdd(nout, cmt); sprintf(cmt, "max hits: %g, in bin %d, around value %g\n", ! maxhits, maxhitidx, nrrdAxisPos(nout, 0, maxhitidx)); if (!E) E |= nrrdCommentAdd(nout, cmt); if (!E) E |= nrrdContentSet(nout, func, nin, "%d", sy); --- 256,260 ---- if (!E) E |= nrrdCommentAdd(nout, cmt); sprintf(cmt, "max hits: %g, in bin %d, around value %g\n", ! maxhits, maxhitidx, nrrdAxisInfoPos(nout, 0, maxhitidx)); if (!E) E |= nrrdCommentAdd(nout, cmt); if (!E) E |= nrrdContentSet(nout, func, nin, "%d", sy); *************** *** 351,354 **** --- 354,360 ---- nout->axis[ax].label = NULL; } + if (!nrrdStateKindNoop) { + nout->axis[ax].kind = nrrdKindDomain; + } /* the skinny: we traverse the input samples in linear order, and *************** *** 492,495 **** --- 498,504 ---- nout->axis[d].max = range[d]->max; nout->axis[d].center = nrrdCenterCell; + if (!nrrdStateKindNoop) { + nout->axis[d].kind = nrrdKindDomain; + } if (nin[d]->content) { hadContent = 1; Index: nrrdEnums.h =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/nrrdEnums.h,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** nrrdEnums.h 30 Mar 2004 03:26:12 -0000 1.42 --- nrrdEnums.h 30 Mar 2004 19:25:09 -0000 1.43 *************** *** 61,65 **** nrrdFormatTypeUnknown, nrrdFormatTypeNRRD, /* 1: basic nrrd format (associated with any of ! the magics starting with "NRRD" */ nrrdFormatTypePNM, /* 2: PNM image */ nrrdFormatTypePNG, /* 3: PNG image */ --- 61,65 ---- nrrdFormatTypeUnknown, nrrdFormatTypeNRRD, /* 1: basic nrrd format (associated with any of ! the magics starting with "NRRD") */ nrrdFormatTypePNM, /* 2: PNM image */ nrrdFormatTypePNG, /* 3: PNG image */ *************** *** 173,176 **** --- 173,206 ---- /* + ******** nrrdKind enum + ** + ** The very cautious (and last?) step nrrd takes towards sementics. + ** + ** More of these may be added in the future, as when nrrd supports bricking. + ** + ** NB: The nrrdKindSize() function returns the suggested length for these. + */ + enum { + nrrdKindUnknown, + nrrdKindDomain, /* 1: "It makes sense to resample along here" */ + nrrdKindList, /* 2: "It makes NO sense to resample along here" */ + nrrdKindStub, /* 3: axis with one sample */ + nrrdKindScalar, /* 4: same as a stub */ + nrrdKindComplex, /* 5: real and imaginary components of a number */ + nrrdKind3Color, /* 6: ANY 3-component color value */ + nrrdKind4Color, /* 7: ANY 4-component color value */ + nrrdKind3Vector, /* 8: any 3-vector */ + nrrdKind3Normal, /* 9: 3-vectors which are assumed normalized */ + nrrdKind4Vector, /* 10: any 4-vector */ + nrrdKind6Tensor, /* 11: the 6 unique elements of a symmetric 3x3 tensor */ + nrrdKind7Tensor, /* 12: some scalar "confidence" or "valid" value, and + the 6 unique elements of a symmetric 3x3 tensor */ + nrrdKind9Tensor, /* 13: all 9 elements of a 3x3 tensor */ + nrrdKind9Matrix, /* 14: all 9 elements of a 3x3 matrix */ + nrrdKindLast + }; + #define NRRD_KIND_MAX 14 + + /* ******** nrrdAxisInfo enum ** *************** *** 189,200 **** nrrdAxisInfoCenter, /* 5: cell vs. node */ #define NRRD_AXIS_INFO_CENTER_BIT (1<<5) ! nrrdAxisInfoLabel, /* 6: string describing the axis */ ! #define NRRD_AXIS_INFO_LABEL_BIT (1<<6) ! nrrdAxisInfoUnit, /* 7: string identifying units */ ! #define NRRD_AXIS_INFO_UNIT_BIT (1<<7) nrrdAxisInfoLast }; ! #define NRRD_AXIS_INFO_MAX 7 ! #define NRRD_AXIS_INFO_ALL ((1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)) #define NRRD_AXIS_INFO_NONE 0 --- 219,233 ---- nrrdAxisInfoCenter, /* 5: cell vs. node */ #define NRRD_AXIS_INFO_CENTER_BIT (1<<5) ! nrrdAxisInfoKind, /* 6: from the nrrdKind* enum */ ! #define NRRD_AXIS_INFO_KIND_BIT (1<<6) ! nrrdAxisInfoLabel, /* 7: string describing the axis */ ! #define NRRD_AXIS_INFO_LABEL_BIT (1<<7) ! nrrdAxisInfoUnit, /* 8: string identifying units */ ! #define NRRD_AXIS_INFO_UNIT_BIT (1<<8) nrrdAxisInfoLast }; ! #define NRRD_AXIS_INFO_MAX 8 ! #define NRRD_AXIS_INFO_ALL \ ! ((1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)) #define NRRD_AXIS_INFO_NONE 0 *************** *** 227,245 **** nrrdField_axis_maxs, /* 10 */ nrrdField_centers, /* 11 */ ! nrrdField_labels, /* 12 */ ! nrrdField_units, /* 13 */ ! nrrdField_min, /* 14 */ ! nrrdField_max, /* 15 */ ! nrrdField_old_min, /* 16 */ ! nrrdField_old_max, /* 17 */ ! nrrdField_data_file, /* 18 */ ! nrrdField_endian, /* 19 */ ! nrrdField_encoding, /* 20 */ ! nrrdField_line_skip, /* 21 */ ! nrrdField_byte_skip, /* 22 */ ! nrrdField_keyvalue, /* 23 */ nrrdField_last }; ! #define NRRD_FIELD_MAX 23 /* --- 260,279 ---- nrrdField_axis_maxs, /* 10 */ nrrdField_centers, /* 11 */ ! nrrdField_kinds, /* 12 */ ! nrrdField_labels, /* 13 */ ! nrrdField_units, /* 14 */ ! nrrdField_min, /* 15 */ ! nrrdField_max, /* 16 */ ! nrrdField_old_min, /* 17 */ ! nrrdField_old_max, /* 18 */ ! nrrdField_data_file, /* 19 */ ! nrrdField_endian, /* 20 */ ! nrrdField_encoding, /* 21 */ ! nrrdField_line_skip, /* 22 */ ! nrrdField_byte_skip, /* 23 */ ! nrrdField_keyvalue, /* 24 */ nrrdField_last }; ! #define NRRD_FIELD_MAX 24 /* Index: nrrd.h =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/nrrd.h,v retrieving revision 1.136 retrieving revision 1.137 diff -C2 -d -r1.136 -r1.137 *** nrrd.h 30 Mar 2004 03:26:12 -0000 1.136 --- nrrd.h 30 Mar 2004 19:25:09 -0000 1.137 *************** *** 70,77 **** spacing) should be taken to be significant at any time. */ ! int center; /* cell vs. node centering */ char *label; /* short info string for each axis */ char *unit; /* short string for identifying units */ ! } NrrdAxis; /* --- 70,80 ---- spacing) should be taken to be significant at any time. */ ! int center; /* cell vs. node centering (value should be ! one of nrrdCenter{Unknown,Node,Cell} */ ! int kind; /* what kind of information is along this ! axis (from the nrrdKind* enum) */ char *label; /* short info string for each axis */ char *unit; /* short string for identifying units */ ! } NrrdAxisInfo; /* *************** *** 86,101 **** ** or at the time that the nrrd is wrapped around an existing array */ ! void *data; /* the data in memory */ ! int type; /* a value from the nrrdType enum */ ! int dim; /* what is dimension of data */ /* ** All per-axis specific information */ ! NrrdAxis axis[NRRD_DIM_MAX]; /* axis[0] is the fastest axis in the scan- ! line ordering, the one who's coordinates ! change the fastest as the elements are ! accessed in the order in which they appear ! in memory */ /* --- 89,104 ---- ** or at the time that the nrrd is wrapped around an existing array */ ! void *data; /* the data in memory */ ! int type; /* a value from the nrrdType enum */ ! int dim; /* what is dimension of data */ /* ** All per-axis specific information */ ! NrrdAxisInfo axis[NRRD_DIM_MAX]; /* axis[0] is the fastest axis in the scan- ! line ordering, the one who's coordinates ! change the fastest as the elements are ! accessed in the order in which they ! appear in memory */ /* *************** *** 104,114 **** ** enough to be part of the basic nrrd type */ ! char *content; /* briefly, just what the hell is this data */ ! int blockSize; /* for nrrdTypeBlock array, block byte size */ ! double oldMin, oldMax; /* if non-NaN, and if nrrd is of integral ! type, extremal values for the array ! BEFORE it was quantized */ ! void *ptr; /* never read or set by nrrd; use/abuse ! as you see fit */ /* --- 107,117 ---- ** enough to be part of the basic nrrd type */ ! char *content; /* brief account of what this data is */ ! int blockSize; /* for nrrdTypeBlock:, block byte size */ ! double oldMin, oldMax; /* if non-NaN, and if nrrd is of integral ! type, extremal values for the array ! BEFORE it was quantized */ ! void *ptr; /* never read or set by nrrd; use/abuse ! as you see fit */ /* *************** *** 447,450 **** --- 450,454 ---- TEEM_API int nrrdStateGrayscaleImage3D; TEEM_API int nrrdStateKeyValueReturnInternalPointers; + TEEM_API int nrrdStateKindNoop; /* ---- BEGIN non-NrrdIO */ TEEM_API void nrrdDefGetenv(void); *************** *** 459,462 **** --- 463,467 ---- TEEM_API airEnum *nrrdEncodingType; TEEM_API airEnum *nrrdCenter; + TEEM_API airEnum *nrrdKind; TEEM_API airEnum *nrrdField; /* ---- BEGIN non-NrrdIO */ *************** *** 516,519 **** --- 521,525 ---- /******** axis info related */ /* axis.c */ + TEEM_API int nrrdKindSize(int kind); TEEM_API int nrrdAxisInfoCopy(Nrrd *nout, const Nrrd *nin, const int *axmap, int bitflag); *************** *** 524,537 **** TEEM_API void nrrdAxisInfoGet(const Nrrd *nrrd, int axInfo, ... /* void* */); ! TEEM_API double nrrdAxisPos(const Nrrd *nrrd, int ax, double idx); ! TEEM_API double nrrdAxisIdx(const Nrrd *nrrd, int ax, double pos); ! TEEM_API void nrrdAxisPosRange(double *loP, double *hiP, ! const Nrrd *nrrd, int ax, ! double loIdx, double hiIdx); ! TEEM_API void nrrdAxisIdxRange(double *loP, double *hiP, ! const Nrrd *nrrd, int ax, ! double loPos, double hiPos); ! TEEM_API void nrrdAxisSpacingSet(Nrrd *nrrd, int ax); ! TEEM_API void nrrdAxisMinMaxSet(Nrrd *nrrd, int ax, int defCenter); /******** simple things */ --- 530,543 ---- TEEM_API void nrrdAxisInfoGet(const Nrrd *nrrd, int axInfo, ... /* void* */); ! TEEM_API double nrrdAxisInfoPos(const Nrrd *nrrd, int ax, double idx); ! TEEM_API double nrrdAxisInfoIdx(const Nrrd *nrrd, int ax, double pos); ! TEEM_API void nrrdAxisInfoPosRange(double *loP, double *hiP, ! const Nrrd *nrrd, int ax, ! double loIdx, double hiIdx); ! TEEM_API void nrrdAxisInfoIdxRange(double *loP, double *hiP, ! const Nrrd *nrrd, int ax, ! double loPos, double hiPos); ! TEEM_API void nrrdAxisInfoSpacingSet(Nrrd *nrrd, int ax); ! TEEM_API void nrrdAxisInfoMinMaxSet(Nrrd *nrrd, int ax, int defCenter); /******** simple things */ Index: subset.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/subset.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** subset.c 7 Jan 2004 15:34:30 -0000 1.39 --- subset.c 30 Mar 2004 19:25:09 -0000 1.40 *************** *** 292,297 **** } for (d=0; d<nin->dim; d++) { ! nrrdAxisPosRange(&(nout->axis[d].min), &(nout->axis[d].max), ! nin, d, min[d], max[d]); } strcpy(buff1, ""); --- 292,298 ---- } for (d=0; d<nin->dim; d++) { ! nrrdAxisInfoPosRange(&(nout->axis[d].min), &(nout->axis[d].max), ! nin, d, min[d], max[d]); ! nout->axis[d].kind = _nrrdKindAltered(nin->axis[d].kind); } strcpy(buff1, ""); |
|
From: Gordon K. <kin...@us...> - 2004-03-30 19:37:23
|
Update of /cvsroot/teem/teem/src/nrrd/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6688/nrrd/test Modified Files: ax.c genvol.c quadvol.c Log Message: Two major changes, which were done simultaneously: 1) Some renamings related to NrrdAxis, nrrdAxisInfo, and so on 2) Addition of the nrrdKind information to the NrrdAxisInfo struct In detail: 1) Some renamings related to NrrdAxis, nrrdAxisInfo, and so on: struct: NrrdAxis --> NrrdAxisInfo (NB: Nrrd struct still has field "axis") functions: nrrdAxisPos() --> nrrdAxisInfoPos() nrrdAxisIdx() --> nrrdAxisInfoIdx() nrrdAxisPosRange() --> nrrdAxisInfoPosRange() nrrdAxisIdxRange() --> nrrdAxisInfoIdxRange() nrrdAxisSpacingSet() --> nrrdAxisInfoSpacingSet() nrrdAxisMinMaxSet() --> nrrdAxisInfoMinMaxSet() Now, ANYTHING having to do with setting, getting, or manipulating the meta-information about the axes starts with "nrrdAxisInfo". The single exception to this is that the Nrrd struct's "axis" field was not renamed to "axisInfo", since this seemed more annoying that it was worth. Also, (this isn't new) ANYTHING having to do the set of axes, the shape of the array, or the per-axis ordering of samples, starts with "nrrdAxes". The nrrdAxes functions are NOT merely for manipulating the per-axis meta information-- something about the array as a whole, or the set of axes as a whole, is changing. Yes, this means that there's a function called "nrrdAxesInsert", even though it only inserts a single axis, but I figured the consistency generated by strict adherence to the nrrdAxes and nrrdAxisInfo prefixes would be better in the long run. 2) Addition of the nrrdKind information to the NrrdAxisInfo struct This is nrrd's latest and probably most dangerous step towards putting real semantic information in the array representation (that is, the "nearly raw" philosophy is getting stretched). The best way to think about this is that its a *hint*: an extra bit of information, kind of like the label or the unit, that you may want to associated with the axis, and which has a sufficiently general nature to warrent direct representation. So, new to the (newly renamed) NrrdAxisInfo struct: int kind; /* what kind of information is along this axis (from the nrrdKind* enum) */ Accordingly, there is change to the file format, which of course means that the magic is once again incremented. If you write a nrrd with known kinds on any axis, the magic will be "NRRD0003". The new kinds field looks like (for-example) kinds: 3-color domain domain for an RGB image. Like other per-axis fields, its specification is plural (its "kinds:", not "kind:"), and like centering, you use "???" to mean, "I don't know", for example: kinds: ??? domain domain To make this hint more useful, there's a new function nrrdKindSize() which returns what nrrd thinks is the suggested axis size for the different nrrdKind's. This function will return 0 to indicate "I have no advice for you on how big this axis should be". The reason for using 0 instead of -1 is that someday nrrd may change the axis size type from int to unsigned int. To offer some control of the nrrdKind behavior, there is a new global "state" variable: nrrdStateKindNoop. Currently, this is AIR_TRUE by defaul. You can set it to AIR_FALSE to enable some minimal cleverness on the part of nrrd. The nature of that minimal cleverness is almost certainly likely to change with time. Due to the nature of nrrdAxisInfoCopy, anything which doesn't explicitly ask the axis information NOT to be copied, will have it be copied. For example, nrrdSlice will propogate through the kinds on the axes that it didn't touch, same with nrrdAxesPermute, and the like. Regardless of NrrdKindStateNoop, the output of these functions will set nrrdKindUnknown on all the axes that experienced a non-trivial change: nrrdAxesSplit, nrrdAxesMerge, nrrdReshape, nrrdReshape_nva, nrrdUnblock, nrrdJoin, nrrdApply1DLut, nrrdApply1DRegMap, and nrrdApply1DIrregMap. These functions respect nrrdKindStateNoop: nrrdCrop, nrrdPad, nrrdShuffle, nrrdFlip, nrrdSpatialResample: if (nrrdKindStateNoop) { If the axis operated on was not a nrrdKindDomain or nrrdKindList, the resulting kind is nrrdKindUnknown Else, the resulting kind is the same as the input kind. This is implemented through _nrrdKindAltered() } else { output kind is a copy of the input kind } nrrdHisto, nrrdHistoAxis, nrrdHistoJoint: if (nrrdKindStateNoop) { histogram axes are nrrdKindDomain } else { histogram axes are nrrdKindUnknown } nrrdAxisInsert: if (nrrdKindStateNoop) { new axis is nrrdKindStub } else { new axis is nrrdKindUnknown } For the record, this is what this change entailed: added: - global int nrrdStateKindNoop - nrrdKindSize() - airEnum *nrrdKind (maps between strings like "3color" and nrrdKind* values) - NRRD_KIND_MAX #define augmented: - NrrdAxisInfo struct (now has "kind" field) - _nrrdFieldInteresting(), _nrrdSprintFieldInfo(), _nrrdFormatNRRD_write() with things relating to new field ("kinds:") and magic ("NRRD0003") - _nrrdReadNrrdParseInfo[] parser callback, with new _nrrdReadNrrdParse_kinds() - airEnum *nrrdField - nrrdAxisInfo C enum (for passing to nrrdAxisInfo{Set,Get}) - nrrdField* C enum - nrrdStateGetenv(): looks for NRRD_STATE_KIND_NOOP" environment variable One annoying bit: I didn't add a new flag to "unu make" to learn the axis kinds because I *can't*. This is a basic limitation in hest which is gotten pretty annoying: there is direct way to see if an option was given on the command line or not. Every option has to have a value supplied, either via the command-line or via the default value string, but once its all been parsed, you don't know where it came from, and nor can you tell hest "this option is really really optional, there is no default, and its okay if the user never gives you a value." This will only be fixed with a hest re-write. Index: quadvol.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/test/quadvol.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** quadvol.c 7 Jan 2004 15:34:31 -0000 1.4 --- quadvol.c 30 Mar 2004 19:25:12 -0000 1.5 *************** *** 85,91 **** nrrdAxisInfoSet(nout, nrrdAxisInfoMin, min[0], min[1], min[2]); nrrdAxisInfoSet(nout, nrrdAxisInfoMax, max[0], max[1], max[2]); ! nrrdAxisSpacingSet(nout, 0); ! nrrdAxisSpacingSet(nout, 1); ! nrrdAxisSpacingSet(nout, 2); if (nrrdSave(out, nout, NULL)) { airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways); --- 85,91 ---- nrrdAxisInfoSet(nout, nrrdAxisInfoMin, min[0], min[1], min[2]); nrrdAxisInfoSet(nout, nrrdAxisInfoMax, max[0], max[1], max[2]); ! nrrdAxisInfoSpacingSet(nout, 0); ! nrrdAxisInfoSpacingSet(nout, 1); ! nrrdAxisInfoSpacingSet(nout, 2); if (nrrdSave(out, nout, NULL)) { airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways); Index: genvol.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/test/genvol.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** genvol.c 19 Feb 2004 06:45:13 -0000 1.14 --- genvol.c 30 Mar 2004 19:25:12 -0000 1.15 *************** *** 115,121 **** nrrdAxisInfoSet(nout, nrrdAxisInfoCenter, nrrdCenterNode, nrrdCenterNode, nrrdCenterNode); ! nrrdAxisSpacingSet(nout, 0); ! nrrdAxisSpacingSet(nout, 1); ! nrrdAxisSpacingSet(nout, 2); if (nrrdSave(out, nout, NULL)) { airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways); --- 115,121 ---- nrrdAxisInfoSet(nout, nrrdAxisInfoCenter, nrrdCenterNode, nrrdCenterNode, nrrdCenterNode); ! nrrdAxisInfoSpacingSet(nout, 0); ! nrrdAxisInfoSpacingSet(nout, 1); ! nrrdAxisInfoSpacingSet(nout, 2); if (nrrdSave(out, nout, NULL)) { airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways); Index: ax.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/test/ax.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ax.c 7 Jan 2004 15:34:31 -0000 1.8 --- ax.c 30 Mar 2004 19:25:12 -0000 1.9 *************** *** 42,78 **** idx = 0; printf("\n"); ! pos = nrrdAxisPos(nrrd, 0, idx); printf("pos(0, %g) == %g --> %g\n", ! idx, pos, nrrdAxisIdx(nrrd, 0, pos)); ! pos = nrrdAxisPos(nrrd, 1, idx); printf("pos(1, %g) == %g --> %g\n", ! idx, pos, nrrdAxisIdx(nrrd, 1, pos)); idx = 1; printf("\n"); ! pos = nrrdAxisPos(nrrd, 0, idx); printf("pos(0, %g) == %g --> %g\n", ! idx, pos, nrrdAxisIdx(nrrd, 0, pos)); ! pos = nrrdAxisPos(nrrd, 1, idx); printf("pos(1, %g) == %g --> %g\n", ! idx, pos, nrrdAxisIdx(nrrd, 1, pos)); idx = 2; printf("\n"); ! pos = nrrdAxisPos(nrrd, 0, idx); printf("pos(0, %g) == %g --> %g\n", ! idx, pos, nrrdAxisIdx(nrrd, 0, pos)); ! pos = nrrdAxisPos(nrrd, 1, idx); printf("pos(1, %g) == %g --> %g\n", ! idx, pos, nrrdAxisIdx(nrrd, 1, pos)); idx = 0; idx2 = 0; printf("\n"); ! nrrdAxisPosRange(&lo, &hi, nrrd, 0, idx, idx2); ! nrrdAxisIdxRange(&idx3, &idx4, nrrd, 0, lo, hi); printf("range(0, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); ! nrrdAxisPosRange(&lo, &hi, nrrd, 1, idx, idx2); ! nrrdAxisIdxRange(&idx3, &idx4, nrrd, 1, lo, hi); printf("range(1, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); --- 42,78 ---- idx = 0; printf("\n"); ! pos = nrrdAxisInfoPos(nrrd, 0, idx); printf("pos(0, %g) == %g --> %g\n", ! idx, pos, nrrdAxisInfoIdx(nrrd, 0, pos)); ! pos = nrrdAxisInfoPos(nrrd, 1, idx); printf("pos(1, %g) == %g --> %g\n", ! idx, pos, nrrdAxisInfoIdx(nrrd, 1, pos)); idx = 1; printf("\n"); ! pos = nrrdAxisInfoPos(nrrd, 0, idx); printf("pos(0, %g) == %g --> %g\n", ! idx, pos, nrrdAxisInfoIdx(nrrd, 0, pos)); ! pos = nrrdAxisInfoPos(nrrd, 1, idx); printf("pos(1, %g) == %g --> %g\n", ! idx, pos, nrrdAxisInfoIdx(nrrd, 1, pos)); idx = 2; printf("\n"); ! pos = nrrdAxisInfoPos(nrrd, 0, idx); printf("pos(0, %g) == %g --> %g\n", ! idx, pos, nrrdAxisInfoIdx(nrrd, 0, pos)); ! pos = nrrdAxisInfoPos(nrrd, 1, idx); printf("pos(1, %g) == %g --> %g\n", ! idx, pos, nrrdAxisInfoIdx(nrrd, 1, pos)); idx = 0; idx2 = 0; printf("\n"); ! nrrdAxisInfoPosRange(&lo, &hi, nrrd, 0, idx, idx2); ! nrrdAxisInfoIdxRange(&idx3, &idx4, nrrd, 0, lo, hi); printf("range(0, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); ! nrrdAxisInfoPosRange(&lo, &hi, nrrd, 1, idx, idx2); ! nrrdAxisInfoIdxRange(&idx3, &idx4, nrrd, 1, lo, hi); printf("range(1, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); *************** *** 80,89 **** idx = 0; idx2 = 1; printf("\n"); ! nrrdAxisPosRange(&lo, &hi, nrrd, 0, idx, idx2); ! nrrdAxisIdxRange(&idx3, &idx4, nrrd, 0, lo, hi); printf("range(0, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); ! nrrdAxisPosRange(&lo, &hi, nrrd, 1, idx, idx2); ! nrrdAxisIdxRange(&idx3, &idx4, nrrd, 1, lo, hi); printf("range(1, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); --- 80,89 ---- idx = 0; idx2 = 1; printf("\n"); ! nrrdAxisInfoPosRange(&lo, &hi, nrrd, 0, idx, idx2); ! nrrdAxisInfoIdxRange(&idx3, &idx4, nrrd, 0, lo, hi); printf("range(0, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); ! nrrdAxisInfoPosRange(&lo, &hi, nrrd, 1, idx, idx2); ! nrrdAxisInfoIdxRange(&idx3, &idx4, nrrd, 1, lo, hi); printf("range(1, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); *************** *** 91,100 **** idx = 1; idx2 = 0; printf("\n"); ! nrrdAxisPosRange(&lo, &hi, nrrd, 0, idx, idx2); ! nrrdAxisIdxRange(&idx3, &idx4, nrrd, 0, lo, hi); printf("range(0, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); ! nrrdAxisPosRange(&lo, &hi, nrrd, 1, idx, idx2); ! nrrdAxisIdxRange(&idx3, &idx4, nrrd, 1, lo, hi); printf("range(1, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); --- 91,100 ---- idx = 1; idx2 = 0; printf("\n"); ! nrrdAxisInfoPosRange(&lo, &hi, nrrd, 0, idx, idx2); ! nrrdAxisInfoIdxRange(&idx3, &idx4, nrrd, 0, lo, hi); printf("range(0, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); ! nrrdAxisInfoPosRange(&lo, &hi, nrrd, 1, idx, idx2); ! nrrdAxisInfoIdxRange(&idx3, &idx4, nrrd, 1, lo, hi); printf("range(1, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); *************** *** 106,142 **** idx = 0; printf("\n"); ! pos = nrrdAxisPos(nrrd, 0, idx); printf("pos(0, %g) == %g --> %g\n", ! idx, pos, nrrdAxisIdx(nrrd, 0, pos)); ! pos = nrrdAxisPos(nrrd, 1, idx); printf("pos(1, %g) == %g --> %g\n", ! idx, pos, nrrdAxisIdx(nrrd, 1, pos)); idx = 1; printf("\n"); ! pos = nrrdAxisPos(nrrd, 0, idx); printf("pos(0, %g) == %g --> %g\n", ! idx, pos, nrrdAxisIdx(nrrd, 0, pos)); ! pos = nrrdAxisPos(nrrd, 1, idx); printf("pos(1, %g) == %g --> %g\n", ! idx, pos, nrrdAxisIdx(nrrd, 1, pos)); idx = 2; printf("\n"); ! pos = nrrdAxisPos(nrrd, 0, idx); printf("pos(0, %g) == %g --> %g\n", ! idx, pos, nrrdAxisIdx(nrrd, 0, pos)); ! pos = nrrdAxisPos(nrrd, 1, idx); printf("pos(1, %g) == %g --> %g\n", ! idx, pos, nrrdAxisIdx(nrrd, 1, pos)); idx = 0; idx2 = 0; printf("\n"); ! nrrdAxisPosRange(&lo, &hi, nrrd, 0, idx, idx2); ! nrrdAxisIdxRange(&idx3, &idx4, nrrd, 0, lo, hi); printf("range(0, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); ! nrrdAxisPosRange(&lo, &hi, nrrd, 1, idx, idx2); ! nrrdAxisIdxRange(&idx3, &idx4, nrrd, 1, lo, hi); printf("range(1, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); --- 106,142 ---- idx = 0; printf("\n"); ! pos = nrrdAxisInfoPos(nrrd, 0, idx); printf("pos(0, %g) == %g --> %g\n", ! idx, pos, nrrdAxisInfoIdx(nrrd, 0, pos)); ! pos = nrrdAxisInfoPos(nrrd, 1, idx); printf("pos(1, %g) == %g --> %g\n", ! idx, pos, nrrdAxisInfoIdx(nrrd, 1, pos)); idx = 1; printf("\n"); ! pos = nrrdAxisInfoPos(nrrd, 0, idx); printf("pos(0, %g) == %g --> %g\n", ! idx, pos, nrrdAxisInfoIdx(nrrd, 0, pos)); ! pos = nrrdAxisInfoPos(nrrd, 1, idx); printf("pos(1, %g) == %g --> %g\n", ! idx, pos, nrrdAxisInfoIdx(nrrd, 1, pos)); idx = 2; printf("\n"); ! pos = nrrdAxisInfoPos(nrrd, 0, idx); printf("pos(0, %g) == %g --> %g\n", ! idx, pos, nrrdAxisInfoIdx(nrrd, 0, pos)); ! pos = nrrdAxisInfoPos(nrrd, 1, idx); printf("pos(1, %g) == %g --> %g\n", ! idx, pos, nrrdAxisInfoIdx(nrrd, 1, pos)); idx = 0; idx2 = 0; printf("\n"); ! nrrdAxisInfoPosRange(&lo, &hi, nrrd, 0, idx, idx2); ! nrrdAxisInfoIdxRange(&idx3, &idx4, nrrd, 0, lo, hi); printf("range(0, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); ! nrrdAxisInfoPosRange(&lo, &hi, nrrd, 1, idx, idx2); ! nrrdAxisInfoIdxRange(&idx3, &idx4, nrrd, 1, lo, hi); printf("range(1, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); *************** *** 144,153 **** idx = 0; idx2 = 2; printf("\n"); ! nrrdAxisPosRange(&lo, &hi, nrrd, 0, idx, idx2); ! nrrdAxisIdxRange(&idx3, &idx4, nrrd, 0, lo, hi); printf("range(0, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); ! nrrdAxisPosRange(&lo, &hi, nrrd, 1, idx, idx2); ! nrrdAxisIdxRange(&idx3, &idx4, nrrd, 1, lo, hi); printf("range(1, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); --- 144,153 ---- idx = 0; idx2 = 2; printf("\n"); ! nrrdAxisInfoPosRange(&lo, &hi, nrrd, 0, idx, idx2); ! nrrdAxisInfoIdxRange(&idx3, &idx4, nrrd, 0, lo, hi); printf("range(0, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); ! nrrdAxisInfoPosRange(&lo, &hi, nrrd, 1, idx, idx2); ! nrrdAxisInfoIdxRange(&idx3, &idx4, nrrd, 1, lo, hi); printf("range(1, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); *************** *** 155,164 **** idx = 2; idx2 = 0; printf("\n"); ! nrrdAxisPosRange(&lo, &hi, nrrd, 0, idx, idx2); ! nrrdAxisIdxRange(&idx3, &idx4, nrrd, 0, lo, hi); printf("range(0, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); ! nrrdAxisPosRange(&lo, &hi, nrrd, 1, idx, idx2); ! nrrdAxisIdxRange(&idx3, &idx4, nrrd, 1, lo, hi); printf("range(1, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); --- 155,164 ---- idx = 2; idx2 = 0; printf("\n"); ! nrrdAxisInfoPosRange(&lo, &hi, nrrd, 0, idx, idx2); ! nrrdAxisInfoIdxRange(&idx3, &idx4, nrrd, 0, lo, hi); printf("range(0, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); ! nrrdAxisInfoPosRange(&lo, &hi, nrrd, 1, idx, idx2); ! nrrdAxisInfoIdxRange(&idx3, &idx4, nrrd, 1, lo, hi); printf("range(1, %g -- %g) == (%g -- %g) --> (%g -- %g)\n", idx, idx2, lo, hi, idx3, idx4); *************** *** 170,175 **** pos = 0; pos2 = 1; ! nrrdAxisIdxRange(&idx, &idx2, nrrd, 0, pos, pos2); ! nrrdAxisPosRange(&pos3, &pos4, nrrd, 0, idx, idx2); printf("min, max = %g, %g\n", nrrd->axis[0].min, nrrd->axis[0].max); printf("pos, pos2 = %g, %g\n", pos, pos2); --- 170,175 ---- pos = 0; pos2 = 1; ! nrrdAxisInfoIdxRange(&idx, &idx2, nrrd, 0, pos, pos2); ! nrrdAxisInfoPosRange(&pos3, &pos4, nrrd, 0, idx, idx2); printf("min, max = %g, %g\n", nrrd->axis[0].min, nrrd->axis[0].max); printf("pos, pos2 = %g, %g\n", pos, pos2); *************** *** 187,196 **** nrrd->axis[0].max = frand(-3.0, 3.0); idx = frand(-3.0, 3.0); ! pos = nrrdAxisPos(nrrd, 0, idx); ! diff = idx - nrrdAxisIdx(nrrd, 0, pos); if (AIR_ABS(diff) > 0.00000001) { printf("PANIC 0\n"); exit(2); } pos = frand(-3.0, 3.0); ! idx = nrrdAxisIdx(nrrd, 0, pos); ! diff = pos - nrrdAxisPos(nrrd, 0, idx); if (AIR_ABS(diff) > 0.00000001) { printf("PANIC 1\n"); exit(2); } --- 187,196 ---- nrrd->axis[0].max = frand(-3.0, 3.0); idx = frand(-3.0, 3.0); ! pos = nrrdAxisInfoPos(nrrd, 0, idx); ! diff = idx - nrrdAxisInfoIdx(nrrd, 0, pos); if (AIR_ABS(diff) > 0.00000001) { printf("PANIC 0\n"); exit(2); } pos = frand(-3.0, 3.0); ! idx = nrrdAxisInfoIdx(nrrd, 0, pos); ! diff = pos - nrrdAxisInfoPos(nrrd, 0, idx); if (AIR_ABS(diff) > 0.00000001) { printf("PANIC 1\n"); exit(2); } *************** *** 199,210 **** idx = (int)frand(-10.0, 10.0); idx2 = (int)frand(-10.0, 10.0); ! nrrdAxisPosRange(&pos, &pos2, nrrd, 0, idx, idx2); ! nrrdAxisIdxRange(&idx3, &idx4, nrrd, 0, pos, pos2); diff = AIR_ABS(idx - idx3) + AIR_ABS(idx2 - idx4); if (AIR_ABS(diff) > 0.00000001) { printf("PANIC 2\n"); exit(2); } pos = (int)frand(-3.0, 3.0); pos2 = (int)frand(-3.0, 3.0); ! nrrdAxisIdxRange(&idx, &idx2, nrrd, 0, pos, pos2); ! nrrdAxisPosRange(&pos3, &pos4, nrrd, 0, idx, idx2); diff = AIR_ABS(pos - pos3) + AIR_ABS(pos2 - pos4); if (AIR_ABS(diff) > 0.00000001) { --- 199,210 ---- idx = (int)frand(-10.0, 10.0); idx2 = (int)frand(-10.0, 10.0); ! nrrdAxisInfoPosRange(&pos, &pos2, nrrd, 0, idx, idx2); ! nrrdAxisInfoIdxRange(&idx3, &idx4, nrrd, 0, pos, pos2); diff = AIR_ABS(idx - idx3) + AIR_ABS(idx2 - idx4); if (AIR_ABS(diff) > 0.00000001) { printf("PANIC 2\n"); exit(2); } pos = (int)frand(-3.0, 3.0); pos2 = (int)frand(-3.0, 3.0); ! nrrdAxisInfoIdxRange(&idx, &idx2, nrrd, 0, pos, pos2); ! nrrdAxisInfoPosRange(&pos3, &pos4, nrrd, 0, idx, idx2); diff = AIR_ABS(pos - pos3) + AIR_ABS(pos2 - pos4); if (AIR_ABS(diff) > 0.00000001) { |
|
From: Gordon K. <kin...@us...> - 2004-03-30 19:37:20
|
Update of /cvsroot/teem/teem/src/gage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6688/gage Modified Files: shape.c Log Message: Two major changes, which were done simultaneously: 1) Some renamings related to NrrdAxis, nrrdAxisInfo, and so on 2) Addition of the nrrdKind information to the NrrdAxisInfo struct In detail: 1) Some renamings related to NrrdAxis, nrrdAxisInfo, and so on: struct: NrrdAxis --> NrrdAxisInfo (NB: Nrrd struct still has field "axis") functions: nrrdAxisPos() --> nrrdAxisInfoPos() nrrdAxisIdx() --> nrrdAxisInfoIdx() nrrdAxisPosRange() --> nrrdAxisInfoPosRange() nrrdAxisIdxRange() --> nrrdAxisInfoIdxRange() nrrdAxisSpacingSet() --> nrrdAxisInfoSpacingSet() nrrdAxisMinMaxSet() --> nrrdAxisInfoMinMaxSet() Now, ANYTHING having to do with setting, getting, or manipulating the meta-information about the axes starts with "nrrdAxisInfo". The single exception to this is that the Nrrd struct's "axis" field was not renamed to "axisInfo", since this seemed more annoying that it was worth. Also, (this isn't new) ANYTHING having to do the set of axes, the shape of the array, or the per-axis ordering of samples, starts with "nrrdAxes". The nrrdAxes functions are NOT merely for manipulating the per-axis meta information-- something about the array as a whole, or the set of axes as a whole, is changing. Yes, this means that there's a function called "nrrdAxesInsert", even though it only inserts a single axis, but I figured the consistency generated by strict adherence to the nrrdAxes and nrrdAxisInfo prefixes would be better in the long run. 2) Addition of the nrrdKind information to the NrrdAxisInfo struct This is nrrd's latest and probably most dangerous step towards putting real semantic information in the array representation (that is, the "nearly raw" philosophy is getting stretched). The best way to think about this is that its a *hint*: an extra bit of information, kind of like the label or the unit, that you may want to associated with the axis, and which has a sufficiently general nature to warrent direct representation. So, new to the (newly renamed) NrrdAxisInfo struct: int kind; /* what kind of information is along this axis (from the nrrdKind* enum) */ Accordingly, there is change to the file format, which of course means that the magic is once again incremented. If you write a nrrd with known kinds on any axis, the magic will be "NRRD0003". The new kinds field looks like (for-example) kinds: 3-color domain domain for an RGB image. Like other per-axis fields, its specification is plural (its "kinds:", not "kind:"), and like centering, you use "???" to mean, "I don't know", for example: kinds: ??? domain domain To make this hint more useful, there's a new function nrrdKindSize() which returns what nrrd thinks is the suggested axis size for the different nrrdKind's. This function will return 0 to indicate "I have no advice for you on how big this axis should be". The reason for using 0 instead of -1 is that someday nrrd may change the axis size type from int to unsigned int. To offer some control of the nrrdKind behavior, there is a new global "state" variable: nrrdStateKindNoop. Currently, this is AIR_TRUE by defaul. You can set it to AIR_FALSE to enable some minimal cleverness on the part of nrrd. The nature of that minimal cleverness is almost certainly likely to change with time. Due to the nature of nrrdAxisInfoCopy, anything which doesn't explicitly ask the axis information NOT to be copied, will have it be copied. For example, nrrdSlice will propogate through the kinds on the axes that it didn't touch, same with nrrdAxesPermute, and the like. Regardless of NrrdKindStateNoop, the output of these functions will set nrrdKindUnknown on all the axes that experienced a non-trivial change: nrrdAxesSplit, nrrdAxesMerge, nrrdReshape, nrrdReshape_nva, nrrdUnblock, nrrdJoin, nrrdApply1DLut, nrrdApply1DRegMap, and nrrdApply1DIrregMap. These functions respect nrrdKindStateNoop: nrrdCrop, nrrdPad, nrrdShuffle, nrrdFlip, nrrdSpatialResample: if (nrrdKindStateNoop) { If the axis operated on was not a nrrdKindDomain or nrrdKindList, the resulting kind is nrrdKindUnknown Else, the resulting kind is the same as the input kind. This is implemented through _nrrdKindAltered() } else { output kind is a copy of the input kind } nrrdHisto, nrrdHistoAxis, nrrdHistoJoint: if (nrrdKindStateNoop) { histogram axes are nrrdKindDomain } else { histogram axes are nrrdKindUnknown } nrrdAxisInsert: if (nrrdKindStateNoop) { new axis is nrrdKindStub } else { new axis is nrrdKindUnknown } For the record, this is what this change entailed: added: - global int nrrdStateKindNoop - nrrdKindSize() - airEnum *nrrdKind (maps between strings like "3color" and nrrdKind* values) - NRRD_KIND_MAX #define augmented: - NrrdAxisInfo struct (now has "kind" field) - _nrrdFieldInteresting(), _nrrdSprintFieldInfo(), _nrrdFormatNRRD_write() with things relating to new field ("kinds:") and magic ("NRRD0003") - _nrrdReadNrrdParseInfo[] parser callback, with new _nrrdReadNrrdParse_kinds() - airEnum *nrrdField - nrrdAxisInfo C enum (for passing to nrrdAxisInfo{Set,Get}) - nrrdField* C enum - nrrdStateGetenv(): looks for NRRD_STATE_KIND_NOOP" environment variable One annoying bit: I didn't add a new flag to "unu make" to learn the axis kinds because I *can't*. This is a basic limitation in hest which is gotten pretty annoying: there is direct way to see if an option was given on the command line or not. Every option has to have a value supplied, either via the command-line or via the default value string, but once its all been parsed, you don't know where it came from, and nor can you tell hest "this option is really really optional, there is no default, and its okay if the user never gives you a value." This will only be fixed with a hest re-write. Index: shape.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/shape.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shape.c 29 Mar 2004 21:26:48 -0000 1.10 --- shape.c 30 Mar 2004 19:25:01 -0000 1.11 *************** *** 74,78 **** char me[]="_gageShapeSet", err[AIR_STRLEN_MED]; int i, ai, minsize, cx, cy, cz, sx, sy, sz, num[3], defCenter; ! NrrdAxis *ax[3]; double maxLen, xs, ys, zs, defSpacing; --- 74,78 ---- char me[]="_gageShapeSet", err[AIR_STRLEN_MED]; int i, ai, minsize, cx, cy, cz, sx, sy, sz, num[3], defCenter; ! NrrdAxisInfo *ax[3]; double maxLen, xs, ys, zs, defSpacing; |
|
From: Gordon K. <kin...@us...> - 2004-03-30 19:37:13
|
Update of /cvsroot/teem/teem/src/unrrdu In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6688/unrrdu Modified Files: make.c resample.c Log Message: Two major changes, which were done simultaneously: 1) Some renamings related to NrrdAxis, nrrdAxisInfo, and so on 2) Addition of the nrrdKind information to the NrrdAxisInfo struct In detail: 1) Some renamings related to NrrdAxis, nrrdAxisInfo, and so on: struct: NrrdAxis --> NrrdAxisInfo (NB: Nrrd struct still has field "axis") functions: nrrdAxisPos() --> nrrdAxisInfoPos() nrrdAxisIdx() --> nrrdAxisInfoIdx() nrrdAxisPosRange() --> nrrdAxisInfoPosRange() nrrdAxisIdxRange() --> nrrdAxisInfoIdxRange() nrrdAxisSpacingSet() --> nrrdAxisInfoSpacingSet() nrrdAxisMinMaxSet() --> nrrdAxisInfoMinMaxSet() Now, ANYTHING having to do with setting, getting, or manipulating the meta-information about the axes starts with "nrrdAxisInfo". The single exception to this is that the Nrrd struct's "axis" field was not renamed to "axisInfo", since this seemed more annoying that it was worth. Also, (this isn't new) ANYTHING having to do the set of axes, the shape of the array, or the per-axis ordering of samples, starts with "nrrdAxes". The nrrdAxes functions are NOT merely for manipulating the per-axis meta information-- something about the array as a whole, or the set of axes as a whole, is changing. Yes, this means that there's a function called "nrrdAxesInsert", even though it only inserts a single axis, but I figured the consistency generated by strict adherence to the nrrdAxes and nrrdAxisInfo prefixes would be better in the long run. 2) Addition of the nrrdKind information to the NrrdAxisInfo struct This is nrrd's latest and probably most dangerous step towards putting real semantic information in the array representation (that is, the "nearly raw" philosophy is getting stretched). The best way to think about this is that its a *hint*: an extra bit of information, kind of like the label or the unit, that you may want to associated with the axis, and which has a sufficiently general nature to warrent direct representation. So, new to the (newly renamed) NrrdAxisInfo struct: int kind; /* what kind of information is along this axis (from the nrrdKind* enum) */ Accordingly, there is change to the file format, which of course means that the magic is once again incremented. If you write a nrrd with known kinds on any axis, the magic will be "NRRD0003". The new kinds field looks like (for-example) kinds: 3-color domain domain for an RGB image. Like other per-axis fields, its specification is plural (its "kinds:", not "kind:"), and like centering, you use "???" to mean, "I don't know", for example: kinds: ??? domain domain To make this hint more useful, there's a new function nrrdKindSize() which returns what nrrd thinks is the suggested axis size for the different nrrdKind's. This function will return 0 to indicate "I have no advice for you on how big this axis should be". The reason for using 0 instead of -1 is that someday nrrd may change the axis size type from int to unsigned int. To offer some control of the nrrdKind behavior, there is a new global "state" variable: nrrdStateKindNoop. Currently, this is AIR_TRUE by defaul. You can set it to AIR_FALSE to enable some minimal cleverness on the part of nrrd. The nature of that minimal cleverness is almost certainly likely to change with time. Due to the nature of nrrdAxisInfoCopy, anything which doesn't explicitly ask the axis information NOT to be copied, will have it be copied. For example, nrrdSlice will propogate through the kinds on the axes that it didn't touch, same with nrrdAxesPermute, and the like. Regardless of NrrdKindStateNoop, the output of these functions will set nrrdKindUnknown on all the axes that experienced a non-trivial change: nrrdAxesSplit, nrrdAxesMerge, nrrdReshape, nrrdReshape_nva, nrrdUnblock, nrrdJoin, nrrdApply1DLut, nrrdApply1DRegMap, and nrrdApply1DIrregMap. These functions respect nrrdKindStateNoop: nrrdCrop, nrrdPad, nrrdShuffle, nrrdFlip, nrrdSpatialResample: if (nrrdKindStateNoop) { If the axis operated on was not a nrrdKindDomain or nrrdKindList, the resulting kind is nrrdKindUnknown Else, the resulting kind is the same as the input kind. This is implemented through _nrrdKindAltered() } else { output kind is a copy of the input kind } nrrdHisto, nrrdHistoAxis, nrrdHistoJoint: if (nrrdKindStateNoop) { histogram axes are nrrdKindDomain } else { histogram axes are nrrdKindUnknown } nrrdAxisInsert: if (nrrdKindStateNoop) { new axis is nrrdKindStub } else { new axis is nrrdKindUnknown } For the record, this is what this change entailed: added: - global int nrrdStateKindNoop - nrrdKindSize() - airEnum *nrrdKind (maps between strings like "3color" and nrrdKind* values) - NRRD_KIND_MAX #define augmented: - NrrdAxisInfo struct (now has "kind" field) - _nrrdFieldInteresting(), _nrrdSprintFieldInfo(), _nrrdFormatNRRD_write() with things relating to new field ("kinds:") and magic ("NRRD0003") - _nrrdReadNrrdParseInfo[] parser callback, with new _nrrdReadNrrdParse_kinds() - airEnum *nrrdField - nrrdAxisInfo C enum (for passing to nrrdAxisInfo{Set,Get}) - nrrdField* C enum - nrrdStateGetenv(): looks for NRRD_STATE_KIND_NOOP" environment variable One annoying bit: I didn't add a new flag to "unu make" to learn the axis kinds because I *can't*. This is a basic limitation in hest which is gotten pretty annoying: there is direct way to see if an option was given on the command line or not. Every option has to have a value supplied, either via the command-line or via the default value string, but once its all been parsed, you don't know where it came from, and nor can you tell hest "this option is really really optional, there is no default, and its okay if the user never gives you a value." This will only be fixed with a hest re-write. Index: make.c =================================================================== RCS file: /cvsroot/teem/teem/src/unrrdu/make.c,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** make.c 13 Mar 2004 20:03:11 -0000 1.49 --- make.c 30 Mar 2004 19:25:17 -0000 1.50 *************** *** 83,87 **** Nrrd *nrrd; Nrrd **nslice; ! int *size, nameLen, kvpLen, ki, sizeLen, spacingLen, labelLen, headerOnly, pret, lineSkip, byteSkip, endian, slc, type, encodingType, gotSpacing; --- 83,88 ---- Nrrd *nrrd; Nrrd **nslice; ! int *size, sizeLen, ! nameLen, kvpLen, ki, spacingLen, labelLen, headerOnly, pret, lineSkip, byteSkip, endian, slc, type, encodingType, gotSpacing; Index: resample.c =================================================================== RCS file: /cvsroot/teem/teem/src/unrrdu/resample.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** resample.c 7 Jan 2004 15:34:31 -0000 1.32 --- resample.c 30 Mar 2004 19:25:32 -0000 1.33 *************** *** 122,129 **** if (info->kernel[d] && (!( AIR_EXISTS(nin->axis[d].min) && AIR_EXISTS(nin->axis[d].max))) ) { ! nrrdAxisMinMaxSet(nin, d, ! (nin->axis[d].center ! ? nin->axis[d].center ! : nrrdDefCenter)); } info->min[d] = nin->axis[d].min; --- 122,129 ---- if (info->kernel[d] && (!( AIR_EXISTS(nin->axis[d].min) && AIR_EXISTS(nin->axis[d].max))) ) { ! nrrdAxisInfoMinMaxSet(nin, d, ! (nin->axis[d].center ! ? nin->axis[d].center ! : nrrdDefCenter)); } info->min[d] = nin->axis[d].min; |
|
From: Gordon K. <kin...@us...> - 2004-03-30 14:14:20
|
Update of /cvsroot/teem/teem/src/limn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32435 Modified Files: GNUmakefile Log Message: little utility for making a properly clipped triangular EPS image Index: GNUmakefile =================================================================== RCS file: /cvsroot/teem/teem/src/limn/GNUmakefile,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** GNUmakefile 9 Feb 2004 22:48:01 -0000 1.17 --- GNUmakefile 30 Mar 2004 14:02:42 -0000 1.18 *************** *** 51,55 **** splineMisc.o splineMethods.o splineEval.o $(L).TESTS = test/map test/light test/tcam test/tps test/tspline test/tbc \ ! test/tcamanim test/soid test/off2eps #### #### --- 51,55 ---- splineMisc.o splineMethods.o splineEval.o $(L).TESTS = test/map test/light test/tcam test/tps test/tspline test/tbc \ ! test/tcamanim test/soid test/off2eps test/triimg #### #### |
|
From: Gordon K. <kin...@us...> - 2004-03-30 14:14:20
|
Update of /cvsroot/teem/teem/src/limn/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32435/test Added Files: triimg.c Log Message: little utility for making a properly clipped triangular EPS image --- NEW FILE: triimg.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 "../limn.h" char *info = ("Save a triangular piece of an image to an EPS file."); int main(int argc, char *argv[]) { char *me; hestOpt *hopt=NULL; airArray *mop; NrrdIoState *nio; FILE *file; char *outS; Nrrd *nin; float width, scale, hack, minX, maxX, minY, maxY; int gray, sx, sy, labels; mop = airMopNew(); me = argv[0]; hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, NULL, "input image. Must be SQUARE 8-bit RGB or gray", NULL, NULL, nrrdHestNrrd); hestOptAdd(&hopt, "w", "width", airTypeFloat, 1, 1, &width, "0.0", "border width to put around triangle, in pixels, " "or \"0\" to not have any border"); hestOptAdd(&hopt, "labels", NULL, airTypeInt, 0, 0, &labels, NULL, "put little labels on things; fix with psfrag in LaTeX"); hestOptAdd(&hopt, "o", "output EPS", airTypeString, 1, 1, &outS, NULL, "output file to render postscript 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); if (!( 2 == nin->dim || 3 == nin->dim )) { fprintf(stderr, "%s: input nrrd must be 2-D or 3-D (not %d-D)\n", me, nin->dim); airMopError(mop); return 1; } if (!( nrrdTypeUChar == nin->type )) { fprintf(stderr, "%s: input nrrd must be type %s (not %s)\n", me, airEnumStr(nrrdType, nrrdTypeUChar), airEnumStr(nrrdType, nin->type)); airMopError(mop); return 1; } sx = (2 == nin->dim ? nin->axis[0].size : nin->axis[1].size); sy = (2 == nin->dim ? nin->axis[1].size : nin->axis[2].size); gray = 2 == nin->dim || 1 == nin->axis[0].size; if (!( sx == sy )) { fprintf(stderr, "%s: image must be square (not %d x %d)\n", me, sx, sy); airMopError(mop); return 1; } if (!( file = airFopen(outS, stdout, "wb") )) { fprintf(stderr, "%s: couldn't open \"%s\" for writing", me, outS); airMopError(mop); return 1; } airMopAdd(mop, file, (airMopper)airFclose, airMopAlways); nio = nrrdIoStateNew(); airMopAdd(mop, nio, (airMopper)nrrdIoStateNix, airMopAlways); hack = sqrt(3)/2; /* sorry, copied from nrrd/formatEPS.c */ minX = 0.5; maxX = 8.0; minY = 5.50 - 7.5*hack*sy/sx/2; maxY = 5.50 + 7.5*hack*sy/sx/2; scale = 7.5/sx; minX *= 72; minY *= 72; maxX *= 72; maxY *= 72; scale *= 72; fprintf(file, "%%!PS-Adobe-3.0 EPSF-3.0\n"); fprintf(file, "%%%%Creator: hairy pathetic monster\n"); fprintf(file, "%%%%Title: raving lunatic\n"); fprintf(file, "%%%%Pages: 1\n"); fprintf(file, "%%%%BoundingBox: %d %d %d %d\n", (int)floor(minX), (int)floor(minY), (int)ceil(maxX), (int)ceil(maxY)); fprintf(file, "%%%%HiResBoundingBox: %g %g %g %g\n", minX, minY, maxX, maxY); fprintf(file, "%%%%EndComments\n"); fprintf(file, "%%%%BeginProlog\n"); fprintf(file, "%% linestr creates an empty string to hold " "one scanline\n"); fprintf(file, "/linestr %d string def\n", sx*(gray ? 1 : 3)); fprintf(file, "%%%%EndProlog\n"); fprintf(file, "%%%%Page: 1 1\n"); fprintf(file, "gsave\n"); fprintf(file, "%g %g moveto\n", minX, minY); fprintf(file, "%g %g lineto\n", maxX, minY); fprintf(file, "%g %g lineto\n", (minX + maxX)/2, minY + hack*(maxX - minX)); fprintf(file, "closepath\n"); fprintf(file, "clip\n"); fprintf(file, "gsave newpath\n"); fprintf(file, "%g %g translate\n", minX, minY); fprintf(file, "%g %g scale\n", sx*scale, sy*scale); fprintf(file, "%d %d 8\n", sx, sy); fprintf(file, "[%d 0 0 -%d 0 %d]\n", sx, sy, sy); fprintf(file, "{currentfile linestr readhexstring pop} %s\n", gray ? "image" : "false 3 colorimage"); nio->dataFile = file; nrrdEncodingHex->write(nin, nio); nio->dataFile = NULL; fprintf(file, "\n"); fprintf(file, "grestore\n"); if (width) { fprintf(file, "%g %g moveto\n", minX, minY); fprintf(file, "%g %g lineto\n", maxX, minY); fprintf(file, "%g %g lineto\n", (minX + maxX)/2, minY + hack*(maxX - minX)); fprintf(file, "closepath\n"); fprintf(file, "%g setlinewidth 0 setgray stroke\n", 2*width*scale); } if (labels) { /* happily, psfrag doesn't respect the clipping path */ fprintf(file, "/Helvetica findfont 20 scalefont setfont\n"); fprintf(file, "%g %g moveto (A) show\n", maxX, minY); fprintf(file, "%g %g moveto (B) show\n", (minX + maxX)/2, minY + hack*(maxX - minX)); fprintf(file, "%g %g moveto (C) show\n", minX, minY); } fprintf(file, "grestore\n"); airMopOkay(mop); return 0; } |
|
From: Gordon K. <kin...@us...> - 2004-03-30 04:37:34
|
Update of /cvsroot/teem/teem/src/gage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2671 Modified Files: vecGage.c Log Message: removed unused variable Index: vecGage.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/vecGage.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** vecGage.c 25 Mar 2004 01:37:45 -0000 1.16 --- vecGage.c 30 Mar 2004 04:26:01 -0000 1.17 *************** *** 43,47 **** _gageVecFilter (gageContext *ctx, gagePerVolume *pvl) { char me[]="_gageVecFilter"; ! gage_t *fw00, *fw11, *fw22, *vec, *jac, tmp; int fd; --- 43,47 ---- _gageVecFilter (gageContext *ctx, gagePerVolume *pvl) { char me[]="_gageVecFilter"; ! gage_t *fw00, *fw11, *fw22, *vec, *jac; int fd; |
|
From: Gordon K. <kin...@us...> - 2004-03-30 04:35:09
|
Update of /cvsroot/teem/teem/src/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2296/bin Modified Files: ilk.c Log Message: fixed a memory leak and a bus error Index: ilk.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/ilk.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ilk.c 4 Mar 2004 23:57:22 -0000 1.10 --- ilk.c 30 Mar 2004 04:23:33 -0000 1.11 *************** *** 37,42 **** double mat[6], **matList, *origInfo, origMat[6], origInvMat[6], ox, oy, min[2], max[2]; ! int d, bound, matListLen, i, ax0, size[2], bgLen; ! float *bg, scale[4]; me = argv[0]; --- 37,42 ---- double mat[6], **matList, *origInfo, origMat[6], origInvMat[6], ox, oy, min[2], max[2]; ! int d, bound, matListLen, i, ax0, size[2], _bkgLen; ! float *bkg, *_bkg, scale[4]; me = argv[0]; *************** *** 89,96 **** "\b\bo \"pad\": use a given background value (via \"-bg\")", NULL, nrrdBoundary); ! hestOptAdd(&hopt, "bg", "bg0 bg1", airTypeFloat, 1, -1, &bg, "nan", "background color to use with boundary behavior \"pad\". " "Defaults to all zeroes.", ! &bgLen); hestOptAdd(&hopt, "s", "xSize ySize", airTypeOther, 2, 2, scale, "x1 x1", "For each axis, information about how many samples in output:\n " --- 89,96 ---- "\b\bo \"pad\": use a given background value (via \"-bg\")", NULL, nrrdBoundary); ! hestOptAdd(&hopt, "bg", "bg0 bg1", airTypeFloat, 1, -1, &_bkg, "nan", "background color to use with boundary behavior \"pad\". " "Defaults to all zeroes.", ! &_bkgLen); hestOptAdd(&hopt, "s", "xSize ySize", airTypeOther, 2, 2, scale, "x1 x1", "For each axis, information about how many samples in output:\n " *************** *** 116,123 **** airMopError(mop); return 1; } ! if (AIR_EXISTS(bg[0]) && bgLen != MOSS_NCOL(nin)) { ! fprintf(stderr, "%s: got %d background colors, image has %d colors\n", ! me, bgLen, MOSS_NCOL(nin)); ! airMopError(mop); return 1; } --- 116,132 ---- airMopError(mop); return 1; } ! if (nrrdBoundaryPad == bound) { ! if (_bkgLen != MOSS_NCOL(nin)) { ! fprintf(stderr, "%s: got %d background colors, image has %d colors\n", ! me, _bkgLen, MOSS_NCOL(nin)); ! airMopError(mop); return 1; ! } else { ! bkg = _bkg; ! } ! } else { ! /* maybe warn user if they gave a background that won't be used? */ ! /* No- because hest is stupid, and right now we always parse the ! single (default) "nan" for this argument! */ ! bkg = NULL; } *************** *** 179,183 **** nrrdAxisMinMaxSet(nin, ax0+1, mossDefCenter); } ! if (mossLinearTransform(nout, nin, AIR_EXISTS(bg[0]) ? bg : NULL, mat, msp, min[0], max[0], min[1], max[1], --- 188,192 ---- nrrdAxisMinMaxSet(nin, ax0+1, mossDefCenter); } ! if (mossLinearTransform(nout, nin, bkg, mat, msp, min[0], max[0], min[1], max[1], |
|
From: Gordon K. <kin...@us...> - 2004-03-30 04:35:09
|
Update of /cvsroot/teem/teem/src/moss In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2296/moss Modified Files: hestMoss.c sampler.c Log Message: fixed a memory leak and a bus error Index: sampler.c =================================================================== RCS file: /cvsroot/teem/teem/src/moss/sampler.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** sampler.c 30 Mar 2004 03:30:16 -0000 1.12 --- sampler.c 30 Mar 2004 04:23:35 -0000 1.13 *************** *** 95,98 **** --- 95,103 ---- } } + if (nrrdBoundaryPad == smplr->boundary && !smplr->bg) { + sprintf(err, "%s: want %s boundary behavior, but bg vector is NULL", + me, airEnumStr(nrrdBoundary, nrrdBoundaryPad)); + biffAdd(MOSS, err); return 1; + } return 0; Index: hestMoss.c =================================================================== RCS file: /cvsroot/teem/teem/src/moss/hestMoss.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** hestMoss.c 7 Jan 2004 15:34:30 -0000 1.5 --- hestMoss.c 30 Mar 2004 04:23:35 -0000 1.6 *************** *** 114,117 **** --- 114,118 ---- } + airMopOkay(mop); return 0; } |
|
From: Gordon K. <kin...@us...> - 2004-03-30 03:44:04
|
Update of /cvsroot/teem/teem/src/ten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27237 Modified Files: tendPoint.c Log Message: added more information to output Index: tendPoint.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/tendPoint.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tendPoint.c 25 Mar 2004 03:06:07 -0000 1.8 --- tendPoint.c 30 Mar 2004 03:32:30 -0000 1.9 *************** *** 35,39 **** int loc[3], sx, sy, sz, i; Nrrd *nin; ! float *tdata, eval[3], evec[9], c[TEN_ANISO_MAX+1]; hestOptAdd(&hopt, "p", "x y z", airTypeInt, 3, 3, loc, NULL, --- 35,40 ---- int loc[3], sx, sy, sz, i; Nrrd *nin; ! float *tdata, eval[3], evec[9], c[TEN_ANISO_MAX+1], ! angle, axis[3], mat[9]; hestOptAdd(&hopt, "p", "x y z", airTypeInt, 3, 3, loc, NULL, *************** *** 83,86 **** --- 84,97 ---- fprintf(stderr, "% 15.7f : % 15.7f % 15.7f % 15.7f\n", eval[2], evec[6], evec[7], evec[8]); + angle = ell_3m_to_aa_f(axis, evec); + fprintf(stderr, "eigenvector rotation: %g around {%g,%g,%g}\n", + angle, axis[0], axis[1], axis[2]); + ell_aa_to_3m_f(mat, angle, axis); + fprintf(stderr, "% 15.7f % 15.7f % 15.7f\n", + mat[0], mat[1], mat[2]); + fprintf(stderr, "% 15.7f % 15.7f % 15.7f\n", + mat[3], mat[4], mat[5]); + fprintf(stderr, "% 15.7f % 15.7f % 15.7f\n", + mat[6], mat[7], mat[8]); tenAnisoCalc(c, eval); fprintf(stderr, "anisotropies = \n"); |
|
From: Gordon K. <kin...@us...> - 2004-03-30 03:41:49
|
Update of /cvsroot/teem/teem/src/moss In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26803 Modified Files: sampler.c Log Message: debugging ... Index: sampler.c =================================================================== RCS file: /cvsroot/teem/teem/src/moss/sampler.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** sampler.c 13 Mar 2004 20:03:10 -0000 1.11 --- sampler.c 30 Mar 2004 03:30:16 -0000 1.12 *************** *** 38,43 **** ncol = MOSS_NCOL(image); smplr->bg = airFree(smplr->bg); - smplr->bg = (float*)calloc(ncol, sizeof(float)); if (bg) { for (ci=0; ci<ncol; ci++) { smplr->bg[ci] = bg[ci]; --- 38,43 ---- ncol = MOSS_NCOL(image); smplr->bg = airFree(smplr->bg); if (bg) { + smplr->bg = (float*)calloc(ncol, sizeof(float)); for (ci=0; ci<ncol; ci++) { smplr->bg[ci] = bg[ci]; |
|
From: Gordon K. <kin...@us...> - 2004-03-30 03:37:46
|
Update of /cvsroot/teem/teem/src/nrrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26232 Modified Files: enumsNrrd.c nrrd.h nrrdEnums.h Log Message: removed the nrrdAxisInfo airEnum, since it was not being used, and clarified comment description of nrrdFormatTypeNRRD Index: enumsNrrd.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/enumsNrrd.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** enumsNrrd.c 23 Feb 2004 18:04:15 -0000 1.30 --- enumsNrrd.c 30 Mar 2004 03:26:12 -0000 1.31 *************** *** 270,311 **** nrrdCenter = &_nrrdCenter_enum; - /* ------------------------ nrrdAxisInfo ------------------------- */ - - char - _nrrdAxisInfoStr[NRRD_AXIS_INFO_MAX+1][AIR_STRLEN_SMALL] = { - "(unknown_axis_info)", - "size", - "spacing", - "min", - "max", - "center", - "label", - "unit" - }; - - char - _nrrdAxisInfoDesc[NRRD_AXIS_INFO_MAX+1][AIR_STRLEN_MED] = { - "unknown axis info", - "number of samples along axis", - "spacing between samples", - "minimum position in \"world\" space associated with axis", - "maximum position in \"world\" space associated with axis", - "centering style for samples along this axis", - "short description of space or value spanned by axis", - "units in which sample spacing is measured" - }; - - airEnum - _nrrdAxisInfo = { - "axis_info", - NRRD_AXIS_INFO_MAX, - _nrrdAxisInfoStr, NULL, - _nrrdAxisInfoDesc, - NULL, NULL, - AIR_TRUE - }; - airEnum * - nrrdAxisInfo = &_nrrdAxisInfo; - /* ------------------------ nrrdField ------------------------- */ --- 270,273 ---- Index: nrrdEnums.h =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/nrrdEnums.h,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** nrrdEnums.h 7 Jan 2004 15:34:30 -0000 1.41 --- nrrdEnums.h 30 Mar 2004 03:26:12 -0000 1.42 *************** *** 60,65 **** enum { nrrdFormatTypeUnknown, ! nrrdFormatTypeNRRD, /* 1: basic nrrd format (associated with both ! magic nrrdMagicOldNRRD and nrrdMagicNRRD0001 */ nrrdFormatTypePNM, /* 2: PNM image */ nrrdFormatTypePNG, /* 3: PNG image */ --- 60,65 ---- enum { nrrdFormatTypeUnknown, ! nrrdFormatTypeNRRD, /* 1: basic nrrd format (associated with any of ! the magics starting with "NRRD" */ nrrdFormatTypePNM, /* 2: PNM image */ nrrdFormatTypePNG, /* 3: PNG image */ Index: nrrd.h =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/nrrd.h,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** nrrd.h 15 Mar 2004 03:07:41 -0000 1.135 --- nrrd.h 30 Mar 2004 03:26:12 -0000 1.136 *************** *** 459,463 **** TEEM_API airEnum *nrrdEncodingType; TEEM_API airEnum *nrrdCenter; - TEEM_API airEnum *nrrdAxisInfo; TEEM_API airEnum *nrrdField; /* ---- BEGIN non-NrrdIO */ --- 459,462 ---- |
|
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); |
|
From: Gordon K. <kin...@us...> - 2004-03-29 23:13:57
|
Update of /cvsroot/teem/teemdoc/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14385 Modified Files: lgpl.html Log Message: fixed typo Index: lgpl.html =================================================================== RCS file: /cvsroot/teem/teemdoc/html/lgpl.html,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** lgpl.html 9 Jan 2004 19:46:43 -0000 1.10 --- lgpl.html 29 Mar 2004 23:02:26 -0000 1.11 *************** *** 146,150 **** apply. However, if you have found bugs or API deficiencies in my software, please tell me, so that everyone can benefit. Since this ! software is how I do research, I'll be supporting it for quite awhile. <p> --- 146,150 ---- apply. However, if you have found bugs or API deficiencies in my software, please tell me, so that everyone can benefit. Since this ! software is how I do research, I'll be supporting it for quite a while. <p> |
|
From: Gordon K. <kin...@us...> - 2004-03-29 21:39:17
|
Update of /cvsroot/teem/teem/src/limn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27625 Modified Files: limn.h Log Message: better comments Index: limn.h =================================================================== RCS file: /cvsroot/teem/teem/src/limn/limn.h,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** limn.h 3 Mar 2004 13:14:08 -0000 1.51 --- limn.h 29 Mar 2004 21:27:39 -0000 1.52 *************** *** 144,148 **** limnOptsPS ps; int device; ! float scale, bbox[4]; int yFlip; FILE *file; --- 144,149 ---- limnOptsPS ps; int device; ! float scale, ! bbox[4]; /* minX minY maxX maxY */ int yFlip; FILE *file; |
|
From: Gordon K. <kin...@us...> - 2004-03-29 21:37:06
|
Update of /cvsroot/teem/teemdoc/html/nrrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26716 Modified Files: lib.html Log Message: clarified use of nrrdLoad when using a non-nrrd memory allocator Index: lib.html =================================================================== RCS file: /cvsroot/teem/teemdoc/html/nrrd/lib.html,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** lib.html 19 Feb 2004 22:51:12 -0000 1.6 --- lib.html 29 Mar 2004 21:25:35 -0000 1.7 *************** *** 345,351 **** /* we're done with the nrrdIoState, this sets it to NULL */ nios = nrrdIoStateNix(nios); ! /* load the nrrd again, this time the data will be read, but ! the existing nin->data memory will be used, because nrrdRead (called by nrrdLoad) remembers the address and size of incoming allocated data, and eventually it will get used, instead of --- 345,361 ---- /* we're done with the nrrdIoState, this sets it to NULL */ nios = nrrdIoStateNix(nios); + + /* 1) YOU, the nrrd user, look at things like nin->dim, + nrrdElementNumber(nin), nrrdElementSize(nin), + nin->axis[0].size, nin->axis[1].size, etc in order allocate the data + for the nrrd. Make sure that the data is allocated as one single + contiguous address range, or else nrrd will not operate correctly on + the values stored there. */ + + /* 2) YOU now set nin->data to the beginning of your allocated memory */ + nin->data = YOUR POINTER HERE; ! /* 3) Now load the nrrd again, this time actually reading the data. ! The existing nin->data memory will be used, because nrrdRead (called by nrrdLoad) remembers the address and size of incoming allocated data, and eventually it will get used, instead of |
|
From: Gordon K. <kin...@us...> - 2004-03-29 21:26:53
|
Update of /cvsroot/teem/teem/src/ell/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23166/test Added Files: wheel.c Log Message: little tool to help make diagrams of the eigenwheel --- NEW FILE: wheel.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 "../ell.h" char *wheelInfo = ("Makes pictures of the eigenvalue wheel"); void wheelTenToGeom(double geom[3], double a, double b, double c, double d, double e, double f) { double A, B, C, Q, QQQ, R, Th; A = -a - d - f; B = a*d + a*f + d*f - b*b - c*c - e*e; C = c*c*d + a*e*e + b*b*f - 2*b*c*e - a*d*f; Q = (A*A - 3*B)/9; R = (9*A*B - 27*C - 2*A*A*A)/54; QQQ = Q*Q*Q; Th = QQQ ? acos(R/sqrt(QQQ))/3 : 0; geom[0] = -A/3; geom[1] = 2*sqrt(Q); geom[2] = Th; return; } void wheelABCToGeom(double *geom, double A, double B, double C) { double Q, R, QQQ, Th; Q = (A*A - 3*B)/9; R = (9*A*B - 27*C - 2*A*A*A)/54; QQQ = Q*Q*Q; Th = QQQ ? acos(R/sqrt(QQQ))/3 : 0; geom[0] = -A/3; geom[1] = 2*sqrt(Q); geom[2] = Th; return; } void wheelGeomToRoot(double xroot[3], double yroot[3], double geom[3]) { xroot[0] = geom[0] + geom[1]*cos(geom[2]); xroot[1] = geom[0] + geom[1]*cos(geom[2] - 2*AIR_PI/3); xroot[2] = geom[0] + geom[1]*cos(geom[2] + 2*AIR_PI/3); yroot[0] = geom[1]*sin(geom[2]); yroot[1] = geom[1]*sin(geom[2] - 2*AIR_PI/3); yroot[2] = geom[1]*sin(geom[2] + 2*AIR_PI/3); return; } void wheelGeomToABC(double *ABC, double center, double radius, double angle) { double geom[3], x[3], yroot[3]; ELL_3V_SET(geom, center, radius, angle); wheelGeomToRoot(x, yroot, geom); ELL_3V_SET(ABC, -x[0] - x[1] - x[2], x[0]*x[1] + x[1]*x[2] + x[0]*x[2], -x[0]*x[1]*x[2]); return; } typedef struct { FILE *file; double psc; double bbox[4]; double maxX, maxY, yscale; } wheelPS; #define WPS_X(x) AIR_AFFINE(wps->bbox[0], (x), wps->bbox[2], 0, wps->maxX) #define WPS_Y(y) AIR_AFFINE(wps->bbox[1], (y), wps->bbox[3], 0, wps->maxY) #define WPS_S(s) AIR_DELTA(wps->bbox[1], (s), wps->bbox[3], 0, wps->maxY) void wheelPreamble(wheelPS *wps) { wps->maxX = wps->psc*(wps->bbox[2] - wps->bbox[0]); wps->maxY = wps->psc*(wps->bbox[3] - wps->bbox[1]); fprintf(wps->file, "%%!PS-Adobe-2.0 EPSF-2.0\n"); fprintf(wps->file, "%%%%Creator: limn\n"); fprintf(wps->file, "%%%%Pages: 1\n"); fprintf(wps->file, "%%%%BoundingBox: 0 0 %d %d\n", (int)(wps->maxX), (int)(wps->maxY)); fprintf(wps->file, "%%%%EndComments\n"); fprintf(wps->file, "%%%%EndProlog\n"); fprintf(wps->file, "%%%%Page: 1 1\n"); fprintf(wps->file, "gsave\n"); fprintf(wps->file, "0 0 moveto\n"); fprintf(wps->file, "%g 0 lineto\n", wps->maxX); fprintf(wps->file, "%g %g lineto\n", wps->maxX, wps->maxY); fprintf(wps->file, "0 %g lineto\n", wps->maxY); fprintf(wps->file, "closepath\n"); fprintf(wps->file, "clip\n"); fprintf(wps->file, "gsave newpath\n"); fprintf(wps->file, "1 setlinejoin\n"); fprintf(wps->file, "1 setlinecap\n"); fprintf(wps->file, "/M {moveto} bind def\n"); fprintf(wps->file, "/L {lineto} bind def\n"); fprintf(wps->file, "/W {setlinewidth} bind def\n"); fprintf(wps->file, "/F {fill} bind def\n"); fprintf(wps->file, "/S {stroke} bind def\n"); fprintf(wps->file, "/CP {closepath} bind def\n"); fprintf(wps->file, "/RGB {setrgbcolor} bind def\n"); fprintf(wps->file, "/Gr {setgray} bind def\n"); fprintf(wps->file, "\n"); return; } void wheelWidth(wheelPS *wps, double width) { fprintf(wps->file, "%g W\n", width); return; } void wheelGray(wheelPS *wps, double gray) { fprintf(wps->file, "%g Gr\n", gray); return; } void wheelLabel(wheelPS *wps, double x, double y, char *str) { fprintf(wps->file, "%g %g M (%s) show\n", WPS_X(x), WPS_Y(y), str); return; } void wheelGraph(wheelPS *wps, double a, double d, double f) { double A, B, C; int xi; double x, y; A = -a - d - f; B = a*d + a*f + d*f; C = -a*d*f; for (xi=0; xi<=99; xi++) { x = AIR_AFFINE(0, xi, 99, wps->bbox[0], wps->bbox[2]); y = (((x + A)*x + B)*x + C)/2; fprintf(wps->file, "%g %g %s\n", WPS_X(x), WPS_Y(wps->yscale*y), xi ? "L" : "M"); } fprintf(wps->file, "S\n"); return; } void wheelLine(wheelPS *wps, double x0, double y0, double x1, double y1) { fprintf(wps->file, "%g %g M\n", WPS_X(x0), WPS_Y(y0)); fprintf(wps->file, "%g %g L S\n", WPS_X(x1), WPS_Y(y1)); return; } void wheelCircle(wheelPS *wps, double xc, double yc, double rad) { fprintf(wps->file, "%g %g %g 0 360 arc closepath S\n", WPS_X(xc), WPS_Y(yc), WPS_S(rad)); return; } void wheelArc(wheelPS *wps, double xc, double yc, double rad, double angle1, double angle2) { fprintf(wps->file, "newpath %g %g %g %g %g arc S\n", WPS_X(xc), WPS_Y(yc), WPS_S(rad), angle1, angle2); } void wheelDot(wheelPS *wps, double x, double y, double rad) { fprintf(wps->file, "%g %g %g 0 360 arc closepath F S\n", WPS_X(x), WPS_Y(y), WPS_S(rad)); return; } void wheelEpilog(wheelPS *wps) { fprintf(wps->file, "grestore\n"); fprintf(wps->file, "grestore\n"); fprintf(wps->file, "%%%%Trailer\n"); return; } int main(int argc, char *argv[]) { char *me, *outS; hestOpt *hopt; hestParm *hparm; airArray *mop; double tval[6], ABC[3], geom[3], xroot[3], yroot[3], bbox[4], psc; me = argv[0]; wheelPS wps; int correct, labels; mop = airMopNew(); hparm = hestParmNew(); hparm->elideMultipleNonExistFloatDefault = AIR_TRUE; hopt = NULL; airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways); hestOptAdd(&hopt, "t", "a b c d e f", airTypeDouble, 6, 6, tval, "nan nan nan nan nan nan nan", "six values of symmetric tensors"); hestOptAdd(&hopt, "ABC", "A B C", airTypeDouble, 3, 3, ABC, "nan nan nan", "directly give coefficients of cubic polynomial " "(and override info from \"-t\")"); hestOptAdd(&hopt, "g", "c rad th", airTypeDouble, 3, 3, geom, "nan nan nan", "directly give center, radius, and angle of wheel " "(and override info from \"-t\" and \"-ABC\""); hestOptAdd(&hopt, "correct", NULL, airTypeInt, 0, 0, &correct, NULL, "when using \"-g\", be honest about what the estimated " "acos(sqrt(2)*skew)/3 is going to be"); hestOptAdd(&hopt, "labels", NULL, airTypeInt, 0, 0, &labels, NULL, "put little labels on things; fix with psfrag in LaTeX"); hestOptAdd(&hopt, "bb", "bbox", airTypeDouble, 4, 4, bbox, "nan nan nan nan", "bounding box, in world space around the " "region of the graph that should be drawn to EPS"); hestOptAdd(&hopt, "ysc", "scale", airTypeDouble, 1, 1, &(wps.yscale), "0.5", "scaling on Y axis for drawing graph of characteristic " "polynomial, or \"0\" to turn this off."); hestOptAdd(&hopt, "psc", "scale", airTypeDouble, 1, 1, &psc, "100", "scaling from world space to PostScript points"); hestOptAdd(&hopt, "o", "filename", airTypeString, 1, 1, &outS, "-", "file to write EPS output to"); hestParseOrDie(hopt, argc-1, argv+1, hparm, me, wheelInfo, AIR_TRUE, AIR_TRUE, AIR_TRUE); airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways); airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways); if (!(wps.file = airFopen(outS, stdout, "wb"))) { fprintf(stderr, "%s: couldn't open output file\n", me); airMopError(mop); return 1; } airMopAdd(mop, wps.file, (airMopper)airFclose, airMopAlways); if (AIR_EXISTS(geom[0])) { geom[2] *= AIR_PI/180.0; } if (AIR_EXISTS(geom[0])) { wheelGeomToRoot(xroot, yroot, geom); if (correct) { tval[0] = xroot[0]; tval[1] = tval[2] = 0; tval[3] = xroot[1]; tval[4] = 0; tval[5] = xroot[2]; wheelTenToGeom(geom, tval[0], tval[1], tval[2], tval[3], tval[4], tval[5]); wheelGeomToRoot(xroot, yroot, geom); } wheelGeomToABC(ABC, geom[0], geom[1], geom[2]); } else if (AIR_EXISTS(ABC[0])) { wheelABCToGeom(geom, ABC[0], ABC[1], ABC[2]); wheelGeomToRoot(xroot, yroot, geom); } else { wheelTenToGeom(geom, tval[0], tval[1], tval[2], tval[3], tval[4], tval[5]); wheelGeomToRoot(xroot, yroot, geom); wheelGeomToABC(ABC, geom[0], geom[1], geom[2]); } fprintf(stderr, "%s: ABC: %g %g %g\n", me, ABC[0], ABC[1], ABC[2]); fprintf(stderr, "%s: xroot: %g %g %g\n", me, xroot[0], xroot[1], xroot[2]); fprintf(stderr, "%s: geom: %g %g %g\n", me, geom[0], geom[1], geom[2]); if (!AIR_EXISTS(bbox[0])) { bbox[0] = geom[0] - 1.2*geom[1]; bbox[1] = - 1.2*geom[1]; bbox[2] = geom[0] + 1.2*geom[1]; bbox[3] = + 1.2*geom[1]; fprintf(stderr, "%s: bbox %g %g %g %g\n", me, bbox[0], bbox[1], bbox[2], bbox[3]); } wps.psc = psc; ELL_4V_COPY(wps.bbox, bbox); wheelPreamble(&wps); /* graph */ if (wps.yscale) { wheelWidth(&wps, 4); wheelGray(&wps, 0.5); wheelGraph(&wps, xroot[0], xroot[1], xroot[2]); } /* axis */ wheelWidth(&wps, 2); wheelGray(&wps, 0.0); wheelLine(&wps, bbox[0], 0, bbox[2], 0); /* circle */ wheelWidth(&wps, 4); wheelCircle(&wps, geom[0], 0, geom[1]); /* spokes */ wheelWidth(&wps, 2); wheelLine(&wps, geom[0], 0, xroot[0], yroot[0]); wheelLine(&wps, geom[0], 0, xroot[1], yroot[1]); wheelLine(&wps, geom[0], 0, xroot[2], yroot[2]); /* dots at spoke ends */ wheelDot(&wps, xroot[0], yroot[0], 0.025*geom[1]); wheelDot(&wps, xroot[1], yroot[1], 0.025*geom[1]); wheelDot(&wps, xroot[2], yroot[2], 0.025*geom[1]); /* lines from dots to roots */ wheelWidth(&wps, 2); fprintf(wps.file, "gsave\n"); fprintf(wps.file, "[2 4] 0 setdash\n"); wheelLine(&wps, xroot[0], 0, xroot[0], yroot[0]); wheelLine(&wps, xroot[1], 0, xroot[1], yroot[1]); wheelLine(&wps, xroot[2], 0, xroot[2], yroot[2]); fprintf(wps.file, "grestore\n"); /* tickmarks */ wheelWidth(&wps, 6); wheelLine(&wps, xroot[0], -0.02*geom[1], xroot[0], 0.02*geom[1]); wheelLine(&wps, xroot[1], -0.02*geom[1], xroot[1], 0.02*geom[1]); wheelLine(&wps, xroot[2], -0.02*geom[1], xroot[2], 0.02*geom[1]); /* labels, if wanted */ if (labels) { fprintf(wps.file, "/Helvetica findfont 20 scalefont setfont\n"); wheelLabel(&wps, geom[0], 0, "center"); wheelLine(&wps, geom[0], -0.02*geom[1], geom[0], 0.02*geom[1]); wheelLabel(&wps, (geom[0] + xroot[0])/1.8, yroot[0]/1.8, "radius"); wheelWidth(&wps, 2); wheelArc(&wps, geom[0], 0, geom[1]/2, 0, 180*geom[2]/AIR_PI); wheelLabel(&wps, geom[1]*cos(geom[2]/2)/2.5, geom[1]*sin(geom[2]/2)/2.5, "theta"); wheelLabel(&wps, xroot[0], yroot[0], "spoke0"); wheelLabel(&wps, xroot[1], yroot[1], "spoke-"); wheelLabel(&wps, xroot[2], yroot[2], "spoke+"); wheelLabel(&wps, xroot[0], 0, "root0"); wheelLabel(&wps, xroot[1], 0, "root-"); wheelLabel(&wps, xroot[2], 0, "root+"); } wheelEpilog(&wps); airMopOkay(mop); exit(0); } |