From: <kin...@us...> - 2012-11-01 07:07:55
|
Revision: 5854 http://teem.svn.sourceforge.net/teem/?rev=5854&view=rev Author: kindlmann Date: 2012-11-01 07:07:48 +0000 (Thu, 01 Nov 2012) Log Message: ----------- adding first order BSlines (and its first derivative) for completeness Modified Paths: -------------- teem/trunk/src/meet/meetNrrd.c teem/trunk/src/nrrd/bsplKernel.c teem/trunk/src/nrrd/kernel.c teem/trunk/src/nrrd/nrrd.h Modified: teem/trunk/src/meet/meetNrrd.c =================================================================== --- teem/trunk/src/meet/meetNrrd.c 2012-11-01 06:46:47 UTC (rev 5853) +++ teem/trunk/src/meet/meetNrrd.c 2012-11-01 07:07:48 UTC (rev 5854) @@ -95,6 +95,8 @@ ii = airArrayLenIncr(arr, 1); kern[ii] = nrrdKernelBlackmanDD; /* bsplKernel.c */ + ii = airArrayLenIncr(arr, 1); kern[ii] = nrrdKernelBSpline1; + ii = airArrayLenIncr(arr, 1); kern[ii] = nrrdKernelBSpline1D; ii = airArrayLenIncr(arr, 1); kern[ii] = nrrdKernelBSpline2; ii = airArrayLenIncr(arr, 1); kern[ii] = nrrdKernelBSpline2D; ii = airArrayLenIncr(arr, 1); kern[ii] = nrrdKernelBSpline2DD; @@ -162,6 +164,7 @@ INTGL(nrrdKernelBlackman); INTGL(nrrdKernelBlackmanD); + INTGL(nrrdKernelBSpline1); INTGL(nrrdKernelBSpline2); INTGL(nrrdKernelBSpline2D); INTGL(nrrdKernelBSpline3); Modified: teem/trunk/src/nrrd/bsplKernel.c =================================================================== --- teem/trunk/src/nrrd/bsplKernel.c 2012-11-01 06:46:47 UTC (rev 5853) +++ teem/trunk/src/nrrd/bsplKernel.c 2012-11-01 07:07:48 UTC (rev 5854) @@ -175,6 +175,54 @@ } \ } +/* ============================= order *1* ============================= */ + +static double +_bspl1_sup(const double *parm) { + AIR_UNUSED(parm); + return 1.0; +} + +/* ---------------------- order *1* deriv *0* -------------------------- */ + +#define BSPL1D0(ret, TT, t, x) \ + AIR_UNUSED(t); \ + if (x < 1) { \ + ret = AIR_CAST(TT, 1.0 - x); \ + } else { \ + ret = 0; \ + } + +BSPL_EVEN_METHODS(_bspl1d0, BSPL1D0) + +static NrrdKernel +_nrrdKernelBSpline1 = { + "bspl1", + BSPL_DECL(1, 0) +}; +NrrdKernel *const +nrrdKernelBSpline1 = &_nrrdKernelBSpline1; + +/* ---------------------- order *1* deriv *1* -------------------------- */ + +#define BSPL1D1(ret, TT, t, x) \ + AIR_UNUSED(t); \ + if (x < 1) { \ + ret = AIR_CAST(TT, -1.0); \ + } else { \ + ret = 0; \ + } + +BSPL_ODD_METHODS(_bspl1d1, BSPL1D1) + +static NrrdKernel +_nrrdKernelBSpline1D = { + "bspl1d", + BSPL_DECL(1, 1) +}; +NrrdKernel *const +nrrdKernelBSpline1D = &_nrrdKernelBSpline1D; + /* ============================= order *2* ============================= */ static double Modified: teem/trunk/src/nrrd/kernel.c =================================================================== --- teem/trunk/src/nrrd/kernel.c 2012-11-01 06:46:47 UTC (rev 5853) +++ teem/trunk/src/nrrd/kernel.c 2012-11-01 07:07:48 UTC (rev 5854) @@ -2870,6 +2870,10 @@ if (!strcmp("bkmndd", str)) return nrrdKernelBlackmanDD; if (!strcmp("blackdd", str)) return nrrdKernelBlackmanDD; if (!strcmp("blackmandd", str)) return nrrdKernelBlackmanDD; + if (!strcmp("bspl1", str)) return nrrdKernelBSpline1; + if (!strcmp("bspln1", str)) return nrrdKernelBSpline1; + if (!strcmp("bspl1d", str)) return nrrdKernelBSpline1D; + if (!strcmp("bspln1d", str)) return nrrdKernelBSpline1D; if (!strcmp("bspl2", str)) return nrrdKernelBSpline2; if (!strcmp("bspln2", str)) return nrrdKernelBSpline2; if (!strcmp("bspl2d", str)) return nrrdKernelBSpline2D; Modified: teem/trunk/src/nrrd/nrrd.h =================================================================== --- teem/trunk/src/nrrd/nrrd.h 2012-11-01 06:46:47 UTC (rev 5853) +++ teem/trunk/src/nrrd/nrrd.h 2012-11-01 07:07:48 UTC (rev 5854) @@ -1433,6 +1433,8 @@ /* bsplKernel.c: b-splines of various orders; these do not interpolate, but the ApproxInverse kernels are ok for pre-filtering so that they do */ NRRD_EXPORT NrrdKernel + *const nrrdKernelBSpline1, /* 1st order B-spline */ + *const nrrdKernelBSpline1D, *const nrrdKernelBSpline2, /* 2nd order (quadratic) B-spline */ *const nrrdKernelBSpline2D, *const nrrdKernelBSpline2DD, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |