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

SCM Repository

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

Diff of /trunk/src/dnorm/dnorm.c

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

revision 114, Wed Jun 23 19:39:36 2010 UTC revision 147, Fri Jul 9 08:17:48 2010 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;    int kindIn, kindOut, headerOnly;
46    unsigned int kindAxis, axi, si, sj;    unsigned int kindAxis, axi, si, sj;
47    
48    me = argv[0];    me = argv[0];
# Line 50  Line 50 
50    hparm = hestParmNew();    hparm = hestParmNew();
51    hopt = NULL;    hopt = NULL;
52    airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways);    airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways);
53      hestOptAdd(&hopt, "h,header", NULL, airTypeInt, 0, 0, &headerOnly, NULL,
54                 "output header of nrrd file only, not the data itself");
55    hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, NULL,    hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, NULL,
56               "input image", NULL, NULL, nrrdHestNrrd);               "input image", NULL, NULL, nrrdHestNrrd);
57    hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",    hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
# Line 118  Line 120 
120      kindOut = nrrdKindUnknown;      kindOut = nrrdKindUnknown;
121    }    }
122    
123    /* prepare output (this may eventually be cropping or something else) */    /* initialize output by copying */
124    nout = nrrdNew();    nout = nrrdNew();
125    airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopAlways);    airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopAlways);
126    if (nrrdCopy(nout, nin)) {    if (nrrdCopy(nout, nin)) {
127      airMopAdd(mop, err = biffGet(NRRD), airFree, airMopAlways);      airMopAdd(mop, err = biffGet(NRRD), airFree, airMopAlways);
128      fprintf(stderr, "%s: trouble copying:\n%s", me, err);      fprintf(stderr, "%s: trouble copying:\n%s", me, err);
129      airMopError(mop); exit(1);      airMopError(mop); exit(1);
   
130    }    }
131    
132    /* no comments, either advertising the format URL or anything else */    /* no comments, either advertising the format URL or anything else */
133    nio = nrrdIoStateNew();    nio = nrrdIoStateNew();
134    airMopAdd(mop, nio, (airMopper)nrrdIoStateNix, airMopAlways);    airMopAdd(mop, nio, (airMopper)nrrdIoStateNix, airMopAlways);
135    nio->skipFormatURL = AIR_TRUE;    nio->skipFormatURL = AIR_TRUE;
136      if (headerOnly) {
137        nio->skipData = AIR_TRUE;
138      }
139    nrrdCommentClear(nout);    nrrdCommentClear(nout);
140    
141    /* no measurement frame */    /* no measurement frame */
# Line 180  Line 184 
184    */    */
185    if (nout->spaceDim) {    if (nout->spaceDim) {
186      int saxi = 0;      int saxi = 0;
187        /* we use only the space dimension, not any named space */
188        nout->space = nrrdSpaceUnknown;
189      if (!nrrdSpaceVecExists(nout->spaceDim, nout->spaceOrigin)) {      if (!nrrdSpaceVecExists(nout->spaceDim, nout->spaceOrigin)) {
190        nrrdSpaceVecSetZero(nout->spaceOrigin);        nrrdSpaceVecSetZero(nout->spaceOrigin);
191      }      }
# Line 201  Line 207 
207      for (axi=0; axi<nout->dim; axi++) {      for (axi=0; axi<nout->dim; axi++) {
208        if (nrrdKindUnknown == kindOut || kindAxis != axi) {        if (nrrdKindUnknown == kindOut || kindAxis != axi) {
209          nrrdSpaceVecSetZero(nout->axis[axi].spaceDirection);          nrrdSpaceVecSetZero(nout->axis[axi].spaceDirection);
210          nout->axis[axi].spaceDirection[saxi] = 1.0;          nout->axis[axi].spaceDirection[saxi]
211              = (AIR_EXISTS(nin->axis[axi].spacing)
212                 ? nin->axis[axi].spacing
213                 : 1.0);
214          saxi++;          saxi++;
215        } else {        } else {
216          nrrdSpaceVecSetNaN(nout->axis[axi].spaceDirection);          nrrdSpaceVecSetNaN(nout->axis[axi].spaceDirection);

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

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