In [1]:
%matplotlib inline
from ndreg import *

Read input and reference image

First we read the input image


In [2]:
inImg = imgRead("/cis/home/leebc/Projects/Mouse_Histology/figures/for_kwame/atlas.img")
imgShow(inImg)


Next we read the reference image. The input image will be aligned to this image


In [3]:
refImg = imgRead("/cis/home/leebc/Projects/Mouse_Histology/figures/for_kwame/target.img")
imgShow(refImg)


Downsample Images

Ideally we would do resgistration at the full resolution but this would be far to computationally expensive for the purposes of this tutorial. Therefore to save time we downsample the images to 0.1 mm x 0.1mm x 0.1mm


In [4]:
spacing=[0.1,0.1,0.1]
refImg_ds = imgResample(refImg, spacing=spacing)
imgShow(refImg_ds)



In [5]:
inImg_ds = imgResample(inImg, spacing=spacing)
imgShow(inImg_ds)


Affine Registration

Now we compute the affine transform. Here we use imgAffineComposite which computes a translation then a rigid then an affine transformation. It's output is the composition of those three transforms. We also use Mutual Information matching and enable the verbose option so that each iteration is printed.


In [6]:
affine = imgAffineComposite(inImg_ds, refImg_ds, iterations=100, useMI=True, verbose=True)


Step translation:
0.	 -0.431851241555
1.	 -0.457115379109
2.	 -0.481227945636
3.	 -0.503782474292
4.	 -0.524891183918
5.	 -0.539128433687
6.	 -0.551151239086
7.	 -0.557618829807
8.	 -0.563534123019
9.	 -0.568578834071
10.	 -0.570071738767
11.	 -0.576771578143
12.	 -0.575574256212
13.	 -0.580204307312
14.	 -0.577116497541
15.	 -0.583930604964
16.	 -0.585809984658
17.	 -0.584271006739
18.	 -0.582412004902
19.	 -0.583085614005
20.	 -0.585342411899
21.	 -0.586114376276
22.	 -0.588331408862
23.	 -0.588779100685
24.	 -0.589813053642
25.	 -0.589781308121
26.	 -0.589904622312
27.	 -0.589857532336
28.	 -0.58989924462
29.	 -0.589913677087
Step rigid:
0.	 -0.615408264872
1.	 -0.530698786455
2.	 -0.594800346142
3.	 -0.614379282993
4.	 -0.637108456923
5.	 -0.628291063292
6.	 -0.640267943425
7.	 -0.64070799173
8.	 -0.641024369754
9.	 -0.642189553181
10.	 -0.642256318581
11.	 -0.643009104556
12.	 -0.642866998386
13.	 -0.643514688554
14.	 -0.643429857806
15.	 -0.643915119513
16.	 -0.64396259561
17.	 -0.644120456151
18.	 -0.644243239895
19.	 -0.644366551695
20.	 -0.644596886276
21.	 -0.644725425523
22.	 -0.644873298878
23.	 -0.645080100491
24.	 -0.645223081962
25.	 -0.645384234393
26.	 -0.645560043345
27.	 -0.645781653252
28.	 -0.645921794731
29.	 -0.64609482517
30.	 -0.646295746498
31.	 -0.646467867869
32.	 -0.646639504578
33.	 -0.646798681609
34.	 -0.647057101922
35.	 -0.64722826459
36.	 -0.64739823421
37.	 -0.647560542847
38.	 -0.647783511534
39.	 -0.647977650381
40.	 -0.648196164969
41.	 -0.648351448027
42.	 -0.648596973284
43.	 -0.648835313559
44.	 -0.649025091719
45.	 -0.649250920661
46.	 -0.649396603451
47.	 -0.649596398719
48.	 -0.649902384834
49.	 -0.650066909705
50.	 -0.650237266249
51.	 -0.650522211556
52.	 -0.6507680137
53.	 -0.650944886568
54.	 -0.651107705701
55.	 -0.651366830966
56.	 -0.651572030948
57.	 -0.651764921626
58.	 -0.651998151418
59.	 -0.65223571099
60.	 -0.652372358129
61.	 -0.652595245848
62.	 -0.652795528275
63.	 -0.653055992761
64.	 -0.65314422986
65.	 -0.653326744218
66.	 -0.653531461116
67.	 -0.653819382493
68.	 -0.653888619271
69.	 -0.654092786102
70.	 -0.654206779687
71.	 -0.654430355745
72.	 -0.65457220344
73.	 -0.654825901926
74.	 -0.654881746885
75.	 -0.65516826549
76.	 -0.655170259572
77.	 -0.655543011217
78.	 -0.655534661814
79.	 -0.655908318472
80.	 -0.655852450233
81.	 -0.65622344485
82.	 -0.656164670026
83.	 -0.656575901641
84.	 -0.656516764186
85.	 -0.656905819551
86.	 -0.656828608538
87.	 -0.657241338099
88.	 -0.657124528993
89.	 -0.657614916228
90.	 -0.657469602681
91.	 -0.65793847177
92.	 -0.657803213623
93.	 -0.658278578749
94.	 -0.658136391678
95.	 -0.658637403298
96.	 -0.658497557686
97.	 -0.658951950539
98.	 -0.658835471436
99.	 -0.659326216156
Step affine:
0.	 -0.654783802673
1.	 -0.59268089619
2.	 -0.655843558129
3.	 -0.684545390239
4.	 -0.713719760371
5.	 -0.716440891713
6.	 -0.727850936666
7.	 -0.731628679351
8.	 -0.735976523967
9.	 -0.739093604646
10.	 -0.741721725264
11.	 -0.74519263051
12.	 -0.747517845623
13.	 -0.750704007885
14.	 -0.75178318418
15.	 -0.754619099332
16.	 -0.75535794075
17.	 -0.756664639061
18.	 -0.757971665556
19.	 -0.759193917656
20.	 -0.760451630955
21.	 -0.761558664882
22.	 -0.762679626981
23.	 -0.763702280943
24.	 -0.764748724195
25.	 -0.765787939446
26.	 -0.766778975008
27.	 -0.767664211724
28.	 -0.768608857414
29.	 -0.769176535933
30.	 -0.769971066815
31.	 -0.770204502898
32.	 -0.770604216599
33.	 -0.770949916444
34.	 -0.771333758643
35.	 -0.771681017842
36.	 -0.772018627959
37.	 -0.772368051921
38.	 -0.772681017416
39.	 -0.773015283303
40.	 -0.7733061527
41.	 -0.773634316016
42.	 -0.77387648736
43.	 -0.774213663962
44.	 -0.77441925577
45.	 -0.774737531094
46.	 -0.774859286127
47.	 -0.775176347848
48.	 -0.775231382076

In [7]:
inImg_affine = imgApplyAffine(inImg, affine, size=refImg.GetSize())
imgShow(inImg)


Deformable registration

Now we run LDDMM registration. Here we use imgMetamorphosisComposite which runs LDDMM in multiple steps using the alpha values specified by in alphaList. The field and invField outputs are the composition of all steps. Once agan we use a Mutual Information cost and request verbose output.


In [8]:
inImg_ds = imgResample(inImg_affine, spacing=spacing)
(field, invField) = imgMetamorphosisComposite(inImg_ds, refImg_ds, alphaList=[0.05, 0.02, 0.01], scaleList=[0.25, 0.5, 1.0], useMI=True, iterations=100, verbose=True)
inImg_lddmm = imgApplyField(inImg_affine, field, size=refImg.GetSize())
imgShow(inImg_lddmm)


Step 0: alpha=0.05, beta=0.05, scale=0.25
	E, E_velocity, E_rate, E_image (E_image %), LearningRate
0.	-2.70283e+10, 90.1725, 0, -2.70283e+10 (99.6736%), 1.375000e-04
1.	-2.75799e+10, 173.023, 0, -2.75799e+10 (99.0787%), 1.512500e-04
2.	-2.81863e+10, 273.981, 0, -2.81863e+10 (98.4248%), 1.663750e-04
3.	-2.84641e+10, 312.631, 0, -2.84641e+10 (98.1252%), 9.150625e-05
4.	-2.88684e+10, 357.546, 0, -2.88684e+10 (97.6893%), 1.006569e-04
5.	-2.89488e+10, 425.518, 0, -2.89488e+10 (97.6025%), 1.107226e-04
6.	-2.96471e+10, 496.1, 0, -2.96471e+10 (96.8495%), 1.217948e-04
7.	-2.97112e+10, 572.959, 0, -2.97112e+10 (96.7803%), 1.339743e-04
8.	-2.98088e+10, 628.418, 0, -2.98088e+10 (96.6751%), 7.368587e-05
9.	-2.99975e+10, 671.733, 0, -2.99975e+10 (96.4716%), 8.105445e-05
10.	-3.00481e+10, 679.095, 0, -3.00482e+10 (96.417%), 2.228997e-05
11.	-3.00865e+10, 682.742, 0, -3.00865e+10 (96.3756%), 1.225949e-05
12.	-3.01485e+10, 688.55, 0, -3.01485e+10 (96.3088%), 1.348543e-05
13.	-3.01992e+10, 695.445, 0, -3.01992e+10 (96.2541%), 1.483398e-05
14.	-3.02249e+10, 697.018, 0, -3.02249e+10 (96.2264%), 8.158688e-06
15.	-3.0229e+10, 698.777, 0, -3.0229e+10 (96.2219%), 4.487278e-06
E = -3.0229e+10 (96.2219%)
Length = 28.773
Time = 35.4104s (0.590174m)

Step 1: alpha=0.02, beta=0.05, scale=0.5
	E, E_velocity, E_rate, E_image (E_image %), LearningRate
0.	-2.61199e+10, 3.41957, 0, -2.61199e+10 (99.8349%), 2.750000e-04
1.	-2.65077e+10, 6.01853, 0, -2.65077e+10 (99.4219%), 3.025000e-04
2.	-2.66981e+10, 10.8445, 0, -2.66981e+10 (99.2192%), 3.327500e-04
3.	-2.69169e+10, 17.3552, 0, -2.69169e+10 (98.9863%), 3.660250e-04
4.	-2.70574e+10, 25.9318, 0, -2.70574e+10 (98.8367%), 4.026275e-04
5.	-2.72561e+10, 36.0986, 0, -2.72561e+10 (98.625%), 4.428903e-04
6.	-2.73752e+10, 50.1164, 0, -2.73752e+10 (98.4983%), 4.871793e-04
7.	-2.75278e+10, 65.2244, 0, -2.75278e+10 (98.3358%), 5.358972e-04
8.	-2.75905e+10, 87.166, 0, -2.75905e+10 (98.2691%), 5.894869e-04
9.	-2.77815e+10, 94.9948, 0, -2.77815e+10 (98.0657%), 3.242178e-04
10.	-2.78818e+10, 106.769, 0, -2.78818e+10 (97.9588%), 3.566396e-04
11.	-2.79377e+10, 121.828, 0, -2.79377e+10 (97.8994%), 3.923035e-04
12.	-2.79891e+10, 138.366, 0, -2.79891e+10 (97.8447%), 4.315339e-04
13.	-2.80236e+10, 144.465, 0, -2.80236e+10 (97.8079%), 2.373436e-04
14.	-2.81314e+10, 153.432, 0, -2.81314e+10 (97.6931%), 2.610780e-04
15.	-2.81406e+10, 157.215, 0, -2.81406e+10 (97.6833%), 1.435929e-04
16.	-2.81687e+10, 162.802, 0, -2.81687e+10 (97.6534%), 1.579522e-04
17.	-2.82082e+10, 168.463, 0, -2.82082e+10 (97.6113%), 1.737474e-04
18.	-2.8223e+10, 171.079, 0, -2.8223e+10 (97.5956%), 9.556108e-05
19.	-2.82502e+10, 174.342, 0, -2.82502e+10 (97.5666%), 1.051172e-04
	E, E_velocity, E_rate, E_image (E_image %), LearningRate
20.	-2.82695e+10, 177.8, 0, -2.82695e+10 (97.546%), 1.156289e-04
21.	-2.83043e+10, 182.831, 0, -2.83043e+10 (97.509%), 1.271918e-04
22.	-2.83044e+10, 183.329, 0, -2.83044e+10 (97.5088%), 1.748887e-05
23.	-2.83091e+10, 183.858, 0, -2.83091e+10 (97.5039%), 1.923776e-05
24.	-2.83117e+10, 184.416, 0, -2.83117e+10 (97.5011%), 2.116154e-05
25.	-2.83129e+10, 184.99, 0, -2.83129e+10 (97.4998%), 2.327769e-05
26.	-2.83172e+10, 185.628, 0, -2.83172e+10 (97.4953%), 2.560546e-05
27.	-2.83231e+10, 186.334, 0, -2.83231e+10 (97.4889%), 2.816600e-05
28.	-2.8328e+10, 187.267, 0, -2.8328e+10 (97.4838%), 3.098260e-05
29.	-2.83375e+10, 188.449, 0, -2.83375e+10 (97.4736%), 3.408086e-05
30.	-2.83467e+10, 189.693, 0, -2.83467e+10 (97.4639%), 3.748895e-05
31.	-2.83527e+10, 190.962, 0, -2.83527e+10 (97.4574%), 4.123785e-05
32.	-2.83596e+10, 192.094, 0, -2.83596e+10 (97.4502%), 4.536163e-05
33.	-2.83607e+10, 193.809, 0, -2.83607e+10 (97.449%), 4.989779e-05
34.	-2.83729e+10, 195.03, 0, -2.83729e+10 (97.4359%), 5.488757e-05
35.	-2.83996e+10, 197.003, 0, -2.83996e+10 (97.4075%), 6.037633e-05
36.	-2.84036e+10, 198.989, 0, -2.84036e+10 (97.4033%), 6.641396e-05
37.	-2.84116e+10, 200.11, 0, -2.84116e+10 (97.3948%), 3.652768e-05
38.	-2.84172e+10, 201.545, 0, -2.84172e+10 (97.3888%), 4.018045e-05
39.	-2.8431e+10, 202.728, 0, -2.8431e+10 (97.3741%), 4.419849e-05
	E, E_velocity, E_rate, E_image (E_image %), LearningRate
40.	-2.8432e+10, 203.508, 0, -2.8432e+10 (97.373%), 2.430917e-05
41.	-2.84385e+10, 204.241, 0, -2.84385e+10 (97.3661%), 2.674009e-05
42.	-2.8445e+10, 205.156, 0, -2.8445e+10 (97.3592%), 2.941410e-05
43.	-2.84453e+10, 205.64, 0, -2.84453e+10 (97.3589%), 1.617775e-05
44.	-2.84456e+10, 206.227, 0, -2.84456e+10 (97.3585%), 1.779553e-05
45.	-2.84461e+10, 206.956, 0, -2.84461e+10 (97.358%), 1.957508e-05
46.	-2.8454e+10, 207.796, 0, -2.8454e+10 (97.3496%), 2.153259e-05
47.	-2.84564e+10, 208.677, 0, -2.84564e+10 (97.347%), 2.368585e-05
48.	-2.8458e+10, 209.661, 0, -2.8458e+10 (97.3453%), 2.605443e-05
49.	-2.84635e+10, 210.8, 0, -2.84635e+10 (97.3395%), 2.865988e-05
50.	-2.84705e+10, 212.046, 0, -2.84705e+10 (97.3321%), 3.152586e-05
51.	-2.84744e+10, 213.406, 0, -2.84744e+10 (97.3279%), 3.467845e-05
52.	-2.84805e+10, 214.891, 0, -2.84805e+10 (97.3214%), 3.814630e-05
53.	-2.84848e+10, 216.059, 0, -2.84848e+10 (97.3168%), 4.196092e-05
54.	-2.84897e+10, 216.874, 0, -2.84897e+10 (97.3116%), 2.307851e-05
55.	-2.8496e+10, 217.721, 0, -2.8496e+10 (97.3049%), 2.538636e-05
56.	-2.84962e+10, 217.848, 0, -2.84962e+10 (97.3046%), 3.490624e-06
57.	-2.84967e+10, 217.988, 0, -2.84967e+10 (97.3041%), 3.839687e-06
58.	-2.84977e+10, 218.14, 0, -2.84977e+10 (97.3031%), 4.223656e-06
59.	-2.84986e+10, 218.307, 0, -2.84986e+10 (97.3021%), 4.646021e-06
	E, E_velocity, E_rate, E_image (E_image %), LearningRate
60.	-2.84994e+10, 218.491, 0, -2.84994e+10 (97.3013%), 5.110623e-06
61.	-2.85002e+10, 218.688, 0, -2.85002e+10 (97.3004%), 5.621686e-06
62.	-2.8501e+10, 218.908, 0, -2.8501e+10 (97.2995%), 6.183854e-06
63.	-2.85017e+10, 219.151, 0, -2.85017e+10 (97.2988%), 6.802240e-06
64.	-2.8502e+10, 219.417, 0, -2.8502e+10 (97.2985%), 7.482463e-06
65.	-2.85021e+10, 219.713, 0, -2.85021e+10 (97.2984%), 8.230710e-06
E = -2.85021e+10 (97.2984%)
Length = 14.7413
Time = 859.51s (14.3252m)

Step 2: alpha=0.01, beta=0.05, scale=1.0
	E, E_velocity, E_rate, E_image (E_image %), LearningRate
0.	-2.79487e+10, 0.225165, 0, -2.79487e+10 (99.7131%), 1.100000e-03
1.	-2.80911e+10, 0.657078, 0, -2.80911e+10 (99.5564%), 1.210000e-03
2.	-2.82096e+10, 1.40033, 0, -2.82096e+10 (99.426%), 1.331000e-03
3.	-2.83215e+10, 2.4675, 0, -2.83215e+10 (99.3029%), 1.464100e-03
4.	-2.84278e+10, 4.00839, 0, -2.84278e+10 (99.1859%), 1.610510e-03
5.	-2.8444e+10, 6.02759, 0, -2.8444e+10 (99.1681%), 1.771561e-03
6.	-2.85619e+10, 7.267, 0, -2.85619e+10 (99.0384%), 9.743586e-04
7.	-2.85982e+10, 8.57351, 0, -2.85982e+10 (98.9984%), 1.071794e-03
8.	-2.86598e+10, 10.2928, 0, -2.86598e+10 (98.9307%), 1.178974e-03
9.	-2.87322e+10, 11.0532, 0, -2.87322e+10 (98.8511%), 6.484356e-04
10.	-2.87736e+10, 12.1196, 0, -2.87736e+10 (98.8056%), 7.132792e-04
11.	-2.88072e+10, 13.3442, 0, -2.88072e+10 (98.7686%), 7.846071e-04
12.	-2.88431e+10, 14.7368, 0, -2.88431e+10 (98.7291%), 8.630678e-04
13.	-2.88844e+10, 16.326, 0, -2.88844e+10 (98.6836%), 9.493746e-04
14.	-2.89245e+10, 18.1512, 0, -2.89245e+10 (98.6395%), 1.044312e-03
15.	-2.89683e+10, 20.2257, 0, -2.89683e+10 (98.5913%), 1.148743e-03
16.	-2.90182e+10, 22.6576, 0, -2.90182e+10 (98.5364%), 1.263618e-03
17.	-2.90674e+10, 25.4776, 0, -2.90674e+10 (98.4823%), 1.389979e-03
18.	-2.91035e+10, 28.6885, 0, -2.91035e+10 (98.4426%), 1.528977e-03
19.	-2.91557e+10, 32.3825, 0, -2.91557e+10 (98.3851%), 1.681875e-03
	E, E_velocity, E_rate, E_image (E_image %), LearningRate
20.	-2.91729e+10, 34.3973, 0, -2.91729e+10 (98.3663%), 9.250312e-04
21.	-2.92164e+10, 36.7224, 0, -2.92164e+10 (98.3184%), 1.017534e-03
22.	-2.92432e+10, 37.9669, 0, -2.92432e+10 (98.2889%), 5.596439e-04
23.	-2.92655e+10, 39.346, 0, -2.92655e+10 (98.2644%), 6.156083e-04
24.	-2.92817e+10, 40.8653, 0, -2.92817e+10 (98.2465%), 6.771691e-04
25.	-2.93056e+10, 42.5879, 0, -2.93056e+10 (98.2202%), 7.448860e-04
26.	-2.93208e+10, 44.5144, 0, -2.93208e+10 (98.2035%), 8.193746e-04
27.	-2.93515e+10, 46.6304, 0, -2.93515e+10 (98.1697%), 9.013121e-04
28.	-2.93573e+10, 49.0295, 0, -2.93573e+10 (98.1633%), 9.914433e-04
29.	-2.93746e+10, 51.7757, 0, -2.93746e+10 (98.1444%), 1.090588e-03
30.	-2.93999e+10, 53.2179, 0, -2.93999e+10 (98.1165%), 5.998232e-04
31.	-2.94268e+10, 54.9454, 0, -2.94268e+10 (98.0869%), 6.598055e-04
32.	-2.94287e+10, 56.7672, 0, -2.94287e+10 (98.0849%), 7.257861e-04
33.	-2.94556e+10, 58.8488, 0, -2.94556e+10 (98.0553%), 7.983647e-04
34.	-2.94749e+10, 59.938, 0, -2.94749e+10 (98.034%), 4.391006e-04
35.	-2.94889e+10, 61.1961, 0, -2.94889e+10 (98.0186%), 4.830106e-04
36.	-2.95012e+10, 62.5881, 0, -2.95012e+10 (98.0051%), 5.313117e-04
37.	-2.95145e+10, 64.114, 0, -2.95145e+10 (97.9905%), 5.844429e-04
38.	-2.95283e+10, 65.79, 0, -2.95283e+10 (97.9753%), 6.428872e-04
39.	-2.95427e+10, 67.6533, 0, -2.95427e+10 (97.9594%), 7.071759e-04
	E, E_velocity, E_rate, E_image (E_image %), LearningRate
40.	-2.95576e+10, 69.7254, 0, -2.95576e+10 (97.9431%), 7.778935e-04
41.	-2.95789e+10, 72.0562, 0, -2.95789e+10 (97.9196%), 8.556828e-04
42.	-2.95877e+10, 74.6456, 0, -2.95877e+10 (97.9099%), 9.412511e-04
43.	-2.96063e+10, 77.5045, 0, -2.96063e+10 (97.8895%), 1.035376e-03
44.	-2.96217e+10, 79.0024, 0, -2.96217e+10 (97.8725%), 5.694569e-04
45.	-2.9642e+10, 80.7719, 0, -2.9642e+10 (97.8502%), 6.264026e-04
46.	-2.96507e+10, 82.6547, 0, -2.96507e+10 (97.8406%), 6.890429e-04
47.	-2.96696e+10, 84.8744, 0, -2.96696e+10 (97.8199%), 7.579471e-04
48.	-2.96734e+10, 87.2458, 0, -2.96734e+10 (97.8157%), 8.337419e-04
49.	-2.96917e+10, 90.0189, 0, -2.96917e+10 (97.7955%), 9.171160e-04
50.	-2.97026e+10, 91.4137, 0, -2.97026e+10 (97.7835%), 5.044138e-04
51.	-2.97205e+10, 93.0781, 0, -2.97205e+10 (97.7639%), 5.548552e-04
52.	-2.97283e+10, 94.8869, 0, -2.97283e+10 (97.7553%), 6.103407e-04
53.	-2.97427e+10, 96.9503, 0, -2.97427e+10 (97.7394%), 6.713748e-04
54.	-2.97515e+10, 99.1952, 0, -2.97515e+10 (97.7297%), 7.385123e-04
55.	-2.97656e+10, 101.685, 0, -2.97656e+10 (97.7142%), 8.123635e-04
56.	-2.97659e+10, 104.42, 0, -2.97659e+10 (97.7139%), 8.935999e-04
57.	-2.97756e+10, 107.51, 0, -2.97756e+10 (97.7032%), 9.829598e-04
58.	-2.97982e+10, 109.026, 0, -2.97982e+10 (97.6783%), 5.406279e-04
59.	-2.98143e+10, 110.836, 0, -2.98143e+10 (97.6606%), 5.946907e-04
	E, E_velocity, E_rate, E_image (E_image %), LearningRate
60.	-2.98195e+10, 112.793, 0, -2.98195e+10 (97.6549%), 6.541598e-04
61.	-2.98348e+10, 115.048, 0, -2.98348e+10 (97.6381%), 7.195757e-04
62.	-2.9843e+10, 116.233, 0, -2.9843e+10 (97.629%), 3.957667e-04
63.	-2.98509e+10, 117.628, 0, -2.98509e+10 (97.6204%), 4.353433e-04
64.	-2.98598e+10, 119.148, 0, -2.98598e+10 (97.6106%), 4.788777e-04
65.	-2.98676e+10, 120.83, 0, -2.98676e+10 (97.602%), 5.267654e-04
66.	-2.98765e+10, 122.681, 0, -2.98765e+10 (97.5921%), 5.794420e-04
67.	-2.98865e+10, 124.728, 0, -2.98865e+10 (97.5812%), 6.373862e-04
68.	-2.9895e+10, 126.932, 0, -2.9895e+10 (97.5718%), 7.011248e-04
69.	-2.99028e+10, 129.447, 0, -2.99028e+10 (97.5633%), 7.712373e-04
70.	-2.99078e+10, 132.082, 0, -2.99078e+10 (97.5578%), 8.483610e-04
71.	-2.99248e+10, 133.639, 0, -2.99248e+10 (97.539%), 4.665985e-04
72.	-2.99355e+10, 135.247, 0, -2.99355e+10 (97.5273%), 5.132584e-04
73.	-2.9945e+10, 137.13, 0, -2.9945e+10 (97.5169%), 5.645842e-04
74.	-2.99555e+10, 139.184, 0, -2.99555e+10 (97.5053%), 6.210427e-04
75.	-2.99658e+10, 141.445, 0, -2.99658e+10 (97.4939%), 6.831469e-04
76.	-2.99737e+10, 143.893, 0, -2.99737e+10 (97.4853%), 7.514616e-04
77.	-2.99806e+10, 146.705, 0, -2.99806e+10 (97.4777%), 8.266078e-04
78.	-2.99918e+10, 148.141, 0, -2.99918e+10 (97.4653%), 4.546343e-04
79.	-3.00016e+10, 149.84, 0, -3.00016e+10 (97.4546%), 5.000977e-04
	E, E_velocity, E_rate, E_image (E_image %), LearningRate
80.	-3.00094e+10, 151.641, 0, -3.00094e+10 (97.446%), 5.501075e-04
81.	-3.00156e+10, 153.678, 0, -3.00156e+10 (97.4392%), 6.051182e-04
82.	-3.00233e+10, 155.867, 0, -3.00233e+10 (97.4307%), 6.656301e-04
83.	-3.0029e+10, 158.406, 0, -3.0029e+10 (97.4245%), 7.321931e-04
84.	-3.00339e+10, 161.055, 0, -3.00339e+10 (97.4191%), 8.054124e-04
85.	-3.00345e+10, 164.26, 0, -3.00345e+10 (97.4184%), 8.859536e-04
86.	-3.00546e+10, 165.689, 0, -3.00546e+10 (97.3962%), 4.872745e-04
87.	-3.00603e+10, 167.653, 0, -3.00603e+10 (97.39%), 5.360019e-04
88.	-3.0071e+10, 169.629, 0, -3.0071e+10 (97.3782%), 5.896021e-04
89.	-3.00771e+10, 171.945, 0, -3.00771e+10 (97.3715%), 6.485623e-04
90.	-3.00827e+10, 174.42, 0, -3.00827e+10 (97.3654%), 7.134186e-04
91.	-3.00927e+10, 177.335, 0, -3.00927e+10 (97.3543%), 7.847604e-04
92.	-3.01025e+10, 178.722, 0, -3.01025e+10 (97.3436%), 4.316182e-04
93.	-3.01102e+10, 180.408, 0, -3.01102e+10 (97.3351%), 4.747801e-04
94.	-3.01161e+10, 182.232, 0, -3.01161e+10 (97.3286%), 5.222581e-04
95.	-3.01234e+10, 184.266, 0, -3.01234e+10 (97.3206%), 5.744839e-04
96.	-3.01281e+10, 186.512, 0, -3.01281e+10 (97.3154%), 6.319323e-04
97.	-3.01405e+10, 189.088, 0, -3.01405e+10 (97.3018%), 6.951255e-04
98.	-3.0142e+10, 190.399, 0, -3.0142e+10 (97.3001%), 3.823190e-04
99.	-3.01501e+10, 191.933, 0, -3.01501e+10 (97.2912%), 4.205509e-04
E = -3.01501e+10 (97.2912%)
Length = 9.27708
Time = 1622.24s (27.0373m)

Evaluation using checkerboard

We can evaluate the registration by generating a checkerboard of the deformed input and reference image. In this method the input image is placed on the black squares of the metaphorical checkerboard while the reference image is placed on the red squares. Idealy anatomical sturctures should line up across squares.


In [10]:
imgShow(imgChecker(inImg_lddmm, refImg, useHM=False), numSlices=1)



In [11]:
imgWrite(inImg_lddmm, "/cis/home/kwame/defAtlas.img")

In [12]:
imgWrite(imgChecker(inImg_lddmm, refImg, useHM=False),"/cis/home/kwame/checker.img")

In [17]:
inAnno = imgRead("/cis/home/leebc/Projects/Mouse_Histology/figures/for_kwame/annotation_40_full_withoutOB_rescaled.img")
inAnno_affine = imgApplyAffine(inAnno, affine, size=refImg.GetSize(), useNearest=True)
inAnno_lddmm = imgApplyField(inAnno_affine, field, size=refImg.GetSize(), useNearest=True)
imgWrite(inAnno_lddmm, "/cis/home/kwame/sharedData/forBrian/defAtlasAnno.img")

In [18]:
imgWrite(field,"/cis/home/kwame/sharedData/forBrian/field.vtk")
imgWrite(invField,"/cis/home/kwame/sharedData/forBrian/invField.vtk")

In [19]:
txtWriteList(affine, "/cis/home/kwame/sharedData/forBrian/affine.tex")

In [ ]: