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]; |
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, "-", |
134 |
nio = nrrdIoStateNew(); |
nio = nrrdIoStateNew(); |
135 |
airMopAdd(mop, nio, (airMopper)nrrdIoStateNix, airMopAlways); |
airMopAdd(mop, nio, (airMopper)nrrdIoStateNix, airMopAlways); |
136 |
nio->skipFormatURL = AIR_TRUE; |
nio->skipFormatURL = AIR_TRUE; |
137 |
|
if (headerOnly) { |
138 |
|
nio->skipData = AIR_TRUE; |
139 |
|
} |
140 |
nrrdCommentClear(nout); |
nrrdCommentClear(nout); |
141 |
|
|
142 |
/* no measurement frame */ |
/* no measurement frame */ |
206 |
for (axi=0; axi<nout->dim; axi++) { |
for (axi=0; axi<nout->dim; axi++) { |
207 |
if (nrrdKindUnknown == kindOut || kindAxis != axi) { |
if (nrrdKindUnknown == kindOut || kindAxis != axi) { |
208 |
nrrdSpaceVecSetZero(nout->axis[axi].spaceDirection); |
nrrdSpaceVecSetZero(nout->axis[axi].spaceDirection); |
209 |
nout->axis[axi].spaceDirection[saxi] = 1.0; |
nout->axis[axi].spaceDirection[saxi] |
210 |
|
= (AIR_EXISTS(nin->axis[axi].spacing) |
211 |
|
? nin->axis[axi].spacing |
212 |
|
: 1.0); |
213 |
saxi++; |
saxi++; |
214 |
} else { |
} else { |
215 |
nrrdSpaceVecSetNaN(nout->axis[axi].spaceDirection); |
nrrdSpaceVecSetNaN(nout->axis[axi].spaceDirection); |