3.2.1. An Edge–Based Active Contour Model Using an Inflation/Deflation Force with a Damping Coefficient (EM)
In the continuous domain of ACMs, a parametric curve
$v(s)=(x(s),y(s))$ for
$s\in [0,1]$ can be defined. To match the model to image data, the energy components of this model are associated so as to minimise the total energy of the contour. The active contour energy
$\xi $ is driven by its current shape and data coming from the image, expressed by the digital image brightness function
$I(x,y)$. The total energy of the contour is described by the following equation:
The internal energy modelling the shape of the contour is given as:
Weighing functions
${w}_{1}$ and
${w}_{2}$ allow the tension and the flexibility of the contour to be controlled. The external energy is given as:
The function
$P(x,y)$ has minima in the points of the image where the image gradient is the greatest:
The convolution ${I}_{s}={G}_{\sigma}\ast I(x,y)$ denotes the image I after the smoothing filter has been applied, e.g., a Gaussian one with the parameter $\sigma $.
According to the calculus of variation theory, the contour
$v(s)$ which minimises the energy
$\xi $ satisfies the following vectorvalued partial differential (Euler–Lagrange) equation:
By introducing the variable
t representing time into the equation of the contour
$v(s)$, where
$t\in [0,\infty ]$, we get
$v(s,t)=(x(s,t),y(s,t))$. Equation (
6) takes the form below:
whereas
$\mu (s)$ and
$\gamma (s)$ denote the mass and the damping coefficient.
The discrete active contour model is defined as a set of
N nodes
${v}_{i}(t)=({x}_{i}(t),{y}_{i}(t))$, where
$i=1,2,\dots ,N$. Assuming the zero mass of nodes and the coefficient of node motion damping
$\tau $, and having added the inflation/deflation force
${F}_{i}^{inflation/deflation}(t)$ [
12], Equation (
7) takes the following iterative form:
Equation (
8) simulates polygonal deformations of the discrete ACM, whereas
$\overline{{w}_{1}}$,
$\overline{{w}_{2}}$ and
$\eta $ are weighing coefficients . The
$\tau $ parameter allows the node to move if its value is greater than 1 and allows the inflation/deflation force of the moving point
${v}_{i}$ in iteration
t to be damped if its value is smaller than 1.
${F}_{i}^{external}(t)$ is the external force obtained based on data from image:
The
P function is defined in Equation (
5).
${F}_{i}^{inflation/deflation}(t)=F({I}_{s}({x}_{i},{y}_{i})){n}_{i}(t)$ is the inflation or deflation force which drives the node with the index
i in the iteration
t in the direction normal to the contour and represented by vector
${n}_{i}(t)$. This force allows nodes to be moved towards the approximated edge using the function:
The T parameter is the defined brightness threshold in image I.
${F}_{i}^{tensile}(t)$ is the tensile force counteracting the inflation:
${F}_{i}^{flexural}(t)$ is the flexural force preventing bending:
The use of the tensile and flexural forces is of utmost importance in improving the segmentation of an irregular shape, frequently with poorly exposed edges, and also with intensive noise in the analysed image, whose noise is very difficult to remove using preprocessing methods, e.g., from ultrasound images or mammograms. This was previously analysed in research projects [
12,
15].
The MRI allows a very high contrast between soft brain tissues to be achieved. Furthermore, the preprocessing methods used in this study allow very good amplification of contrast and the removal of noise (cf.
Section 4.1.1, so the tensile (
11) and flexural (
12) forces in Equation (
8) can be omitted. Equation (
8) takes the form below:
In the EM computer implementation, the following parameters are also set:
 
${\theta}_{min}$, ${\theta}_{max}$ i.e., the minimum and maximum angle between the pairs of nodes: $({v}_{i1},{v}_{i})$ and $({v}_{i},{v}_{i+1}),$
 
${D}_{min}$, ${D}_{max}$: the minimum and maximum distance between adjacent nodes $({v}_{i1},{v}_{i}),$
 
$DF$: damping factor—the factor of inflation/deflation force damping,
 
$inRv$: inflation reversals, the allowed number of reversals of the node and after it is exceeded, the current value ${F}_{i}^{inflation/deflation}$ of the node with index i will be damped,
 
$rvHs$: reversal history—a set storing information about the number of reversals of all nodes, $rvH{s}_{i}$—the current number of reversals of the node with the index i,
 
number of iterations executed.
Algorithm 1 allows the CC to be segmented after the initial contour has been initiated and is to maintain a high value of the inflation/deflation force (based on the value of the parameter $\tau >1$) for each node until that node approaches the CC edge looked for. If the node is in the area of the image with intensity values lower than the value of the T threshold, the direction of the normal vector will be reversed to return the node to the area in which it had been previously. If this is repeated more times than has been set using the $inRv$ constant, then the inflation/deflation force of the node will be damped using the $DF$ parameter (lines 10–11 in Algorithm 1). The $\tau $ parameter is updated on a current basis, separately for every node in iteration t. This is to stop the nodes which have reached the edge searched for, and at the same time to allow the efficient movement of nodes which have not reached that edge yet. Nodes which constitute the initial contour have the same values of the $\tau $ parameter.
Algorithm 1 The edgebased active contour model using the inflation/deflation force with a damping coefficient allowing the corpus callosum to be segmented from MR images. 
 1:
Input: V a set of N nodes; C a set of $\tau $ coefficients affecting the inflation/deflation force for all N nodes, these have the same initial value in the initial contour; The following parameter values: $\eta $, T, $inRv$, $DF$, ${D}_{min}$, ${D}_{max}$, ${\theta}_{min}$, ${\theta}_{max}$ are userset.  2:
Output: $\widehat{V}$ a set of $\widehat{N}$ nodes; $\widehat{C}$ a set containing the current values of $\tau $ coefficients for all nodes; $\widehat{rvHs}$ a set containing the current history of reversals for nodes.  3:
for $i=1\to N$ do  4:
$CalcNodeCoordinates\leftarrow 1$  5:
$n\leftarrow $ NormalVector(${v}_{i+1}{v}_{i1}$)  6:
if $I({v}_{i})<T$ then  7:
$n\leftarrow n$ /* vector reversal */  8:
$rvH{s}_{i}\leftarrow rvH{s}_{i}+1$ /* Keep the reversal */  9:
end if  10:
if $rvH{s}_{i}>inRv$ then  11:
${\tau}_{i}\leftarrow DF\ast {\tau}_{i}$  12:
end if  13:
$d\leftarrow \left\right{v}_{i}{v}_{i1}\left\right$  14:
${\theta}_{i}\leftarrow \angle ({v}_{i1}{v}_{i},{v}_{i+1}{v}_{i})$  15:
if ($d>{D}_{min}$ and $\theta >{\theta}_{max}$) or ($d>{D}_{max}$ and $\theta >{\theta}_{min}$) then  16:
Add node‚ $\frac{1}{2}{v}_{i1}+\frac{1}{2}{v}_{i}$  17:
Add node‚ $\frac{1}{2}{v}_{i}+\frac{1}{2}{v}_{i+1}$  18:
Remove node ${v}_{i}$  19:
$CalcNodeCoordinates\leftarrow 0$  20:
else if $d<{D}_{min}$ then  21:
Remove node‚ ${v}_{i}$  22:
$CalcNodeCoordinates\leftarrow 0$  23:
end if  24:
if $CalcNodeCoordinates=1$ then  25:
Calculate the value of the image gradient for the ${v}_{i}$ node  26:
Calculate the external force ${F}_{i}^{external}$  27:
Calculate the inflation/deflation force ${F}_{i}^{inflation/deflation}$  28:
Calculate node coordinates using Equation ( 13)  29:
end if  30:
end for

The values of variables d and $\theta $ are determined between adjacent nodes and denote, respectively, the distance and the angle value. The control of the values of these variables, using the permissible angle values $({\theta}_{min},{\theta}_{max})$ and distances $({D}_{min},{D}_{max})$ allows:
 
Automatically deleting superfluous nodes and adding new ones.
 
Prevents the selfcrossings and looping of the active contour.
The values of the d and $\theta $ variables are updated at every step of Algorithm 1. If the ${v}_{i}$ node exceeds the permissible angle values and distances defined in Algorithm 1, then two new nodes shall be inserted between pairs of adjacent points, namely $({v}_{i1},{v}_{i})$ and $({v}_{i},{v}_{i+1})$, while the ${v}_{i}$ node will be removed. The estimates assumed for new nodes (lines 16–18 of Algorithm 1) mean that the distances between subsequent nodes will decrease twofold. If a node approaches the adjacent node too closely, i.e., to a distance shorter than defined using the ${D}_{min}$ constant, it will be deleted (which means that it is a superfluous node). The addition and removal of nodes described here is executed by lines 15–23 of Algorithm 1.
Compared to previous studies [
12,
15]:
 
In this study, a different iterative equation of node movement was proposed, namely Equation (
13), in which the flexural and tensile forces need not be determined. As a result, the number of calculations in every iteration is significantly reduced because, instead of four components of the equation having to be calculated, only two have to be: the external force and the inflation/deflation force.
 
A different method of identifying new nodes (lines 16–18 of Algorithm 1) has been proposed, namely: when the contour is expanding (i.e., distances between adjacent nodes are increasing), new nodes are automatically added so that the distances between adjacent nodes are halved, and excess nodes are deleted. This estimate has been adjusted to the form of Equation (
13), which contains no flexural and tensile forces.
The use of these solutions was illustrated in
Figure 4, representing an example experiment based on the set ’miriad_188_AD_M_01_MR_1’.
Table 2 and
Table 3 show the values of parameters used in example experiments from
Figure 4.
Figure 4a shows the initiated seed contour, i.e., a small rectangular area defined by 4 nodes.
Figure 4b,d show final contours produced, respectively, using the model presented in publication [
12] and Algorithm 1 from this study.
Figure 4d also shows that the approximate edge of the CC is smoother and more precise.
Figure 4c,e, in turn, present the change in the number of nodes at subsequent iterations of the model from study [
12] and of Algorithm 1, which needed a much smaller number of iterations and nodes to segment the CC. In the final contour produced by the model from article [
12], 900 iterations executed within 236.8 s were necessary. In contrast, Algorithm 1 segmented the CC within 67.8 s for 350 iterations. The differences between the two approaches are significant, as the solutions proposed in this publication and the preprocessing method applied reduced the number of parameters, and hence cut the number of calculations, shortened the evolution time of the active contour and produced a smoother and more accurately approximated CC edge than the approach from previous research [
12].