## 2 Materials and Methods  
### Proposed Methods  
Removing compression artifacts by the EPIIC and EPIIC Sobel methods is divided into six main steps. A flowchart containing these successive steps and exemplary image fragments showing the results are shown in Figure 1.  
The first step, common for both methods, involves the color deconvolution for hematoxylin-eosin staining. The algorithm explained in [24] was applied to construct an \(H\) channel image containing mostly nuclei stained by hematoxylin from eosin-stained tissue structures. A common Matlab implementation released for public use [25] was used. For other images than H&E-stained slides, the \(H\) channel image is replaced by converting the RGB image to grayscale. The next step aims to preprocess the \(H\) image to increase the visibility of cell nuclei and reduce the noise present in the image caused by compression artifacts and the deconvolution process itself. In the EPIIC method, the threshold value is calculated first with the Otsu algorithm. Next, the contrast of the \(H\) image is adjusted by scaling the pixels with values from zero to the threshold value so that they occupy the entire allowed range of intensity values. As a result, only the most intensely colored elements are visible, and unnecessary background is removed. Then, the image is smoothed with the averaging filter to obtain more uniform shapes and colors of cell nuclei, which enables easier detection of the edges. In the EPIIC Sobel method, the image closing operation is performed on the \(H\) image with the structural element in the shape of a disk with a 3-pixel radius. After that, the contrast of an image is adjusted as before, but this time, the threshold value is fixed at 0.75. Next, the obtained image is smoothed with the averaging filter. The different threshold values make the EPIIC method better suited to images with more hematoxylin-stained structures, but in some cases, this results in the loss of poorly stained nuclei, which occurs less frequently in EPIIC Sobel. In the next step, the gradient magnitude is calculated. In the EPIIC algorithm, the central difference method is used to calculate the gradient magnitude, which is blurred using the average smoothing filter. In the EPIIC Sobel, the gradient is calculated using the Sobel operator. The resulting image \(G\) is used to create an edge map. In the following stage, the image \(G\) is processed to obtain the binary edge map \(M_{bin}\). In the EPIIC method, the image is binarized with the Otsu method. The threshold value obtained by the Otsu algorithm is multiplied by the \(T_{m}\) parameter. This will ensure that weaker edges are not included in the map. This operation is followed by a morphological opening with a square-shaped structural element of size \(2\times 2\) to remove isolated pixels from the map. In the EPIIC Sobel algorithm, the threshold value \(T\) is calculated based on the Root Mean Square (RMS) estimate of noise (the method described in [26], pp. 466-469), and its original value is multiplied by the \(T_{m}\) parameter. The additional thinning stage is performed, and the opening operation is skipped. As a result of this method, the edges are much thinner than for EPIIC. Since we are also interested in preserving information about the intensity of the edges, in the EPIIC method, the binary map \(M_{bin}\) is multiplied by the image \(G\) and the pixel values are then scaled. Pixels larger than zero are reduced by the threshold value and then divided by \(1-T\). Finally, the inverse image is used to obtain an edge map \(M\). In the EPIIC Sobel variant, edge maps are created for each of the three RGB color channels. The gradient magnitudes of each channel, calculated with the central difference operator, are used instead of the image \(G\) in the multiplication. Pixel scaling is performed as in the EPIIC method. The threshold \(T\) is set to the original threshold value calculated in the previous step. To obtain the final edge maps, scaled images for each channel are inverted.