Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /trunk/src/lib/common/image.c
ViewVC logotype

Diff of /trunk/src/lib/common/image.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1639, Wed Nov 16 01:48:07 2011 UTC revision 1640, Wed Nov 16 02:19:51 2011 UTC
# Line 13  Line 13 
13  #include "Diderot/diderot.h"  #include "Diderot/diderot.h"
14  #include <teem/nrrd.h>  #include <teem/nrrd.h>
15    
 /* FIXME: eventally we should change the naming conventions in the header files to be generic */  
 #if defined(DIDEROT_SINGLE_PRECISION)  
 #define vec2(a,b)               vec2f(a,b)  
 #define vec3(a,b,c)             vec3f(a,b,c)  
 #define mulMat2x2Vec2(m,v)      mulMat2x2Vec2f(m,v)  
 #define mulMat3x3Vec3(m,v)      mulMat3x3Vec3f(m,v)  
 #else  
 #define vec2(a,b)               vec2d(a,b)  
 #define vec3(a,b,c)             vec3d(a,b,c)  
 #define mulMat2x2Vec2(m,v)      mulMat2x2Vec2d(m,v)  
 #define mulMat3x3Vec3(m,v)      mulMat3x3Vec3d(m,v)  
 #endif  
   
16  // we use double precision representations of the transforms here to  // we use double precision representations of the transforms here to
17  // improve robustness, even when the results are stored as single-precision  // improve robustness, even when the results are stored as single-precision
18  typedef double Matrix2x2_t[4];  typedef double Matrix2x2_t[4];
# Line 349  Line 336 
336      img->dim = 1;      img->dim = 1;
337      img->size[0] = nin->axis[base+0].size;      img->size[0] = nin->axis[base+0].size;
338      img->data = nin->data;      img->data = nin->data;
339        img->dataSzb =  nrrdElementSize(nin) * nrrdElementNumber(nin);
340    
341  //printf("LoadImage \"%s\": space dim = 1, axes = <%d>\n",  //printf("LoadImage \"%s\": space dim = 1, axes = <%d>\n",
342  //name, img->size[base+0]);  //name, img->size[base+0]);
# Line 391  Line 379 
379      img->size[0] = nin->axis[base+0].size;      img->size[0] = nin->axis[base+0].size;
380      img->size[1] = nin->axis[base+1].size;      img->size[1] = nin->axis[base+1].size;
381      img->data = nin->data;      img->data = nin->data;
382        img->dataSzb =  nrrdElementSize(nin) * nrrdElementNumber(nin);
383    
384  //printf("LoadImage \"%s\": space dim = 2, axes = <%d, %d>\n",  //printf("LoadImage \"%s\": space dim = 2, axes = <%d, %d>\n",
385  //name, img->size[0], img->size[1]);  //name, img->size[0], img->size[1]);
# Line 414  Line 403 
403              img->w2i[i].r[j] = mInv[2*i+j];              img->w2i[i].r[j] = mInv[2*i+j];
404          }          }
405      }      }
406      transpose2x2f (img->w2iT, img->w2i);      transpose2x2 (img->w2iT, img->w2i);
407      Diderot_vec2_t tVec = vec2(t[0], t[1]);      Diderot_vec2_t tVec = vec2(t[0], t[1]);
408      img->tVec = -mulMat2x2Vec2(img->w2i, tVec);  // inv([M t]) = [inv(M) -inv(M)t]      img->tVec = -mulMat2x2Vec2(img->w2i, tVec);  // inv([M t]) = [inv(M) -inv(M)t]
409  //printf("tVec = <%f, %f>\n", ((union2f_t)img->tVec).r[0], ((union2f_t)img->tVec).r[1]);  //printf("tVec = <%f, %f>\n", ((union2f_t)img->tVec).r[0], ((union2f_t)img->tVec).r[1]);
# Line 453  Line 442 
442      img->size[1] = nin->axis[base+1].size;      img->size[1] = nin->axis[base+1].size;
443      img->size[2] = nin->axis[base+2].size;      img->size[2] = nin->axis[base+2].size;
444      img->data = nin->data;      img->data = nin->data;
445        img->dataSzb =  nrrdElementSize(nin) * nrrdElementNumber(nin);
446    
447  //printf("LoadImage \"%s\": space dim = 3, axes = <%d, %d, %d>\n",  //printf("LoadImage \"%s\": space dim = 3, axes = <%d, %d, %d>\n",
448  //name, img->size[0], img->size[1], img->size[2]);  //name, img->size[0], img->size[1], img->size[2]);
# Line 476  Line 466 
466              img->w2i[i].r[j] = mInv[3*i+j];              img->w2i[i].r[j] = mInv[3*i+j];
467          }          }
468      }      }
469      transpose3x3f (img->w2iT, img->w2i);      transpose3x3 (img->w2iT, img->w2i);
470      Diderot_vec3_t tVec = vec3(t[0], t[1], t[2]);      Diderot_vec3_t tVec = vec3(t[0], t[1], t[2]);
471      img->tVec = -mulMat3x3Vec3(img->w2i, tVec);  // inv([M t]) = [inv(M) -inv(M)t]      img->tVec = -mulMat3x3Vec3(img->w2i, tVec);  // inv([M t]) = [inv(M) -inv(M)t]
472  //printf("tVec = <%f, %f, %f>\n", ((Diderot_union3_t)img->tVec).r[0], ((Diderot_union3_t)img->tVec).r[1], ((Diderot_union3_t)img->tVec).r[2]);  //printf("tVec = <%f, %f, %f>\n", ((Diderot_union3_t)img->tVec).r[0], ((Diderot_union3_t)img->tVec).r[1], ((Diderot_union3_t)img->tVec).r[2]);

Legend:
Removed from v.1639  
changed lines
  Added in v.1640

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0