Commit 27dd3f40 authored by Alexandre Bône's avatar Alexandre Bône

Cleans a bit the atlas-skull example.

parent 8b5b6de2
Pipeline #50174445 failed with stages
in 19 minutes and 56 seconds
-84.9822 -35.0196
-84.9822 4.98038
-84.9822 44.9804
-84.9822 84.9804
-44.9822 -35.0196
-44.9822 4.98038
-44.9822 44.9804
-44.9822 84.9804
-4.98224 -35.0196
-4.98224 4.98038
-4.98224 44.9804
-4.98224 84.9804
35.0178 -35.0196
35.0178 4.98038
35.0178 44.9804
35.0178 84.9804
5 16 2
3.09755852004 5.16785964929
5.25370061374 5.06673811888
7.26559358602 -3.0606204439
6.20410877606 -7.38719516899
0.265507111093 5.54223356489
-0.249039310962 10.4630676717
0.678518384579 0.742768249009
2.04186576756 -8.43417108245
-3.20864627464 -5.58254131302
0.452508657239 3.21823736699
-0.263704408659 -1.47890187986
-2.92275003647 -8.37181243207
-1.00304492936 1.51115903631
-5.65021098775 -1.05319475872
-8.75318444334 -3.00909034116
-5.62058691308 -5.69626824837
3.1340703913 4.24724700302
1.0587719928 0.681084718788
1.39573264122 -2.04559460416
2.3259559432 -2.95599151216
3.40435080463 4.87919120328
2.50042283925 -1.62817485502
1.75580747687 -3.64219317799
1.11226840888 -4.49206481781
1.8199696485 -0.00652001239359
4.21319512092 -3.07520839758
3.36930769996 -6.28372094594
-0.845697947778 -5.49256679229
0.632164234295 -2.89130553044
0.383632053854 -3.22639750876
2.25494736875 -5.16455458291
-1.58707889821 -3.81113321241
4.53765352909 6.37661625864
6.62863750802 4.48137121694
6.6319773756 -1.84261574247
3.86910980009 -3.97518063616
-0.136498466454 5.4832191742
-0.682491268613 4.56677026814
0.625723658712 -1.86117105182
1.09918221249 -5.95881983172
-4.24944505095 -1.54547270667
-1.01471930929 1.38376337616
1.65051018124 -2.48498136923
-1.86586526941 -6.69576670043
5.75372204743 -2.55761796609
-1.75136440457 -0.0129735320807
-2.41491873749 0.479064876214
-3.30596923828 -4.06233084854
0.133517464623 0.638798620086
-7.24655290251 -2.14594727563
-12.5218164795 2.77441228123
-6.96684550494 5.08993312391
3.55355617171 2.60565468064
2.40597730805 -5.78190467122
-0.829276286589 -1.40114891463
-2.01934750591 4.44012306552
3.70715021156 -0.543488126452
4.61289451271 -4.27198278694
3.0182337882 -4.07696406636
1.83666289249 3.51084992877
9.75255342387 -10.1581557915
6.20307433271 -3.84662426263
4.00365968122 -2.89435387962
1.80971412314 1.68452836317
-1.99830189091 -3.10428467626
-4.90928057441 -5.57975549414
-6.6415707767 2.20907864766
-5.54024391621 6.37001413852
4.16074832715 1.31970676826
1.18473059288 -12.1766366768
-0.166965304285 -1.5844158062
-1.88887958694 8.75540891755
6.06948415097 1.34825419402
3.87683343654 -9.50024692388
4.1956496248 -3.79841707228
3.73546119849 8.29488473467
4.94156169007 -4.57711366564
3.74673266552 -3.79173998348
6.99877470289 -2.02666445123
5.67452162481 5.17394350248
......@@ -12,8 +12,6 @@
<kernel-width>20</kernel-width>
<kernel-type>keops</kernel-type>
<noise-std>1</noise-std>
<!--<noise-variance-prior-normalized-dof>10</noise-variance-prior-normalized-dof>-->
<!--<noise-variance-prior-scale-std>1</noise-variance-prior-scale-std>-->
<filename>data/template.vtk</filename>
</object>
</template>
......
......@@ -2,5 +2,4 @@
<optimization-parameters>
<optimization-method-type>GradientAscent</optimization-method-type>
<use-sobolev-gradient>On</use-sobolev-gradient>
<max-iterations>30</max-iterations>
</optimization-parameters>
-84.9822 -35.0196
-84.9822 4.98038
-84.9822 44.9804
-84.9822 84.9804
-44.9822 -35.0196
-44.9822 4.98038
-44.9822 44.9804
-44.9822 84.9804
-4.98224 -35.0196
-4.98224 4.98038
-4.98224 44.9804
-4.98224 84.9804
35.0178 -35.0196
35.0178 4.98038
35.0178 44.9804
35.0178 84.9804
5 16 2
3.09755852004 5.16785964929
5.25370061374 5.06673811888
7.26559358602 -3.0606204439
6.20410877606 -7.38719516899
0.265507111093 5.54223356489
-0.249039310962 10.4630676717
0.678518384579 0.742768249009
2.04186576756 -8.43417108245
-3.20864627464 -5.58254131302
0.452508657239 3.21823736699
-0.263704408659 -1.47890187986
-2.92275003647 -8.37181243207
-1.00304492936 1.51115903631
-5.65021098775 -1.05319475872
-8.75318444334 -3.00909034116
-5.62058691308 -5.69626824837
3.1340703913 4.24724700302
1.0587719928 0.681084718788
1.39573264122 -2.04559460416
2.3259559432 -2.95599151216
3.40435080463 4.87919120328
2.50042283925 -1.62817485502
1.75580747687 -3.64219317799
1.11226840888 -4.49206481781
1.8199696485 -0.00652001239359
4.21319512092 -3.07520839758
3.36930769996 -6.28372094594
-0.845697947778 -5.49256679229
0.632164234295 -2.89130553044
0.383632053854 -3.22639750876
2.25494736875 -5.16455458291
-1.58707889821 -3.81113321241
4.53765352909 6.37661625864
6.62863750802 4.48137121694
6.6319773756 -1.84261574247
3.86910980009 -3.97518063616
-0.136498466454 5.4832191742
-0.682491268613 4.56677026814
0.625723658712 -1.86117105182
1.09918221249 -5.95881983172
-4.24944505095 -1.54547270667
-1.01471930929 1.38376337616
1.65051018124 -2.48498136923
-1.86586526941 -6.69576670043
5.75372204743 -2.55761796609
-1.75136440457 -0.0129735320807
-2.41491873749 0.479064876214
-3.30596923828 -4.06233084854
0.133517464623 0.638798620086
-7.24655290251 -2.14594727563
-12.5218164795 2.77441228123
-6.96684550494 5.08993312391
3.55355617171 2.60565468064
2.40597730805 -5.78190467122
-0.829276286589 -1.40114891463
-2.01934750591 4.44012306552
3.70715021156 -0.543488126452
4.61289451271 -4.27198278694
3.0182337882 -4.07696406636
1.83666289249 3.51084992877
9.75255342387 -10.1581557915
6.20307433271 -3.84662426263
4.00365968122 -2.89435387962
1.80971412314 1.68452836317
-1.99830189091 -3.10428467626
-4.90928057441 -5.57975549414
-6.6415707767 2.20907864766
-5.54024391621 6.37001413852
4.16074832715 1.31970676826
1.18473059288 -12.1766366768
-0.166965304285 -1.5844158062
-1.88887958694 8.75540891755
6.06948415097 1.34825419402
3.87683343654 -9.50024692388
4.1956496248 -3.79841707228
3.73546119849 8.29488473467
4.94156169007 -4.57711366564
3.74673266552 -3.79173998348
6.99877470289 -2.02666445123
5.67452162481 5.17394350248
<?xml version="1.0"?>
<model>
<model-type>DeterministicAtlas</model-type>
<!-- <model-type>BayesianAtlas</model-type> -->
<!-- <model-type>DeterministicAtlas</model-type> -->
<model-type>BayesianAtlas</model-type>
<dimension>2</dimension>
<template>
<object id="skull">
<deformable-object-type>Polyline</deformable-object-type>
<attachment-type>Varifold</attachment-type>
<attachment-type>varifold</attachment-type>
<kernel-width>20</kernel-width>
<kernel-type>keops</kernel-type>
<noise-std>1</noise-std>
<!--<noise-variance-prior-normalized-dof>10</noise-variance-prior-normalized-dof>-->
<!--<noise-variance-prior-scale-std>1</noise-variance-prior-scale-std>-->
<filename>data/template.vtk</filename>
<!-- <noise-std>1</noise-std> -->
<!-- <noise-variance-prior-normalized-dof>10</noise-variance-prior-normalized-dof> -->
<!-- <noise-variance-prior-scale-std>1</noise-variance-prior-scale-std> -->
<filename>output_deterministic/DeterministicAtlas__EstimatedParameters__Template_skull.vtk</filename>
<!--<filename>data/template.vtk</filename>-->
</object>
</template>
......@@ -23,7 +24,7 @@
<kernel-type>keops</kernel-type>
</deformation-parameters>
<!--<initial-control-points>data/Atlas_ControlPoints.txt</initial-control-points>-->
<!--<initial-momenta>data/ForInitialization_Momenta_AlmostPerfect.txt</initial-momenta>-->
<initial-control-points>output_deterministic/DeterministicAtlas__EstimatedParameters__ControlPoints.txt</initial-control-points>
<initial-momenta>output_deterministic/DeterministicAtlas__EstimatedParameters__Momenta.txt</initial-momenta>
</model>
<?xml version="1.0"?>
<optimization-parameters>
<optimization-method-type>GradientAscent</optimization-method-type>
<!--<optimization-method-type>ScipyLBFGS</optimization-method-type>-->
<max-iterations>200</max-iterations>
<use-sobolev-gradient>On</use-sobolev-gradient>
<max-iterations>20</max-iterations>
</optimization-parameters>
<?xml version="1.0"?>
<model>
<model-type>DeterministicAtlas</model-type>
<model-type>BayesianAtlas</model-type>
<dimension>3</dimension>
<template>
<object id="amygdala">
......
......@@ -239,8 +239,8 @@ class BayesianAtlas(AbstractStatisticalModel):
# Empirical residuals variances, for each object.
sufficient_statistics['S2'] = np.zeros((self.number_of_objects,))
for k in range(self.number_of_objects):
sufficient_statistics['S2'][k] = residuals[k].detach().cpu().numpy()
for i in range(dataset.number_of_subjects):
sufficient_statistics['S2'] += residuals[i].detach().cpu().numpy()
# Finalization -------------------------------------------------------------------------------------------------
return sufficient_statistics
......@@ -261,7 +261,7 @@ class BayesianAtlas(AbstractStatisticalModel):
prior_scale_scalars = self.priors['noise_variance'].scale_scalars
prior_dofs = self.priors['noise_variance'].degrees_of_freedom
for k in range(self.number_of_objects):
noise_variance[k] = (sufficient_statistics['S2'] + prior_scale_scalars[k] * prior_dofs[k]) \
noise_variance[k] = (sufficient_statistics['S2'][k] + prior_scale_scalars[k] * prior_dofs[k]) \
/ float(dataset.number_of_subjects * self.objects_noise_dimension[k] + prior_dofs[k])
self.set_noise_variance(noise_variance)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment