|
From: <kin...@us...> - 2004-02-27 06:13:47
|
Update of /cvsroot/teem/teem/src/nrrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5350/nrrd Modified Files: apply1D.c Log Message: more comments and minor edits. TEAT approved. Index: apply1D.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/apply1D.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** apply1D.c 26 Feb 2004 20:59:45 -0000 1.21 --- apply1D.c 27 Feb 2004 06:05:16 -0000 1.22 *************** *** 859,869 **** ******** nrrdApply1DSubstitution ** ! ** A "subst" is a substitution table, i.e. a list of pairs that describes ! ** what values should be substituted with what (substitution rules). ! ** The output is a copy of the input with values substituted using this table. */ int ! nrrdApply1DSubstitution(Nrrd *nout, const Nrrd *nin, const Nrrd *nsubst) ! { char me[]="nrrdApply1DSubstitution", err[AIR_STRLEN_MED]; double (*lup)(const void *, size_t); --- 859,877 ---- ******** nrrdApply1DSubstitution ** ! ** A "subst" is a substitution table, i.e. a list of pairs that ! ** describes what values should be substituted with what (substitution ! ** rules). So, nsubst must be a scalar 2xN array. The output is a ! ** copy of the input with values substituted using this table. ! ** ! ** Unlike with lookup tables and maps (irregular and regular), we ! ** aren't at liberty to change the dimensionality of the data (can't ! ** substitute a grayscale with a color). The ability to apply ! ** substitutions to non-scalar data will be in a different function. ! ** Also unlike lookup tables and maps, the output type is the SAME as ! ** the input type; the output does NOT inherit the type of the ! ** substitution */ int ! nrrdApply1DSubstitution(Nrrd *nout, const Nrrd *nin, const Nrrd *nsubst) { char me[]="nrrdApply1DSubstitution", err[AIR_STRLEN_MED]; double (*lup)(const void *, size_t); *************** *** 885,889 **** } if (2 != nsubst->dim) { ! sprintf(err, "%s: substitution table hasize to be 2 dimensional, not %d", me, nsubst->dim); biffAdd(NRRD, err); return 1; --- 893,897 ---- } if (2 != nsubst->dim) { ! sprintf(err, "%s: substitution table has to be 2-D, not %d-D", me, nsubst->dim); biffAdd(NRRD, err); return 1; *************** *** 891,895 **** nrrdAxisInfoGet(nsubst, nrrdAxisInfoSize, &asize0, &asize1); if (2 != asize0) { ! sprintf(err, "%s: substitution table hasize to be 2xN, not %dxN", me, asize0); biffAdd(NRRD, err); return 1; --- 899,903 ---- nrrdAxisInfoGet(nsubst, nrrdAxisInfoSize, &asize0, &asize1); if (2 != asize0) { ! sprintf(err, "%s: substitution table has to be 2xN, not %dxN", me, asize0); biffAdd(NRRD, err); return 1; *************** *** 909,913 **** changed = AIR_FALSE; for (jj=0; jj<asize1; jj++) { ! sval = slup(nsubst->data, jj*2); if (val == sval) { val = slup(nsubst->data, jj*2+1); --- 917,921 ---- changed = AIR_FALSE; for (jj=0; jj<asize1; jj++) { ! sval = slup(nsubst->data, jj*2+0); if (val == sval) { val = slup(nsubst->data, jj*2+1); |