## 2 Materials and Methods
### Definition of the Segmentation Tuning as an Optimisation Problem  
To compare each pair of successive images in the space of parameters, it is necessary to formalize the properties of the binary images. In addition, some definitions and operators are established to be applied in our tuning technique.  
A binary image \(I\) of size \(N\times M\), where \(N\) and \(M\) are the width and height of the image respectively, can be represented as a binary vector \(\alpha\) of size \(u=N\ \times\ M\).  
**Definition 1**.: _Let the binary set be represented by \(Z_{2}=\{0,1\}\), then the u-dimensional binary space is given by:_  
\[Z_{2}^{u}=Z_{2}\times Z_{2}\times\ \ldots\ \times Z_{2}\ \mathrm{u-times}.\]  
**Definition 2**.: _An element \(\alpha\) of \(Z_{2}^{u}\) is a u-upla formed by \(\alpha=(\alpha_{1},\alpha_{1},\ldots\alpha_{u})\), with \(\alpha_{i}\in Z_{2}\). This is:_  
\[Z_{2}^{u}=\{\alpha=(\alpha_{1},\alpha_{1},\ldots\alpha_{u}),\ |,\ \alpha\in Z_{2} \times Z_{2}\times\ldots\times Z_{2}\wedge\alpha_{i}\in Z_{2}\}.\]  
**Definition 3**.: _If \(\alpha\in Z_{2}^{u}\), the complement \(\overline{\alpha}\) is defined as the vector obtained by inverting all the elements of \(\alpha\):_  
\[\overline{\alpha}=(\overline{\alpha}_{1},\overline{\alpha}_{2},\ldots\overline {\alpha}_{u})\ \mathrm{where}\ \overline{\alpha}_{i}=0\ \mathrm{if}\ \alpha_{i}=1\ \mathrm{and}\ \overline{\alpha}_{i}=1\ \mathrm{if}\ \alpha_{i}=0.\]  
**Definition 4**.: _If \(\alpha\in Z_{2}^{u}\), the length of \(\alpha\) is defined as a function \(\ell\) of the binary u-dimensional space to the positive integers \(\mathbb{Z}^{+}:\)_  
\[\ell:Z_{2}^{u}\ \longrightarrow\ \mathbb{Z}^{+}\ \ \ \mathrm{function\ is\ defined\ as}\ :\ \ \ell(\alpha)=\ \sum_{i=1}^{u}\alpha_{i}.\]  
**Definition 5**.: _If \(\alpha\in Z_{2}^{u}\), the norm of \(\alpha\) is defined as a function \(\mathcal{N}\) of the binary u-dimensional space to the positive real numbers \(\mathbb{R}^{+}\)_  
\[\mathcal{N}:Z_{2}^{u}\ \longrightarrow\ \mathbb{R}^{+}\ \ \ \mathrm{function\ is\ defined\ as}\ :\ \ \mathcal{N}(\alpha)=\ \|\alpha\|=\ \sqrt{\sum_{i=1}^{u}\alpha_{i}^{2}}=\sqrt{\sum_{i=1}^{u}\alpha_{i}}=\sqrt{ 1(\alpha)}.\]  
Operations between the elements defined in the space \(Z_{2}^{u}\).  
**Definition 6**.: _Let \(\alpha,\beta\) represent two elements of the space \(Z_{2}^{u}\). The dot operation \(\bigcirc\) is defined as:_  
\[\alpha\bigcirc\beta=\ <\alpha,\beta>\ =\ \alpha\cdot\beta=\ \alpha_{1}.\beta_{1}+ \alpha_{2}.\beta_{2}+\ \ldots\ \alpha_{u}.\beta_{u}=\ \|\alpha\|\|\beta\|\text{cos}\phi.\]  
**Definition 7**.: _Difference Operation \(\bigcirc\)_  
_Let \(\alpha,\beta\) represent two elements of the space \(Z_{2}^{u}\). The difference operation is defined as a function \(\bigcirc:Z_{2}^{u}\times Z_{2}^{u}->\{-1,\ 0,\ 1\}\)._  
subject to \(I_{Bn}\), \(I_{B(n-1)}Z_{2}^{u}\) and \(\overrightarrow{p}_{n}\), \(\overrightarrow{p}_{(n-1)}\in\ P^{r}\).  
The \(\Psi\) function is an index associated to each pair of successive binary images \(\Big{(}I_{Bn},I_{B(n-1)}\Big{)}\) of \(Z_{2}^{u}\times Z_{2}^{u}\). From the argument of the optimum of \(\Psi\), the best binary segmented image is found \(I_{Bn}^{*}\).