Automatic cell analysis and counting method based on mathematical morphology
Preprocessing and feature extraction of cell images through mathematical morphology technology, solving the problems of low cell counting efficiency and shape distinction in the existing technology, and achieving efficient and accurate automatic cell counting and classification, suitable for cell and molecular biology research. .
Patent Information
- Application Number
- CN202411281283.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2024-12-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art has problems in cell counting, which are large workload, low efficiency, and are easily affected by subjective judgment, especially when dealing with tight cluster cells, and it is difficult to distinguish normal cells from lesion cells according to cell shape, and it is impossible to effectively calculate. Cell concentration.
Using an automated cell analysis and counting method based on mathematical morphology, the area, center of mass coordinates, shape and activity characteristics of cells are extracted through image preprocessing, expansion, hole filling, corrosion, filtering, fracture treatment and connectivity domain algorithms to achieve the cell's area. Automatic counting and classification.
It improves the efficiency and accuracy of cell counting, can automatically process images, accurately segment cells, distinguish living and dead cells, and calculate cell concentrations, simplify the experimental process and reduce manual intervention.
Smart Images

Figure CN119152500A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of image processing and imaging, and in particular relates to an automated cell analysis and counting method based on mathematical morphology. Background Art
[0002] Cell analysis and counting technology is an indispensable technology in medical and biological research, and is widely used in medical research and diagnosis, pharmaceutical development, and basic biology. Accurate cell counting is crucial in quantitative and qualitative experiments. Traditional cell counting methods mainly rely on manual observation and counting under a microscope. However, this method has problems such as large workload, low efficiency, and susceptibility to subjective judgment when processing a large number of cell samples. In addition, the uneven distribution of cells in the sample will also increase the complexity of counting. Compared with manual analysis and counting, methods based on deep learning and image morphology have been widely used in the field of cell analysis and counting in recent years.
[0003] The deep learning-based method provides an efficient cell counting solution (CN 202010356821.4, CN202110392146.5, CN 202111436292.X). This method can learn complex features from images to achieve high-accuracy identification and counting of cells. At the same time, it can automate the cell counting process, reduce manual intervention, and improve the repeatability and traceability of the experiment. However, this method usually requires a large amount of labeled data for training, and the training process takes a lot of time. At the same time, the deep learning model is sensitive to training data, resulting in poor generalization.
[0004] The technology based on image morphology can quickly identify and count cells by analyzing the morphological features of cell images (CN201210047807.1, CN 201910025249.0). This method can analyze the morphological features of cells and provide more information for cell identification and counting. At the same time, the image morphology method can quickly provide the results of cell counting, which is suitable for experimental processes that require immediate feedback. Despite this, the existing technology still faces segmentation problems when dealing with tightly clustered cells. In addition, these methods often lack a detailed analysis of cell shape, and it is difficult to distinguish normal cells from diseased cells based on cell shape, thereby limiting their application in cell classification and counting. At the same time, the existing technology has not been able to effectively calculate the concentration of cells based on cell counting results, which is an important parameter for experimental design and clinical diagnosis. Therefore, improving the image morphology method, improving the accuracy of cell segmentation, and realizing automatic classification and concentration calculation based on cell shape have become urgent problems to be solved in the development of cell counting technology. Summary of the invention
[0005] The main purpose of the present invention is to overcome the shortcomings of some of the existing technologies mentioned above, and propose an automated cell analysis and counting method based on mathematical morphology, which realizes the automatic counting of cells in tissue sections by intelligently processing cell images, and completes the qualitative analysis and quantitative calculation of tissue section images. This innovative method provides a more efficient and accurate solution for cell counting, and is expected to promote experimental progress in cell and molecular biology research.
[0006] To achieve the above objectives, the present invention adopts the following technical solutions: An automated cell analysis and counting method based on mathematical morphology comprises the following steps: S1, collect images; S2, preprocessing the collected image to obtain a binary image of the cell area; S3, dilating, hole filling, corroding and filtering the preprocessed image in sequence; S4, breaking the interconnected cells in the filtered image; S5, using a connected domain algorithm to process the image result obtained after the fracture processing, each cell corresponds to a connected domain, all connected domains in the image are extracted, and the area and centroid coordinate position of each connected domain are obtained; S6, based on the result of step S5, preliminarily screening the connected domain of each cell to remove impurities and cell debris; S7. According to the result of step S6, the cells with an area of a desired size are counted to obtain a cell counting result of an area of a desired size; the cell shape is determined according to the obtained cell counting result of an area of a desired size, and the cells with a desired shape are counted to obtain a cell counting result of a desired shape; the live or dead of the cells is determined according to the obtained cell counting result of a desired shape, and the live cells and dead cells are counted separately to obtain a count result of live cells and dead cells.
[0007] Furthermore, the image preprocessing in step S2 mainly includes the following steps: (1) Convert the acquired image into a grayscale image; (2) Convert the grayscale image into a binary image using the adaptive threshold method.
[0008] Furthermore, the pre-processed image is expanded in step S3 to eliminate small holes in the cells and compress larger cell holes. Specifically, the process includes: According to the formula The preprocessed image is expanded, where is the expanded image, A 1 represents the image after preprocessing in step S2,B 1 is the structural element required for the expansion operation, For structural elements B 1 Reflection, To follow the point The translation is defined as .
[0009] Furthermore, the step S3 of filling the holes in the image after the expansion process refers to filling the remaining holes in the cell, which specifically includes: (1) Use edge detection algorithms to identify the boundaries of cells in the image; Edge detection algorithms include but are not limited to Canny and Sobel algorithms; (2) Through the connectivity analysis of the image, the regions completely surrounded by the inner border of the cell are identified; these regions are pores; (3) For each detected hole, select the pixel values outside the hole and adjacent to the hole boundary area to fill all the pixel values inside the hole.
[0010] Furthermore, the image after the hole filling in step S3 is corroded to reduce the contact area of the connected cells, specifically including: According to the formula The image after hole filling is corroded, where is the image after corrosion, A 2 is the image after hole filling, B 2 is the structural element required for the corrosion operation, To follow the point The translation is defined as .
[0011] Furthermore, in step S3, the eroded image is filtered to eliminate areas that do not belong to cells, and the filtering methods include but are not limited to median filtering and mean filtering.
[0012] Furthermore, the step S4 of breaking the interconnected cells in the filtered image specifically includes: (1) Calculate the gradient map of the image and find the local minimum of the gradient map, i.e., low gradient values corresponding to valleys, and the local maximum, i.e., high gradient values corresponding to peaks; (2) Set the local minimum point as the seed point; (3) Starting from the seed point, simulate the process of water gradually rising on the terrain. As the water level rises, different valleys begin to be filled with water. When the water levels of two valleys are about to merge, a dam is built between them. This process is repeated until all valleys are filled. (4) After all valleys are filled with water, the constructed dams form the segmentation lines of the cell image, marking all segmentation lines that will separate connected cells.
[0013] Furthermore, the preliminary screening of the connected domains of each cell to remove impurities and cell debris in step S6 mainly includes the following steps: (1) Set the area threshold S 1, The area mentioned here refers to the sum of all pixels in the connected domain. The area of the cell connected domain is smaller than S 1 The cells are judged as impurities or cell debris and removed. 1 The value range is 85~100; (2) Set the aspect ratio threshold K of the rectangle surrounding the cell connectivity domain 1 , the aspect ratio is greater than K 1 The cells were identified as cell debris and removed. 1 The value range is greater than or equal to 5.
[0014] Furthermore, step S7, judging the shape of the cells according to the obtained cell counting result of the desired size area, and counting the cells of the desired shape, comprises the following steps: (1) Fit the cell connectivity domain into an ellipse and calculate the major and minor axes of each ellipse; (2) Calculate the ratio K of the major axis to the minor axis of each cell connectivity domain 2 , K 2 The value range is 1~K 1 between; (3) Screening out connected domains that fall within the range of the major axis to minor axis ratio, and counting the screened connected domains, which is the cell count of the desired shape.
[0015] Furthermore, the cell state in step S7 is whether the cell is alive or dead, and judging whether the cell is alive or dead is based on the obtained cell counting result of the desired shape, and counting the live cells and dead cells respectively, mainly including the following steps: (1) Calculate the mean of the pixels in each cell’s connected domain; (2) Setting a threshold for evaluating cell activity. Cells whose mean value of pixels in the connected domain described in step (1) is greater than the threshold are considered live cells, and cells whose mean value is less than the threshold are considered dead cells. The threshold value ranges from 150 to 250.
[0016] Advantages and beneficial effects of the present invention: (1) The method of the present invention can break connected cells and effectively remove some interference areas.
[0017] (2) The method of the present invention can fit cells into ellipses, calculate the major axis and minor axis of the ellipse, determine the shape of the cells based on the major axis and minor axis, and screen and count cells of specific shapes.
[0018] (3) The method of the present invention can determine whether cells are alive or dead, and count live cells and dead cells separately. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 The present invention provides a flow chart of the cell analysis and counting method.
[0020] Figure 2 These are images during the cell analysis and counting process: A is the original image collected in step S1; B is the image after preprocessing in step S2; C is the image after expansion in step S3; D is the image after hole filling in step S3; E is the image after corrosion treatment in step S3; F is the image after filtering in step S3; G is the image after fracture treatment in step S4; H is the image after preliminary screening in step S6; and I is the final result image after screening in step S7. DETAILED DESCRIPTION
[0021] An automated cell analysis and counting method based on digital image processing, the flow chart of which is as follows Figure 1 As shown, the following steps are included: S1, collecting images; in this embodiment, images are collected by a microscope, such as Figure 2 As shown in A; S2, preprocessing the collected image to obtain a binary image of the cell area; (1) Convert the acquired image into a grayscale image; (2) The grayscale image is converted into a binary image using an adaptive threshold method, such as Figure 2 As shown in B.
[0022] S3, dilating, hole filling, corroding and filtering the preprocessed image in sequence.
[0023] First, the preprocessed image is expanded to eliminate small holes in the cells and compress larger cell holes, including: According to the formula The preprocessed image is expanded, where is the expanded image, A 1 represents the image after preprocessing in step S2, B 1is the structural element required for the expansion operation, For structural elements B 1 Reflection, To follow the point The translation is defined as .
[0024] Performing the expansion process four times usually achieves the best effect. When the number of expansion processes increases to five or more times, the effect may gradually decrease. In this embodiment, the expansion process is performed four times, and the structural element B 1 use Rectangular structural element, the expanded figure is as follows Figure 2 As shown in C.
[0025] Filling holes in the image after expansion means filling the remaining holes in the cells. The specific steps include: (1) Use edge detection algorithms to identify the boundaries of cells in the image; Edge detection algorithms include but are not limited to Canny and Sobel algorithms. In this embodiment, the Sobel algorithm is used; (2) Through the connectivity analysis of the image, the regions completely surrounded by the inner border of the cell are identified; these regions are pores; (3) For each detected hole, select the pixel values outside the hole and adjacent to the hole boundary area to fill all the pixel values inside the hole. The filled image is as follows: Figure 2 As shown in D.
[0026] The hole-filled image is corroded to reduce the contact area of connected cells, including: According to the formula The image after hole filling is corroded, where is the image after corrosion, A 2 is the image after hole filling, B 2 is the structural element required for the corrosion operation, To follow the point The translation is defined as .
[0027] Performing the etching process twice usually achieves the best effect. When the number of treatments increases to three or more, the effect may gradually decrease. In this embodiment, the etching process is performed twice, and the structural element B 2 use Rectangular structural element, the image after corrosion processing is as follows Figure 2 As shown in E.
[0028] The eroded image is filtered to eliminate the area that does not belong to the cell. The filtering methods include but are not limited to median filtering and mean filtering.
[0029] In this embodiment, median filtering is used to remove very small points in the image that are obviously not cells. The image after filtering is as follows Figure 2 As shown in F.
[0030] S4, breaking the interconnected cells in the filtered image; The breakage process of the interconnected cells specifically comprises the following steps: (1) Calculate the gradient map of the image and find the local minimum of the gradient map, i.e., low gradient values corresponding to valleys, and the local maximum, i.e., high gradient values corresponding to peaks; (2) Set the local minimum point as the seed point; (3) Starting from the seed point, simulate the process of water gradually rising on the terrain. As the water level rises, different valleys begin to be filled with water. When the water levels of two valleys are about to merge, a dam is built between them. This process is repeated until all valleys are filled; (4) After all valleys are filled with water, the constructed dams form the dividing lines of the cell image. All dividing lines are marked, and these dividing lines will divide the connected cells. The image after the break processing is shown in the figure below. Figure 2 As shown in G.
[0031] S5. Use a connected domain algorithm to process the image result obtained after the fracture processing in step S4. Each cell corresponds to a connected domain, and the connected domain area and centroid coordinate position of each cell are obtained.
[0032] S6. Based on the result of step S5, the method of preliminarily screening the connected domain of each cell to remove impurities and cell debris comprises the following steps: (1) Set the area threshold S 1 The area here refers to the sum of all pixels in the cell connection domain. The cell connection domain area is smaller than S 1 The cells are judged as impurities or cell debris and removed. 1 The value range of is 85~100. In this embodiment, the area threshold S 1 Set to 90; (2) Set the aspect ratio threshold K of the rectangle surrounding the cell connectivity domain 1 , the aspect ratio is greater than K 1 The cells were identified as cell debris and removed. 1 The value range of K is greater than or equal to 5. 1 Set to 10, the initial screening results are as follows Figure 2 As shown in H.
[0033] S7, according to the result of step S6, counting the cells with the required size area to obtain the cell counting result of the required size area; judging the cell shape according to the obtained cell counting result of the required size area, and counting the cells with the required shape to obtain the cell counting result of the required shape; judging whether the cells are alive or dead according to the obtained cell counting result of the required shape, and counting the live cells and dead cells respectively to obtain the counting results of the live cells and dead cells; According to the screening result of step S6, cells of the required size are counted to obtain the cell counting result of the required size. This method can screen cells of any area. In this embodiment, cells with an area greater than 100 and less than 400 are counted.
[0034] The shape of the cells is determined according to the cell counting result of the desired size area, and the cells of the desired shape are counted. The method comprises the following steps: (1) Fit the cell connectivity domain into an ellipse and calculate the major and minor axes of each ellipse; (2) Calculate the ratio K of the major axis to the minor axis of each cell connectivity domain 2 , K 2 The value range is 1~K 1 between; (3) Screening out connected domains that meet the range of the ratio of the major axis to the minor axis, and counting the screened connected domains, that is, counting the cells of the desired shape; this method can screen cells of any shape. In this embodiment, K 2 Cells greater than 1.5 and less than 4 were counted.
[0035] The cell state is whether the cell is alive or dead. The alive or dead state of the cell is determined according to the counting result of the cells of the desired shape, and the living cells and the dead cells are counted respectively, which mainly includes the following steps: (1) Calculate the mean value of pixels in the connected domain of each cell; (2) Setting a threshold for evaluating cell activity. Cells with a mean greater than the threshold in step (1) are considered live cells, and cells with a mean less than the threshold are considered dead cells. The threshold ranges from 150 to 250. In this embodiment, the threshold is set to 201.
[0036] As attached Figure 1 , Attachment Figure 2 As shown, the results of cell counting of the present invention are given. Figure 1 Attached is a flow chart of the method of the present invention. Figure 2 A is the original image collected. It can be seen that some cells in the original image are adhered together. Figure 2 B to Attached Figure 2 I is the result after the intermediate step of the method of the present invention, Figure 2I is the final cell counting result diagram. Figure 2 It can be seen that the cells adhering to each other are segmented from each other, and then accurately counted. This shows that by the method of the present invention, the cells adhering to each other in the image can be well segmented, and the cells can be accurately counted.
[0037] When the present invention is implemented, the image is first collected, and then the image is preprocessed, expanded, hole-filled, eroded, filtered, broken, connected domain algorithm is used to obtain the cell connected domain, preliminary screening is performed, and finally the number of cells in the image is obtained according to the area, shape, and state of the cells. The present invention can accurately count cells without manual counting, is easy to operate, fast, and highly portable.
Claims
1. An automated cell analysis and counting method based on mathematical morphology, characterized in that: The following steps are involved: S1, collect images; S2, preprocessing the collected image to obtain a binary image of the cell area; S3, dilating, hole filling, corroding and filtering the preprocessed image in sequence; S4, breaking the interconnected cells in the filtered image; S5, using a connected domain algorithm to process the image result obtained after the fracture processing, each cell corresponds to a connected domain, all connected domains in the image are extracted, and the area and centroid coordinate position of each connected domain are obtained; S6, based on the result of step S5, preliminarily screening the connected domain of each cell to remove impurities and cell debris; S7. According to the result of step S6, the cells with an area of a desired size are counted to obtain a cell counting result of an area of a desired size; the cell shape is determined according to the obtained cell counting result of an area of a desired size, and the cells with a desired shape are counted to obtain a cell counting result of a desired shape; the live or dead of the cells is determined according to the obtained cell counting result of a desired shape, and the live cells and dead cells are counted separately to obtain a count result of live cells and dead cells.
2. The method for automated cell analysis and counting based on mathematical morphology according to claim 1, characterized in that: The image preprocessing in step S2 mainly includes the following steps: (1) Convert the collected image into a grayscale image; (2) The grayscale image is converted into a binary image using the adaptive threshold method.
3. The method for automated cell analysis and counting based on mathematical morphology according to claim 1, characterized in that: The step S3 of dilating the pre-processed image to eliminate small holes in the cells and compressing larger cell holes specifically includes: According to the formula The preprocessed image is expanded, where is the expanded image, A 1 represents the image after preprocessing in step S2, B 1 is the structural element required for the expansion operation, For structural elements B 1 Reflection, To follow the point The translation is defined as .
4. The method for automated cell analysis and counting based on mathematical morphology according to claim 1, characterized in that: The step S3 of filling the holes in the image after the expansion process refers to filling the remaining holes in the cell, which specifically includes: (1) Use edge detection algorithms to identify the boundaries of cells in the image; Edge detection algorithms include but are not limited to Canny and Sobel algorithms; (2) Through the connectivity analysis of the image, the regions completely surrounded by the inner border of the cell are identified; these regions are pores; (3) For each detected hole, select the pixel values outside the hole and adjacent to the hole boundary area to fill all the pixel values inside the hole.
5. The method for automated cell analysis and counting based on mathematical morphology according to claim 1, characterized in that: The step S3 of corroding the image after the holes are filled so as to reduce the contact area of the connected cells specifically includes: According to the formula The image after hole filling is corroded, where is the image after corrosion, A 2 is the image after hole filling, B 2 is the structural element required for the corrosion operation, To follow the point The translation is defined as .
6. The method for automated cell analysis and counting based on mathematical morphology according to claim 1, characterized in that: In step S3, the eroded image is filtered to eliminate areas that do not belong to cells. The filtering methods include but are not limited to median filtering and mean filtering.
7. The method for automated cell analysis and counting based on mathematical morphology according to claim 1, characterized in that: The step S4 of breaking the interconnected cells in the filtered image specifically includes: (1) Calculate the gradient map of the image and find the local minimum of the gradient map, i.e., low gradient values corresponding to valleys, and the local maximum, i.e., high gradient values corresponding to peaks; (2) Set the local minimum point as the seed point; (3) Starting from the seed point, the process of water gradually rising on the terrain is simulated. As the water level rises, different valleys begin to be filled with water. When the water levels of two valleys are about to merge, a dam is built between them. This process is repeated until all valleys are filled. (4) After all valleys are filled with water, the constructed dams form the segmentation lines of the cell image, marking all segmentation lines that will separate connected cells.
8. The method for automated cell analysis and counting based on mathematical morphology according to claim 1, characterized in that: The method of preliminarily screening the connected domains of each cell to remove impurities and cell debris in step S6 comprises the following steps: (1) Setting an area threshold S1, where the area refers to the sum of all pixels in the cell connectivity domain. Cells with a cell connectivity domain area smaller than S1 are judged as impurities or cell debris and are removed. The value range of S1 is 85–100. (2) A threshold value K1 for the aspect ratio of the circumscribed rectangle of the cell connectivity domain is set. Cells with an aspect ratio greater than K1 are considered cell debris and removed. The value range of K1 is greater than or equal to 5.
9. The method for automated cell analysis and counting based on mathematical morphology according to claim 1, characterized in that: Step S7, judging the shape of the cells according to the obtained cell counting result of the desired size area, and counting the cells of the desired shape, comprises the following steps: (1) Fit the cell connectivity domain into an ellipse and calculate the major and minor axes of each ellipse; (2) Calculate the ratio K2 of the major axis to the minor axis of each cell connectivity domain, where the value of K2 ranges from 1 to K1; (3) Screening out connected domains that fall within the range of the major axis to minor axis ratio, and counting the screened connected domains, which is the cell count of the desired shape.
10. The method for automated cell analysis and counting based on mathematical morphology according to claim 1, characterized in that: The cell state in step S7 is whether the cell is alive or dead. The alive or dead of the cell is determined according to the cell counting result of the desired shape, and the living cells and dead cells are counted respectively, which mainly includes the following steps: (1) Calculate the mean value of pixels in the connected domain of each cell; (2) Setting a threshold for evaluating cell activity. Cells whose mean value of pixels in the connected domain described in step (1) is greater than the threshold are considered live cells, and cells whose mean value is less than the threshold are considered dead cells. The threshold value ranges from 150 to 250.
Citation Information
Patent Citations
Cell counting method
CN112991213A
Method for segmenting and counting positions of embryonic cells in cleavage period based on image processing
CN112991306A
Cell image processing method, device, system, equipment and storage medium
CN116630364A
Cell counting method and device based on bright field optical image processing and storage medium
CN116703927A
Image recognition based cell recognition and counting method and apparatus, and computer device
WO2021139258A1
