Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar modules or modules having the same or similar functionality throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention. On the contrary, the embodiments of the invention include all changes, modifications and equivalents coming within the spirit and terms of the claims appended hereto.
According to the embodiment of the invention, the square matrix with the length of 5 pixels and the width of 5 pixels is used as the cell model, the cell central area is determined according to the cell model and the gray value of the pixels in the first cell image, the number of the cell central areas is the number of the cells, and the accuracy of cell counting when more cells are clustered is improved.
Example one
Fig. 1 is a flowchart of a method for identifying clustered cells according to an embodiment of the present invention. As shown in fig. 1, the method includes:
step S101: a first cell image is acquired.
In the embodiment of the invention, a slide glass filled with cell sap is shot under the light path of a microscope to obtain a first cell image, and the first cell image can be a color image or a gray-scale image. If the color image is a color image, a gray scale image as shown in FIG. 2 is obtained through conversion. In the case of cell clumps in fig. 2, especially in the box, the clumped cells are up to several tens.
Step S102: the first cell image is scaled according to the cell model and the cell type such that the pixels covered by a single cell match the cell model, wherein the cell model is a square matrix 5 pixels in length and 5 pixels in width.
In the embodiment of the invention, a square matrix with the length of 5 pixels and the width of 5 pixels is taken as a cell model. As shown in fig. 3, each grid represents one pixel, and the entire cell model is a square matrix with a length of 5 pixels and a width of 5 pixels. C is the center of the cell model, B1-B8 is 8 neighborhoods of C, preferably, 12 pixels of A1-A12 of the outermost layer of the square matrix are selected as the outermost layer of the cell model, and the pixels at the four corners of the square matrix are ignored.
In general, the cell fluid in which the cell count is required contains a single type of cells, and the size of the cells is uniform. In the case of a known cell type, such as a cell type that needs to be cell counted, the user inputs the cell type, and the first cell image is scaled so that the pixels covered by a single cell are matched with the cell model, i.e., the number of pixels covered by a single cell is substantially equivalent to the cell model.
Step S103: the cell center point is determined from the cell model and the gray values of the pixels in the first cell image.
In the embodiment of the present invention, the cell center point refers to a point within a cell boundary, and one cell may include a plurality of cell center points.
As an embodiment of the present invention, the process of determining the center point of a cell is shown in FIG. 4, and the method comprises:
step S401: and calculating the gray value difference value of the selected pixel in the first cell image and the pixels in the 8 neighborhoods thereof according to the cell model to obtain the number of the first pixels of which the gray value difference value is larger than the first threshold.
Step S402: and calculating the gray value difference between the selected pixel in the first cell image and the 12 outermost pixels according to the cell model to obtain the number of second pixels of which the gray value difference is greater than a second threshold.
Step S403: and when the number of the first pixels is larger than a first preset counting value or the number of the second pixels is larger than a second preset counting value, determining the selected pixels as the cell center points.
In the embodiment of the invention, pixel points of the zoomed first cell image are traversed, each pixel point is used as C in the cell model, the gray value difference value between the pixel point and the surrounding pixels is calculated, and whether the pixel point is the cell center point is judged. Preferably, in order to enable each calculation to be performed on the complete cell model, the two outermost circles of pixels of the scaled first cell image are ignored, and only the pixels within the two outermost circles of pixels are traversed.
Specifically, one pixel in the preferred range is selected as C in the cell model, and gray value difference values of the pixel and pixels in 8 neighborhoods of the pixel, namely C-B1 and C-B2 … … C-B8, are calculated to obtain the number of first pixels of which the gray value difference value is larger than a first threshold; and calculating gray value difference values of the gray value difference values and 12 pixels on the outermost layer of the cell model, namely C-A1 and C-A2 … … C-A12, and obtaining the number of second pixels of which the gray value difference values are larger than a second threshold. The number of the first pixels is larger than a first preset counting value or the number of the second pixels is larger than a second preset counting value, which indicates that the selected pixel is brighter than the surrounding environment, and the pixel is determined to be positioned in the cell boundary and is the center point of the cell. And traversing each pixel in the preferred range, and repeating the calculation step to determine the cell center point.
Step S104: and setting the gray value of the pixel corresponding to the cell center point in the second cell image with the gray value of the pixel being the first preset value as a second preset value.
Step S105: and determining the areas communicated with the second preset value as the cell central area.
In the embodiment of the present invention, the number of pixels in the length and the number of pixels in the width of the second cell image are both the same as the zoomed first cell image, and the gray values are both the first preset values, for example, the first preset value is 0. The pixel position where the cell center point is located determined in step S103 is mapped to the second cell image, and the gray value of the pixel on the second cell image is set to a second preset value, for example, the second preset value is 255. For each pixel, 4 neighborhoods thereof are detected, and a region connected by a second preset value is determined as a cell center region. The cell mass in the box of FIG. 2 was processed as described above to obtain a binarized image as shown in FIG. 5.
In the present embodiment, the cell center region refers to a region composed of the cell center point. The single white regions in fig. 5 are connected by four neighborhoods of the second preset value, and are composed of one or more cell center points, which are regarded as a cell center region and represent a cell. The number of white regions is the number of cells contained in the cell mass, and a total of 43 white regions in which four adjacent regions are connected in fig. 5 indicate a total of 43 cells.
The embodiment of the invention determines the cell number through the cell central region instead of the cell boundary, thereby reducing the influence of cell boundary deletion or low cell boundary definition on cell counting.
According to the embodiment of the invention, the square matrix with the length of 5 pixels and the width of 5 pixels is used as the cell model, the cell central area is determined according to the cell model and the gray value of the pixels in the first cell image, the number of the cell central areas is the number of the cells, and the accuracy of cell counting when more cells are clustered is improved.
Example two
Fig. 6 is a flowchart of a clustered cell identification method according to a second embodiment of the present invention. As shown in fig. 6, steps S601 to S605 of the method are the same as steps S101 to S105 of the first embodiment, and are not repeated herein. After step S605, the method further includes step S606: each cell center region is expanded according to a preset algorithm to identify cell boundaries.
In embodiments of the invention, the central region of each cell is expanded according to a predetermined algorithm, such as a dilation algorithm, and cell boundaries are determined by stopping dilation when certain conditions are met or when dilation is no longer possible. The first cell image is then combined to obtain a cell image with cell boundaries marked as shown in fig. 7, so that the observation is more intuitive and clear.
The embodiment of the invention determines the cell number through the cell central region instead of the cell boundary, thereby reducing the influence of cell boundary deletion or low cell boundary definition on cell counting. And then, the cell boundary is obtained by expanding the cell center region as the center, so that the observation is more visual and clear.
According to the embodiment of the invention, the square matrix with the length of 5 pixels and the width of 5 pixels is used as the cell model, the cell central area is determined according to the cell model and the gray value of the pixels in the first cell image, the number of the cell central areas is the number of the cells, and the accuracy of cell counting when more cells are clustered is improved.
EXAMPLE III
Fig. 8 is a block diagram of a clustered cell identification apparatus according to a third embodiment of the present invention, and as shown in fig. 8, the apparatus includes: an acquisition unit 81, a first determination unit 82, a setting unit 83, and a second determination unit 84.
The acquisition unit 81 is used to acquire a first cell image.
The first determination unit 82 is adapted to determine the cell center point based on the cell model and the gray values of the pixels in the first cell image.
The setting unit 83 is configured to set the gray value of the pixel corresponding to the cell center point in the second cell image where the gray values of the pixels are all the first preset values as the second preset values.
The second determination unit 84 is configured to determine regions connected by a second preset value as a cell center region.
Wherein the cell model is a square matrix of 5 pixels in length and 5 pixels in width. The first cell image and the second cell image have the same number of pixels in length and the same number of pixels in width.
Preferably, the apparatus further comprises a scaling unit 85 for scaling the first cell image according to the cell model and the cell type such that pixels covered by a single cell match the cell model.
Preferably, the apparatus further comprises an expanding unit 86 for expanding each cell center region according to a preset algorithm to identify cell boundaries.
In the embodiment of the present invention, the first determination unit 82 includes a first calculation subunit, a second calculation subunit, and a judgment subunit.
The first calculating subunit is configured to calculate a gray value difference between the selected pixel in the first cell image and the pixel in the 8-neighborhood region of the selected pixel according to the cell model, and obtain the number of first pixels of which the gray value difference is greater than the first threshold.
The second calculating subunit is configured to calculate gray value differences between the selected pixels in the first cell image and the 12 outermost pixels according to the cell model, and obtain a second number of pixels with gray value differences larger than a second threshold.
The judging subunit is used for determining the selected pixel as the cell center point when the first pixel number is greater than a first preset counting value or the second pixel number is greater than a second preset counting value.
The clustered cell identification method performed in the clustered cell identification apparatus corresponds to the methods described in the first and second embodiments one to one, and details thereof are not repeated herein.
The embodiment of the invention determines the cell number through the cell central region instead of the cell boundary, thereby reducing the influence of cell boundary deletion or low cell boundary definition on cell counting. And then, the cell boundary is obtained by expanding the cell center region as the center, so that the observation is more visual and clear.
According to the embodiment of the invention, the square matrix with the length of 5 pixels and the width of 5 pixels is used as the cell model, the cell central area is determined according to the cell model and the gray value of the pixels in the first cell image, the number of the cell central areas is the number of the cells, and the accuracy of cell counting when more cells are clustered is improved.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.