# Statistical Edge Detection and Circular Hough Transform for Optic Disk Localization
## 2 Materials and Methods
### Implementing the Modified Robust Rank Order Test-Based Edge-Detection Algorithm  
A subimage of size r \(\times\) r is chosen for each pixel. r should be odd and selected properly according to the image and its size. In this study, r is equal to 5, as shown in Figure 7. If a r value smaller than 5  
Figure 5: Block diagram for the calculation of the average brightness level.  
Figure 6: Images consisting of pixels remaining above the specified threshold. (**a**) is a healthy retinal image; (**b**) is a diseased retinal image.  
is chosen, the subimage would be sensitive to noise. Conversely, a larger r value increases the time complexity and edge variations. Two different regions are considered as a set of \(N=m+n\), excluding the target pixels, which are divided into \(X=(X_{1},X_{2},\ldots,X_{M})\) and \(Y=(Y_{1},Y_{2},\ldots,Y_{N})\). \(X_{i}\) and \(Y_{i}\) are pixels in two different groups as shown in Figure 7, where white pixels represent the X region and blue pixels represent the Y region in the mask. The model is built as:  
\[A_{i}=\left\{\begin{array}{cc}X_{I},&X_{I}\in X\\ Y_{I},&Y_{I}\in Y\end{array}\right\} \tag{3}\]  
The null hypothesis and alternative hypothesis are set as:  
\[H_{0}^{\uparrow}:X\geq Y \tag{4}\]  
\[H_{1}^{\uparrow}:X<Y \tag{5}\]  
The term \"null hypothesis\" was first defined and used by [PERSON], a British-born statistician and geneticist [36]. A rank-order based statistical test is used as a good alternative to the Wilcoxon test. Figure 7 shows 8 distinct edge scenarios representing 2 different colors. The test to be performed will be applied for each scenario and will be considered as the edge for the evaluated pixel if any of the scenarios are appropriate for the criteria selected for edge detection. From this point on, it will be explained through scenario (a) shown in Figure 7, and the same procedures are performed for the other scenarios.  
To evaluate \(H_{0}\) against \(H_{1}\), \(A_{i}\) is obtained as follows: For each \(X_{i}\), \(\in X\) the sum of the difference of lower-valued \(Y_{i}\) pixels in \(Y\) are calculated. The obtained number represents \(X_{i}\) and is denoted by \(U(Y,X_{i})\). Then, the average of the \(U\)\((Y,X_{i})\) is calculated by  
\[U(Y,X)=\sum_{i=1}^{m}U(Y,X_{i})/12 \tag{6}\]  
This calculation is also done for the Y pixels \(Y_{i}\), \(Y_{i}\), \(\in Y\). \(U(X,Y_{i})\) is calculated with the sum of the difference of lower-valued \(X_{i}\) pixels in \(X\). Then, the average of \(U(Y,X_{i})\) is calculated by  
\[U(X,Y)=\sum_{i=1}^{m}U(X,Y_{i})/12 \tag{7}\]  
Figure 7: Eight different edge scenarios, where white pixels represent the X region and blue pixels represent the Y region in the mask.  
Next, the homogeneity index is defined as:  
\[V_{X}=\sum_{i=1}^{m}{[U(Y,X_{I})-U(Y,X)]^{2}} \tag{8}\]  
\[\mathrm{V}_{Y}\mathrm{=}\sum_{i=1}^{m}{[U(X,Y_{I})-U(X,Y)]^{2}} \tag{9}\]  
After obtaining test parameters and homogeneity index, the test statistic is built as:  
\[U=\left|\frac{m\cdot U(Y,X)-n\cdot U(X,Y)}{2\sqrt{V_{X}+V_{Y}+U(Y,X)}\cdot U(X,Y)}\right| \tag{10}\]  
\[U_{selected}=\max(U_{I})\ \mathrm{i}\leq 0 \tag{11}\]  
The U value is calculated eight times for eight edge scenarios. If any U value is higher than the threshold \(u_{\infty}\), \(H_{0}\) is rejected and the pixel is labeled as an edge pixel.  
The result of applying the modified robust rank order edge-detection algorithm is shown in Figure 8.