A pathological diagnosis method and system based on image recognition
By segmenting pathological slide images and generating grayscale edge contours, the problem of blurred boundaries in the division of pathological image regions was solved, and the accurate localization of lesion regions and diagnostic consistency were achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN ZHUJUNHAO MEDICAL TECHNOLOGY DEVELOPMENT CO LTD
- Filing Date
- 2026-03-06
- Publication Date
- 2026-06-05
AI Technical Summary
Existing technologies lack stable identification methods in the segmentation of pathological image regions, making it difficult to cope with complex tissue structures and irregular cell distributions, resulting in blurred boundaries and positional drift, which affects the accuracy of lesion region localization and diagnostic consistency.
By acquiring pathological slide images, dividing them into multiple image blocks, extracting the two-dimensional coordinates and directional turning points of cell nuclei, generating a perturbation trend chart, identifying image blocks with concentrated distribution of turning points, extracting gray-scale mutation edge lines, performing path fitting and closure, constructing a closed structure map of lesions, and achieving pixel assignment calibration.
It improves the structural continuity and boundary integrity of pathological image region division, enhances the ability to identify abnormal structures, and improves the accuracy of lesion region localization and diagnostic consistency.
Smart Images

Figure CN122156154A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of region segmentation technology, and in particular to a pathological diagnosis method and system based on image recognition. Background Technology
[0002] The field of region segmentation technology mainly involves dividing pixels or regions in an image to extract and identify target regions. This technology is widely used in computer vision, medical image processing, remote sensing image analysis, and other fields. Its core aspects include boundary recognition, structure extraction, region clustering, and classification of regions of interest in an image. Common techniques include threshold-based segmentation, edge detection, region growing, watershed algorithms, cluster analysis, and graph cut models. The aim is to divide an image into several regions with consistent or specific attributes based on features such as grayscale, texture, and color. In traditional pathological diagnosis, doctors manually observe pathological slide images under a microscope, subjectively analyze and judge aspects such as tissue structure morphology, cell distribution characteristics, and staining, and then give a diagnostic conclusion. Traditional methods mainly rely on the experience and professional knowledge of pathologists. The analysis process usually includes image reading, magnified observation, visual identification of different types of tissue structures, and identification of lesion areas by comparing normal and abnormal tissue morphologies to determine the type and degree of disease. Although some processes can be preliminarily digitized with the help of image acquisition equipment, a large amount of manual operation is still required in the specific analysis process, especially in region recognition, which relies heavily on doctors' recognition and judgment of features such as the contour and color density of the target region.
[0003] Existing technologies lack stable means of identifying structural boundaries during the segmentation of pathological image regions. Complex tissue structures and irregular cell distribution patterns in images are difficult to effectively separate using a single feature. Traditional recognition processes rely heavily on static features such as grayscale and color, making it difficult to handle high-density, continuously changing cell regions. Frequent phenomena such as boundary breaks and region overlaps lead to positional drift or blurred boundaries during region extraction. The differences in features between images and noise interference further weaken the accuracy of region segmentation. Without dynamic structural correlation analysis methods, it is difficult to accurately locate the distribution area of lesions, affecting the integrity and consistency of the image basis for subsequent diagnosis. Summary of the Invention
[0004] To achieve the above objectives, the present invention adopts the following technical solution: a pathological diagnosis method based on image recognition, comprising the following steps: S1: Collect pathological slide images, divide them into multiple image blocks, label each image block with a unique index number, extract the two-dimensional coordinates of cell nuclei in the image blocks, calculate the distance changes between consecutive cell nuclei, extract directional turning points, connect the directional turning points, and generate a perturbation trend chart. S2: Call the disturbance trend chart, perform inflection point distribution density analysis, identify image patches with concentrated inflection points, and construct an image patch set based on clustering and distribution. S3: Call the image block set, perform grayscale change scanning, extract the grayscale change edge line as the edge starting path, track the gradient continuity of the edge starting path, and generate an edge contour map; S4: Call the edge contour map, perform contour closure integrity analysis, find broken edge nodes, perform path fitting based on direction consistency and connection continuity, and generate a lesion closure structure map; S5: Call the closed structure diagram of the lesion, label the pixel belonging according to the closed path range, identify the connected pixel group in the path, assign independent labels, construct the labeled image, and output the set of image blocks of the pathological diagnosis area.
[0005] As a further embodiment of the present invention, the perturbation trend chart includes image patch index number, cell nucleus position coordinate sequence, internuclear distance change sequence, and direction inflection point position; the image patch set includes inflection point density distribution characteristics, aggregation evaluation index, and distribution consistency characteristics; the edge contour map includes gray-scale abrupt change edge line, edge starting path sequence, and path gradient continuity characteristics; the lesion closed structure map includes closed edge path set, broken node connection relationship, and fitted path structure information; and the pathological diagnosis area image patch set includes pixel belonging region within the closed path, pixel connectivity label, and independently calibrated image patch unit.
[0006] As a further aspect of the present invention, the image patch with concentrated distribution of turning points refers to an image patch in the disturbance trend chart in which the number of turning points in its internal and surrounding areas is higher than the local average level and exhibits clustering characteristics.
[0007] As a further aspect of the present invention, the gradient continuity of the edge starting path refers to the fact that the gradient value of the grayscale change remains stable in space along the direction of the edge starting path.
[0008] As a further aspect of the present invention, the specific steps of S1 are as follows: S101: Based on the pathological slide images acquired by the image acquisition terminal, a fixed-size sliding window is used to move along the horizontal and vertical directions to divide the image blocks, and a unique index number is assigned to each image block. Combined with the starting coordinates and step size parameters of the sliding window, an image block index configuration set is generated. S102: Call the image block coordinates in the image block index configuration set, perform cell nucleus localization operation on the corresponding image block region, extract the two-dimensional coordinates of all cell nuclei, arrange the coordinate indexes in order from left to right and from top to bottom, and generate a cell nucleus spatial coordinate sequence. S103: Based on the cell nucleus spatial coordinate sequence, calculate the Euclidean distance between adjacent coordinate points, obtain the distance change value sequence, compare the difference between each distance value and the adjacent value, if the difference is greater than the preset change threshold, extract the turning point index and connect the corresponding coordinate points to generate a disturbance trend chart.
[0009] As a further aspect of the present invention, the specific steps of S2 are as follows: S201: Call the disturbance trend chart, extract the coordinates of the turning points in each path, classify the turning points according to the image block index, and calculate the number of turning points per unit area in combination with the image block area to obtain the turning point density parameter set. S202: Based on the set of inflection point density parameters, calculate the average clustering distance of all inflection points within the image block and compare it with a preset inflection point clustering benchmark value. If it is lower than the preset inflection point clustering benchmark value, record the corresponding image block number and generate an inflection clustering image block index set. S203: Call the set of image block inflection clusters, filter image blocks with inflection point density higher than the global average, record the index number, and obtain the set of image blocks in the inflection cluster.
[0010] As a further aspect of the present invention, the specific steps of S3 are as follows: S301: Based on the set of image blocks in the transition set, perform a grayscale value scanning operation on each image block, extract continuous pixels in the grayscale change region where the grayscale difference is greater than the preset edge recognition threshold, and arrange the pixels in order to form a linear trajectory to obtain a set of grayscale change edge lines; S302: Call the gray-scale abrupt change edge line set, calculate the angle difference of the gradient direction vector of adjacent pixels in each edge line, and if the continuous angle difference is within the gradient consistency threshold range, obtain the continuous gradient edge path set; S303: Based on the continuous gradient edge path set, connect the corresponding pixel points of the path by coordinate connection, perform edge contour closure processing on each path, merge and label all paths in the image coordinate plane, and establish an edge contour map.
[0011] As a further aspect of the present invention, the specific steps of S4 are as follows: S401: Call the edge contour map, compare the positions of the start and end points of each edge path, detect paths that do not form a closed loop, extract the pixel coordinates of the start and end points of the path, record them as the broken edge positions, and generate an edge broken node set. S402: Based on the set of edge break nodes, calculate the angle between the direction vectors of each break node and the endpoint of the adjacent path, and compare and judge the pixel continuity of the adjacent path in the edge contour map. Select node pairs whose absolute value of the angle between the direction vectors is less than a preset angle threshold and whose pixel spacing is less than a preset connection continuity threshold to obtain a set of fitable node pairs. S403: Call the fitted node pairing set, insert a linear connection path between each pair of nodes, and splice it into the original edge path sequence to construct a closed pixel connection region and establish a closed structure map of the lesion.
[0012] As a further aspect of the present invention, the specific steps of S5 are as follows: S501: Based on the lesion closure structure diagram, scan the area surrounded by each closed path line by line, determine the pixel ownership relationship within the path, and extract the image area covered by all paths to generate a pixel set of the closed path area. S502: Call the pixel set of the closed path region, and based on the adjacency relationship, detect the connected pixel group in each region, aggregate the continuous pixels into independent units, and obtain the region connected pixel group set; S503: Based on the set of connected pixels in the region, assign a unique label to each group of pixels and write the label information to the corresponding image block position to establish a set of image blocks for pathological diagnosis region.
[0013] A pathological diagnostic system based on image recognition, comprising: The image perturbation trend extraction module is used to achieve S1: acquiring pathological slide images, dividing them into multiple image blocks, labeling each image block with a unique index number, extracting the two-dimensional coordinates of cell nuclei in the image blocks, calculating the distance changes between consecutive cell nuclei, extracting directional turning points, connecting the directional turning points, and generating a perturbation trend chart. The inflection point density clustering analysis module is used to implement S2: call the disturbance trend chart, perform inflection point distribution density analysis, identify image patches with concentrated inflection points, and construct an image patch set based on clustering and distribution. The grayscale edge contour generation module is used to implement S3: call the image block set, perform grayscale change scanning, extract the grayscale change edge line as the edge starting path, track the gradient continuity of the edge starting path, and generate an edge contour map; The edge closure and structure reconstruction module is used to implement S4: call the edge contour map, perform contour closure integrity analysis, find broken edge nodes, perform path fitting based on direction consistency and connection continuity, and generate a lesion closure structure map; The lesion region labeling module is used to implement S5: calling the closed structure diagram of the lesion, labeling the pixel belonging according to the closed path range, identifying the connected pixel group within the path, assigning independent labels, constructing the labeled image, and outputting a set of pathological diagnosis region image blocks.
[0014] Compared with the prior art, the advantages and positive effects of the present invention are as follows: In this invention, a perturbation path is constructed by extracting changes in the cell nucleus position sequence, local clustering regions are identified based on the distribution density of inflection points, image patch selection is achieved using directional change trends, edge contours are extracted through gray-level abrupt changes and gradient continuity, path fitting is used to close broken boundaries, the expression of complex structural boundaries is enhanced, and region attribution is calibrated through pixel connectivity and path range, thus constructing an image patch set with spatial boundary accuracy, improving the ability to identify abnormal structures, and achieving improvements in image region segmentation in terms of structural continuity, boundary integrity, and calibration accuracy. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a schematic diagram of the steps of the present invention; Figure 2 This is a detailed schematic diagram of S1 of the present invention; Figure 3 This is a detailed schematic diagram of S2 of the present invention; Figure 4 This is a detailed schematic diagram of S3 of the present invention; Figure 5 This is a detailed schematic diagram of S4 of the present invention; Figure 6 This is a detailed schematic diagram of S5 of the present invention; Figure 7 This is a system module diagram of the present invention. Detailed Implementation
[0017] The technical solution of the present invention will now be described with reference to the accompanying drawings.
[0018] In embodiments of the present invention, words such as "exemplarily," "for example," etc., are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present the concept in a concrete manner. Furthermore, in embodiments of the present invention, the meaning expressed by "and / or" can be both, or either one.
[0019] In the embodiments of this invention, the terms "image" and "picture" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, their intended meanings are consistent. Similarly, the terms "of," "corresponding (relevant)," and "corresponding" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, their intended meanings are consistent.
[0020] In this embodiment of the invention, sometimes a subscript such as W1 may be written in a non-subscript form such as W1. When the difference is not emphasized, the meaning they express is the same.
[0021] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.
[0022] Please see Figure 1 This invention provides a pathological diagnosis method based on image recognition, comprising the following steps: S1: Acquire pathological slide images through the image acquisition terminal, divide the images into blocks, and label the unique index number of each image block. Obtain the two-dimensional coordinates of all cell nuclei in each image block. Calculate the distance changes between consecutive cell nuclei based on the spatial distribution order of the cell nuclei. Extract directional turning points from the change sequence, connect all turning points, and output a perturbation trend chart. S2: Call the disturbance trend chart, perform inflection point distribution density analysis on each disturbance trend path, identify image patches with concentrated inflection point distribution, make judgments based on the clustering and distribution consistency of inflection points, and output a set of image patches; S3: Based on the image patch set, perform grayscale change scanning on each image patch in the set, extract the grayscale change edge line as the edge starting path, track the gradient continuity in each edge starting path, and output the edge contour map; S4: Call the edge contour map, perform contour closure integrity analysis on each edge path, find broken edge nodes, perform path fitting processing based on the directional consistency and boundary connection continuity between adjacent nodes, connect all broken edges into complete closed paths, and output the lesion closure structure map; S5: Based on the closed path range in the lesion closed structure diagram, perform pixel assignment labeling on the area surrounded by each closed path, identify all connected image pixel groups within the path, assign an independent label to each pixel group, construct all labeled image blocks, and output a set of pathological diagnosis area image blocks.
[0023] The perturbation trend chart includes image patch index number, cell nucleus location coordinate sequence, internuclear distance change sequence, and direction inflection point location. The image patch set includes inflection point density distribution characteristics, aggregation evaluation index, and distribution consistency characteristics. The edge contour map includes gray-scale abrupt change edge lines, edge initiation path sequence, and path gradient continuity characteristics. The lesion closed structure map includes closed edge path set, broken node connection relationship, and fitted path structure information. The pathological diagnosis region image patch set includes pixel belonging region within closed path, pixel connectivity label, and independently labeled image patch unit.
[0024] Please see Figure 2 The specific steps of S1 are as follows: S101: Based on the pathological slide images acquired by the image acquisition terminal, a fixed-size sliding window is used to move along the horizontal and vertical directions to divide the image blocks, and a unique index number is assigned to each image block. Combined with the starting coordinates and step size parameters of the sliding window, an image block index configuration set is generated. First, the image acquisition unit acquires pathological slide images using a high-resolution scanner and stores them as digital image files. At this stage, the image size may be large; to facilitate subsequent analysis, a fixed-size sliding window technique is used to segment the entire image. During this process, the sliding window size is set to 512×512 pixels to ensure each window contains sufficient local detail information. Next, the starting coordinates of the sliding window are defined, typically set to the top-left corner of the image (0, 0). To traverse the entire image, the sliding window slides horizontally and vertically with a step size of 256 pixels; that is, after each 256-pixel slide, a new image block is acquired. This ensures that each image block has some overlap, which is helpful for subsequent detail extraction and analysis. A unique index number is assigned to each image block based on the starting coordinates of each window slide. For example, on a 2048×2048 image, a sliding window size of 512×512 with a step size of 256 pixels will result in 49 image blocks after sliding. Each image block is recorded as a structure containing its starting coordinates, size, and corresponding index number. This image patch index configuration set will be used for subsequent operations such as cell nucleus localization and perturbation trend chart generation, providing necessary parameter support for the entire analysis process.
[0025] S102: Call the image block coordinates in the image block index configuration set, perform cell nucleus localization operation on the corresponding image block region, extract the two-dimensional coordinates of all cell nuclei, arrange the coordinate indices in order from left to right and from top to bottom, and generate a cell nucleus spatial coordinate sequence. The coordinate information of each image block is read sequentially, and cell nucleus localization is performed on each image block using image processing techniques. First, the image blocks are converted into grayscale images for processing. The purpose of grayscale conversion is to simplify the image content and facilitate subsequent analysis. Then, a binarization method is used to separate the cell regions in the image from the background. Typically, a set grayscale threshold T (e.g., T=120) is used for segmentation, that is, all pixels smaller than the threshold are cell foreground, and the rest are background. After binarization, the cell nucleus part in the image will become white, and the background part will be black. Next, the image will undergo morphological processing, such as erosion and dilation, to remove noise and smooth the cell nucleus boundaries. After processing, a contour detection algorithm is used to detect cell nuclei and extract the centroid coordinates of each cell nucleus. These centroid coordinates are the two-dimensional spatial coordinates of the cell nuclei. For each image block, these coordinates are arranged in a left-to-right and top-to-bottom order to ensure that the order of the coordinates is consistent with the layout of the image. Through this process, a spatial coordinate sequence of cell nuclei in each image block is obtained. For example, if 10 cell nuclei are detected in an image block, the specific coordinates of these cell nuclei are recorded and arranged in a specified order to form a spatial sequence containing the coordinates of all cell nuclei.
[0026] S103: Based on the cell nucleus spatial coordinate sequence, calculate the Euclidean distance between adjacent coordinate points, obtain the distance change value sequence, compare the difference between each distance value and its adjacent values, and if the difference is greater than the preset change threshold, extract the inflection point index and connect the corresponding coordinate points to generate a disturbance trend chart. By calculating the distances between adjacent cell nuclei, the spatial variation trends between cell nuclei can be revealed. First, the coordinates of each pair of adjacent cell nuclei are extracted sequentially, and the straight-line distance between them is calculated using the Euclidean distance formula. For example, assuming the coordinates of two adjacent cell nuclei are (10, 10) and (20, 20), the distance between them is 14.14 pixels. Next, the distance difference between each pair of adjacent cell nuclei is calculated. By comparing all adjacent distance differences, significant distance changes can be identified, which may represent mutations or perturbations in the arrangement of cell nuclei. A distance difference threshold T (e.g., T = 5 pixels) is set. When the distance difference between adjacent cell nuclei exceeds this threshold, it is considered that a significant change has occurred and is marked as a turning point. By connecting the coordinates of these turning points, a perturbation trend map of the image can be generated, revealing the spatial perturbation of cell nuclei arrangement. For example, if a significant change in the distance between two cell nuclei is found, it will be marked as a turning point and the relevant coordinates will be connected to form a trend line depicting the pattern of cell nuclei arrangement. This process can visually demonstrate the changes in cell nuclei distribution and help analyze its biological significance.
[0027] Please see Figure 3 The specific steps of S2 are as follows: S201: Call the disturbance trend chart, extract the coordinates of the turning points in each path, classify the turning points according to the image patch index, and calculate the number of turning points per unit area in combination with the image patch area to obtain the turning point density parameter set. The coordinates of turning points in each path are extracted. These coordinates are obtained by calculating the turning point positions using the Euclidean distance variation of the path; these coordinates represent key locations in the image where cell nuclei arrangement changes. By reading the index information of image patches, the image patch corresponding to each turning point can be identified and classified according to the image patch. For example, if a path is contained within the region of image patch number 5, then the turning point of that path will be classified into image patch 5. After obtaining the coordinates of all turning points and completing the classification, the area of each image patch is further calculated, and this area value is used to evaluate... The inflection point density of each image patch refers to the number of inflection points contained in each unit area. Specifically, the area of each image patch is calculated, and the number of inflection points is divided by the area to obtain the inflection point density of each image patch. For example, for an image patch with an area of 10,000 pixels², if there are 20 inflection points in the image patch, then the inflection point density of the image patch is 0.002 inflection points / pixel². By calculating the inflection point density of each image patch, a complete set of inflection point density parameters is obtained. These parameters provide the basic data for subsequent inflection point clustering analysis.
[0028] S202: Based on the inflection point density parameter set, calculate the average clustering distance of all inflection points within the image block and compare it with the preset inflection point clustering benchmark value. If it is lower than the preset inflection point clustering benchmark value, record the corresponding image block number and generate an inflection clustering image block index set. First, by pairing all the coordinates of the inflection points within each image patch, the distance between each pair of inflection points is calculated, and the average value of these distances is obtained. Specifically, the distance between each inflection point and other inflection points is calculated, and all these distances are summed and divided by the total number of pairs to obtain the average clustering distance. For example, for 5 inflection points in an image block, the distance between every two inflection points is calculated. Assuming these distances are 3.0, 4.2, 2.5, 5.1, and 6.0 pixels respectively, the average value of these distances is approximately 4.2 pixels. Next, the calculated average clustering distance is compared with a preset inflection point clustering benchmark value. Assuming the benchmark value is 4.0 pixels, when the calculated average clustering distance is lower than 4.0 pixels, the inflection point clustering in the image block is considered to be strong, and the image block number is recorded. Finally, image blocks that meet the criteria are included in the inflection clustering image block index set. For example, in a set of image blocks, if the average clustering distance of image block number 7 is 3.8 pixels and is lower than the set benchmark value of 4.0 pixels, then image block number 7 will be added to the inflection clustering image block index set, ultimately forming this set.
[0029] S203: Call the inflection cluster image patch index set, filter the image patches with inflection point density higher than the global average, record the index number, and obtain the image patch set in the inflection cluster; First, the global average inflection point density is calculated. This value is obtained by weighted averaging of the inflection point densities of all image patches. For example, assuming the inflection point densities of all image patches are 10, 12, 8, 15, and 18 per square centimeter, the global average inflection point density is (10+12+8+15+18) / 5 = 12.6 per square centimeter. Then, image patches with an inflection point density higher than 12.6 per square centimeter are selected. For example, if an image patch has an inflection point density of 14 per square centimeter, it will meet the selection criteria. Next, these image patches are further filtered, retaining those with a clustering distance lower than a set benchmark value (e.g., 4.0 pixels). For example, if the clustering distance of the 3rd image patch among the selected image patches is 3.5 pixels, which is lower than the benchmark value, then this image patch will be selected and its index number recorded. Finally, all image patches that meet the inflection point density and clustering distance criteria are recorded and formed into a set of inflection point patches for further analysis.
[0030] Please see Figure 4 The specific steps of S3 are as follows: S301: Based on the set of image blocks in the transition set, perform grayscale value scanning operation on each image block, extract continuous pixels in the grayscale change area where the grayscale difference is greater than the preset edge recognition threshold, and arrange the pixels in order to form a linear trajectory to obtain the grayscale change edge line set; In this process, the pixel values of each image block are scanned line by line, from left to right, sequentially acquiring the grayscale value of each pixel. By calculating the grayscale difference between each adjacent pixel, areas with significant grayscale changes can be identified, which often correspond to the edges of the image. To ensure accurate edge identification, an edge recognition threshold T (e.g., T=15) is set. When the grayscale difference between two adjacent pixels exceeds this threshold, an edge is considered to exist at that location. Then, these pixels with significant grayscale changes are arranged in the order of their appearance, forming continuous linear trajectories. These linear trajectories correspond to the grayscale abrupt change edge lines in the image. For example, in an image block, if the grayscale change of some pixels exceeds the threshold T during the left-to-right scan, these pixels are marked and connected to form a complete edge line. Finally, the set of edge lines composed of pixels with grayscale abrupt changes in all image blocks serves as the input for subsequent path analysis, laying the foundation for further edge recognition and extraction.
[0031] S302: Call the gray-scale abrupt change edge line set, calculate the angle difference of the gradient direction vector of adjacent pixels in each edge line, and if the continuous angle difference is within the gradient consistency threshold range, obtain the continuous gradient edge path set; First, the gradient direction vectors of every two adjacent pixels are calculated. For example, for two adjacent pixels P1(x1, y1) and P2(x2, y2), the direction vector between them is calculated, and the gradient direction angle is calculated using the arctangent function. Next, the angle difference between these gradient directions is calculated, which is the angle difference between two adjacent pixels. By continuously calculating the angle difference of each pair of adjacent pixels, it can be determined whether the edge line maintains a consistent direction. If the angle difference between adjacent pixels is less than a set gradient consistency threshold (for example, a threshold of 15 degrees), then this part of the edge is considered to be... If the edges belong to the same continuous path, they are considered to have abrupt changes; otherwise, the edges are considered to have abrupt changes. The purpose of this angle difference calculation is to ensure that the directionality of each edge line is consistent, and to avoid misjudging discontinuous or unrelated edges as the same edge. For example, if the angle difference between the first two pixels of an edge line is 10 degrees and the angle difference between the next two pixels is 8 degrees, and these angle differences are all less than the set threshold of 15 degrees, then the edge line is considered continuous and enters the subsequent gradient edge path set. Finally, a set containing all continuous gradient edge paths is generated for subsequent path connection and closure processing.
[0032] S303: Based on the continuous gradient edge path set, connect the corresponding pixel points of the path with coordinates, perform edge contour closure processing on each path, merge and label all paths in the image coordinate plane, and establish an edge contour map. The coordinates of the pixels corresponding to each path are connected. For each path, the coordinates of all pixels in the path are connected sequentially to construct a complete edge path. For example, for a path containing 5 pixels, the coordinates of the path are P1(x1, y1), P2(x2, y2), P3(x3, y3), P4(x4, y4), and P5(x5, y5). These coordinate points are connected by straight lines to outline the shape of the edge. Next, the edge contour of each path is closed, especially when there are breaks in the path, by filling in the missing parts. The process involves separating and closing edges, ensuring each path forms a closed contour. For example, if the distance between the end and start of a path is less than a certain threshold (e.g., 5 pixels), the paths are automatically connected to form a closed path. All processed edge paths are eventually merged and labeled in the image's coordinate plane, forming a complete edge contour map. These contour maps clearly show the various edge features in the image, providing important information for subsequent analysis and processing. Through this process, complete edge information of the image can be extracted from the initial grayscale value changes, which can then be used for further tasks such as morphological analysis.
[0033] Please see Figure 5 The specific steps of S4 are as follows: S401: Call the edge contour map, compare the positions of the start and end points of each edge path, detect paths that do not form closed loops, extract the pixel coordinates of the start and end points of the path, record them as the positions of the broken edges, and generate a set of edge break nodes. The starting and ending points of each edge path are compared. The purpose of this comparison is to identify which edge paths do not form closed loops, meaning their starting and ending points are not connected. This is done by extracting the pixel coordinates of the beginning and end points of the path. For example, if the starting coordinates of an edge path are (100, 150) and the ending coordinates are (200, 250), and there is a certain distance between these two points, then the path is considered not closed. Next, the coordinates of the beginning and end points of these broken paths are recorded, and the endpoint information of these broken paths is saved as the broken edge positions. The position of each broken edge is identified and added to the edge break node set. For example, assuming there are multiple edge paths in the image, and paths numbered 3, 7, and 15 are found to be broken at coordinates (120, 180) and (220, 300) respectively, then the endpoint coordinates of these breaks will be extracted and recorded as a node set. Finally, the endpoint coordinates of all broken paths are summarized to form the edge break node set, providing a reference for subsequent path connection and splicing.
[0034] S402: Based on the set of edge break nodes, calculate the angle between the direction vectors of each break node and the endpoints of the adjacent paths, and compare and judge the pixel continuity of the adjacent paths in the edge contour map. Select node pairs whose absolute value of the angle between the direction vectors is less than the preset angle threshold and whose pixel spacing is less than the preset connection continuity threshold to obtain a set of fitable node pairs. First, the direction vector between each pair of break nodes and their adjacent path endpoints is calculated. This is done by extracting the coordinate differences between the nodes. For example, if the coordinates of the break node are (120, 180) and the coordinates of the adjacent path endpoint are (130, 190), then their direction vector is calculated as (130-120, 190-180), which is (10, 10). Next, the angle between this direction vector and the direction vector of the adjacent path endpoint is calculated, and the angle value is obtained using the dot product formula. For example, assuming the direction vectors of the adjacent path endpoints are (15, 15), the angle between them can be obtained using the dot product formula. If the included angle is less than a preset threshold (e.g., the threshold is set to 15 degrees), these paths are considered to be in the same direction, indicating that the endpoints of the two paths can be connected. Furthermore, the pixel continuity of adjacent paths in the edge contour map is compared and judged. For example, it is checked whether the pixel distance between the two paths is less than a preset connection continuity threshold T (e.g., set to 5 pixels). When the included angle is less than the set value and the pixel distance is less than the threshold, the node pair is considered to be fittable and recorded in the fittable node pairing set. For example, if the broken node is in the same direction as the endpoint of the adjacent path and the pixel distance is close, then these nodes will enter the pairing set as candidate nodes for subsequent path connection.
[0035] S403: Call the fitable node pairing set, insert a linear connection path between each pair of nodes, and splice it into the original edge path sequence to construct a closed pixel connection region and establish a closed structure map of the lesion. First, a straight-line connection path is calculated based on the coordinates of the node pair. For example, if the coordinates of the node pair are (120, 180) and (130, 190), a straight-line path connecting these two nodes will be calculated. Using an interpolation algorithm, intermediate pixels are generated along this straight line and inserted into the existing edge path sequence. These newly generated pixels ensure smooth connection of the path in the broken sections. Then, these connecting paths are spliced into the original edge paths to form closed pixel connection regions. For example, assuming the path between nodes (120, 180) and (130, 190) is broken in a broken region of the image, pixels will be inserted between these two points to form a new path, which will then be merged into the existing edge path. Finally, after all path splicing operations are completed, a complete closed structure, i.e., a lesion closure structure map, is formed. In this structure map, all the originally broken paths are connected, forming a complete closed region for subsequent image analysis or diagnosis.
[0036] Please see Figure 6 The specific steps of S5 are as follows: S501: Based on the lesion closure structure diagram, scan the area surrounded by each closed path line by line, determine the pixel belonging relationship within the path, and extract the image area covered by all paths to generate a pixel set of the closed path area. The system scans the region enclosed by each closed path line by line. During the scan, the system traverses the pixels of each closed path to determine the pixel affiliation within the path. Specifically, it determines whether a pixel belongs to a closed path region by assessing its position relative to the path. This determination is based on whether the pixel is located inside or at the edge of the path. For example, if path A surrounds the outside of region B, all pixels within the path are considered to belong to the region enclosed by path A. When a path region is scanned, all pixels within the image region covered by the path are extracted. The set of these pixels constitutes the closed path region pixel set. For instance, if path A surrounds a lesion region, all pixels within path A are considered part of the closed region, and their coordinates are recorded to generate the closed path region pixel set, containing information about all pixels located within the path.
[0037] S502: Call the pixel set of the closed path region, and based on the adjacency relationship, detect the connected pixel group in each region, aggregate the continuous pixels into independent units, and obtain the region connected pixel group set; The algorithm processes pixels based on their adjacency relationships. Adjacency refers to the spatial connection between two pixels, typically defined by horizontal, vertical, or diagonal connections. It examines each pixel region individually, detecting connected pixel groups within each region based on adjacency relationships. By comparing pixel coordinates, it determines if directly connected pixels exist. For example, if a pixel (100, 100) is directly connected to its neighboring pixel (101, 100), these two pixels are considered to belong to the same connected region. These consecutive pixels are then aggregated into a single unit, forming a connected pixel group. For instance, if multiple pixels exist within a region, forming a contiguous pixel region through adjacency, these pixels are merged into a connected pixel group. Through this process, each connected region in the image is independently identified and aggregated into a connected pixel group, ultimately resulting in a set of connected pixel groups containing information about all connected pixel groups.
[0038] S503: Based on the region-connected pixel group set, assign a unique label to each group of pixels and write the label information to the corresponding image block position to establish a pathological diagnosis region image block set; Each connected pixel group is assigned a unique label to distinguish different connected regions; for example, the first connected pixel group is assigned label 1, the second label 2, and so on. The label information of each pixel group is recorded in the corresponding image block location. The label information is appended to the pixel data of the image block to ensure that each pixel in each image block can be clearly identified as belonging to which connected region. For example, if there is a connected pixel group containing 50 pixels in an image block, these pixels will be assigned a unified label, such as label 1, and the label will be recorded in the pixel data of the image block. Finally, all the label information will constitute a set of image blocks for pathological diagnosis, serving as the basis for subsequent lesion area analysis and processing. For example, if the label of the lesion area is 1, the set of image blocks will contain all pixel information related to the lesion, and the labels will be used to distinguish the pathological features of different areas, providing support for subsequent diagnosis and analysis.
[0039] Please see Figure 7 A pathological diagnostic system based on image recognition, comprising: The image perturbation trend extraction module is used to achieve S1: acquiring pathological slide images, dividing them into multiple image blocks, labeling each image block with a unique index number, extracting the two-dimensional coordinates of cell nuclei in the image blocks, calculating the distance changes between consecutive cell nuclei, extracting directional inflection points, connecting directional inflection points, and generating a perturbation trend chart; The inflection point density clustering analysis module is used to implement S2: call the perturbation trend chart, perform inflection point distribution density analysis, identify image patches with concentrated inflection points, and construct an image patch set based on clustering and distribution. The grayscale edge contour generation module is used to implement S3: call the image block set, perform grayscale change scanning, extract the edge line of grayscale change as the edge starting path, track the gradient continuity of the edge starting path, and generate the edge contour map; The edge closure and structure reconstruction module is used to implement S4: call the edge contour map, perform contour closure integrity analysis, find broken edge nodes, perform path fitting based on direction consistency and connection continuity, connect broken edges, and generate a lesion closure structure map; The lesion region labeling module is used to implement S5: call the lesion closed structure map, label the pixel belonging according to the closed path range, identify the connected pixel group within the path, assign independent labels, construct the labeled image, and output a set of pathological diagnosis region image blocks.
[0040] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A pathological diagnosis method based on image recognition, characterized in that, Includes the following steps: S1: Collect pathological slide images, divide them into multiple image blocks, label each image block with a unique index number, extract the two-dimensional coordinates of cell nuclei in the image blocks, calculate the distance changes between consecutive cell nuclei, extract directional turning points, connect the directional turning points, and generate a perturbation trend chart. S2: Call the disturbance trend chart, perform inflection point distribution density analysis, identify image patches with concentrated inflection points, and construct an image patch set based on clustering and distribution. S3: Call the image block set, perform grayscale change scanning, extract the grayscale change edge line as the edge starting path, track the gradient continuity of the edge starting path, and generate an edge contour map; S4: Call the edge contour map, perform contour closure integrity analysis, find broken edge nodes, perform path fitting based on direction consistency and connection continuity, and generate a lesion closure structure map; S5: Call the closed structure diagram of the lesion, label the pixel belonging according to the closed path range, identify the connected pixel group in the path, assign independent labels, construct the labeled image, and output the set of image blocks of the pathological diagnosis area.
2. The pathological diagnosis method based on image recognition according to claim 1, characterized in that, The perturbation trend chart includes image patch index number, cell nucleus location coordinate sequence, internuclear distance change sequence, and direction inflection point location. The image patch set includes inflection point density distribution characteristics, aggregation evaluation index, and distribution consistency characteristics. The edge contour map includes gray-scale abrupt change edge lines, edge initiation path sequence, and path gradient continuity characteristics. The lesion closed structure map includes closed edge path set, broken node connection relationship, and fitted path structure information. The pathological diagnosis region image patch set includes pixel belonging region within closed path, pixel connectivity label, and independently calibrated image patch unit.
3. The pathological diagnosis method based on image recognition according to claim 1, characterized in that, The image patch with concentrated inflection points refers to an image patch in the disturbance trend chart where the number of inflection points in its internal and surrounding areas is higher than the local average level, and it exhibits clustering characteristics.
4. The pathological diagnosis method based on image recognition according to claim 1, characterized in that, The gradient continuity of the edge starting path refers to the fact that the gradient value of grayscale change remains stable in space along the direction of the edge starting path.
5. The pathological diagnosis method based on image recognition according to claim 1, characterized in that, The specific steps of S1 are as follows: S101: Based on the pathological slide images acquired by the image acquisition terminal, a fixed-size sliding window is used to move along the horizontal and vertical directions to divide the image blocks, and a unique index number is assigned to each image block. Combined with the starting coordinates and step size parameters of the sliding window, an image block index configuration set is generated. S102: Call the image block coordinates in the image block index configuration set, perform cell nucleus localization operation on the corresponding image block region, extract the two-dimensional coordinates of all cell nuclei, arrange the coordinate indexes in order from left to right and from top to bottom, and generate a cell nucleus spatial coordinate sequence. S103: Based on the cell nucleus spatial coordinate sequence, calculate the Euclidean distance between adjacent coordinate points, obtain the distance change value sequence, compare the difference between each distance value and the adjacent value, if the difference is greater than the preset change threshold, extract the turning point index and connect the corresponding coordinate points to generate a disturbance trend chart.
6. The pathological diagnosis method based on image recognition according to claim 1, characterized in that, The specific steps of S2 are as follows: S201: Call the disturbance trend chart, extract the coordinates of the turning points in each path, classify the turning points according to the image block index, and calculate the number of turning points per unit area in combination with the image block area to obtain the turning point density parameter set. S202: Based on the set of inflection point density parameters, calculate the average clustering distance of all inflection points within the image block and compare it with a preset inflection point clustering benchmark value. If it is lower than the preset inflection point clustering benchmark value, record the corresponding image block number and generate an inflection clustering image block index set. S203: Call the set of image block inflection clusters, filter image blocks with inflection point density higher than the global average, record the index number, and obtain the set of image blocks in the inflection cluster.
7. The pathological diagnosis method based on image recognition according to claim 1, characterized in that, The specific steps for S3 are as follows: S301: Based on the set of image blocks in the transition set, perform a grayscale value scanning operation on each image block, extract continuous pixels in the grayscale change region where the grayscale difference is greater than the preset edge recognition threshold, and arrange the pixels in order to form a linear trajectory to obtain a set of grayscale change edge lines; S302: Call the gray-scale abrupt change edge line set, calculate the angle difference of the gradient direction vector of adjacent pixels in each edge line, and if the continuous angle difference is within the gradient consistency threshold range, obtain the continuous gradient edge path set; S303: Based on the continuous gradient edge path set, connect the corresponding pixel points of the path by coordinate connection, perform edge contour closure processing on each path, merge and label all paths in the image coordinate plane, and establish an edge contour map.
8. The pathological diagnosis method based on image recognition according to claim 1, characterized in that, The specific steps of S4 are as follows: S401: Call the edge contour map, compare the positions of the start and end points of each edge path, detect paths that do not form a closed loop, extract the pixel coordinates of the start and end points of the path, record them as the broken edge positions, and generate an edge broken node set. S402: Based on the set of edge break nodes, calculate the angle between the direction vectors of each break node and the endpoint of the adjacent path, and compare and judge the pixel continuity of the adjacent path in the edge contour map. Select node pairs whose absolute value of the angle between the direction vectors is less than a preset angle threshold and whose pixel spacing is less than a preset connection continuity threshold to obtain a set of fitable node pairs. S403: Call the fitted node pairing set, insert a linear connection path between each pair of nodes, and splice it into the original edge path sequence to construct a closed pixel connection region and establish a closed structure map of the lesion.
9. The pathological diagnosis method based on image recognition according to claim 1, characterized in that, The specific steps of S5 are as follows: S501: Based on the lesion closure structure diagram, scan the area surrounded by each closed path line by line, determine the pixel ownership relationship within the path, and extract the image area covered by all paths to generate a pixel set of the closed path area. S502: Call the pixel set of the closed path region, and based on the adjacency relationship, detect the connected pixel group in each region, aggregate the continuous pixels into independent units, and obtain the region connected pixel group set; S503: Based on the set of connected pixels in the region, assign a unique label to each group of pixels and write the label information to the corresponding image block position to establish a set of image blocks for pathological diagnosis region.
10. A pathological diagnostic system based on image recognition, characterized in that, The system is used to implement the image recognition-based pathological diagnosis method according to any one of claims 1-9, the system comprising: The image perturbation trend extraction module is used to achieve S1: acquiring pathological slide images, dividing them into multiple image blocks, labeling each image block with a unique index number, extracting the two-dimensional coordinates of cell nuclei in the image blocks, calculating the distance changes between consecutive cell nuclei, extracting directional turning points, connecting the directional turning points, and generating a perturbation trend chart. The inflection point density clustering analysis module is used to implement S2: call the disturbance trend chart, perform inflection point distribution density analysis, identify image patches with concentrated inflection points, and construct an image patch set based on clustering and distribution. The grayscale edge contour generation module is used to implement S3: call the image block set, perform grayscale change scanning, extract the grayscale change edge line as the edge starting path, track the gradient continuity of the edge starting path, and generate an edge contour map; The edge closure and structure reconstruction module is used to implement S4: call the edge contour map, perform contour closure integrity analysis, find broken edge nodes, perform path fitting based on direction consistency and connection continuity, and generate a lesion closure structure map; The lesion region labeling module is used to implement S5: calling the closed structure diagram of the lesion, labeling the pixel belonging according to the closed path range, identifying the connected pixel group within the path, assigning independent labels, constructing the labeled image, and outputting a set of pathological diagnosis region image blocks.