/* $Id: shoot_multiscale.c 4875 2012-08-30 20:04:30Z john $ */ /* (c) John Ashburner (2011) */ #include #include #include "shoot_boundary.h" /* 2nd degree B-spline basis */ static double wt2(double x) { x = fabs(x); if (x < 0.5) return(0.75 - x*x); if (x < 1.5) { x = 1.5 - x; return(0.5*x*x); } return(0.0); } /* Linear interpolation (1st degree B-spline) basis */ static double wt1(double x) { x = fabs(x); if (x < 1.0) return(1.0-x); return(0.0); } /* Note that restriction uses linear interpolation, whereas prolongation uses 2nd degree B-spline. For "bending energy", the restriction and prolongation operators need to be at least this degree. See Numerical Recipes for further details. */ static void restrict_plane(mwSize na[], float *a, mwSize nc[], float *c, float *b) { mwSignedIndex i, j, o; double loc, s; float *ap, *bp, *cp; /* a - na[0]*na[1] * c - nc[0]*nc[1] * b - na[0]*nc[1] */ if (na[1]==1) { for(j=0; j