# Multiple Preprocessing Hybrid Level Set Model for Optic Disc Segmentation in Fundus Images
## 3 Multiple Preprocessing Hybrid Level Set Model
### Hybrid Level Set Model  
The level set model is robust and flexible. It is not sensitive to small noise and can flexibly change the model to be suitable for specific tasks. So, we designed a model that is based on the level set model to segment OD. The level set model is a type of active contour model [45] that embeds the contour into a level set function \(\phi\) that has a higher dimensional number and uses a certain level set (usually zero-level set) to represent the current contour. The activity of the contour is shown in Equation (1). \(F\) is the energy function, and for different tasks, the corresponding \(F\) needs to be designed. \(|\
abla\phi|\) is the gradient of level set function. This equation means that level set function \(\phi\) changes along the gradient direction under the action of energy function \(F\). The change in unit time \(t\) is the product of \(F\) and \(|\
abla\phi|\). \[\frac{\partial\phi}{\partial t}=F|\
abla\phi| \tag{1}\]  
For solving the problems in OD segmentation, the corresponding \(F\) should have the following characteristics: (1) Because some areas in OD are occluded by blood vessels, OD segmentation results have a depression in these areas. To avoid the effect of blood vessels, the smoothness of the contour should be controllable. (2) There are some PPA regions and bright noise surrounding OD. To avoid being affected by this noise, the contour evolution should be limited. (3) Due to the existence of PPA regions and bright noise, the OD contrast is low, and the gradient of the boundary is poor. So, segmentation failure caused by a poor gradient should be avoided. Figure 4: The flowchart of the proposal. According to the above characteristics, as shown in Equation (2), this paper proposes a level set model that has four terms: the distance-regularized, line integral and area integral, area-based, and shape-based terms, which is why it is called HLSM. The most important terms in HLSM are the area- and shape-based terms. The area-based term is used to avoid segmentation failure in low-contrast images. The shape-based term is utilized to avoid the effects of bright noise and PPA regions. Apart from this, the distance-regularized term is used to avoid reinitialization, and the line and area integral terms are able to control the contour smoothness and evolutionary direction, respectively. \[ \begin{split} F&=F_{distance-regularized}\\ &+F_{line\;integral\;\& area\;integral}\\ &+F_{area\_based}\\ &+F_{shape\_basal}\end{split}  \tag{2}\]  
The distance-regularized term is represented by Equation (3), where \(\mu\) is the weight of this term, \(\Omega\) is the image domain, \((x,y)\) is each point in the image. Since the signed distance function (SDF) has the property of \(|\
abla\phi|=1\), the contour is usually embedded in SDF for level set model. However, when it is applied to an image, SDF needs to be discretized, so that the level set function no longer remains as the SDF in the process of evolution. The level set function needs to be reinitialized after each evolution. The distance-regularized term can keep \(|\
abla\phi|\) near 1, and keep the level set function as an SDF as much as possible. Thus, this term is able to avoid reinitialization and speed up the evolution. \[F_{distance-regularized}=\mu\int_{\Omega}p(|\
abla\phi|)dxdy \tag{3}\]  
where,  
\[p(s)=\left\{ \begin{matrix}\frac{1}{2\pi}sin(2\pi s),\;if\;s\leq 1\\ s-1,\;if\;s>1\end{matrix} \right. \tag{4}\]  
The line integral term is expressed in Equation (5), while the area integral term is expressed in Equation (6). \(\  
The formula of the area-based term is shown in Equation (9), where \(u_{0}\) is the average pixel values of the whole image, and \(c_{1},c_{2}\) are the average pixel values inside and outside the contour, respectively. The area-based term evolves the contour through the difference of the average pixel values between the inside and outside of the contour, and the weight of inside and outside can be controlled by \(\lambda_{in}\) and \(\lambda_{out}\).