# Fast Segmentation Algorithm for Cytoid Macular Edema Based on Omnidirectional Wave Operator
## 2 Methods
### Image Segmentation
#### 2.3.2 Contour Extraction by Omnidirectional Wave Operator
After direction adjustment, the parameters (Formulas (6) to (10)) in the wave potential energy equation and the wave correction equation have multidirectional properties. \(\varphi_{g}\) represents gravitational potential energy, where \(Z\) is the 3 \(\times\) 3 template where the central pixel is located, \(I(i^{\prime},j^{\prime})\) is the gray value of the central pixel of the template, \(g(i^{\prime},j^{\prime})\) is the Gaussian weighting function, and MAX is the maximum gray value of the whole image. \(\varphi_{v}\) represents kinetic energy, \(v\) is central velocity, \(v_{q}\) is wavefront velocity, \(\sigma\) is a regulation factor, and the function of wavefront velocity \(v_{q}\) is to eliminate speckle noise near the boundary line, which leads to a sharp increase in kinetic energy. The Q template is a 3 \(\times\) 2 template before the center pixel, and \(v_{q}\) is the normalized difference value of adjacent pixels in the Q template. The function of regulation factor \(\sigma\) is to prevent the large area and high gray value area in the image from causing too much kinetic energy and over-segmentation of boundary areas. \(\sigma\) controls the influence of the gray value of the 3 \(\times\) 3 template on kinetic energy, and the value is between 0 and 1. In the wave correction equation, \(K\) is a geometric shape determination function, which shows the geometric distribution of gray values near the point to be measured; \(C\) is the gray difference judgment function, which shows the numerical difference in gray values near the point to be measured. \[\varphi_{g}=\frac{\sum_{i\in Z}\sum_{i\in Z}I(i^{\prime},j^{\prime})\times g( i^{\prime},j^{\prime})}{MAX} \tag{6}\]  
\[\varphi_{v}=v\times v_{q}\times\sigma \tag{7}\]  
\[\sigma=\exp(-(\frac{I(i^{\prime},j^{\prime})}{255\times\delta})^{2}) \tag{8}\]  
\[K=\frac{I(i^{\prime},j^{\prime}-1)-I(i^{\prime},j^{\prime}-3)}{I(i^{\prime},j ^{\prime}+2)-I(i^{\prime},j^{\prime})} \tag{9}\]  
\[C=\frac{I(i^{\prime},j^{\prime})+I(i^{\prime},j^{\prime}+1)+I(i^{\prime},j^{ \prime}+2)}{I(i^{\prime},j^{\prime}-1)+I(i^{\prime},j^{\prime}-2)+I(i^{\prime },j^{\prime}-3)} \tag{10}\]  
After the process of the wave potential energy equation and wave correction equation, the contour of the target can be obtained. In this paper, an image containing CME is selected to verify the extraction results of the omnidirectional wave operator in four directions separately and the fusion results of four directions, as shown in Figure 5. Considering that the image is a two-dimensional plane, a two-dimensional coordinate is established in the image plane. The rotation angle \(\theta\) is the angle formed with any point A and its rotated point A\({}^{\prime}\), respectively, with the rotation center. When the operator turns to \(\pi/2\), \(\pi\), and 3 \(\pi/2\), the operating direction is parallel to the positive direction of the y-axis, negative direction of the x-axis, and the negative direction of the y-axis. Figure 4: A description of the direction adjustment function. The direction adjustment function is a matrix form of the rotation relationship of \(A\) and \(A^{\prime}\). It can be seen from Figure 5 that the contour lines extracted in four directions by using the omnidirectional wave operator all have approximately the same tangent direction, and the results in a single direction are all non-closed and incomplete, so the unidirectional wave algorithm cannot extract complete closed curves. As CME is elliptical, the wave algorithm cannot realize the complete segmentation of the cyst. The algorithm proposed in this paper adds the orientation characteristic based on the wave algorithm, and the curves in different directions can be obtained through the independent extraction in four directions, and then the complete results can be obtained by using curve fusion, realizing the accurate and complete segmentation of CME. The omnidirectional wave operator has the advantages of the wave algorithm.