## 2 Materials and Methods
### Acdc: A Method for the Automatic Cell Detection and Counting
#### 2.2.2 Nucleus Seed Selection  
The following steps are executed to obtain a reliable seed selection, so that the cells nuclei can be accurately extracted from the pre-processed images:  
1. A thresholding technique has to be first applied to detect the cell regions. Both global and local thresholding techniques aim at separating foreground objects of interest from the background in an image, considering differences in pixel intensities [54]. Global thresholding determines a single threshold for all pixels and works well if the histogram of the input image contains well-separated peaks corresponding to the desired foreground objects and background [55]. Local adaptive thresholding techniques estimate the threshold locally over sub-regions of the entire image, by considering only a user-defined window with a specific size and exploiting local image properties to calculate a variable threshold [53; 54]. These algorithms find the threshold by locally examining the intensity values of the neighborhood of each pixel according to image intensity statistics. To avoid unwanted pixels in the thresholded image, mainly due to small noisy hyper-intense regions caused by non-uniform illumination, we apply the Otsu global thresholding method [55] instead of local adaptive thresholding based on the mean value in a neighborhood [56]. Moreover, global threshold techniques are significantly faster than local adaptive strategies.
2. Hole filling is applied to remove possible holes in the detected nuclei due to small hypo-intense regions included in the nuclei regions.
3. Morphological opening (using a disk with 1-pixel radius as a structuring element) is used to remove loosely connected-components, such as in the case of almost overlapping cells.
4. Unwanted areas are removed according to the connected-components size. In particular, the detected candidate regions with areas smaller than 40 pixels are removed to refine the achieved segmentation results by robustly avoiding false positives.
5. Morphological closing (using a 2-pixel radius circular structuring element) is applied to smooth the boundaries of the detected nuclei and avoid the under-estimation of the detected nuclei regions.
6. The approximate Euclidean distance transform (EDT) from the binary mask, achieved by applying the Otsu algorithm and refined by using the previous 3 steps, is used to obtain the matrix of distances of each pixel to the background by exploiting the \(\ell_{2}\) Euclidean distance [57] (with a \(5\times 5\) pixel mask for a more accurate distance estimation). This algorithm calculates the distance to the closest background pixel for each pixel of the source image.  
Regional maxima computation allows for estimating foreground peaks on the normalized distance map. Regional maxima are connected-components of pixels with a constant intensity value, whose external boundary pixels have all a lower intensity value [42]. The resulting binary mask contains pixels that are set to 1 for identifying regional maxima, while all other pixels are set to 0. A 5 \(\times\) 5 pixel square was employed as structuring element.
* Morphological dilation (using a 3-pixel radius circular structuring element) is applied to the foreground peaks previously detected for better defining the foreground regions and merging neighboring local minima into a single seed point. The segmentation results on Figure 4(a),b are shown in Figure 5(a),b, respectively. The detail in Figure 4(a) shows that ACDC is highly specific to cell nuclei detection, discarding non-cell regions related to acquisition artifacts.  
For the Nucleus Seed Selection step of the pipeline, the user can set the following parameters: a structuring element for the morphological opening; a structuring element for the morphological closing; a structuring element for the morphological dilation; the minimum size (in pixels) for the unwanted area removal.