|
From: Gordon K. <kin...@us...> - 2004-03-30 04:35:09
|
Update of /cvsroot/teem/teem/src/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2296/bin Modified Files: ilk.c Log Message: fixed a memory leak and a bus error Index: ilk.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/ilk.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ilk.c 4 Mar 2004 23:57:22 -0000 1.10 --- ilk.c 30 Mar 2004 04:23:33 -0000 1.11 *************** *** 37,42 **** double mat[6], **matList, *origInfo, origMat[6], origInvMat[6], ox, oy, min[2], max[2]; ! int d, bound, matListLen, i, ax0, size[2], bgLen; ! float *bg, scale[4]; me = argv[0]; --- 37,42 ---- double mat[6], **matList, *origInfo, origMat[6], origInvMat[6], ox, oy, min[2], max[2]; ! int d, bound, matListLen, i, ax0, size[2], _bkgLen; ! float *bkg, *_bkg, scale[4]; me = argv[0]; *************** *** 89,96 **** "\b\bo \"pad\": use a given background value (via \"-bg\")", NULL, nrrdBoundary); ! hestOptAdd(&hopt, "bg", "bg0 bg1", airTypeFloat, 1, -1, &bg, "nan", "background color to use with boundary behavior \"pad\". " "Defaults to all zeroes.", ! &bgLen); hestOptAdd(&hopt, "s", "xSize ySize", airTypeOther, 2, 2, scale, "x1 x1", "For each axis, information about how many samples in output:\n " --- 89,96 ---- "\b\bo \"pad\": use a given background value (via \"-bg\")", NULL, nrrdBoundary); ! hestOptAdd(&hopt, "bg", "bg0 bg1", airTypeFloat, 1, -1, &_bkg, "nan", "background color to use with boundary behavior \"pad\". " "Defaults to all zeroes.", ! &_bkgLen); hestOptAdd(&hopt, "s", "xSize ySize", airTypeOther, 2, 2, scale, "x1 x1", "For each axis, information about how many samples in output:\n " *************** *** 116,123 **** airMopError(mop); return 1; } ! if (AIR_EXISTS(bg[0]) && bgLen != MOSS_NCOL(nin)) { ! fprintf(stderr, "%s: got %d background colors, image has %d colors\n", ! me, bgLen, MOSS_NCOL(nin)); ! airMopError(mop); return 1; } --- 116,132 ---- airMopError(mop); return 1; } ! if (nrrdBoundaryPad == bound) { ! if (_bkgLen != MOSS_NCOL(nin)) { ! fprintf(stderr, "%s: got %d background colors, image has %d colors\n", ! me, _bkgLen, MOSS_NCOL(nin)); ! airMopError(mop); return 1; ! } else { ! bkg = _bkg; ! } ! } else { ! /* maybe warn user if they gave a background that won't be used? */ ! /* No- because hest is stupid, and right now we always parse the ! single (default) "nan" for this argument! */ ! bkg = NULL; } *************** *** 179,183 **** nrrdAxisMinMaxSet(nin, ax0+1, mossDefCenter); } ! if (mossLinearTransform(nout, nin, AIR_EXISTS(bg[0]) ? bg : NULL, mat, msp, min[0], max[0], min[1], max[1], --- 188,192 ---- nrrdAxisMinMaxSet(nin, ax0+1, mossDefCenter); } ! if (mossLinearTransform(nout, nin, bkg, mat, msp, min[0], max[0], min[1], max[1], |