Code covered by the BSD License  

Highlights from
3D Free Form Image Registration Toolbox (GUI)

image thumbnail
from 3D Free Form Image Registration Toolbox (GUI) by Daniel Markel
A toolbox for performing image registrations on 4D RTOG files or any other volumetric image.

dLdPy(base,sz2,sz,m,n,i1,j1)
%determine the change in deformation in the y direction for the mth by nth
%control point
function dLXdpy = dLdPy(base,sz2,sz,m,n,i1,j1)
sz3 = size(base);
[y,x] = find(base >= 0);
locations = find(base >= 0);
X = zeros(sz3(1),sz3(2));
Y = zeros(sz3(1),sz3(2));
X(locations) = x(locations)+j1;
Y(locations) = y(locations)+i1;
dLXdpy = zeros(sz3(1),sz3(2));

        i = floor(((Y-0.5).*(sz2(1)-3)./sz(1))+2)-1;
        j = floor(((X-0.5).*(sz2(2)-3)./sz(2))+2)-1;
        loc = find(m-i >=0 & m-i <=3 & n-j >=0 & n-j <=3);
%             u = X(loc).*sz2(2)./sz(2) - floor(X(loc).*sz2(2)./sz(2));
%             v = Y(loc).*sz2(1)./sz(1) - floor(Y(loc).*sz2(1)./sz(1));
              u = ((X(loc)-0.5).*(sz2(2)-3)./sz(2))+2 - floor(((X(loc)-0.5).*(sz2(2)-3)./sz(2))+2);
              v = ((Y(loc)-0.5).*(sz2(1)-3)./sz(1))+2 - floor(((Y(loc)-0.5).*(sz2(1)-3)./sz(1))+2);
            ysum = bspline(u,n-j(loc)).*bspline(v,m-i(loc));
     
        dLXdpy(loc) = ysum;

Contact us at files@mathworks.com