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

SCM Repository

[diderot] Diff of /branches/lamont/src/dnorm/dnorm.c
ViewVC logotype

Diff of /branches/lamont/src/dnorm/dnorm.c

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

revision 147, Fri Jul 9 08:17:48 2010 UTC revision 1116, Thu May 5 04:49:02 2011 UTC
# Line 42  Line 42 
42    char *err;    char *err;
43    Nrrd *nin, *nout;    Nrrd *nin, *nout;
44    NrrdIoState *nio;    NrrdIoState *nio;
45    int kindIn, kindOut, headerOnly;    int kindIn, kindOut, headerOnly, haveMM;
46    unsigned int kindAxis, axi, si, sj;    unsigned int kindAxis, axi, si, sj;
47    
48    me = argv[0];    me = argv[0];
# Line 71  Line 71 
71    
72    /* make sure all kinds are set to something */    /* make sure all kinds are set to something */
73    /* see if there's a range kind, verify that there's only one */    /* see if there's a range kind, verify that there's only one */
74      /* set haveMM */
75      haveMM = AIR_TRUE;
76    kindIn = nrrdKindUnknown;    kindIn = nrrdKindUnknown;
77    kindAxis = 0;    kindAxis = 0;
78    for (axi=0; axi<nin->dim; axi++) {    for (axi=0; axi<nin->dim; axi++) {
79      if (nrrdKindUnknown == nin->axis[axi].kind      if (nrrdKindUnknown == nin->axis[axi].kind
80          || nrrdKindIsDomain(nin->axis[axi].kind)) {          || nrrdKindIsDomain(nin->axis[axi].kind)) {
81        continue;        haveMM &= AIR_EXISTS(nin->axis[axi].min);
82      }        haveMM &= AIR_EXISTS(nin->axis[axi].max);
83        } else {
84      if (nrrdKindUnknown != kindIn) {      if (nrrdKindUnknown != kindIn) {
85        fprintf(stderr, "%s: got non-domain kind %s on axis %u, but already "        fprintf(stderr, "%s: got non-domain kind %s on axis %u, but already "
86                "have %s from axis %u\n", me,                "have %s from axis %u\n", me,
# Line 88  Line 91 
91      kindIn = nin->axis[axi].kind;      kindIn = nin->axis[axi].kind;
92      kindAxis = axi;      kindAxis = axi;
93    }    }
94      }
95    /* see if the non-domain kind is something we can interpret as a tensor */    /* see if the non-domain kind is something we can interpret as a tensor */
96    if (nrrdKindUnknown != kindIn) {    if (nrrdKindUnknown != kindIn) {
97      switch (kindIn) {      switch (kindIn) {
# Line 201  Line 205 
205          nrrdSpaceVecSetNaN(nout->axis[axi].spaceDirection);          nrrdSpaceVecSetNaN(nout->axis[axi].spaceDirection);
206        }        }
207      }      }
208      } else if (haveMM) {
209        int saxi = 0;
210        for (axi=0; axi<nout->dim; axi++) {
211          if (nrrdKindUnknown == kindOut || kindAxis != axi) {
212            nrrdSpaceVecSetZero(nout->axis[axi].spaceDirection);
213            nout->axis[axi].spaceDirection[saxi]
214              = (nin->axis[axi].max - nin->axis[axi].min)/(nin->axis[axi].size-1);
215            nout->spaceOrigin[saxi] = nin->axis[axi].min;
216            saxi++;
217          } else {
218            nrrdSpaceVecSetNaN(nout->axis[axi].spaceDirection);
219          }
220        }
221        nout->spaceDim = saxi;
222    } else {    } else {
223      int saxi = 0;      int saxi = 0;
224      nrrdSpaceVecSetZero(nout->spaceOrigin);      nrrdSpaceVecSetZero(nout->spaceOrigin);
# Line 218  Line 236 
236      }      }
237      nout->spaceDim = saxi;      nout->spaceDim = saxi;
238    }    }
239    /* probably should be asserted earlier */  
240      /* space dimension has to match the number of domain axes */
241    if (nout->dim != nout->spaceDim + !!kindOut) {    if (nout->dim != nout->spaceDim + !!kindOut) {
242      fprintf(stderr, "%s: output dim %d != spaceDim %d + %d %s%s%s\n",      fprintf(stderr, "%s: output dim %d != spaceDim %d + %d %s%s%s\n",
243              me, nout->dim, nout->spaceDim, !!kindOut,              me, nout->dim, nout->spaceDim, !!kindOut,

Legend:
Removed from v.147  
changed lines
  Added in v.1116

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