int _nrrdReadNrrdParse_units (FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { char me[]="_nrrdReadNrrdParse_units", err[BIFF_STRLEN]; char *h; /* this is the "here" pointer which gradually progresses through all the units (for all axes) */ unsigned int ai; char *info; AIR_UNUSED(file); /* because we have to correctly interpret quote marks, we can't simply rely on airParseStrS */ info = nio->line + nio->pos; /* printf("!%s: info |%s|\n", me, info); */ _CHECK_HAVE_DIM; h = info; for (ai=0; ai<nrrd->dim; ai++) { if (!( nrrd->axis[ai].units = _nrrdGetQuotedString(&h, useBiff) )) { sprintf(err, "%s: couldn't get get unit %d of %d\n", me, ai+1, nrrd->dim); biffMaybeAdd(NRRD, err, useBiff); return 1; } } if (strlen(h) != strspn(h, _nrrdFieldSep)) { sprintf(err, "%s: seem to have more than expected %d units", me, nrrd->dim); biffMaybeAdd(NRRD, err, useBiff); return 1; } if (_nrrdFieldCheck[nrrdField_units](nrrd, useBiff)) { sprintf(err, "%s: trouble", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
/* ******** nrrdSameSize() ** ** returns 1 iff given two nrrds have same dimension and axes sizes. ** This does NOT look at the type of the elements. ** ** The intended user of this is someone who really wants the nrrds to be ** the same size, so that if they aren't, some descriptive (error) message ** can be generated according to useBiff */ int nrrdSameSize (const Nrrd *n1, const Nrrd *n2, int useBiff) { char me[]="nrrdSameSize", err[BIFF_STRLEN]; unsigned int ai; if (!(n1 && n2)) { sprintf(err, "%s: got NULL pointer", me); biffMaybeAdd(NRRD, err, useBiff); return 0; } if (n1->dim != n2->dim) { sprintf(err, "%s: n1->dim (%d) != n2->dim (%d)", me, n1->dim, n2->dim); biffMaybeAdd(NRRD, err, useBiff); return 0; } for (ai=0; ai<n1->dim; ai++) { if (n1->axis[ai].size != n2->axis[ai].size) { sprintf(err, "%s: n1->axis[%d].size (" _AIR_SIZE_T_CNV ") != n2->axis[%d].size (" _AIR_SIZE_T_CNV ")", me, ai, n1->axis[ai].size, ai, n2->axis[ai].size); biffMaybeAdd(NRRD, err, useBiff); return 0; } } return 1; }
int _nrrdSizeCheck(const size_t *size, unsigned int dim, int useBiff) { char me[]="_nrrdSizeCheck", err[BIFF_STRLEN]; size_t num, pre; unsigned int ai; pre = num = 1; for (ai=0; ai<dim; ai++) { if (!size[ai]) { sprintf(err, "%s: axis %u size is zero!", me, ai); biffMaybeAdd(NRRD, err, useBiff); return 1; } num *= size[ai]; if (num/size[ai] != pre) { sprintf(err, "%s: total # of elements too large to be represented in " "type size_t, so too large for current architecture", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } pre *= size[ai]; } return 0; }
int _nrrdReadNrrdParse_space (FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { char me[]="_nrrdReadNrrdParse_space", err[BIFF_STRLEN], *info; int space; AIR_UNUSED(file); info = nio->line + nio->pos; if (nio->seen[nrrdField_space_dimension]) { sprintf(err, "%s: can't specify space after specifying " "space dimension (%d)", me, nrrd->spaceDim); biffAdd(NRRD, err); return 1; } if (!(space = airEnumVal(nrrdSpace, info))) { sprintf(err, "%s: couldn't parse space \"%s\"", me, info); biffMaybeAdd(NRRD, err, useBiff); return 1; } if (nrrdSpaceSet(nrrd, space)) { sprintf(err, "%s: trouble", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } if (_nrrdFieldCheck[nrrdField_space](nrrd, useBiff)) { sprintf(err, "%s: trouble", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdCheck(const Nrrd *nrrd, int checkData, int useBiff) { char me[]="_nrrdCheck", err[BIFF_STRLEN]; int fi; if (!nrrd) { sprintf(err, "%s: got NULL pointer", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } if (checkData) { if (!(nrrd->data)) { sprintf(err, "%s: nrrd has NULL data pointer", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } } for (fi=nrrdField_unknown+1; fi<nrrdField_last; fi++) { /* yes, this will call _nrrdFieldCheckSpaceInfo() many many times */ if (_nrrdFieldCheck[fi](nrrd, AIR_TRUE)) { sprintf(err, "%s: trouble with %s field", me, airEnumStr(nrrdField, fi)); biffMaybeAdd(NRRD, err, useBiff); return 1; } } return 0; }
int _nrrdReadNrrdParse_space_directions (FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { char me[]="_nrrdReadNrrdParse_space_directions", err[BIFF_STRLEN]; unsigned int dd; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; _CHECK_HAVE_DIM; _CHECK_HAVE_SPACE_DIM; for (dd=0; dd<nrrd->dim; dd++) { if (_nrrdSpaceVectorParse(nrrd->axis[dd].spaceDirection, &info, nrrd->spaceDim, useBiff)) { sprintf(err, "%s: trouble getting space vector %d of %d", me, dd+1, nrrd->dim); biffMaybeAdd(NRRD, err, useBiff); return 1; } } if (strlen(info) != strspn(info, _nrrdFieldSep)) { sprintf(err, "%s: seem to have more than expected %d directions", me, nrrd->dim); biffMaybeAdd(NRRD, err, useBiff); return 1; } if (_nrrdFieldCheck[nrrdField_space_directions](nrrd, useBiff)) { sprintf(err, "%s: trouble", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdReadNrrdParse_axis_maxs (FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { char me[]="_nrrdReadNrrdParse_axis_maxs", err[BIFF_STRLEN]; unsigned int ret; double val[NRRD_DIM_MAX]; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; _CHECK_HAVE_DIM; ret = airParseStrD(val, info, _nrrdFieldSep, nrrd->dim); _CHECK_GOT_ALL_VALUES; nrrdAxisInfoSet_nva(nrrd, nrrdAxisInfoMax, val); /* HEY: this is a very imperfect check of excess info */ if (nrrd->dim+1 == airParseStrD(val, info, _nrrdFieldSep, nrrd->dim+1)) { sprintf(err, "%s: seem to have more than expected %d axis maxs", me, nrrd->dim); biffMaybeAdd(NRRD, err, useBiff); return 1; } if (_nrrdFieldCheck[nrrdField_axis_maxs](nrrd, useBiff)) { sprintf(err, "%s: trouble", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdReadNrrdParse_sizes (FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { char me[]="_nrrdReadNrrdParse_sizes", err[BIFF_STRLEN]; unsigned int ret; size_t val[NRRD_DIM_MAX]; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; _CHECK_HAVE_DIM; // MOD-BY-LEETEN 04/21/2012-FROM: ret = airParseStrZ(val, info, _nrrdFieldSep, nrrd->dim); { unsigned int *puTemp = malloc(sizeof(puTemp[0]) * nrrd->dim); size_t d; ret = airParseStrUI(puTemp, info, _nrrdFieldSep, nrrd->dim); for(d = 0; d < nrrd->dim; d++) val[d] = puTemp[d]; free(puTemp); } // MOD-BY-LEETEN 04/21/2012-END _CHECK_GOT_ALL_VALUES; nrrdAxisInfoSet_nva(nrrd, nrrdAxisInfoSize, val); /* HEY: this is a very imperfect check of excess info */ if (nrrd->dim+1 == airParseStrZ(val, info, _nrrdFieldSep, nrrd->dim+1)) { sprintf(err, "%s: seem to have more than expected %d sizes", me, nrrd->dim); biffMaybeAdd(NRRD, err, useBiff); return 1; } if (_nrrdFieldCheck[nrrdField_sizes](nrrd, useBiff)) { sprintf(err, "%s: trouble", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdReadNrrdParse_keyvalue (FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { char me[]="_nrrdReadNrrdParse_keyvalue", err[BIFF_STRLEN]; char *keysep, *line, *key, *value; AIR_UNUSED(file); /* we know this will find something */ line = airStrdup(nio->line); if (!line) { sprintf(err, "%s: can't allocate parse line", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } keysep = strstr(line, ":="); if (!keysep) { sprintf(err, "%s: didn't see \":=\" key/value delimiter in \"%s\"", me, line); free(line); biffMaybeAdd(NRRD, err, useBiff); return 1; } keysep[0] = 0; keysep[1] = 0; key = line; value = keysep+2; /* convert escape sequences */ airUnescape(key); airUnescape(value); nrrdKeyValueAdd(nrrd, key, value); free(line); return 0; }
char * _nrrdGetQuotedString(char **hP, int useBiff) { char me[]="_nrrdGetQuotedString", err[BIFF_STRLEN], *h, *buff, *ret; airArray *buffArr; int pos; _chpu uu; h = *hP; /* skip past space */ /* printf("!%s: h |%s|\n", me, h);*/ h += strspn(h, _nrrdFieldSep); /* printf("!%s: h |%s|\n", me, h);*/ /* make sure we have something */ if (!*h) { sprintf(err, "%s: hit end of string before seeing opening \"", me); biffMaybeAdd(NRRD, err, useBiff); return NULL; } /* make sure we have a starting quote */ if ('"' != *h) { sprintf(err, "%s: didn't start with \"", me); biffMaybeAdd(NRRD, err, useBiff); return NULL; } h++; /* parse string until end quote */ buff = NULL; uu.c = &buff; buffArr = airArrayNew(uu.v, NULL, sizeof(char), 2); if (!buffArr) { sprintf(err, "%s: couldn't create airArray", me); biffMaybeAdd(NRRD, err, useBiff); return NULL; } pos = airArrayLenIncr(buffArr, 1); /* pos should get 0 */ while (h[pos]) { /* printf("!%s: h+%d |%s|\n", me, pos, h+pos); */ if ('\"' == h[pos]) { break; } if ('\\' == h[pos] && '\"' == h[pos+1]) { h += 1; } buff[pos] = h[pos]; pos = airArrayLenIncr(buffArr, 1); } if ('\"' != h[pos]) { sprintf(err, "%s: didn't see ending \" soon enough", me); biffMaybeAdd(NRRD, err, useBiff); return NULL; } h += pos + 1; buff[pos] = 0; ret = airStrdup(buff); airArrayNuke(buffArr); *hP = h; return ret; }
int _nrrdReadNrrdParse_kinds (FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { char me[]="_nrrdReadNrrdParse_kinds", err[BIFF_STRLEN]; unsigned int ai; char *info, *tok, *last; airArray *mop; AIR_UNUSED(file); mop = airMopNew(); info = airStrdup(nio->line + nio->pos); airMopAdd(mop, info, airFree, airMopAlways); _CHECK_HAVE_DIM; for (ai=0; ai<nrrd->dim; ai++) { tok = airStrtok(!ai ? info : NULL, _nrrdFieldSep, &last); if (!tok) { sprintf(err, "%s: couldn't extract string for kind %d of %d", me, ai+1, nrrd->dim); biffMaybeAdd(NRRD, err, useBiff); airMopError(mop); return 1; } if (!strcmp(tok, NRRD_UNKNOWN)) { nrrd->axis[ai].kind = nrrdKindUnknown; continue; } if (!strcmp(tok, NRRD_NONE)) { nrrd->axis[ai].center = nrrdKindUnknown; continue; } if (!(nrrd->axis[ai].kind = airEnumVal(nrrdKind, tok))) { sprintf(err, "%s: couldn't parse \"%s\" kind %d of %d", me, tok, ai+1, nrrd->dim); biffMaybeAdd(NRRD, err, useBiff); airMopError(mop); return 1; } } if (airStrtok(!ai ? info : NULL, _nrrdFieldSep, &last)) { sprintf(err, "%s: seem to have more than expected %d kinds", me, nrrd->dim); biffMaybeAdd(NRRD, err, useBiff); airMopError(mop); return 1; } /* can't run this now because kinds can come before sizes, in which case the kind/size check in _nrrdFieldCheck_kinds will incorrectly flag an error ... if (_nrrdFieldCheck[nrrdField_kinds](nrrd, useBiff)) { sprintf(err, "%s: trouble", me); biffMaybeAdd(NRRD, err, useBiff); airMopError(mop); return 1; } */ airMopOkay(mop); return 0; }
int _nrrdReadNrrdParse_centers (FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { char me[]="_nrrdReadNrrdParse_centers", err[BIFF_STRLEN]; unsigned int ai; char *tok, *info, *last; airArray *mop; AIR_UNUSED(file); mop = airMopNew(); info = airStrdup(nio->line + nio->pos); airMopAdd(mop, info, airFree, airMopAlways); _CHECK_HAVE_DIM; for (ai=0; ai<nrrd->dim; ai++) { tok = airStrtok(!ai ? info : NULL, _nrrdFieldSep, &last); if (!tok) { sprintf(err, "%s: couldn't extract string for center %d of %d", me, ai+1, nrrd->dim); biffMaybeAdd(NRRD, err, useBiff); airMopError(mop); return 1; } if (!strcmp(tok, NRRD_UNKNOWN)) { nrrd->axis[ai].center = nrrdCenterUnknown; continue; } if (!strcmp(tok, NRRD_NONE)) { nrrd->axis[ai].center = nrrdCenterUnknown; continue; } if (!(nrrd->axis[ai].center = airEnumVal(nrrdCenter, tok))) { sprintf(err, "%s: couldn't parse center \"%s\" for axis %d", me, tok, ai); biffMaybeAdd(NRRD, err, useBiff); airMopError(mop); return 1; } } if (airStrtok(!ai ? info : NULL, _nrrdFieldSep, &last)) { sprintf(err, "%s: seem to have more than expected %d centers", me, nrrd->dim); biffMaybeAdd(NRRD, err, useBiff); airMopError(mop); return 1; } if (_nrrdFieldCheck[nrrdField_centers](nrrd, useBiff)) { sprintf(err, "%s: trouble", me); biffMaybeAdd(NRRD, err, useBiff); airMopError(mop); return 1; } airMopOkay(mop); return 0; }
int _nrrdReadNrrdParse_type (FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { char me[]="_nrrdReadNrrdParse_type", err[BIFF_STRLEN]; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; if (!(nrrd->type = airEnumVal(nrrdType, info))) { sprintf(err, "%s: couldn't parse type \"%s\"", me, info); biffMaybeAdd(NRRD, err, useBiff); return 1; } if (_nrrdFieldCheck[nrrdField_type](nrrd, useBiff)) { sprintf(err, "%s: trouble", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdFieldCheck_type(const Nrrd *nrrd, int useBiff) { char me[]="_nrrdFieldCheck_type", err[BIFF_STRLEN]; if (airEnumValCheck(nrrdType, nrrd->type)) { sprintf(err, "%s: type (%d) is not valid", me, nrrd->type); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdReadNrrdParse_sample_units (FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { char me[]="_nrrdReadNrrdParse_sample_units", err[BIFF_STRLEN]; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; if (strlen(info) && !(nrrd->sampleUnits = airStrdup(info))) { sprintf(err, "%s: couldn't strdup() sampleUnits", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } if (_nrrdFieldCheck[nrrdField_sample_units](nrrd, useBiff)) { sprintf(err, "%s: trouble", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdFieldCheck_spacings(const Nrrd *nrrd, int useBiff) { char me[]="_nrrdFieldCheck_spacings", err[BIFF_STRLEN]; double val[NRRD_DIM_MAX]; unsigned int ai; nrrdAxisInfoGet_nva(nrrd, nrrdAxisInfoSpacing, val); for (ai=0; ai<nrrd->dim; ai++) { if (!( !airIsInf_d(val[ai]) && (airIsNaN(val[ai]) || (0 != val[ai])) )) { sprintf(err, "%s: axis %d spacing (%g) invalid", me, ai, val[ai]); biffMaybeAdd(NRRD, err, useBiff); return 1; } } if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { sprintf(err, "%s: trouble", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdFieldCheck_block_size(const Nrrd *nrrd, int useBiff) { char me[]="_nrrdFieldCheck_block_size", err[BIFF_STRLEN]; if (nrrdTypeBlock == nrrd->type && (!(0 < nrrd->blockSize)) ) { sprintf(err, "%s: type is %s but nrrd->blockSize (" _AIR_SIZE_T_CNV ") invalid", me, airEnumStr(nrrdType, nrrdTypeBlock), nrrd->blockSize); biffMaybeAdd(NRRD, err, useBiff); return 1; } if (nrrdTypeBlock != nrrd->type && (0 < nrrd->blockSize)) { sprintf(err, "%s: type is %s (not block) but blockSize is " _AIR_SIZE_T_CNV, me, airEnumStr(nrrdType, nrrd->type), nrrd->blockSize); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdFieldCheck_measurement_frame(const Nrrd *nrrd, int useBiff) { char me[]="_nrrdFieldCheck_measurement_frame", err[BIFF_STRLEN]; if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { sprintf(err, "%s: space info problem", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdFieldCheck_space_dimension(const Nrrd *nrrd, int useBiff) { char me[]="_nrrdFieldCheck_space_dimension", err[BIFF_STRLEN]; if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { sprintf(err, "%s: trouble", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdReadNrrdParse_measurement_frame (FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { char me[]="_nrrdReadNrrdParse_measurement_frame", err[BIFF_STRLEN]; double colvec[NRRD_SPACE_DIM_MAX]; unsigned int dd, ii; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; _CHECK_HAVE_SPACE_DIM; for (dd=0; dd<nrrd->spaceDim; dd++) { /* we are going through the *columns* of the mf matrix */ if (_nrrdSpaceVectorParse(colvec, &info, nrrd->spaceDim, useBiff)) { sprintf(err, "%s: trouble getting space vector %d of %d", me, dd+1, nrrd->spaceDim); biffMaybeAdd(NRRD, err, useBiff); return 1; } for (ii=0; ii<NRRD_SPACE_DIM_MAX; ii++) { nrrd->measurementFrame[dd][ii] = (ii < nrrd->spaceDim ? colvec[ii] : AIR_NAN); } } if (strlen(info) != strspn(info, _nrrdFieldSep)) { sprintf(err, "%s: seem to have more than expected %d directions", me, nrrd->spaceDim); biffMaybeAdd(NRRD, err, useBiff); return 1; } for (dd=nrrd->spaceDim; dd<NRRD_SPACE_DIM_MAX; dd++) { for (ii=0; ii<NRRD_SPACE_DIM_MAX; ii++) { nrrd->measurementFrame[dd][ii] = AIR_NAN; } } if (_nrrdFieldCheck[nrrdField_measurement_frame](nrrd, useBiff)) { sprintf(err, "%s: trouble", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdFieldCheck_dimension(const Nrrd *nrrd, int useBiff) { char me[]="_nrrdFieldCheck_dimension", err[BIFF_STRLEN]; if (!AIR_IN_CL(1, nrrd->dim, NRRD_DIM_MAX)) { sprintf(err, "%s: dimension %u is outside valid range [1,%d]", me, nrrd->dim, NRRD_DIM_MAX); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdFormatVTK_fitsInto(const Nrrd *nrrd, const NrrdEncoding *encoding, int useBiff) { char me[]="_nrrdFormatVTK_fitsInto", err[BIFF_STRLEN]; if (!( nrrd && encoding )) { sprintf(err, "%s: got NULL nrrd (%p) or encoding (%p)", me, AIR_CAST(void*, nrrd), AIR_CAST(void*, encoding)); biffMaybeAdd(NRRD, err, useBiff); return AIR_FALSE; }
int _nrrdFieldCheck_sizes(const Nrrd *nrrd, int useBiff) { char me[]="_nrrdFieldCheck_sizes", err[BIFF_STRLEN]; size_t size[NRRD_DIM_MAX]; nrrdAxisInfoGet_nva(nrrd, nrrdAxisInfoSize, size); if (_nrrdSizeCheck(size, nrrd->dim, useBiff)) { sprintf(err, "%s: trouble with array sizes", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdFieldCheck_space_units(const Nrrd *nrrd, int useBiff) { char me[]="_nrrdFieldCheck_space_units", err[BIFF_STRLEN]; /* not sure if there's anything to specifically check for the space units themselves ... */ if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { sprintf(err, "%s: space info problem", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdFieldCheck_old_max(const Nrrd *nrrd, int useBiff) { char me[]="_nrrdFieldCheck_old_max", err[BIFF_STRLEN]; int ret; if ((ret=airIsInf_d(nrrd->oldMax))) { sprintf(err, "%s: old max %sinf invalid", me, 1==ret ? "+" : "-"); biffMaybeAdd(NRRD, err, useBiff); return 1; } /* oldMin == oldMax is perfectly valid */ return 0; }
int _nrrdFieldCheck_units(const Nrrd *nrrd, int useBiff) { char me[]="_nrrdFieldCheck_units", err[BIFF_STRLEN]; /* as with labels- the strings themselves don't need checking themselves */ /* but per-axis units cannot be set for axes with space directions ... */ if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { sprintf(err, "%s: space info problem", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdFormatEPS_fitsInto(const Nrrd *nrrd, const NrrdEncoding *encoding, int useBiff) { char me[]="_nrrdFormatEPS_fitsInto", err[BIFF_STRLEN]; int ret; AIR_UNUSED(encoding); /* encoding information is ignored- its always going to be hex */ if (!nrrd) { sprintf(err, "%s: got NULL nrrd (%p)", me, AIR_CAST(void*, nrrd)); biffMaybeAdd(NRRD, err, useBiff); return AIR_FALSE; }
int _nrrdReadNrrdParse_space_origin (FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { char me[]="_nrrdReadNrrdParse_space_origin", err[BIFF_STRLEN]; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; _CHECK_HAVE_SPACE_DIM; if (_nrrdSpaceVectorParse(nrrd->spaceOrigin, &info, nrrd->spaceDim, useBiff)) { sprintf(err, "%s: couldn't parse origin \"%s\"", me, info); biffMaybeAdd(NRRD, err, useBiff); return 1; } if (_nrrdFieldCheck[nrrdField_space_origin](nrrd, useBiff)) { sprintf(err, "%s: trouble", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } return 0; }
int _nrrdFieldCheck_axis_maxs(const Nrrd *nrrd, int useBiff) { char me[]="_nrrdFieldCheck_axis_maxs", err[BIFF_STRLEN]; double val[NRRD_DIM_MAX]; unsigned int ai; int ret; nrrdAxisInfoGet_nva(nrrd, nrrdAxisInfoMax, val); for (ai=0; ai<nrrd->dim; ai++) { if ((ret=airIsInf_d(val[ai]))) { sprintf(err, "%s: axis %d max %sinf invalid", me, ai, 1==ret ? "+" : "-"); biffMaybeAdd(NRRD, err, useBiff); return 1; } } if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { sprintf(err, "%s: trouble", me); biffMaybeAdd(NRRD, err, useBiff); return 1; } /* HEY: contemplate checking min != max, but what about stub axes ... */ return 0; }
int _nrrdFormatEPS_fitsInto(const Nrrd *nrrd, const NrrdEncoding *encoding, int useBiff) { char me[]="_nrrdFormatEPS_fitsInto", err[AIR_STRLEN_MED]; AIR_UNUSED(nrrd); AIR_UNUSED(encoding); AIR_UNUSED(useBiff); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatEPS->name); biffMaybeAdd(NRRD, err, useBiff); return AIR_FALSE; }