# ChroSegNet: An Attention-Based Model for Chromosome Segmentation with Enhanced Processing
## 3 Method
### Enhanced Dataset and Enhanced Processing
#### 3.1.1 Image Enhancement Processing  
During the chromosome image acquisition, sensor noise, uneven illumination, and various cellular debris can severely degrade the quality of the chromosome images, resulting in a significant impact on the chromosome contours and the banding characteristics. This would affect not only the expert recognition of chromosomes but also the performance of the subsequent chromosome segmentation. The chromosome images provided by geneticists are black and white images since other color features does not help the subsequent chromosome segmentation but increasing the computation. Therefore, we applied gray value adjustment for the initial processing of microscopic images. As there are many impurities and glass slide noises in the chromosome images, we adopted a processing technique combining contrast adjustment and Contrast Limited Adaptive Histogram Equalization (CLAHE) to eliminate the impurities and noises. Meanwhile, the chromosome edges and band features in the image were enhanced. Specifically, the steps of the image enhancement are as follows.  
**Step-1 Grayscale Conversion:** Converting all the chromosome microscopic images from RGB to grayscale can reduce the computational dimensionality and the processing time without affecting the image feature extractions. We adopt floating-point arithmetic to replace the R, G, and B channels of original images with the operation results, so as to obtain the grayscale images.  
**Step-2 Contrast Stretching:** Due to the unique characteristics of chromosomes such as uneven illumination and blurred imaging, the chromosomes in the original image often lose characteristic information. In addition, irresistible factors, e.g., imaging interference, during the chromosome slide preparation can make chromosome images dark and blurry. Image contrast refers to the difference between the brightest part and the darkest part in an image. In our processing, the contrast stretching operation is performed to map all the pixels in the image to a larger range in the grayscale space. This operation not only effectively reduces the noise interference but also makes the contour and band features of chromosomes more prominent. This operation is formulated in (1):  
\[\begin{cases}y_{g}+b>255&,y_{c}=255\\ y_{g}+b\leqslant 255&,y_{c}=y_{g}\end{cases} \tag{1}\]  
where \(y_{g}\) represents the grayscale image, \(y_{c}\) represents the contrast-stretched image, and \(b\) represents a quantitative value. Since excessive contrast stretching can wash out saturated region of images, we divided the images into two categories: low-light-intensity images and high-light-intensity images. For low-light-intensity images, we set b to 50 for a large stretch. For images with high light intensity, the gray value of the whole image will be higher due to high illumination intensity, so we set b as 20 for fine tuning. Moderate contrast stretching allows further clarification of the image and initial elimination of a large amount of background noise.  
**Step-3 Contrast Limited Adaptive Histogram Equalization (CLAHE):** CLAHE was applied after the contrast stretching to ensure further enhancement of the chromosome bands and contouring without amplifying noise. CLAHE is a modified version of adaptive histogram equalization (AHE), which tends to amplify contrast in near-constant areas of the image because of the high concentration of histograms in such areas. This can cause the noise to be amplified in a near-constant region. In CLAHE, the contrast amplification in the vicinity of a given pixel value is given by the slope of the transformation function. This is proportional to the slope of the neighborhood cumulative distribution function (CDF) and therefore to the value of the histogram at that pixel value. CLAHE clipped the histogram to a predetermined value before calculating the CDF. This limits the slope of the CDF and thus the slope of the transform function, both limiting the contrast amplification and therefore reducing the noise amplification problems.