> When we apply the normalization transformation to resample a reference
> image to a template space we interpolate the reference image in the points
> obtained when transforming the points of the regular grid of the template
> image according to:
>
> y = Affine*(x+u)
>
> Affine is in the mat file enclosing the transformation parameters. u is
> calculated using "spm_dctmtx" in the grid of the template.
>
> My question is:
>
> If I want to invert this to resample template image in the reference space,
> should I compute
>
> x = inv(Affine)*(y-u) or x = inv(Affine)*y-u?
For a small deformation approximation, let us assume that the inverse
I'm afraid that neither of them will give you an exact inverse because
deformations can not be simply added and subtracted (although they can be
inverted via their Lie algebra). You can get an inverse via the Deformations
toolbox though. This simple example should illustrate this:
m = 64;
n = 8;
x=(1:m)';
u=spm_dctmtx(m,n)*randn(n,1)*10;
figure
subplot(2,2,1); plot(x,(x+u));title('Deformation');axis([1 m 1 m])
subplot(2,2,2); plot(x+u,x);title('Inverse Deformation');axis([1 m 1 m])
subplot(2,2,3); plot(x-u,x);title('Not the Deformation');axis([1 m 1 m])
subplot(2,2,4); plot(x,x-u);title('Not the Inverse Deformation');axis([1 m 1
m])
whereas if we parameterise differently:
k = 4;
x=(1:m)';
v=spm_dctmtx(m,n)*randn(n,1)*10;
o=ones(m,1);
y=x+v/2^k;
for i=1:k, y=spm_sample_vol(y,y,o,o,[1 NaN]);end;
iy=x-v/2^k;
for i=1:k, iy=spm_sample_vol(iy,iy,o,o,[1 NaN]);end;
subplot(2,2,1);plot(x,y);title('Deformation');axis([1 m 1 m])
subplot(2,2,2);plot(y,x);title('Inverse Deformation');axis([1 m 1 m])
subplot(2,2,3);plot(iy,x);title('Still the Deformation');axis([1 m 1 m])
subplot(2,2,4);plot(x,iy);title('|Still the Inverse Deformation');axis([1 m 1
m])
Note that a value of k=0 will produce a small deformation approximation (with
a poor inverse), whereas bigger values of k will produce more consistent
inverses (and one-to-one mappings).
All the best,
-John
|