# A Prostate MRI Segmentation Tool Based on Active Contour Models Using a Gradient Vector Flow
## 2 Materials and Methods
### Implementation of the Proposed Active Contour Model  
The base method implemented is inspired on [12; 16]. Both of them are active contours--level-set algorithms. Particularly, the model by [PERSON] et al. [12] was conceived and customized to work with MR images. The general idea of snake algorithms is to modify a curve based on certain forces that push the boundaries of such curve until it reaches the border of the object of interest. A particular feature of this type of segmentation algorithm is that they are unsupervised methods, given that there is not feedback on whether the boundary is following the correct borders or not. Due to this assumption of snake-based methods, an initial contour must be provided, and the closer this initial contour is to the real object, the better the result of the segmentation. Typically, most snake-based algorithms follow the information about the gradient of the image, which means the curve will try to evolve towards the edges of the object. Nonetheless, if the object does not contain well defined edges, or it has been previously smoothed in order to reduce the noise, this algorithm might fail in following the shape of the object. As a consequence, the outcome will be either a contour that is smaller or larger than the object's boundaries, or in the worst case, the contour will be reduced until it disappears. This is the reason why several researchers developed specific algorithms depending on the type of object to detect, and the type of image to deal with. This is done adding different terms called _priors_. Each constraint added to the algorithm defines a prior, and its corresponding weight will define its contribution to the force. In this previous work [12], the goal is to segment the shape of the left ventricle of the heart, but since it is aimed to work with MR images, and the priors are similar to the assumptions that can be done for the prostate zones, we considered it as a good starting point for carrying out our experiments and implement the GVF extension to demonstrate its viability in this image modality. The basic assumption of the developed algorithm is that the contour will split the image into two areas, the target object and the background. The evolution of the curve will be driven trying to minimize an energy functional that in this case, it is composed of four components. Each of them will define the priors the final contour must comply with [12]:  
1. **Model matching**. it is assumed that the pixel values inside and outside the object follow different statistical models, specified as \(M1\) and \(M2\), respectively. 2. **Edge information**. the contour must be attracted to certain clues that describe the limits of the object, i.e., the strongest edge values of the image should attract the curve. 3. **Shape prior**. Besides certain possible variations between patients, each prostatic zone has a general shape. This shape information can be thought as a function \(C_{H}(\theta)\), with \(\theta=[\theta_{1},\theta_{2},...,\theta_{n}]^{T}\). The parameters \(\theta_{i}\) define a model of the actual shape and size of the requested zone, and depending of how distant is the contour from this estimated shape, this prior will contribute more or less to the snake evolution. 4. **Contour smoothness**: The contour is supposed to not be jagged or too noisy, so this parameter controls that. Then the functional that defines the energy described above, depending on the contour \(C\), can be expressed as:  
\[J(C)=\lambda_{1}J_{1}(C)+\lambda_{2}J_{2}(C)+\lambda_{3}J_{3}(C)+\lambda_{4}J_ {4}(C) \tag{1}\]  
where \(\lambda_{i}\) are the weights of each prior included in the energy function. This function will be used to make evolve the contour.