# A Machine Learning Approach to Support Treatment Identification for Chari I Malformation
## 2 Methods
### Registration
#### 2.2.2 Correction by Active Contour  
As noticed in [30], registration can provide only a preliminary identification of the main brain regions of interest, but it is not able to fit the details of the contours, as the regions in the atlas and in the test image could be even topologically different. Thus, the boundaries of the regions estimated by the balanced multi-image algorithm were corrected using an active contour (or snake) [40], i.e., a curve (with parametric representation \(\mathbf{v}(s)=\left[v_{x}(s)\,,\;v_{y}(s)\right]\), where \(s\) is the curvilinear abscissa and bold format is used to indicate a vector) approaching iteratively the borders of interest minimizing a functional accounting for different constraints \[E(\mathbf{v})=\int\limits_{0}^{1}\big{[}E_{int}(\mathbf{v}(s))+E_{image}( \mathbf{v}(s))+E_{ext}(\mathbf{v}(s))\big{]}ds\] (3) The three contributions on the right hand side are defined as follows. * \(E_{int}\) is the internal energy, defined as \[E_{int}(\mathbf{v}(s))=(\alpha|\mathbf{v}_{s}(s)|^{2}+\beta|\mathbf{v}_{ss}(s )|^{2})/2\] (4) where \(\mathbf{v}_{s}\) and \(\mathbf{v}_{ss}\) are the first and second derivatives of \(\mathbf{v}(s)\), respectively; \(\alpha=0.05\) controls the tension and \(\beta=0.5\) is related to the rigidity of the active contour. * \(E_{image}\) is the energy due to the image and is the weighted sum of 3 terms, allowing the snake to be attracted on dark regions, edges and termination points, respectively \[E_{image}=w_{line}E_{line}+w_{edge}E_{edge}+w_{term}E_{term}\] (5) where \(E_{line}\) is defined by a Gaussian smoothing of the original image (with standard deviation 3 pixels), \(E_{edge}\) is the norm of the image (again with Gaussian smoothing on the derivatives) and \(E_{term}\) depends on the curvature of level lines [40] and \(w_{line}=5\), \(w_{edge}=20\), \(w_{term}=10\). Then we included also the Gradient Vector Flow (GVF) [41], which is the vector field \(W(x,y)=[U(x,y),V(x,y)]\) minimizing the energy functional \[E=\int\limits_{0}^{1}\int\limits_{0}^{1}\mu(U_{x}^{2}+U_{y}^{2}+V_{x}^{2}+V_{ y}^{2})+|\
abla f|^{2}|W-\
abla f|^{2}dxdy\] (6) where \(f=-E_{image}\) is the edge map and \(\mu=0.2\); notice that it is close to the gradient of \(f\) (and thus it forces the snake to go in the direction opposite to the gradient of the MRI) when such a gradient is large, otherwise a smooth field is obtained. This contribution allows us to help the snake to follow the borders of concave regions [41]. * \(E_{ext}\) are external forces, pushing the snake toward low intensity edge points in the image. It is defined as the sum of two terms: the distance transform from low intensity points (identified by image binarization with a two-class k-means clustering, as in [30]) and the balloon force, in direction normal to the snake and allowing it to contract when the other contributions are small [42]; the two contributions had weights 0.1 and \(-0.05\), respectively. In conclusion, the method is based on the one used in [30]: the inclusion of GVF and balloon force are the main variations. Figure 4 shows an example of application. The deformation allowing to match the atlas and the test image is estimated; then, it is applied on the regions delineated on the atlas to estimate the same regions of interest on the test image; finally, active contour is applied to improve the estimation of the borders. Notice that a region including the brainstem of the atlas is also considered (shown in Figure 4c), in order to refine the estimation of the left portion of cerebellum (as the boundary separating it from the brainstem is not easy to identify from MRI; see [30] for details). Notice that the gender was not included, as it was not significantly related to the outcome. Moreover, the area of posterior fossa and cerebellum where not considered, as the information on the dimensions of the target regions was already included by using the following three indexes: area of the brain, C/PF ratio and PF/B ratio. We standardized features by removing the mean and scaling to unit variance.