Medical image inpainting method and device for double-connected label interference, equipment and medium
Patent Information
- Application Number
- CN202610883641.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-18
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2046-06-18
AI Technical Summary
[0006]本发明提供一种双连通标记干扰的医学影像修复方法、装置、设备及介质,用以解决现有技术中修复后的图像与原始图像之间存在明显差异,且常伴随边缘模糊、图像内容破损以及结构断层等视觉缺陷的问题,实现高保真、高特异性的影像修复,使得修复后的影像在形态结构上严密闭合且色彩过渡上自然平滑,保证了纹理结构的一致性
[0017] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements a medical image restoration method for biconnected marker interference as described above.
Smart Images

Figure CN122415396B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical image processing technology, and in particular to a method, apparatus, device, and medium for medical image restoration of biconnected marker interference. Background Technology
[0002] With the continuous development of artificial intelligence technology, the industry has been exploring intelligent medical image recognition methods for many years, aiming to assist doctors in identifying various diseases and potential risks, thereby improving work efficiency. Taking the Picture Archiving and Communication System (PACS) as an example, this research process can be roughly divided into three stages. The first stage is based on traditional image processing algorithms, mainly using a large amount of prior knowledge to manually design and extract features to achieve pathological detection. The second stage is based on traditional machine learning algorithms, dedicated to improving the accuracy and speed of pathological detection. The third stage is based on deep convolutional neural networks, which automatically extracts features from pathological regions and enhances the expression of semantic information in images layer by layer, aiming to achieve good results in terms of detection accuracy and model applicability.
[0003] However, deep convolutional neural network models require a large sample of image data. These images need to cover various observation angles, environments, and disease types, many of which have low frequency of occurrence and cannot be reproduced in a short time. Therefore, current research needs to fully utilize historical image samples accumulated by medical departments over many years. These historical images often contain markings manually annotated with colored lines, mostly in circular, elliptical, or rectangular shapes, with the internal structure representing the pathological state of the disease. To improve the generalization ability of deep network models, training based on the original images is necessary. This means detecting and repairing the marked regions from these historical images to maintain overall visual consistency.
[0004] Currently, medical image restoration techniques targeting marker interference are the foundation of many artificial intelligence projects. The industry generally uses background color to fill the marked area or covers the marked area with the color of the nearest edge point.
[0005] However, when the marked lines are thick, using background color filling or color coverage of nearby edge points often results in significant differences between the restored image and the original image. It is also often accompanied by visual defects such as blurred edges, damaged image content, and structural breaks, which seriously affects the quality of the restored image and cannot meet the requirements of data accuracy for subsequent high-precision analysis applications. Summary of the Invention
[0006] This invention provides a medical image restoration method, apparatus, device, and medium for biconnected marker interference, which solves the problem that there are obvious differences between the restored image and the original image in the prior art, and that the restored image is often accompanied by visual defects such as blurred edges, damaged image content, and structural tortuosity. It achieves high-fidelity and high-specificity image restoration, so that the restored image is tightly closed in terms of morphological structure and has a natural and smooth color transition, ensuring the consistency of texture structure.
[0007] This invention provides a medical image restoration method for biconnected labeled interference, comprising: acquiring a medical image to be restored; determining the color function value of each pixel in the medical image to be restored, obtaining a color matrix, and extracting regions in the color matrix that are greater than a target color threshold to obtain candidate target regions; extracting connected components and the largest internal connected component determined based on the minimum convex bun matrix corresponding to the connected component in the candidate target regions, and filtering out biconnected labeled regions based on the real area of the connected components and the real area of the largest internal connected component; for each biconnected labeled region, determining the corresponding center point and edge points, and determining the angle range of each edge point relative to the center point; partitioning the edge points and fitting and restoring them partition by partition to obtain the restored medical image.
[0008] According to the present invention, a medical image restoration method for biconnected marker interference includes inner edge points and outer edge points. The method involves determining the angular range of each edge point relative to the center point, partitioning the edge points, and performing partition-by-partition fitting restoration to obtain the restored medical image. The method includes: for both inner and outer edge points, determining the rotation angle of the line connecting each edge point to the center point relative to the image width direction, with the center point as the center; and based on the rotation angle, performing preliminary matching between the outer and inner edge points according to their angular proximity; based on the rotation angle, dividing the outer edge points into multiple subsets according to the angular range; for each subset, moving the corresponding pre-matched inner edge point according to the corresponding outer edge point, determining the color difference between the inner and outer edge points under different inner movement amounts, and using the inner movement amount with the smallest color difference as the optimal matching offset for the corresponding subset; based on the optimal matching offset for each subset, performing secondary matching between the outer matched edge points and the inner edge points in the corresponding subset, determining the optimal inner matched edge point corresponding to each outer edge point, and performing linear fitting restoration to obtain the restored medical image.
[0009] According to the present invention, a medical image restoration method for biconnected marker interference includes, after obtaining the restored medical image, the method comprising: for each remaining discrete pixel to be restored in the restored medical image, searching along the line connecting the corresponding remaining pixel to be restored and the center point to both sides to obtain the first restored pixel on both sides that does not belong to the remaining pixel to be restored; and restoring the corresponding discrete pixel to be restored by linear fitting based on the color value of the first restored pixel on both sides and the distance from the discrete pixel to be restored to the first restored pixel on both sides.
[0010] According to a medical image restoration method for biconnected labeled interference provided by the present invention, connected components in a candidate target region and the largest internal connected component determined based on the minimum convex bun matrix corresponding to the connected component are extracted. Biconnected labeled regions are then selected based on the real area of the connected components and the real area of the largest internal connected component. The method includes: determining connected components based on the candidate target region and determining the minimum convex bun matrix covering each connected component; obtaining the corresponding inverse matrix for each minimum convex bun matrix and determining the largest internal connected component of the corresponding inverse matrix; determining the real area of each connected component and the corresponding area based on each largest internal connected component; and determining the corresponding connected component as a biconnected labeled region when the real area of the connected component is greater than or equal to a preset area threshold, and the ratio of the real area of the corresponding largest internal connected component to the real area of the connected component is greater than or equal to a preset ratio threshold.
[0011] According to a medical image restoration method for biconnected labeled interference provided by the present invention, after screening out biconnected labeled regions, the method includes: for the biconnected labeled regions, searching for pixels in the medical image to be restored that meet optimization conditions, and merging the pixels that meet the optimization conditions into the biconnected labeled regions to optimize the biconnected labeled regions; wherein, the optimization conditions include: determining that there are pixels that do not belong to the biconnected labeled regions; determining that the color function value corresponding to the pixel is greater than or equal to the target color threshold after being downgraded by a preset downgrade coefficient; and determining that the pixel is adjacent to the biconnected labeled regions.
[0012] According to the present invention, a medical image restoration method for biconnected labeled interference is provided, which determines the color function value of each pixel in the medical image to be restored, obtains a color matrix, and extracts regions in the color matrix that are greater than a target color threshold to obtain candidate target regions. The method includes: determining the maximum and minimum values of the color components of each pixel according to the medical image to be restored; determining the color function value of each pixel according to the maximum and minimum values of the color components of each pixel, and constructing a color matrix; comparing each element in the color matrix with the target color threshold to determine the target matrix, and obtaining candidate target regions according to the target matrix.
[0013] According to the present invention, a medical image restoration method for biconnected labeled interference is provided, which determines a target matrix by comparing each element in a color matrix with a target color threshold. The method includes: determining the maximum color function value based on the color matrix, and determining an initial retrieval value and an upper limit value for the target color threshold based on the maximum color function value; using the initial retrieval value as the target color threshold, and comparing each element in the color matrix with the target color threshold to determine the target matrix; determining the number of connected components based on the target matrix, and updating the target color threshold according to a preset update coefficient based on the number of connected components being greater than a preset connected component quantity threshold and the target color threshold being less than or equal to the upper limit value; using the updated target color threshold, re-determining the target matrix and the number of connected components, and re-determining whether the number of connected components is greater than the preset connected component quantity threshold and whether the target color threshold is less than or equal to the upper limit value, until it is determined that the number of connected components is less than or equal to the preset connected component quantity threshold, or the target color threshold is greater than the upper limit value, at which point updating the target color threshold stops, resulting in the final target color threshold and its corresponding target matrix.
[0014] The present invention also provides a medical image restoration device for biconnected labeled interference, comprising: a region screening module, which acquires the medical image to be restored, determines the color function value of each pixel in the medical image to be restored, obtains a color matrix, and extracts regions in the color matrix that are greater than a target color threshold to obtain candidate target regions; a label screening module, which extracts connected components in the candidate target regions and the largest internal connected component determined based on the minimum convex bun matrix corresponding to the connected component, and filters out biconnected labeled regions based on the real area of the connected component and the real area of the largest internal connected component; and an image restoration module, which, for each biconnected labeled region, determines the corresponding center point and edge point, determines the angle range of each edge point relative to the center point, partitions the edge points and performs fitting restoration partition by partition to obtain the restored medical image.
[0015] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a medical image restoration method for biconnected marker interference as described above.
[0016] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a medical image restoration method for biconnected marker interference as described above.
[0017] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements a medical image restoration method for biconnected marker interference as described above.
[0018] The medical image restoration method, apparatus, device, and medium for biconnected labeled interference provided by this invention removes massive background noise for subsequent depth analysis by constructing a color function matrix based on pixel color and applying quantitative comparison of the target color threshold. This achieves high contrast enhancement and adaptive initial screening of the labeled region. Furthermore, by determining the real area of the connected domain and the real area of the largest internal connected domain, a dual-constraint screening of the biconnected labeled region is performed, improving the specificity of the target region screening and ensuring the morphological effectiveness of the target to be restored. This overcomes interference problems caused by solid artifacts, fine noise, or meaningless depressions. Additionally, by establishing the polar coordinate angle distribution of edge points based on the center point and performing refined fitting and restoration by angle partitioning, this invention thoroughly solves the pain points of easily interfered labeled region extraction and misaligned edge restoration in complex medical images. It achieves high-fidelity and high-specificity image restoration, resulting in a tightly closed morphological structure and natural, smooth color transitions in the restored image, ensuring the consistency of the texture structure and fundamentally guaranteeing the reliability of clinical diagnosis of medical images. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0020] Figure 1 This is a flowchart illustrating the medical image restoration method for biconnected marker interference provided by the present invention. Figure 2 This is a schematic diagram of the biconnected label partitioning subset provided by the present invention; Figure 3 This is a schematic diagram of a medical image showing the completed repair process provided by the present invention; Figure 4 This is a schematic diagram of the medical image restoration device for bi-connected marker interference provided by the present invention. Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0022] Figure 1 This is a flowchart illustrating the medical image restoration method for biconnected marker interference provided by the present invention, as shown below. Figure 1 As shown, the method includes the following: S11, acquire the medical image to be repaired, determine the color function value of each pixel in the medical image to be repaired, obtain the color matrix, and extract the region in the color matrix that is greater than the target color threshold to obtain the candidate target region; S12, extract the connected components in the candidate target region and the largest internal connected component determined based on the minimum convex bun matrix corresponding to the connected component, and filter out the biconnected marked regions based on the real area of the connected component and the real area of the largest internal connected component. S13. For each biconnected marked region, determine the corresponding center point and edge point, and determine the angle range of each edge point relative to the center point. Divide the edge points into regions and fit and repair them region by region to obtain the repaired medical image.
[0023] It should be noted that the following will be combined with... Figures 2-3 This invention describes a medical image restoration method for biconnected marker interference.
[0024] Step S11: Obtain the medical image to be repaired, determine the color function value of each pixel in the medical image to be repaired, obtain the color matrix, and extract the regions in the color matrix that are greater than the target color threshold to obtain the candidate target region.
[0025] In this embodiment, the color function values of each pixel in the medical image to be repaired are determined to obtain a color matrix, and the regions in the color matrix that are greater than the target color threshold are extracted to obtain candidate target regions. This includes: determining the maximum and minimum values of the color components of each pixel based on the medical image to be repaired; determining the color function values of each pixel based on the maximum and minimum values of the color components of each pixel to construct a color matrix; comparing each element in the color matrix with the target color threshold to determine the target matrix; and obtaining candidate target regions based on the target matrix.
[0026] It should be noted that by determining the maximum and minimum values of the color components of each pixel in the hospital image to be repaired, the color function value is determined, and a color matrix is constructed. This overcomes the shortcomings of traditional grayscale features or single color channels in medical images, which are easily affected by individual differences and color casts. It realizes a color function mapping based on the dynamic construction of the maximum and minimum color values, which accurately amplifies the color contrast between the identified area and the normal image, providing a highly discriminative feature base for subsequent extraction. Combined with the target color threshold, the target matrix is determined. Based on the target matrix, the area in the color matrix that is greater than the target color threshold is extracted. This avoids the blurring of the target boundary and mis-extraction caused by artifacts, noise, and edge transitions in complex medical backgrounds. It effectively filters out low-contrast background interference, accurately locks high-value candidate repair areas, and significantly reduces the computational cost and risk of mis-repair in subsequent image repair.
[0027] Furthermore, in medical images, the same marker is typically drawn with a single-color line. Since the marker is often semi-transparently overlaid on the original medical image, and the compressed storage of the original image can cause the marker color to spread outwards, the pixel colors of the marked areas in the medical image to be repaired are not entirely consistent. In this embodiment, the medical image to be repaired is set to be close to gray, while the marked areas are in color.
[0028] Furthermore, the maximum and minimum values of the color components of each pixel are expressed as: in, Indicates the maximum value; Indicates the minimum value; Represents the color components of a single pixel. , , These represent the values for red, green, and blue, respectively, and are integers ranging from 0 to 255.
[0029] For each element in the color matrix, it can be determined based on the color function value of the corresponding pixel, that is, the color matrix... Line 1 The color function value of a column pixel is represented as: in, and Represents the color matrix No. Line 1 The color function value of the column pixels, It is obtained based on the maximum and minimum values of the corresponding pixel color components; Indicates the first medical image to be repaired Line 1 The color values of the columns of pixels. Since the larger the color function value of a pixel in the color matrix, the greater the probability that the point is a marked region, a target color threshold is defined to mark pixels in the color matrix that are higher than the target color threshold as candidate regions.
[0030] In addition, based on each element in the color matrix, the target color threshold is compared to determine the target matrix, including: comparing each element in the color matrix with the target color threshold; when the corresponding element is greater than or equal to the target color threshold, the position of the corresponding element is marked as a first preset value; when the corresponding element is less than the target color threshold, the position of the corresponding element is marked as a second preset value; and constructing the target matrix.
[0031] It should be added that the first and second preset values can be configured according to actual design requirements. For example, the first preset value can be 1 and the second preset value can be 0. No further restrictions are made here.
[0032] In addition, the target matrix The Middle Line 1 Column elements are represented as: in, Representing the target matrix The Middle Line 1 Column elements; This indicates the target color threshold.
[0033] It should be noted that the target color threshold The smaller the value, the wider the candidate region, which can easily introduce too many false candidate target regions. The larger the value, the more stringent the candidate region selection, potentially missing true target regions. If the image is a high-purity grayscale image, then... A smaller value can be chosen; if the image contains a lot of color interference, then... A larger value should be selected.
[0034] In an optional embodiment, to enhance adaptability to various image types, a target matrix is determined by comparing each element in the color matrix with a target color threshold. Based on the target matrix, regions in the color matrix that are greater than the target color threshold are extracted to obtain candidate target regions. This includes: determining the maximum color function value based on the color matrix, and determining the initial retrieval value and upper limit value of the target color threshold based on the maximum color function value; using the initial retrieval value as the target color threshold, and comparing each element of the color matrix with the target color threshold to determine the target matrix; determining the number of connected components based on the target matrix, and updating the target color threshold according to a preset update coefficient based on the number of connected components being greater than a preset connected component quantity threshold and the target color threshold being less than or equal to the upper limit value; using the updated target color threshold, re-determining the target matrix and the number of connected components, and re-determining whether the number of connected components is greater than the preset connected component quantity threshold and whether the target color threshold is less than or equal to the upper limit value, until it is determined that the number of connected components is less than or equal to the preset connected component quantity threshold, or the target color threshold is greater than the upper limit value, at which point updating the target color threshold stops, resulting in the final target color threshold and its corresponding target matrix.
[0035] It should be noted that by extracting the maximum and minimum global color values of the current image and determining the initial retrieval value and upper limit of the target color threshold, the threshold search space is defined accordingly. This overcomes the shortcomings of traditional fixed thresholds, which are difficult to adapt to the differences in different marker colors. It ensures that the subsequent threshold iteration optimization process does not deviate from the true features of the current image and avoids ineffective blind searches. Furthermore, the threshold quantification comparison is transformed into the counting statistics of connected components, realizing the leap from pixel-level color judgment to region-level morphological evaluation. In addition, by constructing a dual-boundary condition feedback iteration mechanism based on the aggregation of thresholds when connected components are too fragmented, the adaptability to various image types is guaranteed. This overcomes the problems of fragmented marker regions and edge overflow caused by background noise and artifacts in medical images. It achieves the effective filtering of small noise interference while ensuring the morphological integrity and boundary compactness of the target region, completely eliminating the cost of manual trial and error parameter tuning and significantly improving the robustness of complex image marker detection.
[0036] It should be added that the initial search value and upper limit value of the target color threshold can be taken as follows: in, Indicates the upper limit value; Indicates the initial search value; This represents the maximum color function value in the color matrix. This represents the row index of the color matrix. Represents the column index of the color matrix. This represents the total number of rows in the color matrix. This represents the total number of columns in the color matrix.
[0037] In addition, the target color threshold is updated according to a preset update coefficient, as shown below: in, This indicates the updated target color threshold; This represents the preset update coefficient, which can be designed according to actual design requirements and prior experience. For example, it can be 1.3, and no further limitation is made here. Indicates the number of connected components; This represents the preset threshold for the number of connected components, which is directly related to the maximum number of markers in the medical image to be repaired. It can be set to twice the maximum number of markers, such as 10. No further restrictions are imposed here.
[0038] Step S12: Extract the connected components in the candidate target region and the largest internal connected component determined based on the minimum convex bun matrix corresponding to the connected component. Based on the real area of the connected component and the real area of the largest internal connected component, filter out the biconnected marked regions.
[0039] In this embodiment, connected components and the largest internal connected component determined based on the minimum convex submatrix corresponding to the connected components are extracted from the candidate target region. Based on the real area of the connected components and the real area of the largest internal connected component, biconnected marked regions are selected. This includes: determining connected components based on the candidate target region, and determining the minimum convex submatrix covering each connected component; obtaining the corresponding inverse matrix for each connected component's minimum convex submatrix, and determining the largest internal connected component of the corresponding inverse matrix; determining the real area of each connected component based on each connected component, and determining the corresponding area based on each largest internal connected component; determining the corresponding connected component as a biconnected marked region when the real area of the connected component is greater than or equal to a preset area threshold, and the ratio of the real area of the corresponding largest internal connected component to the real area of the connected component is greater than or equal to a preset ratio threshold.
[0040] It should be noted that by determining the connected components and the minimum convex hull boundary covering the connected components, a smooth envelope and reference space definition of the external geometric contour of the target region are achieved, laying a robust geometric framework for accurately calculating the real internal missing regions. By inversely inverting the convex hull and the original connected components and extracting the maximum internal connected components, the filtering of small external depressions and the precise stripping of the core internal cavity are achieved, thereby highly restoring the topological structure of the biconnected markers. Furthermore, by constructing a dual constraint judgment mechanism that combines the absolute area lower limit with the ratio of the inner and outer areas of the ring, the interference caused by small noise or solid normal regions in morphology is overcome, and the biconnected markers are screened, which greatly improves the specificity of target region detection and effectively avoids the risk of misjudging solid artifacts as targets to be repaired.
[0041] It should be added that the minimum convex bun matrix is used to characterize the smallest rectangular region that can completely enclose the corresponding connected domain; the biconnected marker refers to a figure composed of closed curves that do not have intersections, such as a circle, ellipse or rectangle; the biconnected marker region is the region where the marker is located, which is a biconnected overall structure composed of closed lines and forms only a single hole.
[0042] Furthermore, the real area of a connected region is expressed as: in, Represents connected components The actual area; Indicates that the candidate target region covers connected components. Minimum convex bun matrix The Line 1 Column elements, A value of 1 indicates a connected component. A value of 0 indicates the background; minimum convex submatrix. The size is .
[0043] The real area of the largest internally connected region is expressed as: in, Represents connected components Maximum internal connected components The actual area of the connected component can be calculated using the formula for the actual area of the connected component mentioned above. (The largest internal connected component...) Based on the minimum convex bun matrix inverse matrix It is confirmed that the inverse matrix is obtained by inverting the values of the binary image of the minimum convex submatrix of each connected component. No. Line 1 Column elements .
[0044] If and only if the connected components A region can be classified as a biconnected region if it simultaneously satisfies the following conditions: the actual area of the connected component is greater than or equal to a preset area threshold, and the ratio of the actual area of the corresponding largest internal connected component to the actual area of the connected component is greater than or equal to a preset ratio threshold. These conditions are expressed as follows: in, This represents the preset area threshold, which is directly related to the thickness and size of the marker lines. The specific area threshold can be designed according to actual needs, such as 80. No further limitation is made here. This represents the preset ratio threshold, which is related to the line thickness. The specific value can be designed according to actual needs, such as 2. No further limitation is made here.
[0045] In an optional embodiment, after identifying the biconnected marked regions, the process includes: for the biconnected marked regions, searching for pixels in the medical image to be repaired that meet optimization criteria, and merging the pixels that meet the optimization criteria into the biconnected marked regions to optimize the biconnected marked regions; wherein the optimization criteria include: determining the existence of pixels. Not a biconnected marked region Determine the pixel point Corresponding color function value Greater than or equal to the target color threshold after downgrading by a preset downgrading factor Determine the pixel point With biconnected marked regions Adjacent.
[0046] It should be added that, since the marker color is rendered outwards, further optimization of the biconnected marker region is needed to extract as many pixels as possible that are affected by the rendering. For the biconnected marker region... Mid-pixel coordinates When the optimization conditions are met, they can be merged into the group. The optimization conditions are expressed as follows: in, This indicates the target color threshold after downgrading. This represents the preset degradation coefficient, which can be set according to actual needs and prior knowledge. A value between 0.4 and 0.6 is more appropriate, for example, a value of 0.5 can be used. No further limitation is made here. By relaxing the target color threshold and performing secondary processing on the target edge, the detection results are finely optimized.
[0047] It should be added that the pixel point is determined. With biconnected marked regions Adjacent, including: regions marked by biconnectivity Pixel coordinates within and regions that do not belong to biconnected marked regions pixel coordinates Determine the absolute value of the difference between the row and column coordinates; when the absolute value of the difference between the row and column coordinates is less than or equal to 1, determine the pixel point. With biconnected marked regions Adjacent.
[0048] Step S13: For each biconnected marked region, determine the corresponding center point and edge point, and determine the angle range of each edge point relative to the center point. Divide the edge points into regions and fit and repair them region by region to obtain the repaired medical image.
[0049] In this embodiment, for each biconnected marked region, the corresponding center point and edge point are determined, including: for each biconnected marked region, the corresponding largest internal connected domain is determined to obtain the center point coordinates; edge detection is performed on the biconnected marked region to extract all edge points and divide them into inner edge points and outer edge points.
[0050] It should be added that the center point coordinates Specifically, it is expressed as: in, This represents the largest internal connected component corresponding to the biconnected labeled region; This represents the real area of the largest internal connected region of the biconnected marked region.
[0051] In addition, edge detection algorithms can be selected according to actual design requirements, such as the Canny edge detection algorithm or the Sobel edge detection algorithm; all edge points can be detected. Point at the outer edge With the inner edge point The two sets, inner edge points and outer edge points, are represented as follows: It should be added that, when dividing the inner and outer edge points, for any inner edge point... Inner edge points within the set When edge points exist The largest internal connected component corresponding to a biconnected labeled region And the edge point With the inner edge point When the absolute value of the difference between the row coordinates and column coordinates of the edge point is less than or equal to 1, then the edge point is... Divide to the inner edge point Set; otherwise, set the edge point. Divided to the outer edge point gather.
[0052] In addition, edge points include inner edge points and outer edge points. The angle range of each edge point relative to the center point is determined, and the edge points are partitioned and fitted and repaired partition by partition to obtain the repaired medical image. This includes: for both inner and outer edge points, with the center point as the center, determining the rotation angle of the line connecting each edge point to the center point relative to the image width direction, and based on the rotation angle, performing preliminary matching between the outer and inner edge points according to the degree of angular similarity; based on the rotation angle, dividing the outer edge points into multiple subsets according to the angle range, for each subset, moving the corresponding pre-matched inner edge point according to the corresponding outer edge point, determining the color difference between the inner and outer edge points under different inner movement amounts, and taking the inner movement amount with the smallest color difference as the optimal matching offset for the corresponding subset; based on the optimal matching offset for each subset, performing secondary matching between the outer matched edge points and the inner edge points in the corresponding subset, determining the optimal inner matched edge points corresponding to each outer edge point, and performing linear fitting and repair to obtain the repaired medical image.
[0053] It should be noted that by calculating the rotation angle of the inner and outer edge points relative to the image width direction with the center point as the reference, and performing preliminary matching according to the similarity of the angles, the defects of easy misalignment of the inner and outer edges in the spatial distribution of the biconnected structure and the easy occurrence of cross-layer misconnection due to direct matching are overcome. This achieves edge spatial orientation alignment and coarse-grained association based on polar coordinates. The system is divided into subsets according to the angle range, and the color difference of the inner and outer edge points under each inner movement amount is calculated within the subset. The inner movement amount with the smallest color difference is used as the optimal matching offset, which solves the problem of non-uniform deformation and gray-level jump of the inner and outer edges of the biconnected structure. This achieves adaptive offset calibration based on optimal color consistency in local areas, thereby ensuring that the matching accuracy of the inner and outer edges is not affected by local deformation, accurately capturing the displacement of the real medical image structure. Secondary matching is performed using the optimal matching offset of each subset to determine the optimal inner matching edge point, and linear fitting is performed to repair it. This achieves point-by-point adaptive alignment and texture blending of the edges that strictly follow the biconnected topology, completely solving the problems of repair misalignment and abrupt transition, effectively restoring the texture structure features of the image, and ensuring high-fidelity image restoration.
[0054] Specifically, the target rotation direction can be determined according to actual design requirements, such as clockwise, and the rotation angle is expressed as: in, Representing the coordinates of the center point Center, edge points The clockwise rotation angle relative to the width of the image.
[0055] In addition, based on the rotation angle, the outer edge points and inner edge points are initially matched by angle, including: sorting the inner and outer edge points respectively in ascending order based on the rotation angle; and determining the point with the closest angle among the sorted inner edge points as the corresponding matched inner edge point, denoted as the angle numbering mapping function. .
[0056] Furthermore, the angle numbering mapping function Represented as: in, express The Middle The rotation angle corresponding to each point; express The Middle The rotation angle corresponding to each point.
[0057] It should be noted that since the connected components of the biconnected marked region are the areas to be repaired, and both the outer and inner sides are the original images, the repair result should smoothly transition with the inner and outer sides while maintaining consistency in structural details. Due to the limited thickness of the marked lines, structural details are mainly reflected in the textures that have been truncated by the marked lines in the image. The repaired image should restore the complete structure of these textures as much as possible. Therefore, it is necessary to perform a secondary matching of the outer edge points and the inner edge points on the original image.
[0058] Since the texture structure cannot guarantee stable consistency across the entire marked area, the outer edge points are divided into multiple subsets based on angular range, and the optimal matching relationship is then sought within each subset. Based on angular range, Average score A subset, such as Figure 2 As shown, It can be designed according to actual design requirements, such as The value is 12. For the... Subset Then the numbers of its first and last edge points are respectively and Represented as: in, Indicates the first Subset The first edge point Rotation angle; Indicates the first edge point The previous edge point The rotation angle can generally be the first... Subset The rotation angle of the last edge point; Indicates the first Subset The rotation angle of the last edge point; Represents edge points The next edge point The rotation angle can generally be the first... Subset The rotation angle of the first edge point.
[0059] In addition, for each subset, based on the corresponding outer edge point, the corresponding initially matched inner edge point is moved, and the color difference between the inner and outer edge points under different inner movement amounts is determined. The inner movement amount with the smallest color difference is taken as the optimal matching offset for the corresponding subset. This includes: for a single subset, determining the corresponding color difference under different inner movement amounts based on the color components of the corresponding outer edge point and the corresponding initially matched inner edge point pixels; and selecting the inner movement amount that minimizes the color difference as the optimal matching offset for the corresponding subset based on each inner movement amount and the variable out-of-bounds constraint of the angle number mapping function.
[0060] It should be added that the optimal matching offset is expressed as: in, Indicates the first The optimal matching offset for each subset; Represents edge points The pixel column coordinates, with values ranging from the first... The pixel column coordinates from the first edge point to the last edge point of each subset; Indicates the total number of points on the outer edge; This represents the maximum amount of movement and is directly related to the thickness of the marking line; it can be approximated as [value missing]. ; This indicates the amount of inward movement, which is the length of movement of the inner edge point in pixels. A negative value indicates counterclockwise movement, and a positive value indicates clockwise movement. Indicates the amount of inner movement Color difference below; Indicates the first The color component and inward shift of the pixel corresponding to the outer edge point of the subset. The color difference of the color components of the pixels corresponding to the inner edge points below; Indicates the first medical image to be repaired The color components of each outer edge point correspond to the pixel. express Corresponding to red, green, and blue values; Indicates the corresponding inner movement amount The color components of the pixels corresponding to the inner edge points. express Corresponding to red, green, and blue values; express Inner movement amount Angle numbering mapping function under certain conditions.
[0061] It is worth noting that, regarding the first The optimal matching offset for the midpoint of each subset can be referenced above. The optimal matching offset for both sides is also related to the first... The best matching offset of each subset With the The best matching offset of each subset Relatedly, in order to maintain a smooth transition in the image patching area, for the first... The subset number is Define the optimal numbering mapping function for the outer edge points and the inner edge points. for: in, This is the floor function.
[0062] Furthermore, the pixel color vector in the restored medical image is represented as follows: in, Indicates the point relative to the inner edge. Distance is The coordinates of the pixel to be repaired are The repaired color vector; Indicates the inner edge point of the match. With the outer edge point The distance between them; Indicates the first The subset number is Pixel coordinates of the outer edge point; express The corresponding matching number is The pixel coordinates of the inner edge points; This represents the ratio of the vertical distance between the outer edge point and the inner edge point to the total distance; This represents the ratio of the horizontal distance between the outer edge point and the inner edge point to the total distance. Indicates the inner edge point Color components; Indicates the outer edge point Color components.
[0063] It should be added that by keeping the outer edge point fixed, the distance is... Starting from 1, incrementing by 1 step to The pixels are processed one by one according to the above formula to achieve linear fitting and repair of the line connecting the inner and outer edge points; the outer pixels of all subsets are processed one by one to find the best inner matching edge point, and the pixels on the line connecting the two points are linearly fitted to achieve the initial repair of the marked area.
[0064] In an optional embodiment, for a single marked region, due to the randomness of matching inner and outer edge points and numerical calculation errors, after performing the above-described partitioned linear fitting repair, the repaired medical image may still have a small number of pixels to be repaired, and most of them are discretely distributed. For these pixels to be repaired, in order to maintain a smooth transition, nearby repaired points can be found in the direction of the line connecting the pixel to the center point, and then repaired using a linear fitting method.
[0065] Specifically, after obtaining the repaired medical image, the process includes: for each remaining discrete pixel to be repaired in the repaired medical image, searching outwards along the line connecting the corresponding remaining pixel to be repaired and the center point to obtain the first repaired pixel on each side that does not belong to the remaining pixels to be repaired; based on the color value of the first repaired pixel on each side and the distance from the discrete pixel to be repaired to the first repaired pixel on each side, repairing the corresponding discrete pixels to be repaired through linear fitting to obtain the final repaired medical image, as shown in the reference. Figure 3 .
[0066] It should be noted that by searching for the first repaired pixel on both sides along the line connecting the discrete pixel to be repaired and the center point, and by combining the color values of the first repaired pixels on both sides and their distance from the pixel to be repaired for linear fitting, the repaired pixel is perfectly integrated into the radially extending grayscale gradient trend. This ensures the smoothness and visual realism of the medical image structure at the microscopic level, and achieves precise and seamless filling of discrete damaged pixels. It avoids cross-structure color pollution and perfectly reconstructs the continuous gradient of radial texture, ensuring smooth image transition and high-fidelity image restoration.
[0067] It should be added that the distance between the remaining pixels to be repaired and the center point is... The pixel coordinates are represented as: in, Indicates the remaining pixels to be repaired. With the center point Connect the lines and the distance is Pixel coordinates; Represents pixels Relative to the center point Unit vector components in the vertical direction; Represents pixels Relative to the center point Unit vector component in the horizontal direction.
[0068] Accordingly, let the set of remaining discrete pixels to be repaired be denoted as . ,Will Starting from 1, increment by 1, and search for the first element that does not belong to the parentheses. The pixels, denoted as length . Similarly, Starting from -1, decrease by 1 step to find the first one that does not belong to... The pixels, denoted as length . Then the color vector of the discrete pixel to be repaired after repair is represented as: in, Represents the discrete pixels to be repaired after restoration. Color vector; Indicates the inner pixel coordinates have been repaired. Color components; Indicates that the outer pixel coordinates have been repaired. Color components.
[0069] In summary, this invention, by constructing a color function matrix based on pixel color and applying a quantitative comparison of the target color threshold, removes massive background noise for subsequent depth analysis, achieving high contrast enhancement and adaptive initial screening of the marked region. Furthermore, by determining the real area of connected components and the real area of the largest internal connected component for dual-constraint screening of bi-connected marked regions, the specificity of target region screening is improved, ensuring the morphological effectiveness of the target to be repaired. This overcomes interference problems caused by solid artifacts, fine noise, or meaningless depressions. Additionally, by establishing the polar coordinate angle distribution of edge points based on the center point and performing refined fitting and repair by angle partitioning, this invention thoroughly solves the pain points of easily interfered marked region extraction and misaligned edge repair in complex medical images. It achieves high-fidelity and high-specificity image repair, resulting in a tightly closed morphological structure and natural, smooth color transitions in the repaired image, ensuring the consistency of texture structure and fundamentally guaranteeing the reliability of clinical diagnosis in medical images.
[0070] The medical image restoration device for dual-connected marker interference provided by the present invention will be described below. The medical image restoration device for dual-connected marker interference described below can be referred to in correspondence with the medical image restoration method for dual-connected marker interference described above.
[0071] Figure 4 A schematic diagram of a medical image restoration device for biconnected marker interference is shown. The device includes: The region filtering module 41 acquires the medical image to be repaired, determines the color function value of each pixel in the medical image to be repaired, obtains a color matrix, and extracts the regions in the color matrix that are greater than the target color threshold to obtain candidate target regions. The labeling and filtering module 42 extracts the connected components in the candidate target region and the largest internal connected component determined based on the minimum convex bun matrix corresponding to the connected component, and filters out the biconnected labeled regions based on the real area of the connected component and the real area of the largest internal connected component. The image restoration module 43 determines the corresponding center point and edge point for each biconnected marked region, and determines the angle range of each edge point relative to the center point. It then divides the edge points into partitions and performs fitting and restoration partition by partition to obtain the restored medical image.
[0072] It should be noted that the specific principles of the embodiments of the present invention are the same as those of the method embodiments described above. For details, please refer to the method embodiments above. More detailed explanations will not be repeated here.
[0073] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5 As shown, the electronic device may include a processor 510, a communications interface 520, a memory 530, and a communication bus 540. The processor 510, communications interface 520, and memory 530 communicate with each other via the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute a medical image restoration method for biconnected label interference. This method includes: acquiring the medical image to be restored; determining the color function values of each pixel in the medical image to be restored, obtaining a color matrix, and extracting regions in the color matrix that are greater than a target color threshold to obtain candidate target regions; extracting connected components and the largest internal connected component determined based on the minimum convex submatrix of the connected components from the candidate target regions, and filtering out biconnected label regions based on the real area of the connected components and the real area of the largest internal connected component; for each biconnected label region, determining the corresponding center point and edge points, and determining the angle range of each edge point relative to the center point; partitioning the edge points and fitting and restoring each partition sequentially to obtain the restored medical image.
[0074] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0075] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the medical image restoration method for biconnected labeled interference provided by the above methods. The method includes: acquiring a medical image to be restored; determining the color function value of each pixel in the medical image to be restored; obtaining a color matrix; and extracting regions in the color matrix that are greater than a target color threshold to obtain candidate target regions; extracting connected components and the largest internal connected component determined based on the minimum convex bun matrix corresponding to the connected component in the candidate target regions; and filtering out biconnected labeled regions based on the real area of the connected components and the real area of the largest internal connected component; for each biconnected labeled region, determining the corresponding center point and edge point, and determining the angle range of each edge point relative to the center point; partitioning the edge points and fitting and restoring them partition by partition to obtain the restored medical image.
[0076] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a medical image restoration method for biconnected labeled interference provided by the methods described above. The method includes: acquiring a medical image to be restored; determining the color function value of each pixel in the medical image to be restored; obtaining a color matrix; and extracting regions in the color matrix that are greater than a target color threshold to obtain candidate target regions; extracting connected components and the largest internal connected component determined based on the minimum convex submatrix of the connected components in the candidate target regions; and filtering out biconnected labeled regions based on the real area of the connected components and the real area of the largest internal connected component; for each biconnected labeled region, determining the corresponding center point and edge point, and determining the angle range of each edge point relative to the center point; partitioning the edge points and fitting and restoring them partition by partition to obtain the restored medical image.
[0077] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0078] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0079] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for medical image restoration of biconnected marker interference, characterized in that, include: Acquire the medical image to be repaired, determine the color function value of each pixel in the medical image to be repaired, obtain a color matrix, and extract the regions in the color matrix that are greater than the target color threshold to obtain candidate target regions; Extract the connected components and the largest internal connected component determined based on the minimum convex bun matrix corresponding to the connected components in the candidate target region, and filter out the biconnected marked regions based on the real area of the connected components and the real area of the largest internal connected component. For each of the biconnected marked regions, the corresponding center point and edge point are determined, and the angle range of each edge point relative to the center point is determined. The edge points are divided into regions and fitted and repaired region by region to obtain the repaired medical image. Extract the connected components from the candidate target regions and the largest internal connected component determined based on the minimum convex bun matrix corresponding to the connected components. Then, based on the real area of the connected components and the real area of the largest internal connected component, filter out biconnected marked regions, including: Based on the candidate target regions, the connected components are determined, and the minimum convex bun matrix covering each of the connected components is determined. For each of the connected components, the minimum convex submatrix is obtained, and the maximum internal connected component of the corresponding inverse matrix is determined. Based on each of the connected components, determine the real area of each of the connected components, and based on each of the largest internal connected components, determine the corresponding area; When the actual area of the connected region is greater than or equal to a preset area threshold, and the ratio of the actual area of the corresponding largest internal connected region to the actual area of the connected region is greater than or equal to a preset ratio threshold, the corresponding connected region is determined to be a biconnected marked region.
2. The medical image restoration method for biconnected marker interference according to claim 1, characterized in that, The edge points include inner edge points and outer edge points; the angle range of each edge point relative to the center point is determined, the edge points are divided into regions and fitted and repaired region by region to obtain the repaired medical image, including: For both inner and outer edge points, with the center point as the center, determine the rotation angle of the line connecting each edge point and the center point relative to the image width direction, and based on the rotation angle, perform preliminary matching between the outer and inner edge points according to the degree of angular similarity. Based on the rotation angle, the outer edge points are divided into multiple subsets according to the angle range. For each subset, the corresponding inner edge points are moved according to the corresponding outer edge points. The color difference between the inner and outer edge points under different inner movement amounts is determined. The inner movement amount with the smallest color difference is taken as the best matching offset for the corresponding subset. Based on the optimal matching offset of each subset, the outer matching edge points in the corresponding subset are matched with the inner edge points in a second time to determine the optimal inner matching edge points corresponding to each outer edge point and perform linear fitting repair to obtain the repaired medical image.
3. The medical image restoration method for biconnected marker interference according to claim 1, characterized in that, After obtaining the restored medical images, including: For each remaining discrete pixel to be repaired in the repaired medical image, search along the line connecting the corresponding remaining pixel to be repaired and the center point to both sides to obtain the first repaired pixel on each side that does not belong to the remaining pixel to be repaired. Based on the color values of the first repaired pixels on both sides and the distance from the discrete pixel to be repaired to the first repaired pixels on both sides, the corresponding discrete pixel to be repaired is repaired by linear fitting.
4. The medical image restoration method for biconnected marker interference according to claim 1, characterized in that, After filtering out the biconnected marked regions, the following is included: For the biconnected marked region, pixels that meet the optimization conditions are found in the medical image to be repaired, and these pixels are merged into the biconnected marked region to optimize it; wherein the optimization conditions include: It was determined that there were pixels that did not belong to the biconnected marked region; The color function value corresponding to the pixel is determined to be greater than or equal to the target color threshold after being downgraded by a preset downgrade coefficient; The pixel is determined to be adjacent to the biconnected marker region.
5. The medical image restoration method for biconnected marker interference according to claim 1, characterized in that, The color function values of each pixel in the medical image to be repaired are determined to obtain a color matrix. Regions in the color matrix that are greater than a target color threshold are extracted to obtain candidate target regions, including: Based on the medical image to be repaired, determine the maximum and minimum values of the color components of each pixel; Based on the maximum and minimum values of the color components of each pixel, the color function value of each pixel is determined, and a color matrix is constructed. Based on each element in the color matrix, a target matrix is determined by comparing it with the target color threshold, and candidate target regions are obtained based on the target matrix.
6. The medical image restoration method for biconnected marker interference according to claim 5, characterized in that, Based on each element in the color matrix, and by comparing it with a target color threshold, the target matrix is determined, including: Based on the color matrix, determine the maximum color function value, and based on the maximum color function value, determine the initial retrieval value and upper limit value of the target color threshold; The initial search value is used as the target color threshold. The target matrix is determined by comparing the elements of each color matrix with the target color threshold. Based on the target matrix, the number of connected components is determined, and the target color threshold is updated according to a preset update coefficient, provided that the number of connected components is greater than a preset connected component quantity threshold and the target color threshold is less than or equal to the upper limit value. Using the updated target color threshold, the target matrix and the number of connected components are redefined, and it is redefined whether the number of connected components is greater than a preset connected component quantity threshold and whether the target color threshold is less than or equal to the upper limit value. The target color threshold is then updated until it is determined that the number of connected components is less than or equal to the preset connected component quantity threshold or the target color threshold is greater than the upper limit value. The target color threshold is then stopped, and the final target color threshold and its corresponding target matrix are obtained.
7. A medical image restoration device for biconnected marker interference, characterized in that, include: The region filtering module acquires the medical image to be repaired, determines the color function value of each pixel in the medical image to be repaired, obtains a color matrix, and extracts the regions in the color matrix that are greater than the target color threshold to obtain candidate target regions. The marking and filtering module extracts the connected components in the candidate target region and the largest internal connected component determined based on the minimum convex bun matrix corresponding to the connected component, and filters out biconnected marked regions based on the real area of the connected component and the real area of the largest internal connected component. The image restoration module determines the corresponding center point and edge point for each of the biconnected marked regions, and determines the angle range of each edge point relative to the center point. It then partitions the edge points and performs fitting and restoration on each partition to obtain the restored medical image. The tagging and filtering module is used for: Based on the candidate target regions, the connected components are determined, and the minimum convex bun matrix covering each of the connected components is determined. For each of the connected components, the minimum convex submatrix is obtained, and the maximum internal connected component of the corresponding inverse matrix is determined. Based on each of the connected components, determine the real area of each of the connected components, and based on each of the largest internal connected components, determine the corresponding area; When the actual area of the connected region is greater than or equal to a preset area threshold, and the ratio of the actual area of the corresponding largest internal connected region to the actual area of the connected region is greater than or equal to a preset ratio threshold, the corresponding connected region is determined to be a biconnected marked region.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the medical image restoration method for biconnected marker interference as described in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the medical image restoration method for biconnected marker interference as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Image restoration method and system based on angle perception block matching
CN110246100A
Medical segmented image concave defect filling method based on convex hull high-order power fitting
CN116596791A