Automatic Cell Counter Algorithm

From Hackuarium
Jump to navigation Jump to search

The aim of this algorithm is first to detect cells (or groups of cells), to count them and to find cells containing a micronucleus. Theoretically this may be easy as the micronuclei should be as coloured as the nucleus. But other elements, bacteria for instance, can also be coloured by the dye. The big deal seems to be able to distinguish micronuclei from those other elements.

Background and Material Used

Methylene blue is known as a DNA dye. Thus it enable to discriminate the nucleus from the rest of the cell. This dye is widely used and allow a quite good visual recognition. Micronuclei, which is also composed of DNA, will also be coloured by this dye.

Pictures used to build the algorithm are taken using the Raspberry Pi Camera connected to the microscope.

Picture Procedure

First, we took photos while zooming on the cells of interest. As cells are quite translucent, they were difficult to detect. In addition, we realized that the microscope was so dirty that the durst was detected as well as the cells and it may be difficult to distinguish them. It was thus decided to apply some preprocessing instead of directly searching for cells contour.

In order to apply the background removal, we took a picture of the background without focusing on anything. The pre-processing will also remove noise due to the difference in luminosity. This removal would be easier if the field of view is the same on all images. Thus we thought it was better to take a picture of the whole field of view instead of zooming on the thing of interest.

Cell Detection

Pre-processing

Then several methods were tried to remove the background from the image of interest. First a simple subtraction of the background image was done. Unfortunately, this method results in strange horizontals lines which may be due to the actualisation of the camera. For some images it was not a problem but for others the cell was very difficult to detect due to those lines.

Another method was then tested, mainly the difference between the image representing the cell and the background image was computed. Then the cell is much more easily selected.

Cell Selection

Cell selection is done as followed:

  • First contours on the difference image are computed.
  • Then a thresholding step is done in order to keep only larger contours (larger area), the ones that may represent cells.
  • Finally, the nucleus detection (next step) will be done on those larger contours only.

Results

The developed algorithm is able to find isolated cells as well as groups of cells. Then a mask is applied in order to keep only what is inside the cells. This would simplify the next step which is finding the nucleus.

Nucleus Detection

Available Code