## 2 Materials and Methods
### Acdc: A Method for the Automatic Cell Detection and Counting
#### 2.2.1 Pre-Processing  
The input microscopy image is pre-processed to yield a convenient input to the downstream watershed-based segmentation by means of the following steps:  
1. Application of bilateral filtering that allows for denoising the image \(\mathcal{I}\) while preserving the edges by means of a non-linear combination of nearby image values [38]. This noise-reducing smoothing filter combines gray levels (colors) according to both a geometric closeness function \(c\) and a radiometric (photometric) similarity function \(s\). This combination is used to strengthen near values with respect to distant values in both spatial and intensity domains. This simple yet effective strategy allows for contrast enhancement [49]. Bilateral filter has been shown to work properly in fluorescence imaging even preserving the directional information, such as in the case of the F-actin filaments [50]. This denoising technique was effectively applied to biological electron microscopy [51], as well as to cell detection [52], revealing better performance--compared to low-pass filtering--in noise reduction without removing the structural features conveyed by strong edges. The most commonly used version of bilateral filtering is the shift-invariant Gaussian filtering, wherein both the closeness function \(c\) and the similarity function \(s\) are Gaussian functions of the Euclidean distance between their arguments [38]. With more details, \(c\) is radially symmetric: \(c(\mathbf{p},\mathbf{q})=e^{-\frac{1}{2}\left(\frac{||\mathbf{p}-\mathbf{q}|| }{\sigma_{\mathrm{S}}}\right)^{2}}\). Consistently, the similarity function \(s\) can be defined as: \(s(\mathbf{p},\mathbf{q})=e^{-\frac{1}{2}\left(\frac{||\mathbf{I}(\mathbf{p})- \mathbf{I}(\mathbf{q}||}{\sigma_{\mathrm{S}}})\right)^{2}}\). In ACDC we set \(\sigma_{c}=1\) and \(\sigma_{s}=\sigma_{\mathrm{global}}\) (where \(\sigma_{\mathrm{global}}\) is the the standard deviation of the input image \(\mathcal{I}\)) for the standard deviation of the Gaussian functions \(c\) and \(s\), respectively. This smart denoising approach allows us to keep the edge sharpness while reducing the noise of the processed image, so avoiding cell region under-estimation.
2. Application of top-hat transform for background correction with a binary circular structuring element (radius: 21 pixels) on the smoothed image. This operation accounts for non-uniform illumination artifacts, by extracting the nuclei from the background. The white top-hat transform is the difference between the input image \(l\) and the opening of \(\mathcal{I}\) with a gray-scale structuring element \(b\): \(\mathcal{T}_{\mathrm{w}}=\mathcal{I}-\mathcal{I}\circ b\)[53].  
The results of the pre-processing images applied to Figures 0(a) and 0(a) are shown in Figure 0(a),b, respectively. For the pre-processing step, ACDC requires only 3 parameters, namely: \(\sigma_{c}\) and \(\sigma_{s}\) for the bilateral filtering, and a structuring element for the hat-top transform.  
Figure 5: Result of the application of the pre-processing steps on the images shown in Figure 0(b) and Figure 0(a) (b).