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-05-10 19:27:40
|
Update of /cvsroot/teem/teem/src/limn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13197 Modified Files: cam.c hestLimn.c limn.h methodsLimn.c Log Message: added two new fields to the limnCamera, "fov" and "aspect", augmented the semantics of limnCameraUpdate, and made an effort to fix/debug the limnCameraPathMake() function. "fov" is like the "fovy" argument to gluPerspective()- the angle in degrees vertically subtended by the view window, and "aspect" is the ratio of horizontal to vertical size of the view window. Now, when limCameraUpdate() is called, it will see if both fov and aspect are set (non-NaN), and if so will update uRange[] and vRange[] accordingly. Otherwise, uRange[] and vRange[] will not be touched. limnCameraPathMake is not a new function, but it never worked usefully. Index: methodsLimn.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/methodsLimn.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** methodsLimn.c 13 Feb 2004 22:57:30 -0000 1.12 --- methodsLimn.c 10 May 2004 19:27:25 -0000 1.13 *************** *** 44,47 **** --- 44,51 ---- cam->orthographic = limnDefCameraOrthographic; cam->rightHanded = limnDefCameraRightHanded; + cam->uRange[0] = cam->uRange[1] = AIR_NAN; + cam->vRange[0] = cam->vRange[1] = AIR_NAN; + cam->fov = AIR_NAN; + cam->aspect = AIR_NAN; } return; Index: hestLimn.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/hestLimn.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** hestLimn.c 7 Jan 2004 15:34:30 -0000 1.8 --- hestLimn.c 10 May 2004 19:27:24 -0000 1.9 *************** *** 36,39 **** --- 36,40 ---- ** ur: cam->uRange ** vr: cam->vRange + ** fv: cam->fov */ void *************** *** 41,45 **** char *frDef, char *atDef, char *upDef, char *dnDef, char *diDef, char *dfDef, ! char *urDef, char *vrDef) { hestOpt *hopt; --- 42,46 ---- char *frDef, char *atDef, char *upDef, char *dnDef, char *diDef, char *dfDef, ! char *urDef, char *vrDef, char *fvDef) { hestOpt *hopt; *************** *** 68,71 **** --- 69,74 ---- hestOptAdd(&hopt, "vr", "vMin vMax", airTypeDouble, 2, 2, cam->vRange, vrDef, "range in V direction of image plane"); + hestOptAdd(&hopt, "fv", "field of view", airTypeDouble, 1, 1, &(cam->fov), + fvDef, "angle (in degrees) vertically subtended by view window"); *hoptP = hopt; return; Index: limn.h =================================================================== RCS file: /cvsroot/teem/teem/src/limn/limn.h,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** limn.h 29 Mar 2004 21:27:39 -0000 1.52 --- limn.h 10 May 2004 19:27:24 -0000 1.53 *************** *** 63,68 **** uRange[2], /* range of U values to put on horiz. image axis */ vRange[2], /* range of V values to put on vert. image axis */ ! neer, faar, /* neer and far clipping plane distances ! (misspelled for the sake of McRosopht) */ dist; /* distance to image plane */ int atRelative, /* if non-zero: given neer, faar, and dist --- 63,74 ---- uRange[2], /* range of U values to put on horiz. image axis */ vRange[2], /* range of V values to put on vert. image axis */ ! fov, /* if non-NaN, and aspect is non-NaN, then {u,v}Range ! will be set accordingly by limnCameraUpdate(). ! "fov" is the angle, in degrees, vertically subtended ! by the view window */ ! aspect, /* the ratio of horizontal to vertical size of the ! view window */ ! neer, faar, /* near and far clipping plane distances ! (misspelled for the sake of a McRosopht compiler) */ dist; /* distance to image plane */ int atRelative, /* if non-zero: given neer, faar, and dist *************** *** 321,325 **** limnCameraPathTrackAt, /* 2: 3-D spline for *at* points, quaternion spline for directions back to camera */ ! limnCameraPathTrackBoth, /* 3: 2 3-D splines: one for from, one for at */ limnCameraPathTrackLast }; --- 327,332 ---- limnCameraPathTrackAt, /* 2: 3-D spline for *at* points, quaternion spline for directions back to camera */ ! limnCameraPathTrackBoth, /* 3: three 3-D splines: for from point, at ! point, and the up vector */ limnCameraPathTrackLast }; *************** *** 362,365 **** --- 369,375 ---- TEEM_API int limnDefCameraRightHanded; + /* enumsLimn.c */ + TEEM_API airEnum *limnCameraPathTrack; + /* qn.c */ TEEM_API int limnQNBins[LIMN_QN_MAX+1]; *************** *** 369,373 **** TEEM_API int (*limnVtoQN_d[LIMN_QN_MAX+1])(double *vec); - /* light.c */ TEEM_API void limnLightSet(limnLight *lit, int which, int vsp, --- 379,382 ---- *************** *** 399,405 **** char *frDef, char *atDef, char *upDef, char *dnDef, char *diDef, char *dfDef, ! char *urDef, char *vrDef); /* cam.c */ TEEM_API int limnCameraUpdate(limnCamera *cam); TEEM_API int limnCameraPathMake(limnCamera *cam, int numFrames, --- 408,416 ---- char *frDef, char *atDef, char *upDef, char *dnDef, char *diDef, char *dfDef, ! char *urDef, char *vrDef, char *fvDef); /* cam.c */ + TEEM_API int limnCameraAspectSet(limnCamera *cam, + int horz, int vert, int centering); TEEM_API int limnCameraUpdate(limnCamera *cam); TEEM_API int limnCameraPathMake(limnCamera *cam, int numFrames, *************** *** 409,413 **** limnSplineTypeSpec *posType, limnSplineTypeSpec *distType, ! limnSplineTypeSpec *uvType); /* obj.c */ --- 420,424 ---- limnSplineTypeSpec *posType, limnSplineTypeSpec *distType, ! limnSplineTypeSpec *viewType); /* obj.c */ Index: cam.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/cam.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** cam.c 7 Jan 2004 15:34:30 -0000 1.19 --- cam.c 10 May 2004 19:27:24 -0000 1.20 *************** *** 24,28 **** ******** limnCameraUpdate() ** ! ** sets in cam: W2V matrix, vspNeer, vspFaar, vspDist ** ** This does use biff to describe problems with camera settings --- 24,29 ---- ******** limnCameraUpdate() ** ! ** sets in cam: W2V, V2W, U, V, N, vspNeer, vspFaar, vspDist ! ** and, if fov and aspect are set, this also sets uRange and vRange ** ** This does use biff to describe problems with camera settings *************** *** 30,47 **** int limnCameraUpdate(limnCamera *cam) { ! char me[] = "limnCameraUpdate", err[129]; ! double len, l[4], u[4], v[4], n[4], T[16], R[16]; ! ELL_4V_SET(u, 0, 0, 0, 0); ! ELL_4V_SET(v, 0, 0, 0, 0); ! ELL_4V_SET(n, 0, 0, 0, 0); ! ELL_4V_SET(l, 0, 0, 0, 1); ! ELL_3V_SUB(n, cam->at, cam->from); ! len = ELL_3V_LEN(n); if (!len) { ! sprintf(err, "%s: cam->at (%g,%g,%g) == cam->from (%g,%g,%g)\n", me, ! cam->at[0], cam->at[1], cam->at[2], ! cam->from[0], cam->from[1], cam->from[2]); biffAdd(LIMN, err); return 1; } --- 31,51 ---- int limnCameraUpdate(limnCamera *cam) { ! char me[] = "limnCameraUpdate", err[AIR_STRLEN_MED]; ! double len, bb[4], uu[4], vv[4], nn[4], TT[16], RR[16]; ! if (!cam) { ! sprintf(err, "%s: got NULL pointer", me); ! biffAdd(LIMN, err); return 1; ! } ! ELL_4V_SET(uu, 0, 0, 0, 0); ! ELL_4V_SET(vv, 0, 0, 0, 0); ! ELL_4V_SET(nn, 0, 0, 0, 0); ! ELL_4V_SET(bb, 0, 0, 0, 1); ! ELL_3V_SUB(nn, cam->at, cam->from); ! len = ELL_3V_LEN(nn); if (!len) { ! sprintf(err, "%s: cam->at (%g,%g,%g) == cam->from", me, ! cam->at[0], cam->at[1], cam->at[2]); biffAdd(LIMN, err); return 1; } *************** *** 59,95 **** } if (!(cam->vspNeer > 0 && cam->vspDist > 0 && cam->vspFaar > 0)) { ! sprintf(err, "%s: eye-relative near (%g), dist (%g), or far (%g) <= 0\n", me, cam->vspNeer, cam->vspDist, cam->vspFaar); biffAdd(LIMN, err); return 1; } if (!(cam->vspNeer <= cam->vspFaar)) { ! sprintf(err, "%s: eye-relative near (%g) further than far (%g)\n", me, cam->vspNeer, cam->vspFaar); biffAdd(LIMN, err); return 1 ; } ! ELL_3V_SCALE(n, 1.0/len, n); ! ELL_3V_CROSS(u, n, cam->up); ! len = ELL_3V_LEN(u); if (!len) { ! sprintf(err, "%s: cam->up is co-linear with view direction\n", me); biffAdd(LIMN, err); return 1 ; } ! ELL_3V_SCALE(u, 1.0/len, u); if (cam->rightHanded) { ! ELL_3V_CROSS(v, n, u); } else { ! ELL_3V_CROSS(v, u, n); } ! ELL_4V_COPY(cam->U, u); ! ELL_4V_COPY(cam->V, v); ! ELL_4V_COPY(cam->N, n); ! ELL_4M_TRANSLATE_SET(T, -cam->from[0], -cam->from[1], -cam->from[2]); ! ELL_4M_ROWS_SET(R, u, v, n, l); ! ELL_4M_MUL(cam->W2V, R, T); ! ELL_4M_COPY(T, cam->W2V); ! ell_4m_inv_d(cam->V2W, T); return 0; --- 63,117 ---- } if (!(cam->vspNeer > 0 && cam->vspDist > 0 && cam->vspFaar > 0)) { ! sprintf(err, "%s: eye-relative near (%g), dist (%g), or far (%g) <= 0", me, cam->vspNeer, cam->vspDist, cam->vspFaar); biffAdd(LIMN, err); return 1; } if (!(cam->vspNeer <= cam->vspFaar)) { ! sprintf(err, "%s: eye-relative near (%g) further than far (%g)", me, cam->vspNeer, cam->vspFaar); biffAdd(LIMN, err); return 1 ; } ! if (AIR_EXISTS(cam->fov)) { ! if (!( AIR_IN_OP(0.0, cam->fov, 180.0) )) { ! sprintf(err, "%s: cam->fov (%g) not in valid range between 0 and 180", ! me, cam->fov); ! biffAdd(LIMN, err); return 1 ; ! } ! if (!AIR_EXISTS(cam->aspect)) { ! sprintf(err, "%s: cam->fov set, but cam->aspect isn't", me); ! biffAdd(LIMN, err); return 1; ! } ! /* "fov" is half vertical angle */ ! cam->vRange[0] = -tan(cam->fov*AIR_PI/360)*(cam->vspDist); ! cam->vRange[1] = -cam->vRange[0]; ! cam->uRange[0] = cam->vRange[0]*(cam->aspect); ! cam->uRange[1] = -cam->uRange[0]; ! } ! /* else cam->fov isn't set, but we're not going to complain if ! uRange and vRange aren't both set ... */ ! ! ELL_3V_SCALE(nn, 1.0/len, nn); ! ELL_3V_CROSS(uu, nn, cam->up); ! len = ELL_3V_LEN(uu); if (!len) { ! sprintf(err, "%s: cam->up is co-linear with view direction", me); biffAdd(LIMN, err); return 1 ; } ! ELL_3V_SCALE(uu, 1.0/len, uu); if (cam->rightHanded) { ! ELL_3V_CROSS(vv, nn, uu); } else { ! ELL_3V_CROSS(vv, uu, nn); } ! ELL_4V_COPY(cam->U, uu); ! ELL_4V_COPY(cam->V, vv); ! ELL_4V_COPY(cam->N, nn); ! ELL_4M_TRANSLATE_SET(TT, -cam->from[0], -cam->from[1], -cam->from[2]); ! ELL_4M_ROWS_SET(RR, uu, vv, nn, bb); ! ELL_4M_MUL(cam->W2V, RR, TT); ! ell_4m_inv_d(cam->V2W, cam->W2V); return 0; *************** *** 97,134 **** /* ******** limnCameraPathMake ** ! ** the atRelative, orthographic, and rightHanded fields are used from ! ** keycam[0], and those fields are ignored for all other keycam[i] */ int limnCameraPathMake(limnCamera *cam, int numFrames, ! limnCamera *keycam, double *time, ! int numKeys, int trackFrom, limnSplineTypeSpec *quatType, limnSplineTypeSpec *posType, limnSplineTypeSpec *distType, ! limnSplineTypeSpec *uvType) { char me[]="limnCameraPathMake", err[AIR_STRLEN_MED]; char which[AIR_STRLEN_MED]; airArray *mop; ! Nrrd *nquat, *npos, *ndist, *nuv, *ntime, *nsample; ! double fratVec[3], *quat, *pos, *dist, *uv, W2V[9], N[3], fratDist; ! limnSpline *timeSpline, *quatSpline, *posSpline, *distSpline, *uvSpline; limnSplineTypeSpec *timeType; ! int ii; ! if (!( cam && keycam && time ! && quatType && posType && distType && uvType )) { sprintf(err, "%s: got NULL pointer", me); biffAdd(LIMN, err); return 1; } ! /* create and allocate nrrds */ mop = airMopNew(); airMopAdd(mop, nquat = nrrdNew(), (airMopper)nrrdNuke, airMopAlways); ! airMopAdd(mop, npos = nrrdNew(), (airMopper)nrrdNuke, airMopAlways); airMopAdd(mop, ndist = nrrdNew(), (airMopper)nrrdNuke, airMopAlways); ! airMopAdd(mop, nuv = nrrdNew(), (airMopper)nrrdNuke, airMopAlways); airMopAdd(mop, ntime = nrrdNew(), (airMopper)nrrdNix, airMopAlways); if (nrrdWrap(ntime, time, nrrdTypeDouble, 1, numKeys)) { --- 119,233 ---- /* + ******** limnCameraAspectSet + ** + ** simply sets the "aspect" field of the cam. Note that calling this + ** does *not* automatically mean that the uRange and vRange in the camera + ** will be set according to the "fov"- the "fov" has to actually be set + ** (be non-NaN) for that to happen. This allows dumber functions to + ** call this whenever they have the information required to do so, even + ** if the "aspect" is not going to be needed for a given camera use + */ + int + limnCameraAspectSet(limnCamera *cam, int horz, int vert, int centering) { + char me[] = "limnCameraAspectSet", err[AIR_STRLEN_MED]; + + if (!cam) { + sprintf(err, "%s: got NULL pointer", me); + biffAdd(LIMN, err); return 1; + } + if (!( horz > 0 && vert > 0 )) { + sprintf(err, "%s: bad image dimensions %dx%d", me, horz, vert); + biffAdd(LIMN, err); return 1; + } + if (airEnumValCheck(nrrdCenter, centering)) { + sprintf(err, "%s: centering %d not valid", me, centering); + biffAdd(LIMN, err); return 1; + } + + if (nrrdCenterCell == centering) { + cam->aspect = ((double)horz)/vert; + } else { + cam->aspect = ((double)(horz-1))/(vert-1); + } + + return 0; + } + + /* ******** limnCameraPathMake ** ! ** uses limnSplines to do camera paths based on key-frames ! ** ! ** output: cameras at all "numFrames" frames are set in the ! ** PRE-ALLOCATED array of output cameras, "cam". ! ** ! ** input: an array of keyframe cameras "keycam", and times associated ! ** with the key frames "time", both arrays length "numKeys" ! ** trackWhat: takes values from the limnCameraPathTrack* enum ! ** quatType: spline to control camera orientations. This is needed for ! ** tracking at or from, but not needed for limnCameraPathTrackBoth ! ** This is the only limnSplineTypeSpec* argument that can be NULL ! ** posType: spline to control whichever of from, at, and up are needed for ! ** the given style of tracking ! ** distType: spline to control neer, faar, dist: positions of near clipping, ! ** far clipping, and image plane, as well as the ! ** distance between from and at (which is used if not doing ! ** limnCameraPathTrackBoth) ! ** viewType: spline to control fov (and aspect, if you're crazy) ! ** ! ** NOTE: The "atRelative", "orthographic", and "rightHanded" fields ! ** are used from keycam[0], and those fields are ignored for all other ! ** keycam[i]. Also, for the sake of simplicity, this only works with ! ** fov and aspect, instead of {u,v}Range, and hence both "fov" and "aspect" ! ** need to set in *all* the keycams, even if neither of them ever changes! */ int limnCameraPathMake(limnCamera *cam, int numFrames, ! limnCamera *keycam, double *time, int numKeys, ! int trackWhat, limnSplineTypeSpec *quatType, limnSplineTypeSpec *posType, limnSplineTypeSpec *distType, ! limnSplineTypeSpec *viewType) { char me[]="limnCameraPathMake", err[AIR_STRLEN_MED]; char which[AIR_STRLEN_MED]; airArray *mop; ! Nrrd *nquat, *nfrom, *natpt, *nupvc, *ndist, *nfova, *ntime, *nsample; ! double fratVec[3], *quat, *from, *atpt, *upvc, *dist, *fova, ! W2V[9], N[3], fratDist; ! limnSpline *timeSpline, *quatSpline, *fromSpline, *atptSpline, *upvcSpline, ! *distSpline, *fovaSpline; limnSplineTypeSpec *timeType; ! int ii, E; ! if (!( cam && keycam && time && posType && distType && viewType )) { sprintf(err, "%s: got NULL pointer", me); biffAdd(LIMN, err); return 1; } + if (!( AIR_IN_OP(limnCameraPathTrackUnknown, trackWhat, + limnCameraPathTrackLast) )) { + sprintf(err, "%s: trackWhat %d not in valid range [%d,%d]", me, + trackWhat, limnCameraPathTrackUnknown+1, + limnCameraPathTrackLast-1); + biffAdd(LIMN, err); return 1; + } + if (limnCameraPathTrackBoth != trackWhat && !quatType) { + sprintf(err, "%s: need the quaternion limnSplineTypeSpec if not " + "doing trackBoth", me); + biffAdd(LIMN, err); return 1; + } ! /* create and allocate nrrds. For the time being, we're allocating ! more different nrrds, and filling their contents, than we need ! to-- nquat is not needed if we're doing limnCameraPathTrackBoth, ! for example. However, we do make an effort to only do the spline ! evaluation on the things we actually need to know. */ mop = airMopNew(); airMopAdd(mop, nquat = nrrdNew(), (airMopper)nrrdNuke, airMopAlways); ! airMopAdd(mop, nfrom = nrrdNew(), (airMopper)nrrdNuke, airMopAlways); ! airMopAdd(mop, natpt = nrrdNew(), (airMopper)nrrdNuke, airMopAlways); ! airMopAdd(mop, nupvc = nrrdNew(), (airMopper)nrrdNuke, airMopAlways); airMopAdd(mop, ndist = nrrdNew(), (airMopper)nrrdNuke, airMopAlways); ! airMopAdd(mop, nfova = nrrdNew(), (airMopper)nrrdNuke, airMopAlways); airMopAdd(mop, ntime = nrrdNew(), (airMopper)nrrdNix, airMopAlways); if (nrrdWrap(ntime, time, nrrdTypeDouble, 1, numKeys)) { *************** *** 140,153 **** airMopAdd(mop, timeType, (airMopper)limnSplineTypeSpecNix, airMopAlways); if (nrrdMaybeAlloc(nquat, nrrdTypeDouble, 2, 4, numKeys) ! || nrrdMaybeAlloc(npos, nrrdTypeDouble, 2, 3, numKeys) || nrrdMaybeAlloc(ndist, nrrdTypeDouble, 2, 4, numKeys) ! || nrrdMaybeAlloc(nuv, nrrdTypeDouble, 2, 4, numKeys)) { sprintf(err, "%s: couldn't allocate buffer nrrds", me); biffMove(LIMN, err, NRRD); airMopError(mop); return 1; } quat = (double*)(nquat->data); ! pos = (double*)(npos->data); dist = (double*)(ndist->data); ! uv = (double*)(nuv->data); /* check cameras, and put camera information into nrrds */ --- 239,256 ---- airMopAdd(mop, timeType, (airMopper)limnSplineTypeSpecNix, airMopAlways); if (nrrdMaybeAlloc(nquat, nrrdTypeDouble, 2, 4, numKeys) ! || nrrdMaybeAlloc(nfrom, nrrdTypeDouble, 2, 3, numKeys) ! || nrrdMaybeAlloc(natpt, nrrdTypeDouble, 2, 3, numKeys) ! || nrrdMaybeAlloc(nupvc, nrrdTypeDouble, 2, 3, numKeys) || nrrdMaybeAlloc(ndist, nrrdTypeDouble, 2, 4, numKeys) ! || nrrdMaybeAlloc(nfova, nrrdTypeDouble, 2, 2, numKeys)) { sprintf(err, "%s: couldn't allocate buffer nrrds", me); biffMove(LIMN, err, NRRD); airMopError(mop); return 1; } quat = (double*)(nquat->data); ! from = (double*)(nfrom->data); ! atpt = (double*)(natpt->data); ! upvc = (double*)(nupvc->data); dist = (double*)(ndist->data); ! fova = (double*)(nfova->data); /* check cameras, and put camera information into nrrds */ *************** *** 157,160 **** --- 260,267 ---- biffAdd(LIMN, err); airMopError(mop); return 1; } + if (!( AIR_EXISTS(keycam[ii].fov) && AIR_EXISTS(keycam[ii].aspect) )) { + sprintf(err, "%s: fov, aspect not both defined on keyframe %d", me, ii); + biffAdd(LIMN, err); airMopError(mop); return 1; + } ell_4m_to_q_d(quat + 4*ii, keycam[ii].W2V); if (ii) { *************** *** 163,178 **** } } ! if (trackFrom) { ! ELL_3V_COPY(pos + 3*ii, keycam[ii].from); ! } else { ! ELL_3V_COPY(pos + 3*ii, keycam[ii].at); ! } ELL_3V_SUB(fratVec, keycam[ii].from, keycam[ii].at); ELL_4V_SET(dist + 4*ii, ELL_3V_LEN(fratVec), keycam[ii].neer, keycam[ii].dist, keycam[ii].faar); ! ELL_4V_SET(uv + 4*ii, ! keycam[ii].uRange[0], keycam[ii].uRange[1], ! keycam[ii].vRange[0], keycam[ii].vRange[1]); } --- 270,281 ---- } } ! ELL_3V_COPY(from + 3*ii, keycam[ii].from); ! ELL_3V_COPY(atpt + 3*ii, keycam[ii].at); ! ELL_3V_COPY(upvc + 3*ii, keycam[ii].up); ELL_3V_SUB(fratVec, keycam[ii].from, keycam[ii].at); ELL_4V_SET(dist + 4*ii, ELL_3V_LEN(fratVec), keycam[ii].neer, keycam[ii].dist, keycam[ii].faar); ! ELL_2V_SET(fova + 2*ii, keycam[ii].fov, keycam[ii].aspect); } *************** *** 180,189 **** if (!( (strcpy(which, "quaternion"), quatSpline = limnSplineCleverNew(nquat, limnSplineInfoQuaternion, quatType)) ! && (strcpy(which, "position"), posSpline = ! limnSplineCleverNew(npos, limnSplineInfo3Vector, posType)) ! && (strcpy(which, "distance"), distSpline = limnSplineCleverNew(ndist, limnSplineInfo4Vector, distType)) ! && (strcpy(which, "uvRange"), uvSpline = ! limnSplineCleverNew(nuv, limnSplineInfo4Vector, uvType)) && (strcpy(which, "time warp"), timeSpline = limnSplineCleverNew(ntime, limnSplineInfoScalar, timeType)) )) { --- 283,296 ---- if (!( (strcpy(which, "quaternion"), quatSpline = limnSplineCleverNew(nquat, limnSplineInfoQuaternion, quatType)) ! && (strcpy(which, "from point"), fromSpline = ! limnSplineCleverNew(nfrom, limnSplineInfo3Vector, posType)) ! && (strcpy(which, "at point"), atptSpline = ! limnSplineCleverNew(natpt, limnSplineInfo3Vector, posType)) ! && (strcpy(which, "up vector"), upvcSpline = ! limnSplineCleverNew(nupvc, limnSplineInfo3Vector, posType)) ! && (strcpy(which, "plane distances"), distSpline = limnSplineCleverNew(ndist, limnSplineInfo4Vector, distType)) ! && (strcpy(which, "field-of-view"), fovaSpline = ! limnSplineCleverNew(nfova, limnSplineInfo2Vector, viewType)) && (strcpy(which, "time warp"), timeSpline = limnSplineCleverNew(ntime, limnSplineInfoScalar, timeType)) )) { *************** *** 192,214 **** } airMopAdd(mop, quatSpline, (airMopper)limnSplineNix, airMopAlways); ! airMopAdd(mop, posSpline, (airMopper)limnSplineNix, airMopAlways); airMopAdd(mop, distSpline, (airMopper)limnSplineNix, airMopAlways); ! airMopAdd(mop, quatSpline, (airMopper)limnSplineNix, airMopAlways); airMopAdd(mop, timeSpline, (airMopper)limnSplineNix, airMopAlways); /* evaluate splines */ ! if (limnSplineSample(nsample, timeSpline, limnSplineMinT(timeSpline), ! numFrames, limnSplineMaxT(timeSpline)) ! || limnSplineNrrdEvaluate(nquat, quatSpline, nsample) ! || limnSplineNrrdEvaluate(npos, posSpline, nsample) ! || limnSplineNrrdEvaluate(ndist, distSpline, nsample) ! || limnSplineNrrdEvaluate(nuv, uvSpline, nsample)) { sprintf(err, "%s: trouble evaluating splines", me); biffAdd(LIMN, err); airMopError(mop); return 1; } - quat = (double*)(nquat->data); - pos = (double*)(npos->data); - dist = (double*)(ndist->data); - uv = (double*)(nuv->data); /* copy information from nrrds back into cameras */ --- 299,350 ---- } airMopAdd(mop, quatSpline, (airMopper)limnSplineNix, airMopAlways); ! airMopAdd(mop, fromSpline, (airMopper)limnSplineNix, airMopAlways); ! airMopAdd(mop, atptSpline, (airMopper)limnSplineNix, airMopAlways); ! airMopAdd(mop, upvcSpline, (airMopper)limnSplineNix, airMopAlways); airMopAdd(mop, distSpline, (airMopper)limnSplineNix, airMopAlways); ! airMopAdd(mop, fovaSpline, (airMopper)limnSplineNix, airMopAlways); airMopAdd(mop, timeSpline, (airMopper)limnSplineNix, airMopAlways); /* evaluate splines */ ! E = AIR_FALSE; ! if (!E) E |= limnSplineSample(nsample, timeSpline, ! limnSplineMinT(timeSpline), numFrames, ! limnSplineMaxT(timeSpline)); ! quat = NULL; ! from = NULL; ! atpt = NULL; ! upvc = NULL; ! switch(trackWhat) { ! case limnCameraPathTrackAt: ! if (!E) E |= limnSplineNrrdEvaluate(natpt, atptSpline, nsample); ! if (!E) atpt = (double*)(natpt->data); ! if (!E) E |= limnSplineNrrdEvaluate(nquat, quatSpline, nsample); ! if (!E) quat = (double*)(nquat->data); ! break; ! case limnCameraPathTrackFrom: ! if (!E) E |= limnSplineNrrdEvaluate(nfrom, fromSpline, nsample); ! if (!E) from = (double*)(nfrom->data); ! if (!E) E |= limnSplineNrrdEvaluate(nquat, quatSpline, nsample); ! if (!E) quat = (double*)(nquat->data); ! break; ! case limnCameraPathTrackBoth: ! if (!E) E |= limnSplineNrrdEvaluate(nfrom, fromSpline, nsample); ! if (!E) from = (double*)(nfrom->data); ! if (!E) E |= limnSplineNrrdEvaluate(natpt, atptSpline, nsample); ! if (!E) atpt = (double*)(natpt->data); ! if (!E) E |= limnSplineNrrdEvaluate(nupvc, atptSpline, nsample); ! if (!E) upvc = (double*)(nupvc->data); ! break; ! } ! dist = NULL; ! if (!E) E |= limnSplineNrrdEvaluate(ndist, distSpline, nsample); ! if (!E) dist = (double*)(ndist->data); ! fova = NULL; ! if (!E) E |= limnSplineNrrdEvaluate(nfova, fovaSpline, nsample); ! if (!E) fova = (double*)(nfova->data); ! if (E) { sprintf(err, "%s: trouble evaluating splines", me); biffAdd(LIMN, err); airMopError(mop); return 1; } /* copy information from nrrds back into cameras */ *************** *** 217,237 **** cam[ii].orthographic = keycam[0].orthographic; cam[ii].rightHanded = keycam[0].rightHanded; ! ell_q_to_3m_d(W2V, quat + 4*ii); ! ELL_3MV_ROW1_GET(cam[ii].up, W2V); ! if (cam[ii].rightHanded) { ! ELL_3V_SCALE(cam[ii].up, -1, cam[ii].up); ! } ! ELL_3MV_ROW2_GET(N, W2V); ! ELL_4V_GET(fratDist, cam[ii].neer, cam[ii].dist, cam[ii].faar, ! dist + 4*ii); ! if (trackFrom) { ! ELL_3V_COPY(cam[ii].from, pos + 3*ii); ! ELL_3V_SCALE_ADD2(cam[ii].at, 1.0, cam[ii].from, fratDist, N); } else { ! ELL_3V_COPY(cam[ii].at, pos + 3*ii); ! ELL_3V_SCALE_ADD2(cam[ii].from, 1.0, cam[ii].at, -fratDist, N); } ! ELL_4V_GET(cam[ii].uRange[0], cam[ii].uRange[1], ! cam[ii].vRange[0], cam[ii].vRange[1], uv + 4*ii); if (limnCameraUpdate(cam + ii)) { sprintf(err, "%s: trouble with output camera %d\n", me, ii); --- 353,381 ---- cam[ii].orthographic = keycam[0].orthographic; cam[ii].rightHanded = keycam[0].rightHanded; ! if (limnCameraPathTrackBoth == trackWhat) { ! ELL_3V_COPY(cam[ii].from, from + 3*ii); ! ELL_3V_COPY(cam[ii].at, atpt + 3*ii); ! ELL_3V_COPY(cam[ii].up, upvc + 3*ii); } else { ! fratDist = (dist + 4*ii)[0]; ! ell_q_to_3m_d(W2V, quat + 4*ii); ! ELL_3MV_ROW1_GET(cam[ii].up, W2V); ! if (cam[ii].rightHanded) { ! ELL_3V_SCALE(cam[ii].up, -1, cam[ii].up); ! } ! ELL_3MV_ROW2_GET(N, W2V); ! if (limnCameraPathTrackFrom == trackWhat) { ! ELL_3V_COPY(cam[ii].from, from + 3*ii); ! ELL_3V_SCALE_ADD2(cam[ii].at, 1.0, cam[ii].from, fratDist, N); ! } else { ! ELL_3V_COPY(cam[ii].at, atpt + 3*ii); ! ELL_3V_SCALE_ADD2(cam[ii].from, 1.0, cam[ii].at, -fratDist, N); ! } } ! cam[ii].neer = (dist + 4*ii)[1]; ! cam[ii].dist = (dist + 4*ii)[2]; ! cam[ii].faar = (dist + 4*ii)[3]; ! cam[ii].fov = (fova + 2*ii)[0]; ! cam[ii].aspect = (fova + 2*ii)[1]; if (limnCameraUpdate(cam + ii)) { sprintf(err, "%s: trouble with output camera %d\n", me, ii); |
|
From: Gordon K. <kin...@us...> - 2004-05-10 19:27:38
|
Update of /cvsroot/teem/teem/src/limn/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13197/test Modified Files: tcamanim.c Log Message: added two new fields to the limnCamera, "fov" and "aspect", augmented the semantics of limnCameraUpdate, and made an effort to fix/debug the limnCameraPathMake() function. "fov" is like the "fovy" argument to gluPerspective()- the angle in degrees vertically subtended by the view window, and "aspect" is the ratio of horizontal to vertical size of the view window. Now, when limCameraUpdate() is called, it will see if both fov and aspect are set (non-NaN), and if so will update uRange[] and vRange[] accordingly. Otherwise, uRange[] and vRange[] will not be touched. limnCameraPathMake is not a new function, but it never worked usefully. Index: tcamanim.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/test/tcamanim.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcamanim.c 19 Feb 2004 06:45:12 -0000 1.4 --- tcamanim.c 10 May 2004 19:27:25 -0000 1.5 *************** *** 27,36 **** int _limnReadCamanim(int imgSize[2], limnCamera **keycamP, double **timeP, ! double **isoValueP, int *numKeysP, FILE *fin) { char me[]="_limnReadCamanim", err[AIR_STRLEN_MED]; char line[AIR_STRLEN_HUGE]; int lret, ki; ! double *tmp, *dwell, di, dn, df, va, vm, um, fr[3], at[3], up[3]; ! airArray *mop, *camA, *dwellA, *isoValueA; if (!( 0 < (lret = airOneLine(fin, line, AIR_STRLEN_HUGE)) --- 27,36 ---- int _limnReadCamanim(int imgSize[2], limnCamera **keycamP, double **timeP, ! int *numKeysP, FILE *fin) { char me[]="_limnReadCamanim", err[AIR_STRLEN_MED]; char line[AIR_STRLEN_HUGE]; int lret, ki; ! double *tmp, *dwell, di, dn, df, fr[3], at[3], up[3], va; ! airArray *mop, *camA, *dwellA; if (!( 0 < (lret = airOneLine(fin, line, AIR_STRLEN_HUGE)) *************** *** 51,58 **** camA = airArrayNew((void **)keycamP, numKeysP, sizeof(limnCamera), 1); dwellA = airArrayNew((void **)&dwell, NULL, sizeof(double), 1); - isoValueA = airArrayNew((void **)isoValueP, NULL, sizeof(double), 1); airMopAdd(mop, camA, (airMopper)airArrayNix, airMopAlways); airMopAdd(mop, dwellA, (airMopper)airArrayNuke, airMopAlways); - airMopAdd(mop, isoValueA, (airMopper)airArrayNix, airMopAlways); while ( 0 < (lret = airOneLine(fin, line, AIR_STRLEN_HUGE)) ) { --- 51,56 ---- *************** *** 60,68 **** ki = airArrayIncrLen(camA, 1); airArrayIncrLen(dwellA, 1); ! airArrayIncrLen(isoValueA, 1); ! if (15 != sscanf(line, "isoValue %lg cam.di %lg cam.at %lg %lg %lg " "cam.up %lg %lg %lg cam.dn %lg cam.df %lg cam.va %lg " "relDwell %lg cam.fr %lg %lg %lg", ! (*isoValueP)+ki, &di, at+0, at+1, at+2, up+0, up+1, up+2, &dn, &df, &va, dwell+ki, fr+0, fr+1, fr+2)) { --- 58,65 ---- ki = airArrayIncrLen(camA, 1); airArrayIncrLen(dwellA, 1); ! if (15 != sscanf(line, "cam.di %lg cam.at %lg %lg %lg " "cam.up %lg %lg %lg cam.dn %lg cam.df %lg cam.va %lg " "relDwell %lg cam.fr %lg %lg %lg", ! &di, at+0, at+1, at+2, up+0, up+1, up+2, &dn, &df, &va, dwell+ki, fr+0, fr+1, fr+2)) { *************** *** 76,85 **** ELL_3V_COPY((*keycamP)[ki].at, at); ELL_3V_COPY((*keycamP)[ki].up, up); ! vm = tan((AIR_PI/180)*(va/2))*di; ! um = vm*imgSize[0]/imgSize[1]; ! (*keycamP)[ki].uRange[0] = -um; ! (*keycamP)[ki].uRange[1] = um; ! (*keycamP)[ki].vRange[0] = -vm; ! (*keycamP)[ki].vRange[1] = vm; } (*keycamP)[0].atRelative = AIR_FALSE; --- 73,78 ---- ELL_3V_COPY((*keycamP)[ki].at, at); ELL_3V_COPY((*keycamP)[ki].up, up); ! (*keycamP)[ki].fov = va; ! (*keycamP)[ki].aspect = (double)imgSize[0]/imgSize[1]; } (*keycamP)[0].atRelative = AIR_FALSE; *************** *** 88,93 **** --- 81,88 ---- tmp = (double*)calloc(*numKeysP, sizeof(double)); + airMopAdd(mop, tmp, airFree, airMopAlways); *timeP = (double*)calloc(*numKeysP, sizeof(double)); for (ki=0; ki<*numKeysP; ki++) { + dwell[ki] = AIR_CLAMP(0, dwell[ki], 2); tmp[ki] = tan(AIR_AFFINE(-0.01, dwell[ki], 2.01, 0.0, AIR_PI/2)); } *************** *** 105,112 **** int ! _limnWriteCamanim(FILE *fout, int imgSize[2], double isoValue, limnCamera *cam, int numFrames) { /* char me[]="_limnWriteCamanim", err[AIR_STRLEN_MED]; */ - double di, vm, va; int fi; --- 100,106 ---- int ! _limnWriteCamanim(FILE *fout, int imgSize[2], limnCamera *cam, int numFrames) { /* char me[]="_limnWriteCamanim", err[AIR_STRLEN_MED]; */ int fi; *************** *** 114,127 **** fprintf(fout, "imgSize {%d %d}\n", imgSize[0], imgSize[1]); for (fi=0; fi<numFrames; fi++) { ! di = cam[fi].dist; ! vm = cam[fi].vRange[1]; ! va = 2*atan2(vm, di)/(AIR_PI/180); ! fprintf(fout, "isoValue %g cam.di %g cam.at {%g %g %g } " "cam.up {%g %g %g } cam.dn %g cam.df %g cam.va %g " "relDwell 1.0 cam.fr {%g %g %g }\n", ! isoValue, cam[fi].dist, cam[fi].at[0], cam[fi].at[1], cam[fi].at[2], cam[fi].up[0], cam[fi].up[1], cam[fi].up[2], ! cam[fi].neer, cam[fi].faar, va, cam[fi].from[0], cam[fi].from[1], cam[fi].from[2]); } --- 108,118 ---- fprintf(fout, "imgSize {%d %d}\n", imgSize[0], imgSize[1]); for (fi=0; fi<numFrames; fi++) { ! fprintf(fout, "cam.di %g cam.at {%g %g %g } " "cam.up {%g %g %g } cam.dn %g cam.df %g cam.va %g " "relDwell 1.0 cam.fr {%g %g %g }\n", ! cam[fi].dist, cam[fi].at[0], cam[fi].at[1], cam[fi].at[2], cam[fi].up[0], cam[fi].up[1], cam[fi].up[2], ! cam[fi].neer, cam[fi].faar, cam[fi].fov, cam[fi].from[0], cam[fi].from[1], cam[fi].from[2]); } *************** *** 137,144 **** char *inS, *outS, *err; limnCamera *keycam, *cam; ! limnSplineTypeSpec *quatType, *posType, *distType, *uvType; ! double *time, *isoValue; FILE *fin, *fout; ! int N, numKeys, imgSize[2], tf; mop = airMopNew(); --- 128,135 ---- char *inS, *outS, *err; limnCamera *keycam, *cam; ! limnSplineTypeSpec *quatType, *posType, *distType, *viewType; ! double *time; FILE *fin, *fout; ! int N, numKeys, imgSize[2], trackWhat; mop = airMopNew(); *************** *** 149,169 **** hestOptAdd(&hopt, "n", "# frames", airTypeInt, 1, 1, &N, "128", "number of frames in output"); ! hestOptAdd(&hopt, "tf", "track from point", airTypeInt, 0, 0, &tf, NULL, ! "track the from (eye) point, instead of the at point"); hestOptAdd(&hopt, "q", "spline", airTypeOther, 1, 1, &quatType, "tent", "spline type for quaternions", NULL, NULL, limnHestSplineTypeSpec); hestOptAdd(&hopt, "p", "spline", airTypeOther, 1, 1, ! &posType, "tent", "spline type for at/from point", NULL, NULL, limnHestSplineTypeSpec); hestOptAdd(&hopt, "d", "spline", airTypeOther, 1, 1, &distType, "tent", "spline type for image plane distances", NULL, NULL, limnHestSplineTypeSpec); ! hestOptAdd(&hopt, "uv", "spline", airTypeOther, 1, 1, ! &uvType, "tent", "spline type for image extents", NULL, NULL, limnHestSplineTypeSpec); - hestOptAdd(&hopt, "o", "output", airTypeString, 1, 1, &outS, NULL, ! "keyframe output from camanim.tcl"); hestParseOrDie(hopt, argc-1, argv+1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE); --- 140,159 ---- hestOptAdd(&hopt, "n", "# frames", airTypeInt, 1, 1, &N, "128", "number of frames in output"); ! hestOptAdd(&hopt, "t", "track what", airTypeEnum, 1, 1, &trackWhat, "both", ! "what to track", NULL, limnCameraPathTrack); hestOptAdd(&hopt, "q", "spline", airTypeOther, 1, 1, &quatType, "tent", "spline type for quaternions", NULL, NULL, limnHestSplineTypeSpec); hestOptAdd(&hopt, "p", "spline", airTypeOther, 1, 1, ! &posType, "tent", "spline type for from/at/up", NULL, NULL, limnHestSplineTypeSpec); hestOptAdd(&hopt, "d", "spline", airTypeOther, 1, 1, &distType, "tent", "spline type for image plane distances", NULL, NULL, limnHestSplineTypeSpec); ! hestOptAdd(&hopt, "v", "spline", airTypeOther, 1, 1, ! &viewType, "tent", "spline type for image fov and aspect", NULL, NULL, limnHestSplineTypeSpec); hestOptAdd(&hopt, "o", "output", airTypeString, 1, 1, &outS, NULL, ! "frame info for camanim.tcl"); hestParseOrDie(hopt, argc-1, argv+1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE); *************** *** 182,186 **** airMopAdd(mop, fout, (airMopper)airFclose, airMopAlways); ! if (_limnReadCamanim(imgSize, &keycam, &time, &isoValue, &numKeys, fin)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble reading keyframe file:\n%s\n", me, err); --- 172,176 ---- airMopAdd(mop, fout, (airMopper)airFclose, airMopAlways); ! if (_limnReadCamanim(imgSize, &keycam, &time, &numKeys, fin)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble reading keyframe file:\n%s\n", me, err); *************** *** 189,199 **** cam = (limnCamera *)calloc(N, sizeof(limnCamera)); airMopAdd(mop, cam, airFree, airMopAlways); ! if (limnCameraPathMake(cam, N, keycam, time, numKeys, tf, ! quatType, posType, distType, uvType)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble making camera path:\n%s\n", me, err); airMopError(mop); return 1; } ! if (_limnWriteCamanim(fout, imgSize, isoValue[0], cam, N)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble writing frame file:\n%s\n", me, err); --- 179,189 ---- cam = (limnCamera *)calloc(N, sizeof(limnCamera)); airMopAdd(mop, cam, airFree, airMopAlways); ! if (limnCameraPathMake(cam, N, keycam, time, numKeys, trackWhat, ! quatType, posType, distType, viewType)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble making camera path:\n%s\n", me, err); airMopError(mop); return 1; } ! if (_limnWriteCamanim(fout, imgSize, cam, N)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble writing frame file:\n%s\n", me, err); |
|
From: Gordon K. <kin...@us...> - 2004-05-10 19:18:54
|
Update of /cvsroot/teem/teem/src/limn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11010 Modified Files: GNUmakefile Added Files: enumsLimn.c Log Message: added an airEnum for limnCameraPathTrack --- NEW FILE: enumsLimn.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 _limnCameraPathTrackStr[][AIR_STRLEN_SMALL] = { "(unknown limnCameraPathTrack)", "from", "at", "both" }; char _limnCameraPathTrackDesc[][AIR_STRLEN_MED] = { "unknown limnCameraPathTrack", "track through eye points, quaternions for camera orientation", "track through look-at points, quaternions for camera orientation", "track eye point, look-at point, and up vector with seperate splines" }; char _limnCameraPathTrackStrEqv[][AIR_STRLEN_SMALL] = { "from", "fr", "at", "look-at", "lookat", "both", "" }; int _limnCameraPathTrackValEqv[] = { limnCameraPathTrackFrom, limnCameraPathTrackFrom, limnCameraPathTrackAt, limnCameraPathTrackAt, limnCameraPathTrackAt, limnCameraPathTrackBoth }; airEnum _limnCameraPathTrack = { "limnCameraPathTrack", LIMN_CAMERA_PATH_TRACK_MAX, _limnCameraPathTrackStr, NULL, _limnCameraPathTrackDesc, _limnCameraPathTrackStrEqv, _limnCameraPathTrackValEqv, AIR_FALSE }; airEnum * limnCameraPathTrack = &_limnCameraPathTrack; Index: GNUmakefile =================================================================== RCS file: /cvsroot/teem/teem/src/limn/GNUmakefile,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** GNUmakefile 30 Mar 2004 14:02:42 -0000 1.18 --- GNUmakefile 10 May 2004 19:18:35 -0000 1.19 *************** *** 49,53 **** $(L).OBJS = defaultsLimn.o qn.o light.o env.o cam.o methodsLimn.o \ obj.o transform.o shapes.o renderLimn.o io.o hestLimn.o \ ! 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 --- 49,53 ---- $(L).OBJS = defaultsLimn.o qn.o light.o env.o cam.o methodsLimn.o \ obj.o transform.o shapes.o renderLimn.o io.o hestLimn.o \ ! splineMisc.o splineMethods.o splineEval.o enumsLimn.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-05-10 10:47:31
|
Update of /cvsroot/teem/teem-vtk/camAnim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18374 Modified Files: anim.tcl camAnim.tcl runiso.tcl Log Message: ran undos on all tcl files Index: anim.tcl =================================================================== RCS file: /cvsroot/teem/teem-vtk/camAnim/anim.tcl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** anim.tcl 25 Aug 2003 06:38:45 -0000 1.1.1.1 --- anim.tcl 10 May 2004 10:47:20 -0000 1.2 *************** *** 1,329 **** ! toplevel .an ! wm title .an "Animation controls" ! ! set magic "LIMN0000" ! set playing 0 ! ! proc affine {i x I o O} { ! return [expr ($x - $i)*($O - $o)/($I - $i) + $o] ! } ! ! proc lerp {w o O} { ! return [expr $w*($O - $o) + $o] ! } ! ! proc loadError {msg} { ! global loadKeysFN ! ! tk_messageBox -parent .an -message "Couldn't load \"$loadKeysFN\":\n$msg" \ ! -icon error -title "Load Error" -type ok ! } ! ! proc loadKeys {} { ! global loadKeysFN ! global magic ! global imgSize ! global masterKey ! global numberFrames ! global numberKeys ! global whichKey ! ! set file [open $loadKeysFN "r"] ! set line [gets $file] ! if {$magic != $line} { ! loadError "Got \"$line\" instead of magic \"$magic\"" ! close $file ! return ! } ! ! set line [gets $file] ! if {2 != [scan $line "imgSize {%d %d}" sx sy]} { ! loadError "Got \"$line\" instead of \"imgSize {<sizeX> <sizeY>}\"" ! close $file ! return ! } ! set imgSize "$sx $sy" ! newImgSize ! ! set masterKey "" ! set key [gets $file] ! while {[llength $key]} { ! lappend masterKey $key ! set key [gets $file] ! } ! close $file ! ! set numberKeys [llength $masterKey] ! .an.whichKeyS config -to [expr $numberKeys-1] ! set whichKey 0 ! newWhichKey ! ! return ! } ! proc saveKeys {} { ! global numberFrames ! global numberKeys ! global masterKey ! global saveKeysFN ! global imgSize ! global magic ! ! set file [open $saveKeysFN "w"] ! puts $file $magic ! puts $file "imgSize {$imgSize}" ! foreach key $masterKey { ! puts $file $key ! } ! ! close $file ! } ! proc getCamState {} { ! global camera ! ! set at [$camera GetFocalPoint] ! set fr [$camera GetPosition] ! set up [$camera GetViewUp] ! set N [v3Norm [v3Sub $at $fr]] ! set U [v3Norm [v3Cross $N $up]] ! set V [v3Cross $N $U] ! set mat [m3Transpose [list $U $V $N]] ! puts "UVN: [list $U $V $N]" ! puts "mat: $mat" ! ! # camHash is a convenience for generating an even-length list ! array set camHash "cam.dn [lindex [$camera GetClippingRange] 0]" ! array set camHash "cam.df [lindex [$camera GetClippingRange] 1]" ! array set camHash "cam.di [$camera GetDistance]" ! array set camHash "cam.va [$camera GetViewAngle]" ! array set camHash "cam.at [list [$camera GetFocalPoint]]" ! array set camHash "cam.mat [list $mat]" ! return [array get camHash] ! } ! proc setCamState {allState} { ! global camera ! global viewAngle ! ! # allHash stores all state, we only access camera-related variables ! array set allHash $allState ! set dn [lindex [array get allHash "cam.dn"] 1] ! set df [lindex [array get allHash "cam.df"] 1] ! set di [lindex [array get allHash "cam.di"] 1] ! set viewAngle [lindex [array get allHash "cam.va"] 1] ! set at [lindex [array get allHash "cam.at"] 1] ! set uvn [m3Transpose [lindex [array get allHash "cam.mat"] 1]] ! set fr [v3Scale [expr -$dn] [lindex $uvn 2]] ! set up [v3Scale -1 [lindex $uvn 1]] ! ! $camera SetClippingRange $dn $df ! $camera SetDistance $di ! $camera SetViewAngle $viewAngle ! eval $camera SetFocalPoint $at ! eval $camera SetViewUp $up ! eval $camera SetPosition $fr ! } ! proc getState {} { ! global isoValue ! global relDwell ! global keyTag ! ! # allHash simplifies construction of even-length list describing state ! array set allHash [getCamState] ! array set allHash "isoValue $isoValue" ! array set allHash "relDwell $relDwell" ! array set allHash "keyTag [list $keyTag]" ! return [array get allHash] ! } ! proc setState {allState} { ! global isoValue ! global relDwell ! global keyTag ! ! array set allHash $allState ! set isoValue [lindex [array get allHash "isoValue"] 1] ! set relDwell [lindex [array get allHash "relDwell"] 1] ! set keyTag [lindex [array get allHash "keyTag"] 1] ! setCamState $allState ! } ! proc newWhichKey {} { ! global whichKey ! global masterKey ! global going ! ! setState [lindex $masterKey $whichKey] ! if {$going} { ! renWin Render ! } ! } ! proc addKey {} { ! global whichKey ! global masterKey ! global numberKeys ! global keyTag ! ! set masterKey [linsert $masterKey $whichKey [lindex $masterKey $whichKey]] ! set numberKeys [llength $masterKey] ! .an.whichKeyS config -to [expr $numberKeys-1] ! set keyTag "" ! incr whichKey ! } ! proc setKey {} { ! global whichKey ! global masterKey ! ! set masterKey [lreplace $masterKey $whichKey $whichKey [getState]] ! } ! proc nixKey {} { ! global whichKey ! global masterKey ! global numberKeys ! ! puts $numberKeys ! if {2 == $numberKeys} { ! return ! } ! set masterKey [lreplace $masterKey $whichKey $whichKey] ! set numberKeys [llength $masterKey] ! .an.whichKeyS config -to [expr $numberKeys-1] ! newWhichKey ! } ! proc initKeys {} { ! global whichKey ! global masterKey ! global numberKeys ! global initState ! ! set masterKey "[list $initState] " ! set numberKeys [llength $masterKey] ! set whichKey 0 ! newWhichKey ! } ! proc nukeKeys {} { ! global numberKeys ! ! initKeys ! .an.whichKeyS config -to [expr $numberKeys-1] ! } ! proc loadScript {} { ! global numberKeys ! global loadScriptFN ! ! set file [open $loadScriptFN "r"] ! ! puts "functionality goes here" ! ! close $file ! } ! ! proc togglePlay {} { ! global playing ! global whichFrame ! global numberFrames ! ! if {$playing} { ! # stop: this can trigger a break in the for-loop below ! # thanks to the "update" call ! set playing 0 ! return ! } ! # else we start playing ! set playing 1 ! # set frameList [genFrameList] ! .an.playB config -text "Stop" ! # to back to beginning if you're at the very end ! if {$whichFrame == $numberFrames-1} { ! set whichFrame 0 ! } ! # start at current frame ! for {set frame $whichFrame} {$frame < $numberFrames} {incr frame} { ! set whichFrame $frame ! # setState [lindex $frameList $frame] ! update ! if {!$playing} { ! break ! } ! } ! set playing 0 ! .an.playB config -text "Play" ! } ! ! ### ! ### initialize first two key frames with current state ! ### ! set relDwell 1.0 ! set keyTag "" ! ! set initState [getState] ! initKeys ! ! set scaleLen 300 ! set entryWidth 35 ! set numberFrames 1 ! ! set row 0 ! label .an.loadKeysL -text "Load Keyframes" ! set loadKeysFN "" ! entry .an.loadKeysE -textvariable loadKeysFN -width $entryWidth ! bind .an.loadKeysE <KeyRelease-Return> loadKeys ! grid .an.loadKeysL -s e -row $row -column 0 ! grid .an.loadKeysE -s w -row $row -column 1 -columnspan 2 ! button .an.nukeKeysB -text "Clear All" -command nukeKeys ! grid .an.nukeKeysB -row $row -column 3 ! ! incr row ! label .an.whichKeyL -text "Current Keyframe" ! scale .an.whichKeyS -len $scaleLen -from 0 -to [expr $numberKeys-1] \ ! -res 1 -ori h -var whichKey ! bind .an.whichKeyS <ButtonRelease> newWhichKey ! grid .an.whichKeyL -s e -row $row -column 0 ! grid .an.whichKeyS -s w -row $row -column 1 -columnspan 3 ! ! incr row ! label .an.keyTagL -text "Keyframe Tag" ! entry .an.keyTagE -textvariable keyTag -width $entryWidth ! bind .an.keyTagE <KeyRelease-Return> setKey ! grid .an.keyTagL -s e -row $row -column 0 ! grid .an.keyTagE -s w -row $row -column 1 -columnspan 3 ! ! incr row ! button .an.addKeyB -text "Add" -command addKey ! button .an.setKeyB -text "Set" -command setKey ! button .an.nixKeyB -text "Delete" -command nixKey ! grid .an.addKeyB -s w -row $row -column 1 ! grid .an.setKeyB -row $row -column 2 ! grid .an.nixKeyB -s e -row $row -column 3 ! ! incr row ! label .an.relDwellL -text "Relative Dwell" ! scale .an.relDwellS -len $scaleLen -from 0.0 -to 2.0 \ ! -res 0.001 -ori h -var relDwell -showvalue 0 ! grid .an.relDwellL -s e -row $row -column 0 ! grid .an.relDwellS -s w -row $row -column 1 -columnspan 3 ! ! incr row ! label .an.saveKeysL -text "Save Keyframes" ! set saveKeysFN "" ! entry .an.saveKeysE -textvariable saveKeysFN -width $entryWidth ! bind .an.saveKeysE <KeyRelease-Return> saveKeys ! grid .an.saveKeysL -s e -row $row -column 0 ! grid .an.saveKeysE -s w -row $row -column 1 -columnspan 3 ! ! incr row ! label .an.loadScriptL -text "Load Script" ! set loadScriptFN "" ! entry .an.loadScriptE -textvariable loadScriptFN -width $entryWidth ! bind .an.loadScriptE <KeyRelease-Return> loadScript ! grid .an.loadScriptL -s e -row $row -column 0 ! grid .an.loadScriptE -s w -row $row -column 1 -columnspan 3 ! ! incr row ! button .an.playB -text "Play" -command togglePlay ! scale .an.playS -len $scaleLen -from 0 -to [expr $numberFrames-1] \ ! -res 1 -ori h -var whichFrame ! grid .an.playB -s e -row $row -column 0 ! grid .an.playS -s w -row $row -column 1 -columnspan 3 ! ! incr row ! button .an.die -text "Quit" -command exit ! grid .an.die -s sw -row $row -column 0 ! grid rowconfigure .an $row -minsize 40 ! --- 1,404 ---- ! # ! # teem: Gordon Kindlmann's research software ! # Copyright (C) 2004, 2003, 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 ! # ! # ! ! toplevel .an ! wm title .an "Animation controls" ! ! set magic "LIMN0000" ! set playing 0 ! ! proc affine {i x I o O} { ! return [expr ($x - $i)*($O - $o)/($I - $i) + $o] ! } ! ! proc lerp {w o O} { ! return [expr $w*($O - $o) + $o] ! } ! ! proc loadError {msg} { ! global loadKeysFN ! ! tk_messageBox -parent .an -message "Couldn't load \"$loadKeysFN\":\n$msg" \ ! -icon error -title "Load Error" -type ok ! } ! ! proc loadKeys {} { ! global loadKeysFN ! global magic ! global imgSize ! global masterKey ! global numberFrames ! global numberKeys ! global whichKey ! ! set file [open $loadKeysFN "r"] ! set line [gets $file] ! if {$magic != $line} { ! loadError "Got \"$line\" instead of magic \"$magic\"" ! close $file ! return ! } ! ! set line [gets $file] ! if {2 != [scan $line "imgSize {%d %d}" sx sy]} { ! loadError "Got \"$line\" instead of \"imgSize {<sizeX> <sizeY>}\"" ! close $file ! return ! } ! set imgSize "$sx $sy" ! newImgSize ! ! set masterKey "" ! set key [gets $file] ! while {[llength $key]} { ! lappend masterKey $key ! set key [gets $file] ! } ! close $file ! ! set numberKeys [llength $masterKey] ! .an.whichKeyS config -to [expr $numberKeys-1] ! set whichKey 0 ! newWhichKey ! ! return ! } ! proc saveKeys {} { ! global numberFrames ! global numberKeys ! global masterKey ! global saveKeysFN ! global imgSize ! global magic ! ! set file [open $saveKeysFN "w"] ! puts $file $magic ! puts $file "imgSize {$imgSize}" ! foreach key $masterKey { ! puts $file $key ! } ! ! close $file ! } ! proc getCamState {} { ! global camera ! ! # camHash is a convenience for generating an even-length list ! array set camHash "cam.dn [lindex [$camera GetClippingRange] 0]" ! array set camHash "cam.df [lindex [$camera GetClippingRange] 1]" ! array set camHash "cam.di [$camera GetDistance]" ! array set camHash "cam.va [$camera GetViewAngle]" ! array set camHash "cam.at [list [$camera GetFocalPoint]]" ! array set camHash "cam.fr [list [$camera GetPosition]]" ! array set camHash "cam.up [list [$camera GetViewUp]]" ! return [array get camHash] ! } ! proc setCamState {allState} { ! global camera cursor cursorX cursorY cursorZ ! global viewAngle ! ! # allHash stores all state, we only access camera-related variables ! array set allHash $allState ! set dn [lindex [array get allHash "cam.dn"] 1] ! set df [lindex [array get allHash "cam.df"] 1] ! set di [lindex [array get allHash "cam.di"] 1] ! set viewAngle [lindex [array get allHash "cam.va"] 1] ! set at [lindex [array get allHash "cam.at"] 1] ! set fr [lindex [array get allHash "cam.fr"] 1] ! set up [lindex [array get allHash "cam.up"] 1] ! ! eval $camera SetFocalPoint $at ! eval $camera SetViewUp $up ! eval $camera SetPosition $fr ! $camera SetClippingRange $dn $df ! $camera SetDistance $di ! $camera SetViewAngle $viewAngle ! set cursor $at ! set cursorX [lindex $cursor 0] ! set cursorY [lindex $cursor 1] ! set cursorZ [lindex $cursor 2] ! eval cube SetBounds [getCubeBounds] ! } ! proc getState {} { ! global isoValue ! global relDwell ! ! # allHash simplifies construction of even-length list describing state ! array set allHash [getCamState] ! array set allHash "isoValue $isoValue" ! array set allHash "relDwell $relDwell" ! return [array get allHash] ! } ! proc setState {allState} { ! global isoValue ! global relDwell ! ! array set allHash $allState ! setCamState $allState ! set isoValue [lindex [array get allHash "isoValue"] 1] ! newIsoValue ! set relDwell [lindex [array get allHash "relDwell"] 1] ! } ! proc newWhichKey {} { ! global whichKey ! global masterKey ! ! setState [lindex $masterKey $whichKey] ! render ! } ! proc addKey {} { ! global whichKey ! global masterKey ! global numberKeys ! ! set masterKey [linsert $masterKey $whichKey [lindex $masterKey $whichKey]] ! set numberKeys [llength $masterKey] ! .an.whichKeyS config -to [expr $numberKeys-1] ! incr whichKey ! } ! proc setKey {} { ! global whichKey ! global masterKey ! ! set masterKey [lreplace $masterKey $whichKey $whichKey [getState]] ! } ! proc nixKey {} { ! global whichKey ! global masterKey ! global numberKeys ! ! puts $numberKeys ! if {2 == $numberKeys} { ! return ! } ! set masterKey [lreplace $masterKey $whichKey $whichKey] ! set numberKeys [llength $masterKey] ! .an.whichKeyS config -to [expr $numberKeys-1] ! newWhichKey ! } ! proc initKeys {} { ! global whichKey ! global masterKey ! global numberKeys ! global initState ! ! set masterKey "[list $initState] " ! set numberKeys [llength $masterKey] ! set whichKey 0 ! newWhichKey ! } ! proc nukeKeys {} { ! global numberKeys ! ! initKeys ! .an.whichKeyS config -to [expr $numberKeys-1] ! } ! proc loadScript {} { ! global numberKeys ! global loadScriptFN ! ! set file [open $loadScriptFN "r"] ! ! puts "functionality goes here" ! ! close $file ! } ! ! proc togglePlay {} { ! global playing ! global whichFrame ! global numberFrames ! ! puts "numberFrames = $numberFrames" ! if {$playing} { ! # stop: this can trigger a break in the for-loop below ! # thanks to the "update" call ! set playing 0 ! return ! } ! # else we start playing ! set playing 1 ! # set frameList [genFrameList] ! .an.playB config -text "Stop" ! # to back to beginning if you're at the very end ! if {$whichFrame == $numberFrames-1} { ! set whichFrame 0 ! } ! # start at current frame ! for {set frame $whichFrame} {$frame < $numberFrames} {incr frame} { ! set whichFrame $frame ! # setState [lindex $frameList $frame] ! update ! if {!$playing} { ! break ! } ! } ! set playing 0 ! .an.playB config -text "Play" ! } ! ! ### ! ### initialize first two key frames with current state ! ### ! set relDwell 1.0 ! ! set initState [getState] ! initKeys ! ! set scaleLen 300 ! set entryWidth 35 ! set numberFrames 1 ! ! set row 0 ! label .an.loadKeysL -text "Load Keyframes" ! set loadKeysFN "" ! entry .an.loadKeysE -textvariable loadKeysFN -width $entryWidth ! bind .an.loadKeysE <KeyRelease-Return> loadKeys ! grid .an.loadKeysL -s e -row $row -column 0 ! grid .an.loadKeysE -s w -row $row -column 1 -columnspan 2 ! button .an.nukeKeysB -text "Clear All" -command nukeKeys ! grid .an.nukeKeysB -row $row -column 3 ! ! incr row ! label .an.whichKeyL -text "Current Keyframe" ! scale .an.whichKeyS -len $scaleLen -from 0 -to [expr $numberKeys-1] \ ! -res 1 -ori h -var whichKey ! bind .an.whichKeyS <ButtonRelease> newWhichKey ! grid .an.whichKeyL -s e -row $row -column 0 ! grid .an.whichKeyS -s w -row $row -column 1 -columnspan 3 ! ! incr row ! label .an.relDwellL -text "Relative Dwell" ! scale .an.relDwellS -len $scaleLen -from 0.0 -to 2.0 \ ! -res 0.001 -ori h -var relDwell -showvalue 0 ! grid .an.relDwellL -s e -row $row -column 0 ! grid .an.relDwellS -s w -row $row -column 1 -columnspan 3 ! ! incr row ! button .an.addKeyB -text "Add" -command addKey ! button .an.setKeyB -text "Set" -command setKey ! button .an.nixKeyB -text "Delete" -command nixKey ! grid .an.addKeyB -s w -row $row -column 1 ! grid .an.setKeyB -row $row -column 2 ! grid .an.nixKeyB -s e -row $row -column 3 ! ! incr row ! label .an.saveKeysL -text "Save Keyframes" ! set saveKeysFN "" ! entry .an.saveKeysE -textvariable saveKeysFN -width $entryWidth ! bind .an.saveKeysE <KeyRelease-Return> saveKeys ! grid .an.saveKeysL -s e -row $row -column 0 ! grid .an.saveKeysE -s w -row $row -column 1 -columnspan 3 ! ! proc newNumberFrames {f} { ! .an.playS config -to [expr $f-1] ! } ! ! incr row ! label .an.numFramesL -text "Number Frames" ! scale .an.numFramesS -len $scaleLen -from 3 -to 2000 \ ! -res 1 -ori h -var numberFrames -command newNumberFrames ! grid .an.numFramesL -s e -row $row -column 0 ! grid .an.numFramesS -s w -row $row -column 1 -columnspan 3 ! ! proc keyDuration {allState} { ! ! array set allHash $allState ! set dwell [lindex [array get allHash "relDwell"] 1] ! return [expr tan([affine -0.01 $dwell 2.01 0.0 3.1415926/2])] ! } ! ! proc genTimeList {} { ! global masterKey ! ! set numberKeys [llength $masterKey] ! foreach key $masterKey { ! lappend duras [keyDuration $key] ! } ! set sum 0 ! lappend _times $sum ! for {set ki 1} {$ki < $numberKeys} {incr ki} { ! set time [expr ([lindex $duras [expr $ki-1]] + [lindex $duras $ki])/2] ! set sum [expr $sum + $time] ! lappend _times $sum ! } ! foreach _time $_times { ! lappend times [expr $_time/$sum] ! } ! return $times ! } ! ! proc saveList {fname data} { ! ! set file [open $fname "w"] ! foreach datum $data { ! puts $file $datum ! } ! close $file ! } ! ! proc genScript {} { ! global numberFrames masterKey ! ! set timeList [genTimeList] ! foreach key $masterKey { ! array set allHash $key ! lappend isoValueList [lindex [array get allHash "isoValue"] 1] ! set dn [lindex [array get allHash "cam.dn"] 1] ! set di [lindex [array get allHash "cam.di"] 1] ! set df [lindex [array get allHash "cam.df"] 1] ! set at [lindex [array get allHash "cam.at"] 1] ! set fr [lindex [array get allHash "cam.fr"] 1] ! set up [lindex [array get allHash "cam.up"] 1] ! lappend dndidfList [list $dn $di $df] ! lappend fratupList [concat $fr $at $up] ! } ! puts "isoValueList = $isoValueList" ! puts "dndidfList = $dndidfList" ! puts "fratupList = $fratupList" ! ! saveList "time.txt" $timeList ! saveList "isovalue.txt" $isoValueList ! saveList "dndidf.txt" $dndidfList ! saveList "fratup.txt" $fratupList ! } ! ! incr row ! button .an.genScript -text "Generate Script" -command genScript ! grid .an.genScript -row $row -column 1 -columnspan 3 ! #label .an.loadScriptL -text "Load Script" ! #set loadScriptFN "" ! #entry .an.loadScriptE -textvariable loadScriptFN -width $entryWidth ! #bind .an.loadScriptE <KeyRelease-Return> loadScript ! #grid .an.loadScriptL -s e -row $row -column 0 ! #grid .an.loadScriptE -s w -row $row -column 1 -columnspan 3 ! ! incr row ! button .an.playB -text "Play" -command togglePlay ! scale .an.playS -len $scaleLen -from 0 -to [expr $numberFrames-1] \ ! -res 1 -ori h -var whichFrame ! grid .an.playB -s e -row $row -column 0 ! grid .an.playS -s w -row $row -column 1 -columnspan 3 ! ! incr row ! button .an.die -text "Quit" -command exit ! grid .an.die -s sw -row $row -column 0 ! grid rowconfigure .an $row -minsize 40 ! Index: camAnim.tcl =================================================================== RCS file: /cvsroot/teem/teem-vtk/camAnim/camAnim.tcl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** camAnim.tcl 10 May 2004 10:27:09 -0000 1.1 --- camAnim.tcl 10 May 2004 10:47:20 -0000 1.2 *************** *** 1,631 **** ! # ! # teem: Gordon Kindlmann's research software ! # Copyright (C) 2003, 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, [...1234 lines suppressed...] ! toggleFrame ! newIsoValue ! configureCB ! ! wm withdraw . ! ! set camera [ren GetActiveCamera] ! #$camera SetViewUp 0 0 -1 ! #$camera SetPosition 2 7 -2 ! set upVector [$camera GetViewUp] ! ! newViewAngle blah ! ren ResetCameraClippingRange ! ! source anim.tcl ! set going 1 ! renWin Render ! newImgSize ! ! ren ResetCameraClippingRange Index: runiso.tcl =================================================================== RCS file: /cvsroot/teem/teem-vtk/camAnim/runiso.tcl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** runiso.tcl 25 Aug 2003 06:38:45 -0000 1.1.1.1 --- runiso.tcl 10 May 2004 10:47:21 -0000 1.2 *************** *** 1,3 **** ! set argc 2 ! set argv vol.vtk ! source isocam.tcl --- 1,23 ---- ! # ! # teem: Gordon Kindlmann's research software ! # Copyright (C) 2004, 2003, 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 ! # ! # ! ! set argc 2 ! set argv vol.vtk ! source camAnim.tcl |
|
From: Gordon K. <kin...@us...> - 2004-05-10 10:27:18
|
Update of /cvsroot/teem/teem-vtk/camAnim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14485 Added Files: camAnim.tcl Removed Files: isocam.tcl Log Message: rename --- isocam.tcl DELETED --- --- NEW FILE: camAnim.tcl --- # # teem: Gordon Kindlmann's research software # Copyright (C) 2003, 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 # # ### isocam.tcl ### ### The purpose of this program is to generate camera information ### usable in teem's miter and mrender commands, as guided by an ### isosurface of a scalar field. The field is centered inside the ### same bi-unit cube that is used by hoover. Note that VTK assumes ### node-centered samples. ### if {$argc < 1} { puts "usage: isocam.tcl <vtk volume file>" exit 1 } set frameShown 0 set cubeWidth 0.04 set cursorX 0 set cursorY 0 set cursorZ 0 ### ### this is set to 1 only after everything has been set up ### set going 0 ### v3Sub, v3Add, v3Scale ### ### 3-vector utility functions ### proc v3Dot {a b} { set ax [lindex $a 0]; set ay [lindex $a 1]; set az [lindex $a 2] set bx [lindex $b 0]; set by [lindex $b 1]; set bz [lindex $b 2] return "[expr $ax*$bx + $ay*$by + $az*$bz]" } proc v3Sub {a b} { set ax [lindex $a 0]; set ay [lindex $a 1]; set az [lindex $a 2] set bx [lindex $b 0]; set by [lindex $b 1]; set bz [lindex $b 2] return "[expr $ax - $bx] [expr $ay - $by] [expr $az - $bz]" } proc v3Add {a b} { set ax [lindex $a 0]; set ay [lindex $a 1]; set az [lindex $a 2] set bx [lindex $b 0]; set by [lindex $b 1]; set bz [lindex $b 2] return "[expr $ax + $bx] [expr $ay + $by] [expr $az + $bz]" } proc v3Scale {s a} { set ax [lindex $a 0]; set ay [lindex $a 1]; set az [lindex $a 2] return "[expr $s*$ax] [expr $s*$ay] [expr $s*$az]" } proc v3Len {a} { set ax [lindex $a 0]; set ay [lindex $a 1]; set az [lindex $a 2] return [expr sqrt($ax*$ax + $ay*$ay + $az*$az)] } proc v3Norm {a} { return [v3Scale [expr 1.0/[v3Len $a]] $a] } proc v3Cross {a b} { set ax [lindex $a 0]; set ay [lindex $a 1]; set az [lindex $a 2] set bx [lindex $b 0]; set by [lindex $b 1]; set bz [lindex $b 2] return "[expr $ay*$bz - $az*$by] \ [expr $az*$bx - $ax*$bz] \ [expr $ax*$by - $ay*$bx]" } proc short {s} { return [expr round($s*1000.0)/1000.0] } proc v3Short {a} { set ax [lindex $a 0]; set ay [lindex $a 1]; set az [lindex $a 2] return "[short $ax] [short $ay] [short $az]" } proc v3Max {a} { set m [lindex $a 0]; set ay [lindex $a 1]; set az [lindex $a 2] if {$m < $ay} {set m $ay} if {$m < $az} {set m $az} return $m } proc v3Angle {a b} { if {[v3Dot $a $b] < 0.0} { set ret [expr 3.1415926 - 2*asin([v3Len [v3Add $a $b]]/2)] } else { set ret [expr 2*asin([v3Len [v3Sub $a $b]]/2)] } return [short [expr 180*$ret/3.1415926]] } proc m3Transpose {m} { set c0 [list [lindex [lindex $m 0] 0] \ [lindex [lindex $m 1] 0] \ [lindex [lindex $m 2] 0]] set c1 [list [lindex [lindex $m 0] 1] \ [lindex [lindex $m 1] 1] \ [lindex [lindex $m 2] 1]] set c2 [list [lindex [lindex $m 0] 2] \ [lindex [lindex $m 1] 2] \ [lindex [lindex $m 2] 2]] return [list $c0 $c1 $c2] } ### ### All event-driven callbacks ### set oldView "" set oldUp "" set buttonPressed 0 proc buttonDownCB {} { global oldView global oldUp global buttonPressed global camera set buttonPressed 1 set oldView [v3Short [v3Norm [v3Sub [$camera GetPosition] \ [$camera GetFocalPoint]]]] set oldUp [v3Short [$camera GetViewUp]] } proc buttonUpCB {} { global oldView global oldUp global axisEnt angleEnt global buttonPressed global camera global cursor cursorX cursorY cursorZ puts "buttonUpCB: hello" set buttonPressed 0 set newView [v3Norm [v3Sub [$camera GetPosition] \ [$camera GetFocalPoint]]] set newUp [$camera GetViewUp] set axis [v3Cross $newView $oldView] if {0 == [v3Len $axis]} { set axis [v3Cross $newUp $oldUp] } if {0 == [v3Len $axis]} { set axisEnt "(none)" set angleEnt "(none)" return } set axisEnt [v3Short [v3Norm $axis]] set angleEnt [v3Angle $newView $oldView] render return } proc configureCB {} { global imgSize set imgSize [iren GetSize] } proc moveCB {} { global buttonPressed global lockUp global upVector global camera global cursor cursorX cursorY cursorZ if {!$buttonPressed} { return } if ($lockUp) { eval $camera SetViewUp $upVector } else { set upVector [v3Short [$camera GetViewUp]] } set cursor [v3Short [$camera GetFocalPoint]] set cursorX [lindex $cursor 0] set cursorY [lindex $cursor 1] set cursorZ [lindex $cursor 2] eval cube SetBounds [getCubeBounds] } ### ### renderer, window, interactor, etc ### vtkRenderer ren vtkRenderWindow renWin renWin AddRenderer ren vtkWindowToImageFilter win2png win2png SetInput renWin vtkPNGWriter pngWriter pngWriter SetInput [win2png GetOutput] vtkInteractorStyleTrackballCamera style vtkRenderWindowInteractor iren iren SetRenderWindow renWin iren SetInteractorStyle style iren AddObserver LeftButtonPressEvent buttonDownCB iren AddObserver MiddleButtonPressEvent buttonDownCB iren AddObserver RightButtonPressEvent buttonDownCB iren AddObserver LeftButtonReleaseEvent buttonUpCB iren AddObserver MiddleButtonReleaseEvent buttonUpCB iren AddObserver RightButtonReleaseEvent buttonUpCB iren AddObserver MouseMoveEvent moveCB iren AddObserver ConfigureEvent configureCB ### ### volume reader ### vtkStructuredPointsReader reader reader SetFileName [lindex $argv 0] reader Update ### ### compute the bi-unit bounding box information from volume ### ### ext{X,Y,Z} : original volume extents in X,Y,Z ### hvs{X,Y,Z} : half bi-unit volume size in X,Y,Z axes ### set ext [[reader GetOutput] GetExtent] set spc [[reader GetOutput] GetSpacing] set extX [expr 1.0*[lindex $ext 1]*[lindex $spc 0]] set extY [expr 1.0*[lindex $ext 3]*[lindex $spc 1]] set extZ [expr 1.0*[lindex $ext 5]*[lindex $spc 2]] set maxext [v3Max {$extX $extY $extZ}] set hvsX [expr $extX/$maxext] set hvsY [expr $extY/$maxext] set hvsZ [expr $extZ/$maxext] ### ### set up transform to map volume into bi-unit cube ### vtkTransform tx tx PostMultiply tx Identity tx Scale [expr 2.0*$hvsX/$extX] \ [expr 2.0*$hvsY/$extY] [expr 2.0*$hvsZ/$extZ] tx Translate [expr -$hvsX] [expr -$hvsY] [expr -$hvsZ] ### ### The spheres mark the corners of the bi-unit cube ### set radius 0.04 for {set i 0} {$i <= 1} {incr i} { for {set j 0} {$j <= 1} {incr j} { for {set k 0} {$k <= 1} {incr k} { vtkSphereSource sphere$i$j$k sphere$i$j$k SetCenter [expr 2*$i - 1] [expr 2*$j - 1] [expr 2*$k - 1] sphere$i$j$k SetRadius $radius vtkPolyDataMapper sphereMapper$i$j$k sphereMapper$i$j$k SetInput [sphere$i$j$k GetOutput] vtkActor sphereActor$i$j$k sphereActor$i$j$k SetMapper sphereMapper$i$j$k [sphereActor$i$j$k GetProperty] SetColor \ [expr 0.4 + 0.6*$i] [expr 0.4 + 0.6*$j] [expr 0.4 + 0.6*$k] } } } set rgb {{1.0 0.4 0.4} {0.4 1.0 0.4} {0.4 0.4 1.0}} eval [sphereActor100 GetProperty] SetColor [lindex $rgb 0] eval [sphereActor010 GetProperty] SetColor [lindex $rgb 1] eval [sphereActor001 GetProperty] SetColor [lindex $rgb 2] ### ### red, green, and blue cylinders for the X, Y, Z axes ### for {set i 0} {$i <= 2} {incr i} { vtkCylinderSource cyl$i cyl$i SetResolution 10 cyl$i SetRadius $radius cyl$i SetHeight 1.0 cyl$i SetCenter 0.0 0.5 0.0 vtkTransform cylT$i cylT$i Identity cylT$i Translate -1 -1 -1 vtkTransformFilter cylTF$i cylTF$i SetTransform cylT$i cylTF$i SetInput [cyl$i GetOutput] vtkPolyDataMapper cylMapper$i cylMapper$i SetInput [cylTF$i GetOutput] vtkActor cylActor$i cylActor$i SetMapper cylMapper$i eval [cylActor$i GetProperty] SetColor [lindex $rgb $i] } cylT0 RotateZ -90 cylT2 RotateX 90 ### ### cube for at-point cursor ### proc getCubeBounds {} { global cubeWidth cursorX cursorY cursorZ puts "getCubeBounds: $cursorX $cursorY $cursorZ" return [list [expr $cursorX - $cubeWidth] \ [expr $cursorX + $cubeWidth] \ [expr $cursorY - $cubeWidth] \ [expr $cursorY + $cubeWidth] \ [expr $cursorZ - $cubeWidth] \ [expr $cursorZ + $cubeWidth] ] } vtkOutlineSource cube eval cube SetBounds [getCubeBounds] vtkPolyDataMapper cubeMapper cubeMapper SetInput [cube GetOutput] vtkActor cubeActor cubeActor SetMapper cubeMapper [cubeActor GetProperty] SetColor 1 0 0 ren AddActor cubeActor ### ### rest of vtk pipeline ### vtkContourFilter iso iso SetInput [reader GetOutput] vtkTransformFilter txf txf SetTransform tx txf SetInput [iso GetOutput] vtkPolyDataMapper isoMapper isoMapper SetInput [txf GetOutput] isoMapper ScalarVisibilityOff vtkActor isoActor isoActor SetMapper isoMapper [isoActor GetProperty] SetColor 1 1 1 [isoActor GetProperty] SetOpacity 1.0 ren AddActor isoActor renWin SetSize 512 512 ren SetBackground 0.5 0.5 0.5 ### ### commands invoked via GUI ### set camCount 0 proc saveCam {} { global camCount global camera set is [iren GetSize] set fr [$camera GetPosition] set at [$camera GetFocalPoint] set up [$camera GetViewUp] set di [$camera GetDistance] set dn [lindex [$camera GetClippingRange] 0] set df [lindex [$camera GetClippingRange] 1] set theta [expr [$camera GetViewAngle]/2.0] set vm [expr tan((3.14159/180.0)*$theta)*$di] set um [expr $vm*[lindex $is 0]/[lindex $is 1]] set fname [format %03d.cam.txt $camCount] set file [open $fname "w"] puts $file "-fr $fr" puts $file "-at $at" puts $file "-up $up -rh" puts $file "-dn $dn -di $di -df $df" puts $file "-vr [expr -$vm] $vm -ur [expr -$um] $um" puts $file "-is $is" close $file incr camCount set fname [format %03d.cam.txt $camCount] .top.buttCam config -text "Save $fname" } proc newIsoValue {} { global isoValue #puts "newIsoValue; going=$going" iso SetValue 0 $isoValue render } proc newViewAngle {blah} { global viewAngle global camera set oldva [$camera GetViewAngle] set fact [expr tan((3.14159/180.0)*$oldva/2)/ \ tan((3.14159/180.0)*$viewAngle/2)] set nd [expr $fact*[$camera GetDistance]] $camera SetViewAngle $viewAngle set at [$camera GetFocalPoint] set norm [$camera GetViewPlaneNormal] eval $camera SetPosition [v3Add $at [v3Scale $nd $norm]] render } proc newUpVector {} { global camera upVector eval $camera SetViewUp $upVector render } proc lockUpCmd {} { global lockUp global upVector global camera if ($lockUp) { eval $camera SetViewUp $upVector } else { $camera OrthogonalizeViewUp set upVector [v3Short [$camera GetViewUp]] } } proc newImgSize {} { global imgSize if {2 != [llength $imgSize]} { configureCB return } set nx [expr round([lindex $imgSize 0])] set ny [expr round([lindex $imgSize 1])] if {!($nx > 0 && $ny > 0)} { configureCB return } set oldsize [iren GetSize] set ox [lindex $oldsize 0] set oy [lindex $oldsize 1] if {$nx != $ox || $ny != $oy} { iren UpdateSize $nx $ny render } return } proc savePng {} { global pngCount set fname [format %03d.png $pngCount] win2png Modified pngWriter SetFileName $fname pngWriter Write incr pngCount set fname [format %03d.png $pngCount] .top.buttPng config -text "Save $fname" } proc toggleFrame {} { global frameShown for {set i 0} {$i <= 1} {incr i} { for {set j 0} {$j <= 1} {incr j} { for {set k 0} {$k <= 1} {incr k} { if {$frameShown} { ren RemoveActor sphereActor$i$j$k } else { ren AddActor sphereActor$i$j$k } } } } for {set i 0} {$i <= 2} {incr i} { if {$frameShown} { ren RemoveActor cylActor$i } else { ren AddActor cylActor$i } } if {$frameShown} { .top.buttFrame config -text "Show Frame" } else { .top.buttFrame config -text "Hide Frame" } render set frameShown [expr 1 - $frameShown] } proc render {} { global going if {$going} { ren ResetCameraClippingRange renWin Render puts "--- Render ---" } } ### ### Tk GUI ### toplevel .top wm title .top "Isocam: isosurface-based camera placement widget" set row 0 label .top.isoText -text "Isovalue" set isoRange [[[[reader GetOutput] GetPointData] GetScalars] GetRange] set isoValue [lindex $isoRange 1] set hi [lindex $isoRange 1] set lo [lindex $isoRange 0] set len 400 set res [expr (($hi - $lo)/($len -1))/100.0] scale .top.isoValue -len $len -from $lo -to $hi -res $res -ori h -var isoValue bind .top.isoValue <ButtonRelease> newIsoValue grid .top.isoText -s e -row $row -column 0 grid .top.isoValue -s w -row $row -column 1 -columnspan 3 incr row set viewAngle 15 label .top.vatext -text "View Angle" scale .top.vavalue -len $len -from 1 -to 60 -res 0.01 -ori h \ -var viewAngle -command newViewAngle grid .top.vatext -s e -row $row -column 0 grid .top.vavalue -s w -row $row -column 1 -columnspan 3 incr row label .top.axlab -text "Rotation Axis" grid .top.axlab -s e -row $row -column 0 set axisEnt "(none)" entry .top.axent -width 20 -textvariable axisEnt grid .top.axent -s w -row $row -column 1 label .top.nglab -text "Rotation Angle" grid .top.nglab -s e -row $row -column 2 set angleEnt "(none)" entry .top.ngent -width 10 -textvariable angleEnt grid .top.ngent -s w -row $row -column 3 incr row set lockUp 0 checkbutton .top.upcheck -text "Lock Up" -variable lockUp -command lockUpCmd grid .top.upcheck -s e -row $row -column 0 set upVector "" entry .top.upent -width 20 -textvariable upVector bind .top.upent <KeyRelease-Return> newUpVector grid .top.upent -s w -row $row -column 1 label .top.imgSizeLab -text "Image Size" grid .top.imgSizeLab -s e -row $row -column 2 set imgSize "" entry .top.imgSizeEnt -width 10 -textvariable imgSize grid .top.imgSizeEnt -s w -row $row -column 3 bind .top.imgSizeEnt <KeyRelease-Return> newImgSize grid rowconfigure .top $row -minsize 40 proc newCursorPos {blah} { global camera cursor cursorX cursorY cursorZ puts "newCursorPos: hello" set cursor [v3Short [list $cursorX $cursorY $cursorZ]] eval cube SetBounds [getCubeBounds] $camera SetFocalPoint $cursorX $cursorY $cursorZ render puts "newCursorPos: bye" } proc newCursor {} { global cursor cursorX cursorY cursorZ set cursorX [lindex $cursor 0] set cursorY [lindex $cursor 1] set cursorZ [lindex $cursor 2] newCursorPos blah } incr row label .top.clab -text "At Point" frame .top.c label .top.c.x -text X label .top.c.y -text Y label .top.c.z -text Z scale .top.c.xpos -len [expr $len/1.5] -from -1.4 -to 1.4 -res 0.001 -ori h \ -var cursorX -command newCursorPos -showvalue 0 scale .top.c.ypos -len [expr $len/1.5] -from -1.4 -to 1.4 -res 0.001 -ori h \ -var cursorY -command newCursorPos -showvalue 0 scale .top.c.zpos -len [expr $len/1.5] -from -1.4 -to 1.4 -res 0.001 -ori h \ -var cursorZ -command newCursorPos -showvalue 0 set cursor [v3Short [list $cursorX $cursorY $cursorZ]] entry .top.c.ent -width 20 -textvariable cursor bind .top.c.ent <KeyPress-Return> newCursor button .top.c.but -text "Hide Cursor" -command toggleCursor grid .top.c.ent -row 1 -col 0 grid .top.c.but -row 2 -col 0 grid .top.c.x -row 0 -col 1 grid .top.c.y -row 1 -col 1 grid .top.c.z -row 2 -col 1 grid .top.c.xpos -row 0 -col 2 grid .top.c.ypos -row 1 -col 2 grid .top.c.zpos -row 2 -col 2 grid .top.clab -s e -row $row -col 0 grid .top.c -s w -row $row -col 1 -columnspan 3 incr row set pngCount 0 set camCount 0 button .top.buttFrame -text "Hide Frame" -command toggleFrame grid .top.buttFrame -s w -row $row -column 1 button .top.buttCam -text "Save [format %03d $camCount].cam.txt" \ -command saveCam grid .top.buttCam -row $row -column 2 button .top.buttPng -text "Save [format %03d $pngCount].png" -command savePng grid .top.buttPng -s e -row $row -column 3 grid rowconfigure .top $row -minsize 40 incr row button .top.buttDie -text "Quit" -command exit grid .top.buttDie -s sw -row $row -column 0 grid rowconfigure .top $row -minsize 40 ### ### here we go ### toggleFrame newIsoValue configureCB wm withdraw . set camera [ren GetActiveCamera] #$camera SetViewUp 0 0 -1 #$camera SetPosition 2 7 -2 set upVector [$camera GetViewUp] newViewAngle blah ren ResetCameraClippingRange source anim.tcl set going 1 renWin Render newImgSize ren ResetCameraClippingRange |
|
From: Gordon K. <kin...@us...> - 2004-05-09 22:55:25
|
Update of /cvsroot/teem/teem/src/ten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29031 Modified Files: tenGage.c Log Message: fixed TEN_LIST_COPY holdover Index: tenGage.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/tenGage.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tenGage.c 7 May 2004 19:13:33 -0000 1.18 --- tenGage.c 9 May 2004 22:55:16 -0000 1.19 *************** *** 223,227 **** tenEigensolve(evalAns, evecAns, tenAns); #else ! TEN_LIST_COPY(tenAnsF, tenAns); tenEigensolve(evalAnsF, evecAnsF, tenAnsF); ELL_3V_COPY(evalAns, evalAnsF); --- 223,227 ---- tenEigensolve(evalAns, evecAns, tenAns); #else ! TEN_T_COPY(tenAnsF, tenAns); tenEigensolve(evalAnsF, evecAnsF, tenAnsF); ELL_3V_COPY(evalAns, evalAnsF); *************** *** 233,237 **** tenEigensolve(evalAns, NULL, tenAns); #else ! TEN_LIST_COPY(tenAnsF, tenAns); tenEigensolve(evalAnsF, NULL, tenAnsF); ELL_3V_COPY(evalAns, evalAnsF); --- 233,237 ---- tenEigensolve(evalAns, NULL, tenAns); #else ! TEN_T_COPY(tenAnsF, tenAns); tenEigensolve(evalAnsF, NULL, tenAnsF); ELL_3V_COPY(evalAns, evalAnsF); |
|
From: Gordon K. <kin...@us...> - 2004-05-07 19:13:44
|
Update of /cvsroot/teem/teem/src/ten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9915 Modified Files: fiber.c tenGage.c tenMacros.h tendHelix.c tensor.c Log Message: changed macros, and started adding shape gradients. Should not break any code Index: fiber.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/fiber.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** fiber.c 7 Jan 2004 15:34:31 -0000 1.11 --- fiber.c 7 May 2004 19:13:33 -0000 1.12 *************** *** 103,107 **** if (ELL_3V_DOT(tfx->lastDir, tfx->lastDir)) { ELL_3V_COPY(vin, tfx->lastDir); ! TEN_3VLIST_MUL(vout, tfx->dten, tfx->lastDir); ELL_3V_NORM(vout, vout, len); _tenFiberAlign(tfx, vout); /* HEY: is this needed? */ --- 103,107 ---- if (ELL_3V_DOT(tfx->lastDir, tfx->lastDir)) { ELL_3V_COPY(vin, tfx->lastDir); ! TEN_T3V_MUL(vout, tfx->dten, tfx->lastDir); ELL_3V_NORM(vout, vout, len); _tenFiberAlign(tfx, vout); /* HEY: is this needed? */ Index: tensor.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/tensor.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tensor.c 13 Mar 2004 20:03:11 -0000 1.29 --- tensor.c 7 May 2004 19:13:34 -0000 1.30 *************** *** 103,107 **** continue; } ! TEN_LIST2MAT(nine, seven); ELL_3M_SCALE(nine, scale, nine); } --- 103,107 ---- continue; } ! TEN_T2M(nine, seven); ELL_3M_SCALE(nine, scale, nine); } *************** *** 163,167 **** N = sx*sy*sz; for (I=0; I<N; I++) { ! TEN_MAT2LIST(seven, nine); seven[0] = conf ? conf[I] : 1.0; seven += 7; --- 163,167 ---- N = sx*sy*sz; for (I=0; I<N; I++) { ! TEN_M2T(seven, nine); seven[0] = conf ? conf[I] : 1.0; seven += 7; *************** *** 198,202 **** int ret; ! TEN_LIST2MAT(m, t); trc = ELL_3M_TRACE(m)/3.0; ELL_3M_IDENTITY_SET(iso); --- 198,202 ---- int ret; ! TEN_T2M(m, t); trc = ELL_3M_TRACE(m)/3.0; ELL_3M_IDENTITY_SET(iso); *************** *** 298,302 **** ELL_3M_MUL(tmpMat2, evecT, tmpMat1); ten[0] = conf; ! TEN_MAT2LIST(ten, tmpMat2); return; } --- 298,302 ---- ELL_3M_MUL(tmpMat2, evecT, tmpMat1); ten[0] = conf; ! TEN_M2T(ten, tmpMat2); return; } *************** *** 473,475 **** --- 473,516 ---- } + void + tenShapeGradients_d(double mean[7], + double var[7], double *varNorm, + double skew[7], double *skewNorm, + double evec[9], double eval[9], int *didEigen, + double ten[7]) { + double meanDot, varDot; + #define Txx (ten[1]) + #define Txy (ten[2]) + #define Txz (ten[3]) + #define Tyy (ten[4]) + #define Tyz (ten[5]) + #define Tzz (ten[6]) + /* 0.57735027 == 1/sqrt(3) */ + TEN_T_SET(mean, ten[0], + 0.57735027, 0, 0, + 0.57735027, 0, + 0.57735027); + TEN_T_SET(var, ten[0], + 2*Txx - Tyy - Tzz, 3*Txy, 3*Txz, + 2*Tyy - Txx - Tzz, 3*Tyz, + 2*Tzz - Txx - Tyy); + *varNorm = TEN_T_NORM(var); + if (*varNorm) { + TEN_T_SCALE(var, 1.0/(*varNorm), var); + } + TEN_T_SET(skew, ten[0], + Tyy*Tzz - Tyz*Tyz, Txz*Tyz - Txy*Tzz, Txy*Tyz - Txz*Tyy, + Txx*Tzz - Txz*Txz, Txy*Txz - Tyz*Txx, + Txx*Tyy - Txy*Txy); + meanDot = TEN_T_DOT(skew, mean); + varDot = TEN_T_DOT(skew, var); + TEN_T_SCALE_INCR2(skew, -meanDot, mean, -varDot, var); + *skewNorm = TEN_T_NORM(skew); + if (*skewNorm) { + TEN_T_SCALE(skew, 1.0/(*skewNorm), skew); + } + + *didEigen = AIR_FALSE; + return; + } Index: tendHelix.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/tendHelix.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tendHelix.c 19 Feb 2004 06:45:13 -0000 1.5 --- tendHelix.c 7 May 2004 19:13:34 -0000 1.6 *************** *** 121,125 **** ELL_3M_MUL(mA, H2W, mB); ! TEN_MAT2LIST(out + 7*idx, mA); (out + 7*idx)[0] = 1.0; } --- 121,125 ---- ELL_3M_MUL(mA, H2W, mB); ! TEN_M2T(out + 7*idx, mA); (out + 7*idx)[0] = 1.0; } Index: tenGage.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/tenGage.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tenGage.c 22 Apr 2004 07:14:54 -0000 1.17 --- tenGage.c 7 May 2004 19:13:33 -0000 1.18 *************** *** 18,21 **** --- 18,28 ---- */ + extern void + tenShapeGradients_d(double mean[7], + double var[7], double *varNorm, + double skew[7], double *skewNorm, + double evec[9], double eval[9], int *didEigen, + double ten[7]); + #include "ten.h" *************** *** 244,250 **** --- 251,287 ---- /* --- Trace --- */ if (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageTraceGradVec)) { + /* + double tmpT[7], meanGrad[7], varGrad[7], varNorm, skewGrad[7], skewNorm, + copyT[7]; + int didEigen=0; + + TEN_T_COPY(copyT, tenAns); + tenShapeGradients_d(meanGrad, + varGrad, &varNorm, + skewGrad, &skewNorm, + NULL, NULL, &didEigen, + copyT); + vecTmp = pvl->directAnswer[tenGageTraceGradVec]; + TEN_T_SET(tmpT, tenAns[0], + gradDtA[0], gradDtB[0], gradDtC[0], + gradDtD[0], gradDtE[0], + gradDtF[0]); + vecTmp[0] = TEN_T_DOT(meanGrad, tmpT); + TEN_T_SET(tmpT, tenAns[0], + gradDtA[1], gradDtB[1], gradDtC[1], + gradDtD[1], gradDtE[1], + gradDtF[1]); + vecTmp[1] = TEN_T_DOT(meanGrad, tmpT); + TEN_T_SET(tmpT, tenAns[0], + gradDtA[2], gradDtB[2], gradDtC[2], + gradDtD[2], gradDtE[2], + gradDtF[2]); + vecTmp[2] = TEN_T_DOT(meanGrad, tmpT); + */ + vecTmp = pvl->directAnswer[tenGageTraceGradVec]; ELL_3V_ADD3(vecTmp, gradDtA, gradDtD, gradDtF); ELL_3V_SCALE(gradCbA, -1, vecTmp); + } if (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageTraceGradMag)) { *************** *** 312,319 **** --- 349,386 ---- /* --- Q --- */ if (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageQGradVec)) { + /* + double tmpT[7], meanGrad[7], varGrad[7], varNorm, skewGrad[7], skewNorm, + copyT[7]; + int didEigen=0; + + TEN_T_COPY(copyT, tenAns); + tenShapeGradients_d(meanGrad, + varGrad, &varNorm, + skewGrad, &skewNorm, + NULL, NULL, &didEigen, + copyT); + gradCbQ = vecTmp = pvl->directAnswer[tenGageQGradVec]; + TEN_T_SET(tmpT, tenAns[0], + gradDtA[0], gradDtB[0], gradDtC[0], + gradDtD[0], gradDtE[0], + gradDtF[0]); + vecTmp[0] = TEN_T_DOT(varGrad, tmpT); + TEN_T_SET(tmpT, tenAns[0], + gradDtA[1], gradDtB[1], gradDtC[1], + gradDtD[1], gradDtE[1], + gradDtF[1]); + vecTmp[1] = TEN_T_DOT(varGrad, tmpT); + TEN_T_SET(tmpT, tenAns[0], + gradDtA[2], gradDtB[2], gradDtC[2], + gradDtD[2], gradDtE[2], + gradDtF[2]); + vecTmp[2] = TEN_T_DOT(varGrad, tmpT); + */ + gradCbQ = vecTmp = pvl->directAnswer[tenGageQGradVec]; ELL_3V_SCALE_ADD2(vecTmp, 1.0/9.0, gradCbS, -1.0/9.0, gradCbB); + } if (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageQGradMag)) { Index: tenMacros.h =================================================================== RCS file: /cvsroot/teem/teem/src/ten/tenMacros.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tenMacros.h 7 Jan 2004 15:34:31 -0000 1.10 --- tenMacros.h 7 May 2004 19:13:34 -0000 1.11 *************** *** 26,30 **** /* ! ******** TEN_LIST2MAT, TEN_MAT2LIST ** ** for going between 7-element list and 9-element matrix --- 26,30 ---- /* ! ******** TEN_T2M, TEN_M2T ** ** for going between 7-element list and 9-element matrix *************** *** 40,85 **** ** As in ell, the matrix ordering is given by: ** ! ** 0 3 6 ! ** 1 4 7 ! ** 2 5 8 ** ! ** Note that TEN_MAT2LIST does NOT set the threshold element (index 0), ! ** and that the threshold value plays no role in TEN_LIST2MAT. */ ! #define TEN_LIST2MAT(m, l) ( \ ! (m)[0] = (l)[1], \ ! (m)[1] = (l)[2], \ ! (m)[2] = (l)[3], \ ! (m)[3] = (l)[2], \ ! (m)[4] = (l)[4], \ ! (m)[5] = (l)[5], \ ! (m)[6] = (l)[3], \ ! (m)[7] = (l)[5], \ ! (m)[8] = (l)[6] ) ! #define TEN_MAT2LIST(l, m) ( \ ! (l)[1] = (m)[0], \ ! (l)[2] = (m)[3], \ ! (l)[3] = (m)[6], \ ! (l)[4] = (m)[4], \ ! (l)[5] = (m)[7], \ ! (l)[6] = (m)[8] ) ! #define TEN_LIST_COPY(d, s) ( \ ! (d)[0] = (s)[0], \ ! (d)[1] = (s)[1], \ ! (d)[2] = (s)[2], \ ! (d)[3] = (s)[3], \ ! (d)[4] = (s)[4], \ ! (d)[5] = (s)[5], \ (d)[6] = (s)[6] ) ! #define TEN_LIST_DET(l) ( \ ! (l)[1]*((l)[4]*(l)[6] - (l)[5]*(l)[5]) \ ! + (l)[2]*((l)[5]*(l)[3] - (l)[2]*(l)[6]) \ ! + (l)[3]*((l)[2]*(l)[5] - (l)[3]*(l)[4])) ! #define TEN_LIST_SCALE(a, s, b) ( \ (a)[0] = (b)[0], \ (a)[1] = (s)*(b)[1], \ --- 40,89 ---- ** As in ell, the matrix ordering is given by: ** ! ** 0 1 2 ! ** 3 4 5 ! ** 6 7 8 ** ! ** Note that TEN_M2T does NOT set the threshold element (index 0), ! ** and that the threshold value plays no role in TEN_T2M. */ ! #define TEN_T2M(m, t) ( \ ! (m)[0] = (t)[1], (m)[1] = (t)[2], (m)[2] = (t)[3], \ ! (m)[3] = (t)[2], (m)[4] = (t)[4], (m)[5] = (t)[5], \ ! (m)[6] = (t)[3], (m)[7] = (t)[5], (m)[8] = (t)[6] ) ! #define TEN_M2T(t, m) ( \ ! (t)[1] = (m)[0], (t)[2] = (m)[1], (t)[3] = (m)[2], \ ! (t)[4] = (m)[4], (t)[5] = (m)[5], \ ! (t)[6] = (m)[8] ) ! #define TEN_T_SET(t, conf, a, b, c, d, e, f) ( \ ! (t)[0] = (conf), \ ! (t)[1] = (a), (t)[2] = (b), (t)[3] = (c), \ ! (t)[4] = (d), (t)[5] = (e), \ ! (t)[6] = (f) ) ! ! #define TEN_T_COPY(d, s) ( \ ! (d)[0] = (s)[0], \ ! (d)[1] = (s)[1], \ ! (d)[2] = (s)[2], \ ! (d)[3] = (s)[3], \ ! (d)[4] = (s)[4], \ ! (d)[5] = (s)[5], \ (d)[6] = (s)[6] ) ! #define TEN_T_DET(t) ( \ ! (t)[1]*((t)[4]*(t)[6] - (t)[5]*(t)[5]) \ ! + (t)[2]*((t)[5]*(t)[3] - (t)[2]*(t)[6]) \ ! + (t)[3]*((t)[2]*(t)[5] - (t)[3]*(t)[4])) ! #define TEN_T_DOT(A, B) ( \ ! (A)[1]*(B)[1] + 2*(A)[2]*(B)[2] + 2*(A)[3]*(B)[3] \ ! + (A)[4]*(B)[4] + 2*(A)[5]*(B)[5] \ ! + (A)[6]*(B)[6] ) ! ! #define TEN_T_NORM(A) (sqrt(TEN_T_DOT(A,A))) ! ! #define TEN_T_SCALE(a, s, b) ( \ (a)[0] = (b)[0], \ (a)[1] = (s)*(b)[1], \ *************** *** 90,97 **** (a)[6] = (s)*(b)[6]) ! #define TEN_3VLIST_MUL(b, l, a) ( \ ! (b)[0] = (l)[1]*(a)[0] + (l)[2]*(a)[1] + (l)[3]*(a)[2], \ ! (b)[1] = (l)[2]*(a)[0] + (l)[4]*(a)[1] + (l)[5]*(a)[2], \ ! (b)[2] = (l)[3]*(a)[0] + (l)[5]*(a)[1] + (l)[6]*(a)[2]) #ifdef __cplusplus --- 94,119 ---- (a)[6] = (s)*(b)[6]) ! #define TEN_T_SCALE_INCR(a, s, b) ( \ ! (a)[0] = (b)[0], \ ! (a)[1] += (s)*(b)[1], \ ! (a)[2] += (s)*(b)[2], \ ! (a)[3] += (s)*(b)[3], \ ! (a)[4] += (s)*(b)[4], \ ! (a)[5] += (s)*(b)[5], \ ! (a)[6] += (s)*(b)[6]) ! ! #define TEN_T_SCALE_INCR2(a, s, b, t, c) ( \ ! (a)[0] = AIR_MIN((b)[0], c[0]), \ ! (a)[1] += (s)*(b)[1] + (t)*(c)[1], \ ! (a)[2] += (s)*(b)[2] + (t)*(c)[2], \ ! (a)[3] += (s)*(b)[3] + (t)*(c)[3], \ ! (a)[4] += (s)*(b)[4] + (t)*(c)[4], \ ! (a)[5] += (s)*(b)[5] + (t)*(c)[5], \ ! (a)[6] += (s)*(b)[6] + (t)*(c)[6]) ! ! #define TEN_T3V_MUL(b, t, a) ( \ ! (b)[0] = (t)[1]*(a)[0] + (t)[2]*(a)[1] + (t)[3]*(a)[2], \ ! (b)[1] = (t)[2]*(a)[0] + (t)[4]*(a)[1] + (t)[5]*(a)[2], \ ! (b)[2] = (t)[3]*(a)[0] + (t)[5]*(a)[1] + (t)[6]*(a)[2]) #ifdef __cplusplus |
|
From: Gordon K. <kin...@us...> - 2004-05-07 19:13:43
|
Update of /cvsroot/teem/teem/src/ten/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9915/test Modified Files: tg.c tt.c Log Message: changed macros, and started adding shape gradients. Should not break any code Index: tg.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/test/tg.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tg.c 7 Jan 2004 15:34:31 -0000 1.7 --- tg.c 7 May 2004 19:13:34 -0000 1.8 *************** *** 122,126 **** tdata[0] = 1.0; ! TEN_MAT2LIST(tdata, mT); tdata += 7; } --- 122,126 ---- tdata[0] = 1.0; ! TEN_M2T(tdata, mT); tdata += 7; } Index: tt.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/test/tt.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tt.c 22 Apr 2004 04:58:34 -0000 1.13 --- tt.c 7 May 2004 19:13:34 -0000 1.14 *************** *** 170,174 **** 7*(2*(samp-1-xi) - (samp-1-yi) + (2*samp-1)*((samp-1-yi) + samp)); tdata[0] = 1.0; ! TEN_MAT2LIST(tdata, mT); } } --- 170,174 ---- 7*(2*(samp-1-xi) - (samp-1-yi) + (2*samp-1)*((samp-1-yi) + samp)); tdata[0] = 1.0; ! TEN_M2T(tdata, mT); } } |
|
From: Gordon K. <kin...@us...> - 2004-05-07 19:10:10
|
Update of /cvsroot/teem/teem/src/ten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9276 Modified Files: aniso.c Log Message: compiler bug? This was causing a problem on the mac Index: aniso.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/aniso.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** aniso.c 22 Apr 2004 07:46:52 -0000 1.31 --- aniso.c 7 May 2004 19:09:58 -0000 1.32 *************** *** 172,176 **** tenAnisoVolume(Nrrd *nout, Nrrd *nin, int aniso, float thresh) { char me[]="tenAnisoVolume", err[AIR_STRLEN_MED]; ! size_t N, I, _I; float *out, *in, *tensor, eval[3], evec[9], c[TEN_ANISO_MAX+1]; int sx, sy, sz, size[3], coord[3], map[NRRD_DIM_MAX]; --- 172,176 ---- tenAnisoVolume(Nrrd *nout, Nrrd *nin, int aniso, float thresh) { char me[]="tenAnisoVolume", err[AIR_STRLEN_MED]; ! size_t N, I, copyI; float *out, *in, *tensor, eval[3], evec[9], c[TEN_ANISO_MAX+1]; int sx, sy, sz, size[3], coord[3], map[NRRD_DIM_MAX]; *************** *** 205,210 **** tenEigensolve(eval, evec, tensor); if (!(AIR_EXISTS(eval[0]) && AIR_EXISTS(eval[1]) && AIR_EXISTS(eval[2]))) { ! _I = I; ! NRRD_COORD_GEN(coord, size, 3, _I); sprintf(err, "%s: not all eigenvalues exist (%g,%g,%g) at sample " "%d = (%d,%d,%d)", --- 205,210 ---- tenEigensolve(eval, evec, tensor); if (!(AIR_EXISTS(eval[0]) && AIR_EXISTS(eval[1]) && AIR_EXISTS(eval[2]))) { ! copyI = I; ! NRRD_COORD_GEN(coord, size, 3, copyI); sprintf(err, "%s: not all eigenvalues exist (%g,%g,%g) at sample " "%d = (%d,%d,%d)", |
|
From: Gordon K. <kin...@us...> - 2004-05-07 19:09:14
|
Update of /cvsroot/teem/teem/src/nrrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9166 Modified Files: superset.c Log Message: removed a hold-over from some old memory debugging Index: superset.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/superset.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** superset.c 30 Mar 2004 19:25:09 -0000 1.16 --- superset.c 7 May 2004 19:09:04 -0000 1.17 *************** *** 158,164 **** numLines; /* number of scanlines in output nrrd */ char *dataIn, *dataOut, *subCont; - double zeros[1024]; - - memset(zeros, 0, 1024*sizeof(double)); /* errors */ --- 158,161 ---- |
|
From: Gordon K. <kin...@us...> - 2004-05-07 19:07:52
|
Update of /cvsroot/teem/teem/src/ell In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8904 Modified Files: ellMacros.h Log Message: why not some more macros Index: ellMacros.h =================================================================== RCS file: /cvsroot/teem/teem/src/ell/ellMacros.h,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** ellMacros.h 8 Mar 2004 14:39:48 -0000 1.41 --- ellMacros.h 7 May 2004 19:07:44 -0000 1.42 *************** *** 87,90 **** --- 87,104 ---- : 1)) + #define ELL_2V_SET(v, a, b) \ + ((v)[0]=(a), (v)[1]=(b)) + + #define ELL_2V_DOT(v1, v2) ((v1)[0]*(v2)[0] + (v1)[1]*(v2)[1]) + + #define ELL_2V_LEN(v) (sqrt(ELL_2V_DOT((v),(v)))) + + #define ELL_2V_SCALE(v2, a, v1) \ + ((v2)[0] = (a)*(v1)[0], \ + (v2)[1] = (a)*(v1)[1]) + + #define ELL_2V_NORM(v2, v1, length) \ + (length = ELL_2V_LEN(v1), ELL_2V_SCALE(v2, 1.0/length, v1)) + #define _ELL_2M_DET(a,b,c,d) ((a)*(d) - (b)*(c)) *************** *** 732,738 **** ELL_4V_SET((m)+12, 0, 0, 0, 1)) - #define ELL_2V_SET(v, a, b) \ - ((v)[0]=(a), (v)[1]=(b)) - #define ELL_5V_SET(v, a, b, c, d, e) \ ((v)[0]=(a), (v)[1]=(b), (v)[2]=(c), (v)[3]=(d), (v)[4]=(e)) --- 746,749 ---- *************** *** 744,759 **** ((v)[0]=(a), (v)[1]=(b), (v)[2]=(c), (v)[3]=(d), (v)[4]=(e), (v)[5]=(f)) ! #define ELL_7V_SET(v, a, b, c, d, e, f, g) \ ! ((v)[0]=(a), (v)[1]=(b), (v)[2]=(c), (v)[3]=(d), \ ! (v)[4]=(e), (v)[5]=(f), (v)[6]=(g)) ! #define ELL_7V_COPY(v2, v1) \ ! ((v2)[0] = (v1)[0], \ ! (v2)[1] = (v1)[1], \ ! (v2)[2] = (v1)[2], \ ! (v2)[3] = (v1)[3], \ ! (v2)[4] = (v1)[4], \ ! (v2)[5] = (v1)[5], \ ! (v2)[6] = (v1)[6]) #define ELL_9V_SET(v, a, b, c, d, e, f, g, h, i) \ --- 755,773 ---- ((v)[0]=(a), (v)[1]=(b), (v)[2]=(c), (v)[3]=(d), (v)[4]=(e), (v)[5]=(f)) ! #define ELL_6V_SCALE_INCR2(v2, s0, v0, s1, v1) \ ! ((v2)[0] += (s0)*(v0)[0] + (s1)*(v1)[0], \ ! (v2)[1] += (s0)*(v0)[1] + (s1)*(v1)[1], \ ! (v2)[2] += (s0)*(v0)[2] + (s1)*(v1)[2], \ ! (v2)[3] += (s0)*(v0)[3] + (s1)*(v1)[3], \ ! (v2)[4] += (s0)*(v0)[4] + (s1)*(v1)[4], \ ! (v2)[5] += (s0)*(v0)[5] + (s1)*(v1)[5]) ! #define ELL_6V_SCALE(v2, a, v1) \ ! ((v2)[0] = (a)*(v1)[0], \ ! (v2)[1] = (a)*(v1)[1], \ ! (v2)[2] = (a)*(v1)[2], \ ! (v2)[3] = (a)*(v1)[3], \ ! (v2)[4] = (a)*(v1)[4], \ ! (v2)[5] = (a)*(v1)[5]) #define ELL_9V_SET(v, a, b, c, d, e, f, g, h, i) \ |
|
From: Gordon K. <kin...@us...> - 2004-05-07 19:07:03
|
Update of /cvsroot/teem/teem/src/ell In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8743 Modified Files: GNUmakefile Log Message: recreates a college physics demonstration of the interference inherent in a diffraction grating Index: GNUmakefile =================================================================== RCS file: /cvsroot/teem/teem/src/ell/GNUmakefile,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** GNUmakefile 29 Mar 2004 21:15:16 -0000 1.13 --- GNUmakefile 7 May 2004 19:06:39 -0000 1.14 *************** *** 48,52 **** $(L).PRIVATE_HEADERS = $(L).OBJS = cubicEll.o eigen.o miscEll.o vecEll.o mat.o quat.o genmat.o ! $(L).TESTS = test/sort3 test/invert test/tq test/wheel #### #### --- 48,52 ---- $(L).PRIVATE_HEADERS = $(L).OBJS = cubicEll.o eigen.o miscEll.o vecEll.o mat.o quat.o genmat.o ! $(L).TESTS = test/sort3 test/invert test/tq test/wheel test/rot2aa test/inter #### #### |
|
From: Gordon K. <kin...@us...> - 2004-05-07 19:06:50
|
Update of /cvsroot/teem/teem/src/ell/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8743/test Added Files: inter.c Log Message: recreates a college physics demonstration of the interference inherent in a diffraction grating --- NEW FILE: inter.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 *interInfo = ("Recreates memories of college physics"); 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 wheelArrow(wheelPS *wps, double x0, double y0, double x1, double y1, double alen, double awidth) { double len, dir[2], perp[2]; dir[0] = x0 - x1; dir[1] = y0 - y1; ELL_2V_NORM(dir, dir, len); ELL_2V_SET(perp, -dir[1], dir[0]); fprintf(wps->file, "%g %g M\n", WPS_X(x0), WPS_Y(y0)); fprintf(wps->file, "%g %g L S\n", WPS_X(x1 + alen*dir[0]/2), WPS_Y(y1 + alen*dir[1]/2)); if (alen && awidth) { if (len < alen) { awidth *= len/alen; alen = len; } fprintf(wps->file, "%g %g M\n", WPS_X(x1 + alen*dir[0] + awidth*perp[0]), WPS_Y(y1 + alen*dir[1] + awidth*perp[1])); fprintf(wps->file, "%g %g L\n", WPS_X(x1), WPS_Y(y1)); fprintf(wps->file, "%g %g L CP F\n", WPS_X(x1 + alen*dir[0] - awidth*perp[0]), WPS_Y(y1 + alen*dir[1] - awidth*perp[1])); } 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; int fidx, aidx, num, frames; double psc, width[2], arrowWidth, lineWidth, angle, seglen, x0, y0, x1, y1, cc, ss; wheelPS wps; char filename[AIR_STRLEN_MED]; me = argv[0]; mop = airMopNew(); hparm = hestParmNew(); hparm->elideMultipleNonExistFloatDefault = AIR_TRUE; hopt = NULL; airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways); hestOptAdd(&hopt, "w", "arrowWidth lineWidth", airTypeDouble, 2, 2, width, "1.0 0.2", "widths"); hestOptAdd(&hopt, "n", "number", airTypeInt, 1, 1, &num, "10", "number of arrows"); hestOptAdd(&hopt, "f", "frames", airTypeInt, 1, 1, &frames, "10", "number of frames"); hestOptAdd(&hopt, "psc", "scale", airTypeDouble, 1, 1, &psc, "200", "scaling from world space to PostScript points"); hestOptAdd(&hopt, "o", "prefix", airTypeString, 1, 1, &outS, NULL, "prefix of file names"); hestParseOrDie(hopt, argc-1, argv+1, hparm, me, interInfo, AIR_TRUE, AIR_TRUE, AIR_TRUE); airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways); airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways); for (fidx=0; fidx<frames; fidx++) { sprintf(filename, "%s%03d.eps", outS, fidx); if (!(wps.file = airFopen(filename, stdout, "wb"))) { fprintf(stderr, "%s: couldn't open output file\n", me); airMopError(mop); return 1; } lineWidth = width[0]; arrowWidth = width[1]; wps.psc = psc; ELL_4V_SET(wps.bbox, -0.45, -0.85, 1.1, 0.85); wheelPreamble(&wps); fprintf(wps.file, "0 setlinecap\n"); wheelGray(&wps, 0.4); wheelWidth(&wps, lineWidth); x0 = 0; y0 = 0; seglen = 1.0/num; angle = AIR_AFFINE(0, fidx, frames, 0, 2*AIR_PI); for (aidx=1; aidx<=num; aidx++) { cc = cos(angle*aidx)*seglen; ss = sin(angle*aidx)*seglen; x1 = x0 + 0.90*cc; y1 = y0 + 0.90*ss; wheelArrow(&wps, x0, y0, x1, y1, arrowWidth, arrowWidth*0.4); x0 += cc; y0 += ss; } wheelGray(&wps, 0.0); wheelArrow(&wps, 0, 0, x0, y0, arrowWidth, arrowWidth*0.4); wheelEpilog(&wps); airFclose(wps.file); } airMopOkay(mop); exit(0); } /* mkdir inter04 test/inter -w 4 0.08 -o inter04/ -n 4 -f 300 mkdir inter08 test/inter -w 2.5 0.04 -o inter08/ -n 8 -f 300 mkdir inter16 test/inter -w 2.2 0.02 -o inter16/ -n 16 -f 300 mkdir inter32 test/inter -w 2 0.01 -o inter32/ -n 32 -f 300 mkdir inter foreach I ( 000 001 002 003 004 005 006 007 008 009 \ 010 011 012 013 014 015 016 017 018 019 \ 020 021 022 023 024 025 026 027 028 029 \ 030 031 032 033 034 035 036 037 038 039 \ 040 041 042 043 044 045 046 047 048 049 \ 050 051 052 053 054 055 056 057 058 059 \ 060 061 062 063 064 065 066 067 068 069 \ 070 071 072 073 074 075 076 077 078 079 \ 080 081 082 083 084 085 086 087 088 089 \ 090 091 092 093 094 095 096 097 098 099 \ 100 101 102 103 104 105 106 107 108 109 \ 110 111 112 113 114 115 116 117 118 119 \ 120 121 122 123 124 125 126 127 128 129 \ 130 131 132 133 134 135 136 137 138 139 \ 140 141 142 143 144 145 146 147 148 149 \ 150 151 152 153 154 155 156 157 158 159 \ 160 161 162 163 164 165 166 167 168 169 \ 170 171 172 173 174 175 176 177 178 179 \ 180 181 182 183 184 185 186 187 188 189 \ 190 191 192 193 194 195 196 197 198 199 \ 200 201 202 203 204 205 206 207 208 209 \ 210 211 212 213 214 215 216 217 218 219 \ 220 221 222 223 224 225 226 227 228 229 \ 230 231 232 233 234 235 236 237 238 239 \ 240 241 242 243 244 245 246 247 248 249 \ 250 251 252 253 254 255 256 257 258 259 \ 260 261 262 263 264 265 266 267 268 269 \ 270 271 272 273 274 275 276 277 278 279 \ 280 281 282 283 284 285 286 287 288 289 \ 290 291 292 293 294 295 296 297 298 299 ) echo $I foreach J ( 04 08 16 32 ) eps2ppm inter{$J}/${I}.eps 250 \ | unu slice -a 0 -p 0 \ | unu resample -s x0.2 x0.2 -o inter${J}/${I}.png end unu pad -i inter04/${I}.png -min 0 0 -max M+1 M -b pad -v 128 \ | unu join -i - inter08/${I}.png -a 0 \ | unu pad -min 0 0 -max M M+1 -b pad -v 128 -o a.png unu pad -i inter16/${I}.png -min 0 0 -max M+1 M -b pad -v 128 \ | unu join -i - inter32/${I}.png -a 0 -o b.png unu join -i a.png b.png -a 1 \ | unu 2op - 255 - -o inter/${I}.png end rm -f a.png b.png */ |
|
From: Gordon K. <kin...@us...> - 2004-05-02 21:43:20
|
Update of /cvsroot/teem/teem/src/coil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17698 Modified Files: coil.h methodsCoil.c realmethods.c scalarCoil.c Log Message: trick to help regularize modified curvature diffusion: mix in a tiny bit of laplacian-based smoothing Index: scalarCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/scalarCoil.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** scalarCoil.c 25 Mar 2004 03:11:50 -0000 1.3 --- scalarCoil.c 2 May 2004 21:43:02 -0000 1.4 *************** *** 137,141 **** double parm[COIL_PARMS_NUM]) { coil_t forwX[3], backX[3], forwY[3], backY[3], forwZ[3], backZ[3], ! grad[3], gm, eps, KK, LL, rspX, rspY, rspZ; /* reciprocals of spacings in X, Y, and Z */ --- 137,141 ---- double parm[COIL_PARMS_NUM]) { coil_t forwX[3], backX[3], forwY[3], backY[3], forwZ[3], backZ[3], ! grad[3], gm, eps, KK, LL, rspX, rspY, rspZ, lerp; /* reciprocals of spacings in X, Y, and Z */ *************** *** 169,176 **** LL = ELL_3V_DOT(backZ, backZ); backZ[2] *= _COIL_CONDUCT(LL, KK)/(eps + sqrt(LL)); ! ! delta[0] = gm*parm[0]*(rspX*(forwX[0] - backX[0]) ! + rspY*(forwY[1] - backY[1]) ! + rspZ*(forwZ[2] - backZ[2])); } --- 169,179 ---- LL = ELL_3V_DOT(backZ, backZ); backZ[2] *= _COIL_CONDUCT(LL, KK)/(eps + sqrt(LL)); ! ! lerp = parm[2]; ! delta[0] = (lerp*_coilLaplacian3(iv3, spacing) ! + (1-lerp)*gm*(rspX*(forwX[0] - backX[0]) ! + rspY*(forwY[1] - backY[1]) ! + rspZ*(forwZ[2] - backZ[2]))); ! delta[0] *= parm[0]; } Index: realmethods.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/realmethods.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** realmethods.c 25 Mar 2004 03:11:50 -0000 1.4 --- realmethods.c 2 May 2004 21:43:02 -0000 1.5 *************** *** 55,59 **** "modified-curvature", coilMethodTypeModifiedCurvature, ! 2 }; const coilMethod* --- 55,59 ---- "modified-curvature", coilMethodTypeModifiedCurvature, ! 3 }; const coilMethod* Index: coil.h =================================================================== RCS file: /cvsroot/teem/teem/src/coil/coil.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** coil.h 25 Mar 2004 03:11:50 -0000 1.3 --- coil.h 2 May 2004 21:43:02 -0000 1.4 *************** *** 159,163 **** typedef struct coilContext_t { /* ---------- input */ ! const Nrrd *nin; /* input volume, converted to coil_t nvol */ const coilKind *kind; /* what kind of volume is nin */ const coilMethod *method; /* what method of filtering to use */ --- 159,164 ---- typedef struct coilContext_t { /* ---------- input */ ! const Nrrd *nin; /* input volume (converted to type coil_t ! in nvol, below) */ const coilKind *kind; /* what kind of volume is nin */ const coilMethod *method; /* what method of filtering to use */ Index: methodsCoil.c =================================================================== RCS file: /cvsroot/teem/teem/src/coil/methodsCoil.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** methodsCoil.c 25 Mar 2004 03:11:50 -0000 1.4 --- methodsCoil.c 2 May 2004 21:43:02 -0000 1.5 *************** *** 198,203 **** } baseDim = (1 == cctx->kind->valLen ? 0 : 1); ! if (nrrdSlice(nout, cctx->nvol, baseDim, 0)) { ! sprintf(err, "%s: trouble slicing to get output", me); biffMove(COIL, err, NRRD); return 1; } --- 198,204 ---- } baseDim = (1 == cctx->kind->valLen ? 0 : 1); ! if (nrrdSlice(nout, cctx->nvol, baseDim, 0) ! || nrrdAxisInfoCopy(nout, cctx->nin, NULL, NRRD_AXIS_INFO_NONE)) { ! sprintf(err, "%s: trouble getting output", me); biffMove(COIL, err, NRRD); return 1; } |
|
From: Gordon K. <kin...@us...> - 2004-05-02 21:42:05
|
Update of /cvsroot/teem/teem/src/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17461 Modified Files: vprobe.c Log Message: simple hack to allow vprobe apply a homog coord transform to the volume as it probes Index: vprobe.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/vprobe.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** vprobe.c 11 Apr 2004 02:28:15 -0000 1.21 --- vprobe.c 2 May 2004 21:41:54 -0000 1.22 *************** *** 85,92 **** six, siy, siz, sox, soy, soz, iBaseDim, oBaseDim, renorm; gage_t *answer; ! Nrrd *nin, *nout; gageContext *ctx; gagePerVolume *pvl; ! double t0, t1, gmc; airArray *mop; --- 85,92 ---- six, siy, siz, sox, soy, soz, iBaseDim, oBaseDim, renorm; gage_t *answer; ! Nrrd *nin, *nout, *_nmat, *nmat; gageContext *ctx; gagePerVolume *pvl; ! double t0, t1, gmc, mat[16], ipos[4], opos[4], spx, spy, spz; airArray *mop; *************** *** 123,126 **** --- 123,131 ---- "0.0", "For curvature-based queries, use zero when gradient " "magnitude is below this"); + hestOptAdd(&hopt, "m", "matrix", airTypeOther, 1, 1, &_nmat, "", + "transform matrix to map volume through " + "(actually the probe locations are sent through " + "its inverse). By default, there is no transform", + NULL, NULL, nrrdHestNrrd); hestOptAdd(&hopt, "t", "type", airTypeEnum, 1, 1, &otype, "float", "type of output volume", NULL, nrrdType); *************** *** 143,146 **** --- 148,172 ---- } + if (_nmat) { + if (!( 2 == _nmat->dim + && 4 == _nmat->axis[0].size && 4 == _nmat->axis[1].size )) { + fprintf(stderr, "%s: matrix needs to be a 2D 4x4 array\n", me); + airMopError(mop); + return 1; + } + nmat = nrrdNew(); + airMopAdd(mop, nmat, (airMopper)nrrdNuke, airMopAlways); + if (nrrdConvert(nmat, _nmat, nrrdTypeDouble)) { + airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways); + fprintf(stderr, "%s: trouble:\n%s\n", me, err); + airMopError(mop); + return 1; + } + ell_4m_inv_d(mat, (double*)(nmat->data)); + /* ell_4m_print_d(stderr, mat); */ + } else { + ELL_4M_IDENTITY_SET(mat); + } + ansLen = kind->table[what].answerLength; iBaseDim = kind->baseDim; *************** *** 149,152 **** --- 175,181 ---- siy = nin->axis[1+iBaseDim].size; siz = nin->axis[2+iBaseDim].size; + spx = SPACING(nin->axis[0+iBaseDim].spacing); + spy = SPACING(nin->axis[1+iBaseDim].spacing); + spz = SPACING(nin->axis[2+iBaseDim].spacing); sox = scale[0]*six; soy = scale[1]*siy; *************** *** 220,228 **** ((61 == xi) && (51 == yi) && (46 == zi)) /* ((40==xi) && (30==yi) && (62==zi)) || */ ! /* ((40==xi) && (30==yi) && (63==zi)) */ ); ! if (gageProbe(ctx, x, y, z)) { fprintf(stderr, "%s: trouble at i=(%d,%d,%d) -> f=(%g,%g,%g):\n%s\n(%d)\n", ! me, xi, yi, zi, x, y, z, gageErrStr, gageErrNum); airMopError(mop); return 1; --- 249,274 ---- ((61 == xi) && (51 == yi) && (46 == zi)) /* ((40==xi) && (30==yi) && (62==zi)) || */ ! /* ((40==xi) && (30==yi) && (63==zi)) */ ); ! ! ELL_4V_SET(opos, x*spx, y*spy, z*spz, 1); ! ELL_4MV_MUL(ipos, mat, opos); ! /* ! fprintf(stderr, "%s: (%g,%g,%g) --> (%g,%g,%g)\n", ! me, opos[0], opos[1], opos[2], ipos[0], ipos[1], ipos[2]); ! */ ! ELL_4V_HOMOG(ipos, ipos); ! ipos[0] = AIR_CLAMP(0, ipos[0]/spx, six-1); ! ipos[1] = AIR_CLAMP(0, ipos[1]/spy, siy-1); ! ipos[2] = AIR_CLAMP(0, ipos[2]/spz, siz-1); ! /* ! fprintf(stderr, "%s: (%g,%g,%g) --> (%g,%g,%g)\n", ! me, x, y, z, ipos[0], ipos[1], ipos[2]); ! */ ! ! if (gageProbe(ctx, ipos[0], ipos[1], ipos[2])) { fprintf(stderr, "%s: trouble at i=(%d,%d,%d) -> f=(%g,%g,%g):\n%s\n(%d)\n", ! me, xi, yi, zi, ipos[0], ipos[1], ipos[2], ! gageErrStr, gageErrNum); airMopError(mop); return 1; |
|
From: Gordon K. <kin...@us...> - 2004-05-02 21:37:13
|
Update of /cvsroot/teem/teem/src/gage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16513 Modified Files: gage.h scl.c sclanswer.c Log Message: added the first non-convolution-based query to gageKindScl: localized weighted median filtering, using the weights from the k00 kernel Index: gage.h =================================================================== RCS file: /cvsroot/teem/teem/src/gage/gage.h,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** gage.h 22 Apr 2004 07:19:00 -0000 1.66 --- gage.h 2 May 2004 21:37:02 -0000 1.67 *************** *** 264,270 **** gageSclCurvDir2, /* 26: "cdir2", 2nd principle curv direction: GT[3] */ gageSclFlowlineCurv,/* 27: "fc", curvature of normal streamline: GT[1] */ gageSclLast }; ! #define GAGE_SCL_ITEM_MAX 27 /* --- 264,271 ---- gageSclCurvDir2, /* 26: "cdir2", 2nd principle curv direction: GT[3] */ gageSclFlowlineCurv,/* 27: "fc", curvature of normal streamline: GT[1] */ + gageSclMedian, /* 28: "med", median filter */ gageSclLast }; ! #define GAGE_SCL_ITEM_MAX 28 /* Index: sclanswer.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/sclanswer.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** sclanswer.c 1 Mar 2004 10:19:45 -0000 1.20 --- sclanswer.c 2 May 2004 21:37:02 -0000 1.21 *************** *** 26,32 **** gage_t gmag=0, *hess, *norm, *gvec, *gten, *k1, *k2, sHess[9], curv=0; double tmpMat[9], tmpVec[3], hevec[9], heval[3]; - gage_t len, gp1[3], gp2[3], *nPerp, nProj[9], ncTen[9]; double T, N, D; /* convenience pointers for work below */ --- 26,35 ---- gage_t gmag=0, *hess, *norm, *gvec, *gten, *k1, *k2, sHess[9], curv=0; double tmpMat[9], tmpVec[3], hevec[9], heval[3]; gage_t len, gp1[3], gp2[3], *nPerp, nProj[9], ncTen[9]; double T, N, D; + #define FD_MEDIAN_MAX 16 + int fd, nidx, xi, yi, zi; + gage_t *fw, iv3wght[2*FD_MEDIAN_MAX*FD_MEDIAN_MAX*FD_MEDIAN_MAX], + wghtSum, wght; /* convenience pointers for work below */ *************** *** 209,212 **** --- 212,249 ---- pvl->directAnswer[gageSclFlowlineCurv][0] = sqrt(ELL_3M_FROB(ncTen)); } + if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclMedian)) { + /* this item is currently a complete oddball in that it does not + benefit from anything done in the "filter" stage, which is in + fact a waste of time if the query consists only of this item */ + fd = GAGE_FD(ctx); + if (fd > FD_MEDIAN_MAX) { + fprintf(stderr, "%s: PANIC: current filter diameter = %d " + "> FD_MEDIAN_MAX = %d\n", me, fd, FD_MEDIAN_MAX); + exit(1); + } + fw = ctx->fw + fd*3*gageKernel00; + /* HEY: this needs some optimization help */ + wghtSum = 0; + nidx = 0; + for (xi=0; xi<fd; xi++) { + for (yi=0; yi<fd; yi++) { + for (zi=0; zi<fd; zi++) { + iv3wght[0 + 2*nidx] = pvl->iv3[nidx]; + iv3wght[1 + 2*nidx] = fw[xi + 0*fd]*fw[yi + 1*fd]*fw[zi + 2*fd]; + wghtSum += iv3wght[1 + 2*nidx]; + nidx++; + } + } + } + qsort(iv3wght, fd*fd*fd, 2*sizeof(gage_t), nrrdValCompare[gage_nrrdType]); + wght = 0; + for (nidx=0; nidx<fd*fd*fd; nidx++) { + wght += iv3wght[1 + 2*nidx]; + if (wght > wghtSum/2) { + break; + } + } + pvl->directAnswer[gageSclMedian][0] = iv3wght[0 + 2*nidx]; + } return; } Index: scl.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/scl.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** scl.c 28 Feb 2004 17:01:53 -0000 1.36 --- scl.c 2 May 2004 21:37:02 -0000 1.37 *************** *** 62,66 **** {gageSclCurvDir1, 3, 2, {gageSclGeomTens, gageSclK1, gageSclK2, -1, -1}, -1, -1}, {gageSclCurvDir2, 3, 2, {gageSclGeomTens, gageSclK1, gageSclK2, -1, -1}, -1, -1}, ! {gageSclFlowlineCurv, 1, 2, {gageSclGeomTens, -1, -1, -1, -1}, -1, -1} }; --- 62,67 ---- {gageSclCurvDir1, 3, 2, {gageSclGeomTens, gageSclK1, gageSclK2, -1, -1}, -1, -1}, {gageSclCurvDir2, 3, 2, {gageSclGeomTens, gageSclK1, gageSclK2, -1, -1}, -1, -1}, ! {gageSclFlowlineCurv, 1, 2, {gageSclGeomTens, -1, -1, -1, -1}, -1, -1}, ! {gageSclMedian, 1, 0, {-1, -1, -1, -1, -1}, -1, -1} }; *************** *** 95,99 **** "1st curvature direction", "2nd curvature direction", ! "flowline curvature" }; --- 96,101 ---- "1st curvature direction", "2nd curvature direction", ! "flowline curvature", ! "median" }; *************** *** 128,132 **** "1st principal curvature direction", "2nd principal curvature direction", ! "curvature of normal streamline" }; --- 130,135 ---- "1st principal curvature direction", "2nd principal curvature direction", ! "curvature of normal streamline", ! "median of iv3 cache (not weighted by any filter (yet))" }; *************** *** 161,165 **** gageSclCurvDir1, gageSclCurvDir2, ! gageSclFlowlineCurv }; --- 164,169 ---- gageSclCurvDir1, gageSclCurvDir2, ! gageSclFlowlineCurv, ! gageSclMedian }; *************** *** 192,195 **** --- 196,200 ---- #define GS_C2 gageSclCurvDir2 #define GS_FC gageSclFlowlineCurv + #define GS_MD gageSclMedian char *************** *** 224,227 **** --- 229,233 ---- "cdir2", "c dir2", "curvdir2", "curv dir2", "curvature direction 2", "fc", "flowlinecurv", "flowline curv", "flowline curvature", + "med", "median", "" }; *************** *** 256,260 **** GS_C1, GS_C1, GS_C1, GS_C1, GS_C1, GS_C2, GS_C2, GS_C2, GS_C2, GS_C2, ! GS_FC, GS_FC, GS_FC, GS_FC }; --- 262,267 ---- GS_C1, GS_C1, GS_C1, GS_C1, GS_C1, GS_C2, GS_C2, GS_C2, GS_C2, GS_C2, ! GS_FC, GS_FC, GS_FC, GS_FC, ! GS_MD, GS_MD }; |
|
From: Gordon K. <kin...@us...> - 2004-05-02 21:36:27
|
Update of /cvsroot/teem/teem/src/gage/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16378/test Added Files: ctfix.c Log Message: tool to fix circular streaks in CT scans, based on gages new-found ability to do localized median filtering --- NEW FILE: ctfix.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 "../gage.h" char *ctfixInfo = ("removes circular streaks from CT datasets, " "assuming you know where they are. nrrd/test/histrad " "is useful for finding the radius of a streak " "in a given slice."); int main(int argc, char *argv[]) { char *me, *outS; hestOpt *hopt; hestParm *hparm; airArray *mop; char *err, done[13]; Nrrd *nin, *_nsinfo, *nsinfo, *nout; NrrdKernelSpec *kern; int E, sx, sy, sz, xi, yi, zi, si; gageContext *ctx; gagePerVolume *pvl; gage_t *answer; double cent[2], r, srad, *sinfo, swidth, astart, angle, astop, corerad; double (*ins)(void *v, size_t I, double d); me = argv[0]; mop = airMopNew(); hparm = hestParmNew(); hopt = NULL; airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways); hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, NULL, "input volume", NULL, NULL, nrrdHestNrrd); hestOptAdd(&hopt, "si", "streak info", airTypeOther, 1, 1, &_nsinfo, NULL, "list of streaks as 2D nrrd; per line: \n " "<slice> <radius> <width> <start> <stop> \n " "where start and stop are angles in [0,4] " "(instead of [-pi,pi]) delimiting arc"); hestOptAdd(&hopt, "k", "kernel", airTypeOther, 1, 1, &kern, "tent", "kernel to use for median weighting", NULL, NULL, nrrdHestKernelSpec); hestOptAdd(&hopt, "c", "center x, y", airTypeDouble, 2, 2, cent, NULL, "The center point of tomography, around which streaks are " "circular arcs or fragments thereof"); hestOptAdd(&hopt, "r", "core radius", airTypeDouble, 1, 1, &corerad, "0", "in addition to the per-streak filtering, giving a non-zero " "radius here turns on filtering of *every* slice within " "this radius, to handle glitches along central tomography " "radius"); hestOptAdd(&hopt, "o", "filename", airTypeString, 1, 1, &outS, "-", "fixed volume output"); hestParseOrDie(hopt, argc-1, argv+1, hparm, me, ctfixInfo, AIR_TRUE, AIR_TRUE, AIR_TRUE); airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways); airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways); if (!( 3 == nin->dim )) { fprintf(stderr, "%s: need 3-D input (not %d-D)\n", me, nin->dim); airMopError(mop); return 1; } if (!( 2 == _nsinfo->dim && 5 == _nsinfo->axis[0].size )) { fprintf(stderr, "%s: need a 2-D 5-by-N list of streak locations\n", me); airMopError(mop); return 1; } nsinfo = nrrdNew(); airMopAdd(mop, nsinfo, (airMopper)nrrdNuke, airMopAlways); if (nrrdConvert(nsinfo, _nsinfo, nrrdTypeDouble)) { airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways); fprintf(stderr, "%s: couldn't convert streak info to doubles:\n%s", me, err); airMopError(mop); return 1; } sinfo = (double*)(nsinfo->data); nout = nrrdNew(); airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopAlways); if (nrrdCopy(nout, nin)) { airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways); fprintf(stderr, "%s: couldn't allocate output:\n%s", me, err); airMopError(mop); return 1; } #define DIST(x0, y0, x1, y1) (sqrt((x0-x1)*(x0-x1) + (y0-y1)*(y0-y1))) sx = nin->axis[0].size; sy = nin->axis[1].size; sz = nin->axis[2].size; ctx = gageContextNew(); airMopAdd(mop, ctx, (airMopper)gageContextNix, airMopAlways); gageParmSet(ctx, gageParmRenormalize, AIR_TRUE); gageParmSet(ctx, gageParmCheckIntegrals, AIR_TRUE); E = 0; if (!E) E |= !(pvl = gagePerVolumeNew(ctx, nin, gageKindScl)); if (!E) E |= gagePerVolumeAttach(ctx, pvl); if (!E) E |= gageKernelSet(ctx, gageKernel00, kern->kernel, kern->parm); if (!E) E |= gageQueryItemOn(ctx, pvl, gageSclMedian); if (!E) E |= gageUpdate(ctx); if (E) { airMopAdd(mop, err = biffGetDone(GAGE), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); airMopError(mop); return 1; } answer = gageAnswerPointer(ctx, pvl, gageSclMedian); ins = nrrdDInsert[nout->type]; fprintf(stderr, "%s: processing streaks ... \n", me); for (si=0; si<nsinfo->axis[1].size; si++) { fprintf(stderr, "%s: streak %d of %d ", me, si+1, nsinfo->axis[1].size); fflush(stderr); zi = sinfo[0 + 5*si]; if (!AIR_IN_CL(0, zi, sz-1)) { fprintf(stderr, "%s: streak[%d] zi=%d outside valid range [0,%d]\n", me, si, zi, sz-1); airMopError(mop); return 1; } srad = sinfo[1 + 5*si]; swidth = sinfo[2 + 5*si]; astart = sinfo[3 + 5*si]; astop = sinfo[4 + 5*si]; for (yi=0; yi<sy; yi++) { if (!(yi%3)) { fprintf(stderr, "%s", airDoneStr(0, yi, sy-1, done)); fflush(stderr); } for (xi=0; xi<sx; xi++) { r = DIST(xi, yi, cent[0], cent[1]); if (!( AIR_ABS(r-srad) < swidth/2 )) { continue; } angle = atan2(yi-cent[1], xi-cent[0]); angle = AIR_AFFINE(-AIR_PI, angle, AIR_PI, 0, 4); if (!( (astart < astop && AIR_IN_CL(astart, angle, astop)) || (astart > astop && (AIR_IN_CL(astart, angle, 4) || AIR_IN_CL(0, angle, astop))) )) { continue; } gageProbe(ctx, xi, yi, zi); ins(nout->data, xi + sx*(yi + sy*zi), *answer); } } fprintf(stderr, "\n"); } if (corerad > 0) { fprintf(stderr, "%s: processing core ... ", me); for (zi=0; zi<sz; zi++) { fprintf(stderr, "%s", airDoneStr(0, zi, sz-1, done)); for (yi=0; yi<sy; yi++) { for (xi=0; xi<sx; xi++) { r = DIST(xi, yi, cent[0], cent[1]); if (!( r < corerad )) { continue; } gageProbe(ctx, xi, yi, zi); ins(nout->data, xi + sx*(yi + sy*zi), *answer); } } } fprintf(stderr, "\n"); } if (nrrdSave(outS, nout, NULL)) { airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways); fprintf(stderr, "%s: couldn't save output:\n%s", me, err); airMopError(mop); return 1; } airMopOkay(mop); exit(0); } |
|
From: Gordon K. <kin...@us...> - 2004-05-02 21:36:27
|
Update of /cvsroot/teem/teem/src/gage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16378 Modified Files: GNUmakefile Log Message: tool to fix circular streaks in CT scans, based on gages new-found ability to do localized median filtering Index: GNUmakefile =================================================================== RCS file: /cvsroot/teem/teem/src/gage/GNUmakefile,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** GNUmakefile 13 Feb 2004 22:56:15 -0000 1.14 --- GNUmakefile 2 May 2004 21:36:18 -0000 1.15 *************** *** 51,55 **** print.o sclanswer.o sclprint.o sclfilter.o \ vecGage.o vecprint.o st.o ! $(L).TESTS = #### #### --- 51,55 ---- print.o sclanswer.o sclprint.o sclfilter.o \ vecGage.o vecprint.o st.o ! $(L).TESTS = test/ctfix #### #### |
|
From: Gordon K. <kin...@us...> - 2004-05-02 21:35:00
|
Update of /cvsroot/teem/teem/src/gage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16118 Modified Files: sclfilter.c Log Message: fixed typo in comment Index: sclfilter.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/sclfilter.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** sclfilter.c 13 Feb 2004 22:56:15 -0000 1.15 --- sclfilter.c 2 May 2004 21:34:52 -0000 1.16 *************** *** 307,311 **** gage_t T; ! /* fw? + 4*? | | | +- along which axis (0:x, 1:y, 2:z) --- 307,311 ---- gage_t T; ! /* fw? + N*? | | | +- along which axis (0:x, 1:y, 2:z) |
|
From: Gordon K. <kin...@us...> - 2004-05-02 21:34:18
|
Update of /cvsroot/teem/teem/src/nrrd/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16020/test Added Files: histrad.c Log Message: tool for doing radial histograms, useful for finding circular or near-circular streaks in CT scans --- NEW FILE: histrad.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 "../nrrd.h" char *histradInfo = ("like unu histax, but for circles"); int main(int argc, char *argv[]) { char *me, *outS; hestOpt *hopt; hestParm *hparm; airArray *mop; char *err; Nrrd *nin, *nhist; double vmin, vmax, rmax, val, cent[2], rad; int bins[2], sx, sy, xi, yi, ridx, hidx, rbins, hbins; NrrdRange *range; double (*lup)(const void *v, size_t I), *hist; me = argv[0]; mop = airMopNew(); hparm = hestParmNew(); hopt = NULL; airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways); hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, NULL, "input image", NULL, NULL, nrrdHestNrrd); hestOptAdd(&hopt, "b", "rbins hbins", airTypeInt, 2, 2, bins, NULL, "# of histogram bins: radial and value"); hestOptAdd(&hopt, "min", "value", airTypeDouble, 1, 1, &vmin, "nan", "Value at low end of histogram. Defaults to lowest value " "found in input nrrd."); hestOptAdd(&hopt, "max", "value", airTypeDouble, 1, 1, &vmax, "nan", "Value at high end of histogram. Defaults to highest value " "found in input nrrd."); hestOptAdd(&hopt, "rmax", "max radius", airTypeDouble, 1, 1, &rmax, "nan", "largest radius to include in histogram"); hestOptAdd(&hopt, "c", "center x, y", airTypeDouble, 2, 2, cent, NULL, "The center point around which to build radial histogram"); hestOptAdd(&hopt, "o", "filename", airTypeString, 1, 1, &outS, "-", "file to write histogram to"); hestParseOrDie(hopt, argc-1, argv+1, hparm, me, histradInfo, AIR_TRUE, AIR_TRUE, AIR_TRUE); airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways); airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways); if (2 != nin->dim) { fprintf(stderr, "%s: need 2-D input (not %d-D)\n", me, nin->dim); airMopError(mop); return 1; } rbins = bins[0]; hbins = bins[1]; nhist = nrrdNew(); airMopAdd(mop, nhist, (airMopper)nrrdNuke, airMopAlways); if (nrrdMaybeAlloc(nhist, nrrdTypeDouble, 2, rbins, hbins)) { airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways); fprintf(stderr, "%s: couldn't allocate histogram:\n%s", me, err); airMopError(mop); return 1; } if (!( AIR_EXISTS(vmin) && AIR_EXISTS(vmax) )) { range = nrrdRangeNewSet(nin, nrrdStateBlind8BitRange); airMopAdd(mop, range, (airMopper)nrrdRangeNix, airMopAlways); vmin = AIR_EXISTS(vmin) ? vmin : range->min; vmax = AIR_EXISTS(vmax) ? vmax : range->max; } #define DIST(x0, y0, x1, y1) (sqrt((x0-x1)*(x0-x1) + (y0-y1)*(y0-y1))) sx = nin->axis[0].size; sy = nin->axis[1].size; if (!AIR_EXISTS(rmax)) { rmax = 0; rmax = AIR_MAX(rmax, DIST(cent[0], cent[1], 0, 0)); rmax = AIR_MAX(rmax, DIST(cent[0], cent[1], sx-1, 0)); rmax = AIR_MAX(rmax, DIST(cent[0], cent[1], 0, sy-1)); rmax = AIR_MAX(rmax, DIST(cent[0], cent[1], sx-1, sy-1)); } lup = nrrdDLookup[nin->type]; hist = (double*)(nhist->data); for (xi=0; xi<sx; xi++) { for (yi=0; yi<sy; yi++) { rad = DIST(cent[0], cent[1], xi, yi); if (!AIR_IN_OP(0, rad, rmax)) continue; val = lup(nin->data, xi + sx*yi); if (!AIR_IN_OP(vmin, val, vmax)) continue; AIR_INDEX(0, rad, rmax, rbins, ridx); AIR_INDEX(vmin, val, vmax, hbins, hidx); hist[ridx + rbins*hidx] += 1; } } nhist->axis[0].min = 0; nhist->axis[0].max = rmax; nhist->axis[1].min = vmin; nhist->axis[1].max = vmax; if (nrrdSave(outS, nhist, NULL)) { airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways); fprintf(stderr, "%s: couldn't save output:\n%s", me, err); airMopError(mop); return 1; } airMopOkay(mop); exit(0); } |
|
From: Gordon K. <kin...@us...> - 2004-05-02 21:34:18
|
Update of /cvsroot/teem/teem/src/nrrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16020 Modified Files: GNUmakefile Log Message: tool for doing radial histograms, useful for finding circular or near-circular streaks in CT scans Index: GNUmakefile =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/GNUmakefile,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** GNUmakefile 7 Jan 2004 15:34:30 -0000 1.23 --- GNUmakefile 2 May 2004 21:34:08 -0000 1.24 *************** *** 63,67 **** $(L).TESTS = test/tread test/trand test/ax test/io test/minmax test/tkernel \ test/typestest test/tline test/genvol test/quadvol test/convo test/kv \ ! test/reuse #### --- 63,67 ---- $(L).TESTS = test/tread test/trand test/ax test/io test/minmax test/tkernel \ test/typestest test/tline test/genvol test/quadvol test/convo test/kv \ ! test/reuse test/histrad #### |
|
From: Gordon K. <kin...@us...> - 2004-04-22 11:17:13
|
Update of /cvsroot/teem/teem/src/ell In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23302 Modified Files: eigen.c Log Message: more information in comments Index: eigen.c =================================================================== RCS file: /cvsroot/teem/teem/src/ell/eigen.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** eigen.c 22 Apr 2004 10:13:51 -0000 1.22 --- eigen.c 22 Apr 2004 11:17:04 -0000 1.23 *************** *** 171,175 **** ** Doing the frobenius normalization proved successfull in avoiding the ** the creating of NaN eigenvalues when the coefficients of the matrix ! ** were really large (> 50000). */ int --- 171,181 ---- ** Doing the frobenius normalization proved successfull in avoiding the ** the creating of NaN eigenvalues when the coefficients of the matrix ! ** were really large (> 50000). Also, when the matrix norm was really ! ** small, the comparison to "epsilon" in ell_cubic mistook three seperate ! ** roots for a single and a double, with this matrix in particular: ! ** 1.7421892 0.0137642 0.0152975 ! ** 0.0137642 1.7565432 -0.0062296 ! ** 0.0152975 -0.0062296 1.7700019 ! ** (actually, this is prior to tenEigensolve's isotropic removal) */ int |
|
From: Milan I. <ik...@us...> - 2004-04-22 10:14:02
|
Update of /cvsroot/teem/teem/src/ell In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9481 Modified Files: eigen.c Log Message: added proper scaling by the inverse of the frobenius norm Index: eigen.c =================================================================== RCS file: /cvsroot/teem/teem/src/ell/eigen.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** eigen.c 4 Apr 2004 21:26:11 -0000 1.21 --- eigen.c 22 Apr 2004 10:13:51 -0000 1.22 *************** *** 179,183 **** frob = ELL_3M_FROB(_m); ! scale = frob > 10 ? 10.0/frob : 1.0; ELL_3M_SCALE(m, scale, _m); /* --- 179,183 ---- frob = ELL_3M_FROB(_m); ! scale = frob ? 1.0/frob : 1.0; ELL_3M_SCALE(m, scale, _m); /* |
|
From: Milan I. <ik...@us...> - 2004-04-22 10:12:54
|
Update of /cvsroot/teem/teem/src/air In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9137 Modified Files: miscAir.c Log Message: fixed cbrt problem on windows Index: miscAir.c =================================================================== RCS file: /cvsroot/teem/teem/src/air/miscAir.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** miscAir.c 28 Feb 2004 15:08:23 -0000 1.23 --- miscAir.c 22 Apr 2004 10:12:45 -0000 1.24 *************** *** 440,444 **** airCbrt(double v) { #ifdef _WIN32 ! return pow(v,1.0/3.0); #else return cbrt(v); --- 440,446 ---- airCbrt(double v) { #ifdef _WIN32 ! /* msvc does not know how to take powers of small negative numbers, ! * so we have to tell it to do it right */ ! return (v < 0.0 ? -pow(-v,1.0/3.0) : pow(v,1.0/3.0)); #else return cbrt(v); |
|
From: Gordon K. <kin...@us...> - 2004-04-22 08:10:51
|
Update of /cvsroot/teem/teem/src/ten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12978 Modified Files: aniso.c tendPoint.c Log Message: better error message for failure in tendAnisoVolume Index: tendPoint.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/tendPoint.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tendPoint.c 30 Mar 2004 03:32:30 -0000 1.9 --- tendPoint.c 22 Apr 2004 07:46:52 -0000 1.10 *************** *** 33,37 **** airArray *mop; ! int loc[3], sx, sy, sz, i; Nrrd *nin; float *tdata, eval[3], evec[9], c[TEN_ANISO_MAX+1], --- 33,37 ---- airArray *mop; ! int loc[3], idx, sx, sy, sz, i; Nrrd *nin; float *tdata, eval[3], evec[9], c[TEN_ANISO_MAX+1], *************** *** 67,72 **** } ! tdata = (float*)(nin->data) + 7*(loc[0] + sx*(loc[1] + sy*loc[2])); ! fprintf(stderr, "location = (%d,%d,%d)\n", loc[0], loc[1], loc[2]); fprintf(stderr, "confidence = %g\n", tdata[0]); fprintf(stderr, "tensor =\n"); --- 67,73 ---- } ! idx = loc[0] + sx*(loc[1] + sy*loc[2]); ! tdata = (float*)(nin->data) + 7*idx; ! fprintf(stderr, "location = (%d,%d,%d) = %d\n", loc[0], loc[1], loc[2], idx); fprintf(stderr, "confidence = %g\n", tdata[0]); fprintf(stderr, "tensor =\n"); Index: aniso.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/aniso.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** aniso.c 22 Apr 2004 07:13:01 -0000 1.30 --- aniso.c 22 Apr 2004 07:46:52 -0000 1.31 *************** *** 172,178 **** tenAnisoVolume(Nrrd *nout, Nrrd *nin, int aniso, float thresh) { char me[]="tenAnisoVolume", err[AIR_STRLEN_MED]; ! size_t N, I; float *out, *in, *tensor, eval[3], evec[9], c[TEN_ANISO_MAX+1]; ! int sx, sy, sz, map[NRRD_DIM_MAX]; if (tenTensorCheck(nin, nrrdTypeFloat, AIR_TRUE, AIR_TRUE)) { --- 172,178 ---- tenAnisoVolume(Nrrd *nout, Nrrd *nin, int aniso, float thresh) { char me[]="tenAnisoVolume", err[AIR_STRLEN_MED]; ! size_t N, I, _I; float *out, *in, *tensor, eval[3], evec[9], c[TEN_ANISO_MAX+1]; ! int sx, sy, sz, size[3], coord[3], map[NRRD_DIM_MAX]; if (tenTensorCheck(nin, nrrdTypeFloat, AIR_TRUE, AIR_TRUE)) { *************** *** 186,192 **** thresh = AIR_CLAMP(0.0, thresh, 1.0); ! sx = nin->axis[1].size; ! sy = nin->axis[2].size; ! sz = nin->axis[3].size; N = sx*sy*sz; if (nrrdMaybeAlloc(nout, nrrdTypeFloat, 3, sx, sy, sz)) { --- 186,192 ---- thresh = AIR_CLAMP(0.0, thresh, 1.0); ! size[0] = sx = nin->axis[1].size; ! size[1] = sy = nin->axis[2].size; ! size[2] = sz = nin->axis[3].size; N = sx*sy*sz; if (nrrdMaybeAlloc(nout, nrrdTypeFloat, 3, sx, sy, sz)) { *************** *** 205,210 **** tenEigensolve(eval, evec, tensor); if (!(AIR_EXISTS(eval[0]) && AIR_EXISTS(eval[1]) && AIR_EXISTS(eval[2]))) { ! sprintf(err, "%s: not all eigenvalues exist (%g,%g,%g) at sample %d", ! me, eval[0], eval[1], eval[2], (int)I); biffAdd(TEN, err); return 1; } --- 205,214 ---- tenEigensolve(eval, evec, tensor); if (!(AIR_EXISTS(eval[0]) && AIR_EXISTS(eval[1]) && AIR_EXISTS(eval[2]))) { ! _I = I; ! NRRD_COORD_GEN(coord, size, 3, _I); ! sprintf(err, "%s: not all eigenvalues exist (%g,%g,%g) at sample " ! "%d = (%d,%d,%d)", ! me, eval[0], eval[1], eval[2], (int)I, ! coord[0], coord[1], coord[2]); biffAdd(TEN, err); return 1; } |