# A New Approach to Border Irregularity Assessment with Application in Skin Pathology
## 2 Material and Methods
### Determining Border Nodes  
To choose endpoints of rete bases we firstly determine candidate points on the epidermis border. A border point is considered a candidate if it is in the center of a border protrusion. We cannot simply take points on the border closest to the rete root as for broad and long retes the main axis determined using the skeleton is heavily deformed--in such case we would choose points in the middle of rete's length instead of points near its base (Figure 13).  
Figure 11: The schema of determining the orientation of a rete (\(\varphi_{p}\)) based on the location of a rete root (\(v_{q}\)) and the corresponding end of a rete stump (\(v_{p}\)).  
Figure 12: Distinguishing between “left” and “right” projections. The dilated main axis \(\pi_{m}\) region is split in halves by the main axis \(\pi_{m}\) combined with rays \(-\vec{s}_{1}\) (cast from \(v_{1}\)) and \(\vec{s}_{n-1}\) (cast from \(v_{n}\)). Rete stumps in the striped half are considered “right” projections and in the other half—“left” projections.  
We compute relative changes in the border slope between consecutive border points (see Section 2.3) and represent it as a function of border run length (Figure 13(a)). The relative orientation of the vector \(v_{1}\) with respect to the vector \(v_{2}\) is given by:  
\[\Delta\varphi(v_{1},v_{2})=\begin{cases}\varphi_{1}-\varphi_{2}&\text{if } \varphi_{1}-\varphi_{2}\in[-\pi,\pi]\\ \varphi_{1}-\varphi_{2}+2\pi&\text{if }\varphi_{1}-\varphi_{2}<-\pi\\ \varphi_{1}-\varphi_{2}-2\pi&\text{if }\varphi_{1}-\varphi_{2}>\pi\end{cases} \tag{9}\]  
where \(\varphi_{1}\) and \(\varphi_{2}\) are the absolute orientations of vectors \(v_{1}\) and \(v_{2}\), respectively. Note that \(\Delta\varphi\in[-\pi,\pi]\).  
To remove tiny fluctuations we firstly use the simple moving average filtering with window size \(w_{s}=15\). To get the general trend, we then perform low-pass filtering using a minimum-order low-pass finite impulse response (FIR) filter with normalized passband frequency 0.1 rad/px, stopband frequency 0.15 rad/px, passband ripple 0.01 dB, and stopband attenuation 65 dB, designed using a Kaiser window method (for boundaries consisting of less then 100 pixels we use stopband attenuation  
Figure 14: Determining border nodes: (a) represent relative changes in the border slope between consecutive border points as a function of border run length, (b) filter the function of relative changes in the border slope between consecutive border points w.r.t. the border run length (thin solid line—the original signal \(f\); thick solid line—\(f\) averaged using the simple moving average filtering, \(f_{\text{avg}}\); dashed line—\(f_{\text{avg}}\) after applying a low-pass filter), (c) the identified node.  
Figure 13: To choose endpoints of rete bases we firstly determine candidate points, located in centers of border protrusions (black dots). Simply taking the points on the border closest to the rete root \(R\) (white dots) yields incorrect results for broad and long retes as in such case the main axis \(\pi_{m}\) determined using the skeleton is heavily deformed (the junction point \(R\) is shifted towards the center of a rete).  
50 dB). In both cases, since the signal corresponds to a closed curve, when smoothing we wrap the signal to prevent artifacts on its ends. Figure 14b shows the results of the compound filtering.  
We find locations of such local maxima (peaks) which height \(h\) and prominence \(p\) is sufficiently large, as higher peaks correspond to sharper turns and more prominent peaks represent a more constant trend. We chose \(h>0.025\) and \(p>0.0015\), respectively (Figure 14c). Again, we analyze a wrapped signal so that peaks on the edge of a non-wrapped signal are correctly detected.