All the examples can be downloaded here.

## Overview

Bayesian version of the deterministic atlas. In addition to the template and the registrations, the variability of the geometry and the data noise are learned. The geometrical variability is represented by a symmetric-positive definite matrix, with which new momenta could be randomly sampled through a multivariate gaussian distribution. The data noise is represented by a single scalar, which is arbitrarily given by the user in the deterministic atlas model through the `noise-std`

entry.

For more details, see [Gori et al. 2017]

## Pre-processing

It can be delicate to estimate a bayesian atlas from scratch. A good practice is to first estimate a deterministic one, before running the bayesian atlas pipeline initialized with the estimated template, control points and momenta.

## Tutorial

If you have followed the deterministic atlas tutorial, you already have generated an "output" folder containing the deterministic atlas results. Let's archive those results by renaming this output folder as `output_deterministic`

. Then adapt the `model.xml`

file in order to estimate a bayesian atlas, initialized with the results of the deterministic one:

- set the model-type entry to
`BayesianAtlas`

, - modify the initial template filename,
- add the tags
`<initial-control-points> [...] </initial-control-points>`

and`<initial-momenta> [...] </initial-momenta>`

.

Your `model.xml`

file should now look like:

```
<?xml version="1.0"?>
<model>
<model-type>BayesianAtlas</model-type>
<dimension>2</dimension>
<template>
<object id="skull">
<deformable-object-type>Polyline</deformable-object-type>
<attachment-type>varifold</attachment-type>
<kernel-width>20</kernel-width>
<kernel-type>keops</kernel-type>
<filename>output_deterministic/DeterministicAtlas__EstimatedParameters__Template_skull.vtk</filename>
</object>
</template>
<deformation-parameters>
<kernel-width>40</kernel-width>
<kernel-type>keops</kernel-type>
</deformation-parameters>
<initial-control-points>output_deterministic/DeterministicAtlas__EstimatedParameters__ControlPoints.txt</initial-control-points>
<initial-momenta>output_deterministic/DeterministicAtlas__EstimatedParameters__Momenta.txt</initial-momenta>
</model>
```

Note that you can remove the `noise-std`

entry, as it is ignored in the bayesian atlas case. This parameter will indeed be estimated directly from the data.

Now run `deformetrica estimate model.xml data_set.xml -p optimization_parameters.xml --output=output_bayesian -v DEBUG`

.

Here are superimposed the template estimated with the deterministic atlas (in black), and the template refined with the bayesian atlas (in blue). A small but typical difference can be observed with the neck region, which is more sharply drawn.

Theoretical discussions argue that the bayesian atlas should estimate more relevant templates, i.e. more representative of the considered dataset. On the other hand, the "reconstructed" observations might be less tightly fitted by this statistical model. In other words, the bayesian atlas is less well-suited for registration purposes, but offers a finer estimate of the template shape.

## Estimation with the MCMC-SAEM

Scheduled for Deformetrica 4.2.0.