# A New Approach to Border Irregularity Assessment with Application in Skin Pathology
## 2 Material and Methods
### Specim Segmentation  
Our approach to specimen segmentation uses color thresholding in the CIELAB color space. CIELAB was designed to be perceptually uniform with respect to human color vision (i.e., the same amount of numerical change in color component values corresponds to about the same amount of visually perceived change). Let us define distance metrics based on CIELAB 1976:  
\[\Delta E_{Lab}^{*}(c_{1},c_{2}) =\sqrt{(L_{2}^{*}-L_{1}^{*})^{2}+(a_{2}^{*}-a_{1}^{*})^{2}+(b_{2}^ {*}-b_{1}^{*})^{2}} \tag{1}\] \[\Delta E_{ab}^{*}(c_{1},c_{2}) =\sqrt{(a_{2}^{*}-a_{1}^{*})^{2}+(b_{2}^{*}-b_{1}^{*})^{2}}\] (2) \[C_{p}^{*} =\sqrt{(a_{p}^{*})^{2}+(b_{p}^{*})^{2}} \tag{3}\]  
where \(c_{1}=(L_{1}^{*},a_{1}^{*},b_{1}^{*})\) and \(c_{2}=(L_{2}^{*},a_{2}^{*},b_{2}^{*})\) are two colors in the CIELAB color space, and \(C_{p}^{*}\) is the chroma (relative saturation) of a color \(c_{p}\).  
To identify the \"average\" background color \(c_{\text{Bg}}\), we construct a 3D histogram of L*a*b* values of nearly achromatic image pixels, i.e., pixels satisfying the condition \(C_{p}^{*}<2\)ND (we partition the  
Figure 7: The steps of the proposed algorithm: (**a**) determine the epidermis “outer” edge, (**b**) compute the epidermis skeleton, (**c**) determine the initial epidermis main axis (marked red), (**d**) determine the position and orientation of projections (“left side” and “right side” projections are marked cyan and magenta, respectively), (**e**) determine border nodes, (**f**) match border nodes with retes (rete bases and rete roots are marked green and magenta, respectively), (**g**) merge adjacent retes, (**h**) retouch the main axis (the outline of the epidermis base is marked blue, the initial main and retouched main axis are marked black and red, respectively), (**i**) split partially merged retes (the split is marked magenta), and (**j**) compute the width, length and height of each individual rete (here marked with different colors for readability).  
L*a*b* color space into \(200\times 256\times 256\) bins), and then choose the coordinates of the largest bin. The JND \(\approx 2.3\) stands for a \"just noticeable difference\", as proposed by [PERSON] et al. [38].  
The background mask \(M_{\rm Bg}\) is obtained using hysteresis thresholding (conditions are applied pixel-wise for each image pixel \(p\)) in the CIELAB color space:  
\[\text{IsSimilarToBg}(c_{p},\tau) =(\Delta E_{Lab}^{*}(p,c_{\rm Bg})<\tau)\vee(\Delta E_{ab}^{*}(c_ {p},c_{\rm Bg})<\tau\wedge L_{p}^{*}>L_{\rm bg}^{*}) \tag{4}\] \[M_{\rm Bg} =\text{IsSimilarToBg}(c_{p},2\,\text{JND})\to\text{IsSimilarToBg}(c_ {p},4\,\text{JND}) \tag{5}\]  
where \(c_{p}\) is the color of a pixel \(p\), \(\tau\) is a color distance threshold, and \(\to\) is a morphological reconstruction. The condition IsSimilarToBg\((c_{p},\tau)\) is satisfied by pixels with color similar to the \"average\" slide background color \(c_{\rm Bg}\) as well as by pixels brighter than \(c_{\rm Bg}\) but having similar chromaticity. The factors of 2 and 4 have been chosen empirically based on the analysis of color distance histograms for background pixels and tissue pixels (see Section 3.3 for details).