[Insight-users] RE: VersorRigid3DTransform & Optimization
Luis Ibanez
luis.ibanez at kitware.com
Tue, 13 Jan 2004 14:54:40 -0500
Hi Radhika,
Thanks for sending your code and the images you
were trying to register.
The real problem is that your images have set a
fictitious pixel spacing, specified just as
1.0 x 1.0 x 1.0
while in reality the pixel size is probably
something like
1.0 x 1.0 x 1.5
Having volumes of 256 x 256 x 164 pixels with
the fictitious spacing result in a physical
extent of
256mm X 256mm X 164mm
which you can imagine as a slab of ratio
1 : 1 : 0.6
When the VersorRigid3D optimizer is exploring
the overlap of two such volumes it attempts the
combination of small rotations around the X and
Y axis. In this combination the overlap between
the two slabs decreases dramatically.
The reason why the optimizer goes up-hill is that
the derivatives of the metric are computed with a
local measure based on the image gradient and the
transform's Jacobian. However when it comes to
compute the actual value of the metric, the mean
squares are computed only over the number of pixels
in the overlapping regions. The result of this
discrepancy is that the optimizer trusts the
direction of the local derivative, increases the
rotation out of the slab plane and then it is
surprised by a higher metric value due to the
reduction of the overlapping region.
All this unfortunate situation is avoided if you
set the correct spacing on the images. By setting
the spacing to ( 1.0 x 1.0 x 1.5 ) and using
Initial step lengths of 0.1, the optimizer is able
to walk monotonically until registering the two images.
Here are the results of running the registration
with your code (once the image spacing was corrected).
--------------------------------------------
time ../bin/register 1000 0.10 0.0001 1000
TranslationScale = 1000
MaxStepLength = 0.10
MinStepLength = 0.0001
MaxIterations = 100
Finished writing fixed image
Finished writing moving image
Transform center before Initializer 0 0 0
Transform center after Initializer 125.472 134.406 131.728
Intial Parameters =
[0, 0, 0, -1.15535, -0.252458, 0.0787966]
Translationscale = 1000
Starting Registration
0 389.774 [0.000498096, 0.0041635, 0.0187648, -1.08007, -0.203521,
0.057368]
1 317.877 [-0.000193999, 0.00613385, 0.0335852, -1.09129, -0.239463,
0.043748]
2 263.486 [-0.000382412, 0.00324637, 0.0471126, -1.09723, -0.280672,
0.0436419]
3 209.872 [-0.000527169, 0.0029608, 0.0578632, -1.09992, -0.324779,
0.0345101]
4 158.294 [-0.000379524, 0.00171905, 0.0670141, -1.10084, -0.370727,
0.0277727]
5 111.143 [-0.000320991, 0.00114254, 0.0744852, -1.10084, -0.417742,
0.019784]
6 68.8284 [-0.000143426, 0.000574566, 0.0808036, -1.09816,
-0.465485, 0.0126217]
7 29.7093 [-0.000108126, 0.00016429, 0.0857882, -1.08819, -0.512831,
0.00498878]
8 2.50794 [0.000514461, -0.000202424, 0.088728, -1.06125, -0.554066,
-0.00109605]
9 3.38161 [-0.00236829, -6.93559e-05, 0.0862178, -1.07729,
-0.537006, -0.00531419]
10 8.29858 [0.00100524, 0.000568953, 0.0866277, -1.07575, -0.531196,
0.00318725]
11 2.39999 [-0.000579384, -0.000590192, 0.0867204, -1.07504,
-0.534585, -0.000222387]
12 1.42702 [0.000199617, 0.000551113, 0.0869217, -1.07564,
-0.534075, 0.000936169]
13 0.762661 [4.30728e-05, -5.54646e-05, 0.0869382, -1.07477,
-0.534418, 0.000935771]
14 0.336736 [-0.000125978, 0.000172539, 0.0870684, -1.07465,
-0.535641, 0.00020024]
15 0.340423 [1.00012e-05, 9.79281e-06, 0.0870758, -1.07425,
-0.535421, 0.000669515]
16 0.273778 [-2.07788e-05, -3.31489e-06, 0.0870919, -1.07405,
-0.535733, 0.000558016]
17 0.270637 [8.8092e-05, 6.80349e-05, 0.0871133, -1.07387,
-0.535819, 0.000759256]
18 0.285837 [3.58203e-05, 1.68003e-05, 0.0871079, -1.07385,
-0.535894, 0.000656946]
19 0.270217 [-1.8407e-05, -1.1657e-05, 0.0871026, -1.07386,
-0.535974, 0.000529341]
Result =
versor X = -1.8407e-05
versor Y = -1.1657e-05
versor Z = 0.0871026
Translation X = -1.07386
Translation Y = -0.535974
Translation Z = 0.000529341
Iterations = 21
Metric value = 0.26885
Matrix =
0.984826 -0.173543 -2.6432e-05
0.173543 0.984826 3.46433e-05
2.00188e-05 -3.87048e-05 1
Offset =
24.1588 -20.2759 0.00321983
859.61s user 1.65s system 99% cpu 14:27.69 total
---------------------------------------------------------
As you can see, after iteration 9, the mean square metric is
down to 3.38 and the rotation angle is reporting 9.9 degrees
(your artificil rotation was 10 degrees).
Upto that point the registration has taken 7minutes in a
Pentium V, 1.8Ghz Linux machine (for code compiled with -O3).
With 8 minutes more of processing the registration drives the
metric down to 0.27 and the angle measure to 9.99 degrees.
Regards,
Luis
------------------------------
Radhika Sivaramakrishna wrote:
> Hi Luis,
...
>
> To answer your question, both images are T1-weighted MRI brain images.
>
> Radhika
>
>