1 Introduction

In any modern neuroimaging study non-linear registration is an essential step, allowing for the quantitative analysis of form, such as detecting changes in brain shape and size, or the precise alignment of the anatomy required for functional group studies. To be useful, non-linear registration methods must be both accurate and computationally efficient [1]. The former reduces the inter-subject anatomical variability allowing identification of small anatomical or functional changes between groups, while the latter is required to enable timely analysis of large datasets [7]. Additionally, non-linear registration should generate well-behaved spatial transformations that best align two images [16]. To achieve this, most typical algorithms [2, 3, 12, 16] constrain the displacement fields to diffeomorphic deformations (i.e. deformations fields which have an inverse, and both the field and its inverse are differentiable).

The demons algorithm, as originally introduced by Thirion [14], presented a step forward in both speed and accuracy. He proposed a method that alternates between the computation of the demons forces (inspired from Maxwell’s Demons, and optical flow equations) and a Gaussian smoothing regularization. This allowed dense correspondences within a computationally efficient algorithm.

Due to its success and implementation simplicity further developments were proposed to improve convergence speed and precision, such as the introduction of a normalization factor \(\alpha \) [5] bounding the step size, and the addition of an “active” force [17] based in the moving image gradient. To extend the classical demons algorithm to provide diffeomorphic transformations, Vercauteren et al. [15] proposed looking for an update step u on the Lie algebra and then mapping it to the space of diffeomorphisms through the exponential map; and later [16] suggested an extension of the demons algorithm to work completely in the log domain, showing improvements over the diffeomorphic-demons. To improve the demons algorithm to intensity inhomogeneities and contrast changes other similarity metrics such as the local cross correlation (LCC [4, 7]) or the point-wise mutual information (PMI [8]) were further proposed.

While subsequent extensions of the demons algorithm showed better total accuracy and higher accuracy per iteration, they also increased the computational cost at each iteration.

Here we propose an adaptation of the demons algorithm to improve total convergence speed of all demon-like variants without compromising on accuracy. The remainder of this paper is organized as follows: the demons framework is presented in Sect. 2 followed by the introduction of the Inertial Demons; both the original and proposed demons are evaluated in Sect. 3; final remarks regarding the applicability of this extension to other non-linear registration approaches are presented in Sect. 4.

2 Demons Framework

2.1 Demons as a Minimization Problem

In non-linear registration, the transformation T(x) that best aligns a source image \(I_0(x)\) to a reference image \(I_1(x)\) is obtained by the optimization of a similarity function \(Sim(I_1(x),I_0(T(x))\). Classically, in intensity-based methods the sum of square differences (SSD) is used as the similarity metric, Eq. 1:

$$\begin{aligned} Sim=\sum \left( I_1(x) - I_0(T(x))\right) ^2 \end{aligned}$$
(1)

Since the optimization of the Sim term alone is ill-posed, a regularization term Reg(T(x)) is usually added to the global energy function E, Eq. 2:

$$\begin{aligned} E(T(x))=Sim(I_1(x),I_0(T(x)) + Reg(T(x)) \end{aligned}$$
(2)

The demons algorithm can then be seen as the optimization of Eq. 2 with the addition of a hidden correspondences C(x) variable [4] that allows the alternate optimization of the similarity and regularization terms, Eq. 3.

$$\begin{aligned} E(C(x),T(x))=Sim(I_1(x),I_0(C(x)) + \sigma \left\| C(x)-T(x) \right\| ^2 + Reg(T(x)) \end{aligned}$$
(3)

One first optimizes \(Sim(I_1(x),I_0(C(x)) + \sigma \left\| C(x)-T(x) \right\| ^2\) with respect to C(x) and with T(x) fixed, and then optimizes \(\sigma \left\| C(x)-T(x) \right\| ^2 + Reg(T(x))\) with respect to T(x) with C(x) fixed. The minimization of the second term is usually obtained by the convolution of the global transformation with a Gaussian kernel, yet more complex approaches such as the use of edge preserving filters have also been proposed [6].

2.2 Demons Forces

In the classical demons the minimization of the first term is performed through the computation of Thirion’s “fixed” demons force, Eq. 4, which was shown to be equivalent to the second order gradient descendent with the SSD as the similarity term [11].

$$\begin{aligned} u(x)= (I_1(x)-I_0(T(x)))\frac{\triangledown I_1(x)}{\left\| \triangledown I_1(x) \right\| ^2+\alpha ^2(I_1(x)-I_0(T(x)))^2} \end{aligned}$$
(4)

Following this framework one can instead derive different demons forces through different minimization procedures. Of particular interest in this work are the symmetric Sym forces, Eq. 5, obtained through the Efficient Second-order Minimization (ESM) [9].

$$\begin{aligned} u(x)=2(I_1(x)-I_0(T(x)))\frac{\triangledown I_1(x)+\triangledown I_0(T(x))}{\left\| \triangledown I_1(x) +\triangledown I_0(T(x)) \right\| ^2+\alpha ^2(I_1(x)-I_0(T(x)))^2} \end{aligned}$$
(5)

2.3 Demons Composition

As non-linear registration should present desirable properties such as diffeomorphism, Vercauteren et al. [15] proposed looking for an update step u(x) on the Lie algebra and then mapping it to the space of diffeomorphisms through the exponential map, Eq. 6,

$$\begin{aligned} T(x)\leftarrow T(x)\circ exp\left( u(x)\right) \end{aligned}$$
(6)

and later [16] suggested to work completely in the log-domain, by considering the spatial transformations as exponentials of smooth velocity fields, Eq. 7, with the advantage of having access to the true inverse transformation.

$$\begin{aligned} \left\{ \begin{matrix} v(x)\leftarrow v(x)\circ u(x) \\ \\ T(x)=exp\left( v(x)\right) \end{matrix}\right. \end{aligned}$$
(7)

Although both these approaches are particularly attractive (since the exponential map can be efficiently approximated by the scaling and squaring approach [10]), it can still be computationally demanding if the magnitudes of the velocity field (in the case of the log-demons) or the update field (in the diffeomorphic-demons) are large. On the other hand, diffeomorphic registration can also be achieved by composing u(x) to T(x) while constraining u(x) to small optimization steps (by treating the voxels as B-Spline control points, it can be shown that a maximal displacement of 0.4 leads to a diffeomorphic field [12, 18]), Eq. 8.

$$\begin{aligned} \left\{ \begin{matrix} \left\| u(x) \right\| \leqslant 0.4 \\ \\ T(x)\leftarrow T(x)\circ u(x) \end{matrix}\right. \end{aligned}$$
(8)

2.4 Demons Momentum

Although computationally efficient, the demons framework relies on forces derived from the images’ gradients (e.g. Eqs. 4 and 5). This fundamentally limits the ability of demons algorithms to converge quickly where gradients are scarce or non-existent (such as homogeneous regions or texture-less images).

To overcome this deficiency, multilevel frameworks are typically employed. Such approaches attempt to retrieve large deformations by sub-sampling the space of deformations, and progressively increasing the resolution to resolve local deformations. However, they do not solve the intrinsic problem of gradient-based methods within each level. Other approaches such as using preconditioning schemes have also been proposed [19].

Here we propose to use the previous update field \(u(x)^{[n-1]}\), Eq. 9, as a predictive update step for the subsequent iteration [n].

$$\begin{aligned} p(x)^{[n]} \leftarrow \alpha \times u(x)^{[n-1]} \end{aligned}$$
(9)

The momentum term p(x) simply adds a fraction of the previous update field to the current one \(u(x)^{[n]}\), controlled by a constant \(\alpha \) between [0,1]Footnote 1, Eq. 10.

$$\begin{aligned} u(x)^{[n]} \leftarrow u(x)^{[n]} \circ \alpha \times p(x)^{[n]} \end{aligned}$$
(10)

Here the system is seen as having an inertia preventing sudden changes in u(x). When the image gradient and the momentum have the same direction, this leads to an increase in step size towards the minimum. When they have different directions this approach leads to smoother updates. Since it is also desirable for T(x) to be part of a diffeomorphic group \(\mathscr {D}\), the inclusion of the momentum term should not change the behaviour of each approach presented in Sect. 2.3. Here we show that these conditions still apply with the use of momentum.

Diffeomorphic-demons: Since \((exp(\nicefrac {u(x)}{A})^{A}\subseteq \mathscr {D})\) if \((\left\| \nicefrac {u(x)}{A} \right\| \leqslant 0.4)\), through the scaling and squaring approach, then \((exp(\nicefrac {u(x)}{B})^{B} \subseteq \mathscr {D})\) if \((\left\| \nicefrac {u(x)\circ p(x)}{B} \right\| \leqslant 0.4)\), with \(\{A,B\}\in \mathbb {N}\). Note A and B will often be different. Also, although u(x) is updated through composition with p(x), the update through addition is also possible.

Log-demons: Similarly to the diffeomorphic demons \((T(x) \subseteq \mathscr {D})\) if \((exp(\nicefrac {v(x)}{A})^{A} \subseteq \mathscr {D})\), with the latter true if \((\left\| \nicefrac {v(x)}{A} \right\| \leqslant 0.4)\). Therefore, the above logic can be applied here to show that \((T(x) \subseteq \mathscr {D})\), when (\(u(x)^{[n]} \leftarrow u(x)^{[n]} \circ \alpha \times p(x)^{[n]})\).

Restricted-demons: In this approach \((T(x) \subseteq \mathscr {D})\) if \((\left\| u(x) \right\| \leqslant 0.4)\). We can also observe that, \((T(x) \subseteq \mathscr {D})\) if \((u(x) \subseteq \mathscr {D})\) since \((\left\| u(x) \right\| \leqslant 0.4) \Rightarrow (u(x) \subseteq \mathscr {D})\). This way we can see that, since \((u(x)^{[n]} \leftarrow u(x)^{[n]} \circ \alpha \times p(x)^{[n]})\) and \((p(x)^{[n]} \leftarrow \alpha \times u(x)^{[n-1]})\) with \(\alpha =[0,1]\), \((p(x) \subseteq \mathscr {D}) \Rightarrow (u(x) \subseteq \mathscr {D}) \Rightarrow (T(x) \subseteq \mathscr {D})\).

2.5 Demons Iterative Process

We can now define the whole demons framework (at each level) with the addition of the momentum term:

figure a

3 Experiments

3.1 Circle to C

To first test the convergence speed improvement of the proposed methodology we applied the original and proposed diffeomorphic-demons, log-demons, and restricted-demons to register the classic “circle to C”.

Since in this example the emphasis is on the comparison of the different methods with and without momentum, all methods use the symmetric demons force (Eq. 5), a single-resolution framework, and a 1 voxel FWHM Gaussian kernel for both the fluid-like and diffusion-like regularizers. Since the restricted-demons can only guarantee diffeomorphic deformations for small optimization steps, the maximal step was set as 0.4 voxels, and 2 voxels for the diffeomorphic and log -demons. For all momentum-based approaches an \(\alpha =0.9\) was used.

As shown in Fig. 1 all the original demons were unable to fully deform the native “circle” to the target “C”, while all the proposed variations are visually identical to the target image (note that all registrations were limited to the same computation time, since time per iteration differs for the different approaches). Regarding topology, all methods presented invertible fields with positive Jacobian determinants, with the proposed methods visually more symmetric than their counterparts (i.e. more symmetric deformation grids).

Globally, the proposed diffeomorphic-demons achieved the quickest convergence, followed by the proposed restricted-demons. The proposed log-demons was unable to achieve the same convergence within the maximum allowed computation time.

Fig. 1.
figure 1

Non-linear registration of the classical “circle to C”. Top - Deformation fields and registered images; Bottom - Normalized SSD against time. Full lines: original methods; Dashed lines: proposed variation. For all cases lower is better.

3.2 Anatomical MRI

To further study the precision of each of the original demons approaches against our methodology we used the simulation framework presented in [13]. In this framework, 20 individual healthy T1-weighted brain images along with cortical and sub-cortical manual segmentation were used to generate a total of 400 ground truth deformations. For each simulation the different demons approaches were used to register the native to the simulated images. In this example, the same parameters used in Sec. 3.1 were applied within a multi-resolution framework with 3 levels, and 50 iterations at the highest resolution. The registration accuracy of each method was obtained by comparing the generated deformation fields and corresponding Jacobian map with the ground truth.

As shown in Fig. 2 (Top) for all approaches the proposed methodology achieved visually closer Jacobian maps to the ground truth, than the original framework. Further quantitative analysis, Fig. 2 (Bottom), show that the deformation field error and Jacobian error scores are significantly lower for the proposed methods (dark shade) comparatively with the original framework (light shade), but similar within themFootnote 2. From all methods here, the proposed restricted-demons achieved the best scores, and showed the largest improvement relative to the original framework (DFE = 55 %, JE = 38 %).

Fig. 2.
figure 2

Anatomical MRI. Top - Jacobian map comparison between the original and proposed methods, and the ground truth; Warmer colors refer to contractions, cooler colors to expansions. Bottom - Violin plot comparison between the original (light shade) and proposed (dark shade) frameworks for the restricted (blue), diffeomorphic (magenta), and log (cyan) -demons approaches; Lower is better for both evaluation metrics. (Color figure online)

4 Conclusion

Although computationally efficient, the demons framework relies on forces derived from the images’ gradients, fundamentally limiting its ability to converge quickly where gradients are scarce or non-existent. Here we proposed an extension of the demons framework to improve the convergence speed through the addition of a momentum term, without compromising on accuracy.

Our experiments showed that the proposed methodology achieves faster and more accurate results for the restricted, diffeomorphic and log -demons for the classical “circle to C” registration, and closer results to the ground truth for the anatomical MRI non-linear registration. While in the classical “circle to C” the proposed log-demons was less accurate than the two other proposed approaches (for the allowed computational time), it showed similar results for the anatomical MRI dataset (where the number of iterations were fixed). Regarding computation time, the original diffeomorphic and log -demons took longer (by approximately 40 % and 90 % more time respectively) than the original restricted-demons. For each approach, the proposed methodology only increased the computation time by less than a third.

In this paper, we considered only the SSD similarity criteria, yet this extension can be conveniently applied to other similarity metrics such as the LCC or PMI. Furthermore, it is easily applicable to other non-linear registration frameworks (e.g. free-form deformations), or group-wise non-linear registration and atlas construction.