|
From: <kin...@us...> - 2003-11-17 15:15:47
|
Update of /cvsroot/teem/teem/src/ten
In directory sc8-pr-cvs1:/tmp/cvs-serv25865
Modified Files:
glyph.c tendGlyph.c
Log Message:
added capability to draw glyphs at arbitrary locations
Index: glyph.c
===================================================================
RCS file: /cvsroot/teem/teem/src/ten/glyph.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** glyph.c 17 Nov 2003 07:10:43 -0000 1.27
--- glyph.c 17 Nov 2003 15:15:06 -0000 1.28
***************
*** 142,150 ****
gageShape *shape;
airArray *mop;
! double I[3], W[3];
float cl, cp, *tdata, evec[9], eval[3], *cvec,
aniso[TEN_ANISO_MAX+1], sRot[16], mA[16], mB[16],
R, G, B, qA, qB, glyphAniso, sliceAniso;
! int idx, ri, axis, si=0, numGlyphs;
limnPart *lglyph;
limnSP *sp;
--- 142,150 ----
gageShape *shape;
airArray *mop;
! double pI[3], pW[3];
float cl, cp, *tdata, evec[9], eval[3], *cvec,
aniso[TEN_ANISO_MAX+1], sRot[16], mA[16], mB[16],
R, G, B, qA, qB, glyphAniso, sliceAniso;
! int idx, _idx=0, ri, axis, si=0, numGlyphs;
limnPart *lglyph;
limnSP *sp;
***************
*** 169,173 ****
biffAdd(TEN, err); airMopError(mop); return 1;
}
! if (!( 2 == npos->dim && 3 == nten->axis[0].size
&& nten->axis[1].size == npos->axis[1].size )) {
sprintf(err, "%s: npos isn't 2-D 3-by-%d array", me, nten->axis[1].size);
--- 169,173 ----
biffAdd(TEN, err); airMopError(mop); return 1;
}
! if (!( 2 == npos->dim && 3 == npos->axis[0].size
&& nten->axis[1].size == npos->axis[1].size )) {
sprintf(err, "%s: npos isn't 2-D 3-by-%d array", me, nten->axis[1].size);
***************
*** 239,251 ****
numGlyphs = shape->size[0] * shape->size[1] * shape->size[2];
}
! for (idx=0; idx<numGlyphs; idx++) {
! fprintf(stderr, "!%s: idx = %d/%d\n", me, idx, numGlyphs);
tdata = (float*)(nten->data) + 7*idx;
if (npos) {
! ELL_3V_COPY(W, (float*)(npos->data) + 3*idx);
} else {
! NRRD_COORD_GEN(I, shape->size, 3, idx);
! fprintf(stderr, "!%s --> I = (%g,%g,%g)\n", me, I[0], I[1], I[2]);
! gageShapeUnitItoW(shape, W, I);
if (parm->nmask) {
if (!( nrrdFLookup[parm->nmask->type](parm->nmask->data, idx)
--- 239,249 ----
numGlyphs = shape->size[0] * shape->size[1] * shape->size[2];
}
! for (idx=0; idx<numGlyphs; idx++, _idx = idx) {
tdata = (float*)(nten->data) + 7*idx;
if (npos) {
! ELL_3V_COPY(pW, (float*)(npos->data) + 3*idx);
} else {
! NRRD_COORD_GEN(pI, shape->size, 3, _idx);
! gageShapeUnitItoW(shape, pW, pI);
if (parm->nmask) {
if (!( nrrdFLookup[parm->nmask->type](parm->nmask->data, idx)
***************
*** 265,269 ****
tenAnisoCalc(aniso, eval);
if (parm->doSlice
! && I[parm->sliceAxis] == parm->slicePos) {
sliceAniso = aniso[parm->sliceAnisoType];
/* HEY: look, a visualization parameter (0.03) that is not
--- 263,267 ----
tenAnisoCalc(aniso, eval);
if (parm->doSlice
! && pI[parm->sliceAxis] == parm->slicePos) {
sliceAniso = aniso[parm->sliceAnisoType];
/* HEY: look, a visualization parameter (0.03) that is not
***************
*** 279,288 ****
ELL_4M_IDENTITY_SET(mA);
ell_4m_post_mul_f(mA, sRot);
! ELL_4M_SCALE_SET(mB,
! shape->voxLen[0],
! shape->voxLen[1],
! shape->voxLen[2]);
ell_4m_post_mul_f(mA, mB);
! ELL_4M_TRANSLATE_SET(mB, W[0], W[1], W[2]);
ell_4m_post_mul_f(mA, mB);
ELL_4M_TRANSLATE_SET(mB,
--- 277,288 ----
ELL_4M_IDENTITY_SET(mA);
ell_4m_post_mul_f(mA, sRot);
! if (!npos) {
! ELL_4M_SCALE_SET(mB,
! shape->voxLen[0],
! shape->voxLen[1],
! shape->voxLen[2]);
! }
ell_4m_post_mul_f(mA, mB);
! ELL_4M_TRANSLATE_SET(mB, pW[0], pW[1], pW[2]);
ell_4m_post_mul_f(mA, mB);
ELL_4M_TRANSLATE_SET(mB,
***************
*** 297,301 ****
if (glyphsEcho) {
esquare = echoObjectNew(glyphsEcho,echoTypeRectangle);
! ELL_3V_ADD2(((echoRectangle*)esquare)->origin, W, originOffset);
ELL_3V_COPY(((echoRectangle*)esquare)->edge0, edge0);
ELL_3V_COPY(((echoRectangle*)esquare)->edge1, edge1);
--- 297,301 ----
if (glyphsEcho) {
esquare = echoObjectNew(glyphsEcho,echoTypeRectangle);
! ELL_3V_ADD2(((echoRectangle*)esquare)->origin, pW, originOffset);
ELL_3V_COPY(((echoRectangle*)esquare)->edge0, edge0);
ELL_3V_COPY(((echoRectangle*)esquare)->edge1, edge1);
***************
*** 325,329 ****
ELL_43M_INSET(mB, evec); /* rotate by evecs */
ell_4m_post_mul_f(mA, mB);
! ELL_4M_TRANSLATE_SET(mB, W[0], W[1], W[2]); /* translate */
ell_4m_post_mul_f(mA, mB);
--- 325,329 ----
ELL_43M_INSET(mB, evec); /* rotate by evecs */
ell_4m_post_mul_f(mA, mB);
! ELL_4M_TRANSLATE_SET(mB, pW[0], pW[1], pW[2]); /* translate */
ell_4m_post_mul_f(mA, mB);
Index: tendGlyph.c
===================================================================
RCS file: /cvsroot/teem/teem/src/ten/tendGlyph.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** tendGlyph.c 17 Nov 2003 07:10:43 -0000 1.17
--- tendGlyph.c 17 Nov 2003 15:15:06 -0000 1.18
***************
*** 42,46 ****
airArray *mop;
! Nrrd *nten, *emap, *nraw;
char *outS;
limnCamera *cam;
--- 42,46 ----
airArray *mop;
! Nrrd *nten, *emap, *nraw, *npos;
char *outS;
limnCamera *cam;
***************
*** 90,93 ****
--- 90,98 ----
"Glyphs will be drawn only for tensors with anisotropy "
"greater than this threshold");
+ hestOptAdd(&hopt, "p", "pos array", airTypeOther, 1, 1, &npos, "",
+ "Instead of being on a grid, tensors are at arbitrary locations, "
+ "as defined by this 3-by-N array of floats. Doing this makes "
+ "various other options moot. ", NULL, NULL,
+ nrrdHestNrrd);
hestOptAdd(&hopt, "m", "mask vol", airTypeOther, 1, 1, &(gparm->nmask), "",
"Scalar volume (if any) for masking region in which glyphs are "
***************
*** 213,219 ****
}
if (tenGlyphGen(doRT ? NULL : glyph,
doRT ? scene : NULL,
! nten, NULL, gparm)) {
airMopAdd(mop, err = biffGetDone(TEN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble generating glyphs:\n%s\n", me, err);
--- 218,228 ----
}
+ if (npos) {
+ fprintf(stderr, "%s: hack: turning off onlyPositive\n", me);
+ gparm->onlyPositive = AIR_FALSE;
+ }
if (tenGlyphGen(doRT ? NULL : glyph,
doRT ? scene : NULL,
! nten, npos, gparm)) {
airMopAdd(mop, err = biffGetDone(TEN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble generating glyphs:\n%s\n", me, err);
|