# A Prostate MRI Segmentation Tool Based on Active Contour Models Using a Gradient Vector Flow
## 2 Materials and Methods
### Gradient Vector Flow Approach (GVF)  
When dealing with snakes algorithms, there are two types of implementations: _Parametric Active Contours (PACs)_ or _Geometric Active Contours (GACs)_. They differ in how they define the curve function, since equations formulated for the minimization problem stays almost the same. PACs are based on a parametric curve of a shape represented in Equation (16):  
\[C(s)=\left\{\left[x(s),y(s)\right],s\in[0,1]\right\} \tag{16}\]  
with the constraint that it should be closed, i.e., \(C(0)=C(1)\). Geometric Active Contours, on the other hand, define the curve to be deformed as embedded in a level-set function, generally as its level zero. This last case is the one implemented and described in Section 2.3. GACs have advantages over PACs,  
Figure 5: Evolution of \(\lambda_{i}\) weights for the energy functional. since they are computationally more stable and they are able to change their topology as the function is deformed. Nonetheless, the implemented method is an edge-based method, since it uses the gradient as pushing force, and local intensity information to determine if a pixel belongs to the object or not. Due to this, several problems can appear, such as:  
1. If the edges of the object are not well defined, a leaking problem occurs, leading the snake outside of the object's boundaries. 2. If the initial contour is not close to the limits of the object, the gradient will not be able to guide the snake to the edges of the object. If the image is just black and white with one object on it, an initial contour far away from the object will not evolve. On the other hand, if there are other objects around, the snake might be attracted to them, instead of the desired object. 3. Since the snake uses the local pixel information to determine the evolution of the curve, it is sensible to the image noise. Additionally, the fact of using gradients only, brings another effect related to concavities, that is illustrated in Figure 6.  
In this case, a simple object with a narrow concavity, and its corresponding gradient vector field are shown. From it, it is easy to see that:  
* In all the space where there the intensities are constant, the gradient is zero. There are gradient vectors only in the borders of the object. This is the main reason why (in an edge-based snake) an initial contour placed far away from the object might not converge to the real object boundaries. * Narrow concavities start to have horizontal gradient vectors (as it can be seen in the right plot of the Figure 6). As a consequence, the snake will attach to the borders, but it will not address towards the interior of such concavity because the gradient does not have any downwards component. These last two problems can be solved in the previously explained algorithm with an external force that, not only adds vectors where the gradient is zero, but that also adds a downwards component in the long concavities in such a way that the active contour will be pushed to the interior of this type of areas. This external force is called Gradient Vector Flow (GVF) [17]. Adding this component to the energy described in Section 2.3 will help to not only make the system more robust against initialization effects, but it will improve the outcome by attaching the resulting snake really close to the edges of the object. Figure 6: Example of Gradient vector field of a U shape object. (**Left**) Original image. (**Center**) Gradient of the object. (**Right**) Zoom of the vector field in the central concavity of the object. The GVF is a dense vector field \(\mathbf{v}(x,y)=[u(x,y),v(x,y)]\) derived from the original image, and it is the result of minimizing the energy term defined in Equation (17) [17].