Generalized marker interference medical image inpainting method and system
By selecting marked regions in medical images and using edge point sets for linear fitting repair, the problem of residual artifacts in the markings was solved, achieving efficient and accurate image repair results and ensuring seamless integration of the repaired area with the surrounding tissue.
Patent Information
- Application Number
- CN202610974894.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-01
- Publication Date
- 2026-11-24
AI Technical Summary
Current medical image restoration techniques cannot effectively eliminate residual artifacts, resulting in significant differences between the restored image and the original image, affecting image quality and the accuracy of subsequent analysis.
By acquiring the image to be repaired, the difference function value between the pixel and the predefined color template set is determined, the marked area is screened, and the matching points are found using the outer and inner edge point sets for linear fitting repair, ensuring that the repaired area is seamlessly integrated with the surrounding tissue structure.
It achieves efficient, accurate and adaptive restoration of complex medical image marked areas, eliminates residual artifacts, ensures seamless integration of the restored area with surrounding tissue structures, and improves image quality and the accuracy of subsequent analysis.
Smart Images

Figure CN123160384A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical image processing technology, and in particular to a method and system for restoring medical images with universal marker interference. Background Technology
[0002] With the continuous development of artificial intelligence technology, intelligent medical image recognition technology has shown great potential in assisting disease interpretation and improving doctors' work efficiency. Taking the Picture Archiving and Communication System (PACS) as an example, the research history of intelligent medical image recognition can be roughly divided into three stages: The first stage was based on traditional image processing algorithms, relying on a large amount of prior knowledge to manually design and extract features to achieve pathological detection; the second stage was based on traditional machine learning algorithms, aiming to improve the accuracy and speed of pathological detection; the third stage is the current research based on deep convolutional neural networks, which automatically extracts features of pathological regions and enhances the semantic information expression of images layer by layer, in order to achieve good results in terms of detection accuracy and model applicability.
[0003] Deep convolutional neural networks (CNNs) heavily rely on large-sample image data, which must cover multiple observation angles, environments, and disease types. Many low-frequency diseases are difficult to reproduce in a short time; therefore, current research relies heavily on historical image samples accumulated by medical institutions over many years. These historical images often contain markings encircled by colored lines, including text, symbols, coils, and underlines. To avoid the marking information affecting model training and to ensure the generalization ability of deep networks, training must be based on the original, unmarked images. Therefore, it is necessary to first detect and repair the marked regions from these historical images to maintain overall visual consistency.
[0004] Medical image restoration techniques targeting marker interference are fundamental to many AI-powered medical projects; however, publicly available research findings are limited, and existing restoration methods are relatively simple and rudimentary. Currently, common processing methods fall into two main categories: one involves directly filling and covering the detected marker area with the background color; the other utilizes the color of the nearest edge point of the marker area to extend inwards and cover the marker area.
[0005] However, when the marked lines are thick or the marked area is wide, using background color filling or nearest-edge color coverage cannot effectively restore the real tissue texture and pathological details beneath the marks. This results in significant differences between the restored image and the original unmarked image. Furthermore, simple filling or pixel extension can easily disrupt the inherent grayscale gradation and structural continuity of medical images, causing obvious edge blurring, image content damage, and structural discontinuity between the restored area and the surrounding normal tissue. This leads to poor visual consistency, which not only fails to truly restore the original state of the image but also introduces artifacts and false information, seriously affecting the quality of the restored image and failing to meet the accuracy requirements of subsequent high-precision analysis applications. Summary of the Invention
[0006] This invention provides a universal medical image restoration method and system for label interference, which addresses the defect in existing technologies where the restored image differs significantly from the original unlabeled image. It can effectively eliminate residual label artifacts and ensure seamless integration of the restored area with the surrounding native tissue structure, achieving efficient, accurate, and adaptive restoration of complex medical image labeled areas.
[0007] This invention provides a general method for medical image restoration of marked interference, comprising: acquiring a medical image to be restored; determining the difference function value between each pixel in the medical image to be restored and a predefined color template set; and filtering the pixels in the medical image to be restored by combining a target template threshold to obtain marked regions; for each marked region, extracting each internal connected component within the corresponding marked region, and performing edge point detection on the marked region; dividing the detected edge points into point sets according to their positional relationship with each internal connected component to obtain an inner edge point set belonging to the corresponding internal connected component and an outer edge point set not belonging to any internal connected component; finding matching points for each edge point based on the outer edge point set and each inner edge point set, and performing linear fitting restoration on the pixels on the line connecting the matching point pairs based on the matching point pairs to obtain the restored medical image.
[0008] According to a universal marker interference medical image restoration method provided by the present invention, the method finds matching points for each edge point based on an outer edge point set and each inner edge point set, including: for any outer edge point in the outer edge point set, determining an outer candidate matching set for the corresponding outer edge point based on the edge point number of each outer edge point in the outer edge point set, the total number of edge points in the outer edge point set, the thickness of the marker line, and a preset sequence spacing coefficient; finding the edge point closest to the corresponding outer edge point in the outer candidate matching set of the outer edge point and all inner edge point sets, and using it as the matching point for the corresponding outer edge point; and / or, based on the outer edge point set and each inner edge point set, for any inner edge point in each inner edge point set, selecting the remaining inner edge point sets other than the inner edge point set to which the inner edge point belongs, and using them as the inner candidate matching set for the corresponding inner edge point; finding the edge point closest to the corresponding inner edge point in the outer edge point set and the inner candidate matching set, and using it as the matching point for the corresponding inner edge point.
[0009] According to a medical image restoration method for general marker interference provided by the present invention, for any outer edge point in the outer edge point set, a candidate matching set for the corresponding outer edge point is determined based on the edge point number of each outer edge point in the outer edge point set, the total number of edge points in the outer edge point set, the thickness of the marker line, and a preset sequence number spacing coefficient. The method includes: for any outer edge point in the outer edge point set, determining the number difference between the remaining outer edge points and the outer edge point based on the edge point number of each outer edge point in the outer edge point set; determining the difference value based on the number difference and the total number of edge points in the outer edge point set, and selecting the minimum value between the difference value and the number difference; when the minimum value is greater than or equal to the number filtering threshold, assigning the remaining outer edge points with the corresponding number to the candidate matching set for the corresponding outer edge point; the number filtering threshold is obtained in advance based on the marker line thickness and the preset sequence number spacing coefficient.
[0010] According to a medical image restoration method for general marker interference provided by the present invention, the method involves finding the edge point closest to the corresponding outer edge point in the outer candidate matching set of the outer edge point and the set of all inner edge points, including: finding edge points in the outer candidate matching set of the outer edge point and the set of all inner edge points based on the corresponding outer edge point; determining that when the absolute value of the difference between the pixel row coordinate and the pixel column coordinate between the outer edge point and the found edge point is less than or equal to a first search range threshold, classifying the corresponding edge point into a first target range point set; the first search range threshold is obtained in advance based on the marker line thickness and a first preset search range coefficient; and finding the edge point closest to the corresponding outer edge point in the first target range point set as the matching point of the corresponding outer edge point.
[0011] According to a medical image restoration method for general marker interference provided by the present invention, in an outer edge point set and an inner candidate matching set, the method finds the edge point closest to the corresponding inner edge point, including: finding edge points in the outer edge point set and the inner candidate matching set based on the corresponding inner edge point; determining that when the absolute value of the difference between the pixel row coordinates and pixel column coordinates between the inner edge point and the found edge point is less than or equal to a second search range threshold, the corresponding edge point is assigned to a second target range point set; the second search range threshold is obtained in advance based on the marker line thickness and a second preset search range coefficient; and in the second target range point set, the method finds the edge point closest to the corresponding inner edge point as the matching point of the corresponding inner edge point.
[0012] According to a universal marker interference medical image restoration method provided by the present invention, before assigning the corresponding edge point to a first target range point set when the absolute value of the difference between the pixel row coordinates and pixel column coordinates between the outer edge point and the found edge point is less than or equal to a first search range threshold, and / or before assigning the corresponding edge point to a second target range point set when the absolute value of the difference between the pixel row coordinates and pixel column coordinates between the inner edge point and the found edge point is less than or equal to a second search range threshold, the method further includes: determining an initial first search range threshold or a second search range threshold based on a preset initial marker line thickness to obtain an initial first target range point set or a second target range point set; and assigning the corresponding edge point to a second target range point set based on the initial first target range point set or the second target range point set. The range point set is used to obtain the total number of edge points of the matching points; when the total number of edge points of the matching points is less than the point count threshold, the preset initial marker line thickness is updated using a preset thickness update coefficient, and the corresponding first target range point set or second target range point set is updated using the updated marker line thickness; the point count threshold is obtained in advance based on a preset proportion coefficient and the total number of edge points of the corresponding marked area; based on the updated first target range point set or second target range point set, the updated total number of edge points of the matching points is determined, and it is determined whether the updated total number of edge points of the matching points is less than the point count threshold, until the updated total number of edge points of the matching points is greater than or equal to the point count threshold, and the final first search range threshold or second search range threshold is obtained based on the final obtained marker line thickness.
[0013] According to a general medical image restoration method for marker interference provided by the present invention, the method performs linear fitting restoration on the pixels on the line connecting matching point pairs to obtain the restored medical image. The method includes: for any matching point pair consisting of an edge point and a corresponding matching point, determining the distance between the edge point and the matching point, and determining the unit step size component of the line in the pixel row direction and pixel column direction; starting from the edge point, determining the coordinates of the pixels to be restored at integer step sizes along the line direction based on the unit step size components in the pixel row direction and pixel column direction; for each pixel to be restored determined along the line direction, determining the restored color vector of the corresponding pixel by linear interpolation based on the line distance, the integer step size corresponding to each pixel to be restored, the color vector of the edge point, and the color vector of the matching point, thereby obtaining the restored medical image.
[0014] According to a general medical image restoration method for marker interference provided by the present invention, after linear fitting restoration of pixels on the line connecting matching point pairs to obtain the restored medical image, the method includes: for each remaining pixel to be restored in a marker region, finding the first restored neighboring pixel in each neighborhood direction as a reference pixel in the corresponding neighborhood direction; for each remaining pixel to be restored, determining the distance between it and the reference pixel in each neighborhood direction to obtain the weighting coefficient for each reference pixel; and performing a weighted summation of the color vectors of each reference pixel based on the reference pixels in each neighborhood direction and the corresponding weighting coefficients to obtain the restored color vector for the remaining pixel to be restored.
[0015] According to a universal labeled interference medical image restoration method provided by the present invention, before filtering pixels in the medical image to be restored by combining a target template threshold, the method includes: comparing each element in the difference matrix with a preset initial target template threshold based on the difference function value between each pixel in the medical image to be restored and a predefined color template set; marking pixels less than or equal to the preset initial target template threshold as first preset markers and pixels greater than the preset initial target template threshold as second preset markers, thereby obtaining a target matrix; extracting connected components based on the target matrix, determining the number of connected components and the area of each connected component, and obtaining the target area of the target matrix based on the area of each connected component; updating the preset initial target template threshold using a preset threshold update coefficient to obtain an updated target template threshold, and comparing each element in the difference matrix with the updated target template threshold to update the target matrix, the number of connected components, and the target area of the target matrix; and determining the connected components. When the number of connected components is greater than or equal to the preset connected component threshold, and the target area of the updated target matrix is greater than or equal to the product of the target area of the original target matrix and the preset area comparison coefficient, the updated target template threshold is used as the current target template threshold. Each element in the difference matrix is compared with the updated current target template threshold, and the corresponding target matrix, the number of connected components, and the target area of the corresponding target matrix are updated. The number of connected components corresponding to the current target template threshold is re-determined to be greater than or equal to the preset connected component threshold, and the target area corresponding to the updated current target template threshold is re-determined to be greater than or equal to the product of the target area corresponding to the current target template threshold and the preset area comparison coefficient, until the number of connected components corresponding to the current target template threshold is less than the preset connected component threshold or the target area corresponding to the updated current target template threshold is less than the product of the target area corresponding to the current target template threshold and the preset area comparison coefficient. The finally determined updated current target template threshold is used as the target template threshold.
[0016] This invention also provides a general medical image restoration system for marked interference, comprising: a region filtering module, which acquires the medical image to be restored, determines the difference function value between each pixel in the medical image to be restored and a predefined color template set, and filters the pixels in the medical image to be restored in combination with a target template threshold to obtain marked regions; a point set partitioning module, which extracts each internal connected component within each marked region, performs edge point detection on the marked region, and partitions the detected edge points into point sets according to their positional relationship with each internal connected component to obtain an inner edge point set belonging to the corresponding internal connected component and an outer edge point set not belonging to any internal connected component; and an image restoration module, which finds matching points for each edge point based on the outer edge point set and each inner edge point set, and performs linear fitting restoration on the pixels on the line connecting the matching point pairs based on the matching point pairs to obtain the restored medical image.
[0017] 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 general marker interference as described above.
[0018] 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 general marker interference as described above.
[0019] 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 general marker interference as described above.
[0020] The present invention provides a general medical image restoration method and system for label interference. It acquires the image to be restored and filters it based on a difference function and a target template threshold to determine the labeled region. This, combined with a global threshold constraint and local feature filtering mechanism, initially reduces the complex medical image domain to a relatively simple labeled subspace. Furthermore, it meticulously extracts the internal connected domains for each labeled region and strictly divides the edge points into inner and outer edge point sets based on their positional relationships. This cleverly establishes a decoupled mapping between the core topology of the region and the dynamic response of the edges, transforming the problem of ambiguous boundary degradation into a problem of the corresponding positional relationship between the inner and outer point sets. This accurately removes the interference of false edges and complex overlaps on the restoration target. Simultaneously, it finds matching points by using the inner and outer edge point sets and performs linear fitting restoration on the connected pixels. Utilizing the spatial symmetry prior and local linear constraints of the opposite edge points, it achieves high-fidelity directional reconstruction of degraded pixels with extremely low computational complexity. This not only avoids the structural ambiguity and texture smoothing caused by traditional global diffusion restoration but also achieves excellent efficiency, accuracy, and adaptive restoration capabilities for complex medical image labeled regions while effectively eliminating label residual artifacts and ensuring seamless integration of the restored region with the surrounding native tissue structure. Attached Figure Description
[0021] 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.
[0022] Figure 1 This is a flowchart illustrating the universal marker interference medical image restoration method provided by the present invention; Figure 2This is a schematic diagram of the inner and outer edge point sets provided by the present invention; Figure 3 This is a schematic diagram of the eight-neighbor retrieval order in edge point sorting provided by the present invention; Figure 4 These are comparison images of the repair effects of medical images provided by this invention; Figure 5 This is a schematic diagram of the structure of the universal marker interference medical image restoration system provided by the present invention; Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0023] 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.
[0024] Figure 1 This is a flowchart illustrating the universal marker interference medical image restoration method 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 difference function value between each pixel in the medical image to be repaired and the predefined color template set, and combine it with the target template threshold to filter the pixels in the medical image to be repaired to obtain the marked area; S12, for each marked region, extract each internal connected component within the corresponding marked region, and perform edge point detection on the marked region. Divide the detected edge points into point sets according to their positional relationship with each internal connected component, and obtain the inner edge point set belonging to the corresponding internal connected component and the outer edge point set not belonging to any internal connected component. S13. Based on the outer edge point set and each inner edge point set, find the matching point of each edge point, and perform linear fitting repair on the pixel points on the line connecting the matching point pairs to obtain the repaired medical image.
[0025] It should be noted that the following will be combined with specific details. Figures 2-4 This invention describes a medical image restoration method for general marker interference.
[0026] Step S11: Obtain the medical image to be repaired, determine the difference function value between each pixel in the medical image to be repaired and the predefined color template set, and filter the pixels in the medical image to be repaired in combination with the target template threshold to obtain the marked area.
[0027] It should be noted that the markings in the medical images to be repaired include various forms such as text, symbols, coils, and underlines. Most medical images are close to grayscale, with a small number containing color components. This method does not limit the medical image to grayscale, nor does it limit the marking lines to color. In addition, the same marking is generally drawn with a single color, but the marking is often semi-transparently overlaid on the original image. Image compression storage can also cause the marking color to render outwards. Furthermore, the colors defined in the template set cannot be guaranteed to be exactly the same as the marking line colors. Therefore, the difference in the marking areas in the image to be repaired is not strictly zero.
[0028] In this embodiment, the difference function value between each pixel in the medical image to be repaired and a predefined color template set is determined, and the pixels in the medical image to be repaired are filtered in combination with a target template threshold to obtain a marked region. This includes: determining the difference function value between each pixel in the medical image to be repaired and the color template set based on the predefined color template set to obtain a difference matrix; comparing each element in the difference matrix with the target template threshold, marking pixels with values less than or equal to the target template threshold as first preset markers, and marking pixels with values greater than the target template threshold as second preset markers to obtain a target matrix; and filtering pixels in the medical image to be repaired according to the first preset markers to obtain a marked region.
[0029] Further, based on a predefined color template set, the difference function values between each pixel in the medical image to be repaired and the color template set are determined to obtain a difference matrix. This includes: based on the predefined color template set, determining the difference function value between each pixel in the medical image to be repaired and each color template in the color template set, and selecting the minimum difference function value as the difference function value of the corresponding pixel; and obtaining the difference matrix based on the difference function values of the pixels.
[0030] It should be added that the difference matrix The Middle Line number The elements of a column are represented as follows: in, Represents the difference matrix The Middle Line number Column elements; Indicates medical images to be repaired Medium pixel and color template set The difference function value; Represents color template set Color templates in express Color vector; This indicates the pixel coordinates in the medical image to be repaired. The color value of the pixel, express Color vector; express and The difference function value.
[0031] Furthermore, the first and second preset markers use different markers, which can be set according to actual design requirements. No further limitations are made here; for example, the first preset marker could be 1, and the second preset marker 0. Correspondingly, the target matrix... The Middle Line number The elements of a column are represented as follows: in, Representing the target matrix The Middle Line number Column elements; This represents the target template threshold.
[0032] It should be noted that the target template threshold The larger the threshold, the wider the candidate region, which can easily introduce too many false target regions; target template threshold The smaller the value, the more stringent the candidate region selection, potentially missing the true target region. If the color of the medical image to be repaired differs significantly from the template set, then... A larger value can be taken; if the medical image to be repaired contains an interference region that is close to the template set, then A smaller value should be selected, and the specific value can be set according to actual needs and prior experience.
[0033] In an optional embodiment, before filtering pixels in the medical image to be repaired by combining a target template threshold, the method includes: based on the difference function value between each pixel in the medical image to be repaired and a predefined color template set, comparing each element in the difference matrix with a preset initial target template threshold, marking pixels less than or equal to the preset initial target template threshold as a first preset marker, and marking pixels greater than the preset initial target template threshold as a second preset marker, to obtain a target matrix; extracting each connected component based on the target matrix, determining the number of connected components and the area of each connected component, and obtaining the target area of the target matrix based on the area of each connected component; updating the preset initial target template threshold using a preset threshold update coefficient to obtain an updated target template threshold, and comparing each element in the difference matrix with the updated target template threshold to update the target matrix, the number of connected components, and the target area of the target matrix; determining that the number of connected components is greater than or equal to the preset initial target template threshold. If a connected component threshold is set, and the target area of the updated target matrix is greater than or equal to the product of the target area of the original target matrix and a preset area comparison coefficient, then the updated target template threshold is used as the current target template threshold. Each element in the difference matrix is compared with the updated current target template threshold, and the corresponding target matrix, the number of connected components, and the target area are updated accordingly. The number of connected components corresponding to the current target template threshold is re-determined to be greater than or equal to the preset connected component threshold, and the target area corresponding to the updated current target template threshold is re-determined to be greater than or equal to the product of the target area corresponding to the current target template threshold and the preset area comparison coefficient. This process continues until the number of connected components corresponding to the current target template threshold is less than the preset connected component threshold or the target area corresponding to the updated current target template threshold is less than the product of the target area corresponding to the current target template threshold and the preset area comparison coefficient. The final updated current target template threshold is then used as the target template threshold.
[0034] It should be noted that the difference matrix Corresponding target matrix The numerical distribution of the region marked by the first preset label is clustered, therefore when When the clustering value changes from high to low, the corresponding target area is... This will result in a sharp reduction. When When the value is too large, it may contain more noise. The value will be relatively large; when If the value is too small, the actual target area will also be excluded. The value will also be too small.
[0035] It should be added that the target template threshold is dynamically determined by the change in target area to enhance adaptability to various image types. Updating the current target template threshold using a preset threshold update coefficient can be expressed as: in, This represents the preset threshold update coefficient, which can be set according to actual design requirements and prior experience, such as 0.85. This indicates that the coefficients are updated using a preset threshold. Update the current target template threshold ; This represents the target area corresponding to the updated current target template threshold; This indicates the target area corresponding to the current target template threshold; This represents the preset area comparison coefficient, which can be set according to actual design requirements and prior experience, such as 0.60. This indicates the number of connected components corresponding to the current target template threshold; This represents the preset connected component threshold, 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, and in this method, it can be set to 8. Representing the target matrix The Middle Line number Column elements, Representing the target matrix the number of rows, Representing the target matrix The number of columns.
[0036] In addition, a preset initial target template threshold is set. The configuration can be based on multi-image analysis and / or prior experience; for example, a range of [40, 55] is more suitable. You can take 50; no further restrictions are imposed here.
[0037] In an optional embodiment, after obtaining the marked region, the process includes: extracting each connected component based on the target matrix and determining the area of each connected component; determining the corresponding connected component as a marked region when the area of the connected component is greater than or equal to a preset area threshold; and filtering out the corresponding connected component as noise when the area of the connected component is less than the preset area threshold, thereby effectively suppressing noise interference by screening the target through the area of the connected components.
[0038] It should be added that the area of a connected region is expressed as: in, Represents the area of the connected region; Indicates a connected component. In addition, the preset area threshold is directly related to the marker size, line thickness, and image resolution. It can be set according to the actual marker size, line thickness, and image resolution, for example, to 80. No further restrictions are imposed here.
[0039] In an optional embodiment, since the marker color is rendered outwards, the boundary of the marked region needs further optimization to extract as many pixels as possible affected by the rendering. Accordingly, after obtaining the marked region, the method further includes: extracting each connected component based on the target matrix; for each connected component, finding pixels in the medical image to be repaired that meet the optimization conditions, and merging the pixels that meet the optimization conditions into the corresponding connected component to optimize the marked region; wherein, the optimization conditions include: determining that there are target pixels in the medical image to be repaired that do not belong to the corresponding connected component, determining that the corresponding element of the target pixel in the difference matrix is less than or equal to the product of the target template threshold and the preset template threshold reduction coefficient, and determining that there are pixels in the corresponding connected component such that the absolute value of the difference between the pixel row coordinates and pixel column coordinates between the target pixel and the pixels in the corresponding connected component is less than or equal to a preset distance threshold.
[0040] It should be added that the connected components mentioned above are those filtered based on their area, to avoid further processing of connected components that are considered noise and to prevent waste of computing resources. Furthermore, the optimization conditions are expressed as follows: in, Represents the pixel coordinates of the target pixel; This indicates that the target pixel corresponds to the first pixel in the difference matrix. Line number Column elements; Indicates the target template threshold; This represents the preset template threshold degradation coefficient, which can be set according to actual design requirements and / or prior experience. A value between 1.1 and 1.3 is more appropriate, such as 1.15. Represents the corresponding connected components The pixel coordinates of the pixels in the image; It represents the absolute value of the difference between the pixel row coordinates of the target pixel and the corresponding pixel in the connected component; It represents the absolute value of the difference between the column coordinates of the target pixel and the corresponding pixel in the connected component.
[0041] It is worth noting that before obtaining the aforementioned marked areas, the detection accuracy of the marked areas can be improved by manually selecting bounding boxes. This effectively enhances detection accuracy when the image and the marked line colors are similar. By manually selecting the area where the marker is located using a rectangular bounding box, the elements outside the bounding box in the difference matrix are set to 255, while the values of the elements inside the bounding box remain unchanged.
[0042] Step S12: For each marked region, extract each internal connected component within the corresponding marked region, and perform edge point detection on the marked region. Divide the detected edge points into point sets according to their positional relationship with each internal connected component, and obtain the inner edge point set belonging to the corresponding internal connected component and the outer edge point set not belonging to any internal connected component.
[0043] It should be noted that this applies to medical images that need to be repaired. A single marked region in the diagram has a structure that is a single connected component, denoted as _____. , Indicates the number of internal connected components corresponding to a single marked region, when A value of 0 indicates that the corresponding marked area does not contain closed lines. The goal of image restoration is to set a new color value for each pixel in each marked area, so that the marked area maintains structural and textural consistency with its neighbors.
[0044] Alternatively, edge detection algorithms can be applied to find all edge points in the marked region, such as the Canny or Sobel edge detection algorithms. All edge points are then assigned to the outer edge. and inner side common A set of edge points, such as Figure 2 As shown, the corresponding set of edge points is: in, Indicates the first A set of inner edge points, ; This represents the set of points on the outer edge.
[0045] In an optional embodiment, after obtaining the set of inner edge points belonging to the corresponding internal connected domain and the set of outer edge points not belonging to any internal connected domain, the process includes: for each set of edge points, sorting the edge points according to their positional connection. Specifically, starting from the topmost edge point, searching for the next edge point in the 8-neighborhood in a clockwise direction to form a closed loop, wherein the search order of the 8-neighborhood is as follows: Figure 3 As shown.
[0046] Step S13: Based on the outer edge point set and each inner edge point set, find the matching points of each edge point, and perform linear fitting repair on the pixels on the line connecting the matching point pairs to obtain the repaired medical image.
[0047] It should be noted that the connected component corresponding to the marked area is the region to be repaired, drawn by the marker lines. Suitable edge point pairs are found on both sides of the marker lines, and the repair is fitted along the direction of the line connecting the two points. This results in a repair that smoothly transitions to the edges while maintaining consistency with structural details. This invention uses the shortest distance method to find matching edge point pairs.
[0048] In one possible implementation, for any outer edge point, its matching point can appear in either the inner set or the outer set. Accordingly, based on the outer edge point set and each inner edge point set, the matching point for each edge point is found, including: for any outer edge point in the outer edge point set, determining the corresponding outer candidate matching set based on the edge point number of each outer edge point in the outer edge point set, the total number of edge points in the outer edge point set, the thickness of the marker line, and a preset sequence spacing coefficient; and finding the edge point closest to the corresponding outer edge point in the outer candidate matching set and all inner edge point sets, which is then used as the matching point for the corresponding outer edge point.
[0049] Specifically, in the outer candidate matching set and all inner edge point sets Find the outer edge point in the middle. The nearest point is used as the outer edge point. The matching point is represented as: in, Indicates the outer edge point matching points; Indicates the outer candidate matching set and all inner edge point sets Edge points are found in the middle.
[0050] In addition, for any outer edge point in the outer edge point set, based on the edge point number of each outer edge point in the outer edge point set, the total number of edge points in the outer edge point set, the thickness of the marker line, and a preset sequence number spacing coefficient, the corresponding outer candidate matching set for the outer edge point is determined. This includes: for any outer edge point in the outer edge point set, based on the edge point number of each outer edge point in the outer edge point set, determining the number difference between the remaining outer edge points and the outer edge point; determining the difference value based on the number difference and the total number of edge points in the outer edge point set, and selecting the minimum value between the difference value and the number difference value; when the minimum value is greater than or equal to the number filtering threshold, the remaining outer edge points with the corresponding number are assigned to the corresponding outer candidate matching set for the outer edge point; the number filtering threshold is obtained in advance based on the marker line thickness and the preset sequence number spacing coefficient.
[0051] Furthermore, the outer edge point set common There are 1 point, respectively ,for For any edge point in the array, its pixel coordinates are The sorting number is Accordingly, the candidate matching set is represented as: in, Represents the outer candidate matching set; This represents the remaining outer edge points in the outer edge point set. Indicates the corresponding sorting number; This represents the preset number spacing coefficient, which can be set according to actual design requirements and / or prior experience, such as 3; Indicates the thickness of the marking line.
[0052] Furthermore, to reduce computational complexity, the process involves searching for the nearest edge point to the corresponding outer edge point within the candidate matching set of the outer edge point and the set of all inner edge points. This includes: searching for edge points in the candidate matching set of the outer edge point and the set of all inner edge points based on the corresponding outer edge point; determining that when the absolute value of the difference between the pixel row coordinates and pixel column coordinates between the outer edge point and the found edge point is less than or equal to a first search range threshold, then assigning the corresponding edge point to the first target range point set; the first search range threshold is pre-determined based on the thickness of the marker line and a first preset search range coefficient; and then, within the first target range point set, searching for the edge point closest to the corresponding outer edge point as the matching point for the corresponding outer edge point.
[0053] It should be added that the edge points of the first target range point set Represented as: in, Indicates the outer edge point With the found edge points The absolute value of the difference between the pixel row coordinates; Indicates the outer edge point With the found edge points The absolute value of the difference between the column coordinates of the pixels; This represents the first preset search range coefficient, which can be set according to actual design requirements and / or prior experience, such as 2. Indicates the thickness of the marking line; This indicates the threshold for the first search range.
[0054] In another possible implementation, for any inner edge point, its matching point can appear in either the outer set or other inner sets, but not in the current inner set; otherwise, the line connecting the two points will not be within the area to be repaired. Accordingly, finding matching points for each edge point based on the outer edge point set and each inner edge point set further includes: for any inner edge point in each inner edge point set, selecting the remaining inner edge point sets (excluding the inner edge point set to which the inner edge point belongs) as the corresponding inner candidate matching set; and finding the edge point closest to the corresponding inner edge point in the outer edge point set and the inner candidate matching set as the matching point for the corresponding inner edge point.
[0055] Specifically, for For any inner edge point, in the set of outer edge points Find the inner edge point by combining it with all other inner edge points. The closest point is used as the inner edge point. The matching point is represented as: in, Indicates the inner edge point matching points; Represents the set of points on the outer edge. The edge point to be searched in the set of all other inner edge points.
[0056] In addition, to reduce computational complexity, the process involves finding the edge point closest to the corresponding inner edge point in the outer edge point set and the inner candidate matching set. This includes: finding edge points in the outer edge point set and the inner candidate matching set based on the corresponding inner edge point; determining that when the absolute value of the difference between the pixel row coordinates and pixel column coordinates between the inner edge point and the found edge point is less than or equal to a second search range threshold, then assigning the corresponding edge point to the second target range point set; the second search range threshold is obtained in advance based on the thickness of the marker line and a second preset search range coefficient; and in the second target range point set, finding the edge point closest to the corresponding inner edge point as the matching point for the corresponding inner edge point.
[0057] Furthermore, the edge points of the second target range point set Represented as: in, Indicates the inner edge point With the found edge points The absolute value of the difference between the pixel row coordinates; Indicates the inner edge point With the found edge points The absolute value of the difference between the column coordinates of the pixels; This represents the second preset search range coefficient, which can be set according to actual design requirements and / or prior experience, such as 2. Indicates the thickness of the marking line; This indicates the threshold for the second search range. Additionally, when the marker line thickness... When the value matches the true value, most edge points can find a matching point within the above range.
[0058] In an optional embodiment, due to differences in marker line thickness and image resolution, the thickness of marker lines in different images may vary significantly, making a fixed value unsuitable. Therefore, an iterative method can be used to dynamically determine the marker line thickness. Correspondingly, before assigning the corresponding edge point to the first target range point set when the absolute value of the difference between the pixel row coordinates and pixel column coordinates between the outer edge point and the found edge point is less than or equal to a first search range threshold, and / or before assigning the corresponding edge point to the second target range point set when the absolute value of the difference between the pixel row coordinates and pixel column coordinates between the inner edge point and the found edge point is less than or equal to a second search range threshold, the method further includes: determining an initial first search range threshold or a second search range threshold based on a preset initial marker line thickness to obtain an initial first target range point set or a second target range point set; and obtaining matching points based on the initial first target range point set or the second target range point set. The total number of edge points; when the total number of edge points of the matching point is less than the point threshold, the preset initial marker line thickness is updated using a preset thickness update coefficient, and the corresponding first target range point set or second target range point set is updated using the updated marker line thickness; the point threshold is obtained in advance based on a preset proportion coefficient and the total number of edge points of the corresponding marked area; based on the updated first target range point set or second target range point set, the total number of edge points of the updated matching point is determined, and it is determined whether the total number of edge points of the updated matching point is less than the point threshold, until the total number of edge points of the updated matching point is greater than or equal to the point threshold, and the final first search range threshold or second search range threshold is obtained based on the final marker line thickness.
[0059] It should be added that the thickness of the marker line is updated using a preset thickness update coefficient, which is expressed as: in, This indicates the thickness of the marker line after updating using a preset thickness update coefficient; This indicates the preset thickness update coefficient, which can be set according to actual design requirements and / or prior experience, such as 1.6; This represents the total number of edge points from which matching points can be found. Indicates the threshold number of points; This indicates the preset percentage coefficient, which can be set according to actual design requirements and / or prior experience, such as 0.75; This indicates the total number of edge points in the marked area. Additionally, the initial thickness of the marker line can be set based on the minimum thickness value for each type of marker line, such as 10; no further limitation is made here.
[0060] In addition, after obtaining the total number of edge points of the matching points based on the initial first target range point set or the second target range point set, the method further includes: when the total number of edge points of the matching points is greater than or equal to the point count threshold, the preset initial marker line thickness is directly used as the final determined marker line thickness, and the corresponding initial first search range threshold or second search range threshold is used as the final obtained first search range threshold or second search range threshold.
[0061] In an optional embodiment, linear fitting repair is performed on the pixels on the line connecting the matching point pairs to obtain the repaired medical image. This includes: for any matching point pair consisting of an edge point and a corresponding matching point, determining the distance between the line connecting the edge point and the matching point, and determining the unit step size component of the line in the pixel row direction and pixel column direction; starting from the edge point, determining the coordinates of the pixels to be repaired at integer step sizes along the line direction based on the unit step size components in the pixel row direction and pixel column direction; for each pixel to be repaired determined along the line direction, determining the repaired color vector of the corresponding pixel to be repaired by linear interpolation based on the line distance, the integer step size corresponding to each pixel to be repaired, the color vector of the edge point, and the color vector of the matching point, to obtain the repaired medical image.
[0062] It should be noted that by detecting the edge points of the marked area as described above, the area is divided into one external set and several internal sets of edge points. The points in each set are sorted according to their positional connection relationship. Then, the thickness of the marked line is calculated iteratively, and the matching points of each edge point are found according to the shortest distance for fitting and repair. This enhances the adaptability to different marked line thicknesses and is suitable for different marked styles and marked line thicknesses. It can not only achieve a smooth and natural transition effect, but also maintain the consistency of the texture structure.
[0063] It should be added that, for any pair of matching points consisting of an edge point and its corresponding matching point, a line is drawn connecting the edge point and its corresponding matching point to linearly fit the points to be repaired, thereby achieving the repair. Let the coordinates of the edge point be denoted as... The corresponding matching point coordinates are Linear fitting and repair are performed on the pixels along the line connecting these two points, and the distance from the edge point is recorded. The coordinates of the pixel to be repaired are The repaired color vector is represented as: in, Represents edge points with matching points The distance between the lines; This represents the unit step size component of the connection in the pixel row direction; This represents the unit step size component of the connection in the pixel column direction; Indicates an integer step size, starting from 1 and increasing by 1 to 1. The above formula is used to process each pixel in order to repair the line connecting the edge point and the matching point; Indicates the pixels to be repaired The repaired color vector; Represents edge points Color vector; Indicates matching point The color vector.
[0064] It should be noted that all edge points with matching points are processed one by one, and the pixels to be repaired on the line connecting the edge point and the corresponding matching point are linearly fitted to achieve the initial repair of the marked area.
[0065] In an optional embodiment, for a single marked region, due to the presence of a small number of edge points without matching points and the randomness of matching, after performing the above edge matching fitting repair operation, a small number of pixels to be repaired may still remain in the original medical image, mostly distributed in small patches at the corners or intersections of the marked lines. For these pixels to be repaired, in order to maintain a smooth transition effect, neighboring repaired points can be found in its eight neighborhood directions, and then repaired using a weighted fitting method.
[0066] Specifically, after linear fitting and repair of the pixels on the matching point pairs to obtain the repaired medical image, the process includes: for each remaining pixel to be repaired in the marked region, finding the first repaired neighboring pixel in each neighborhood direction as the reference pixel for that neighborhood direction; for each remaining pixel to be repaired, determining the distance between it and the reference pixels in each neighborhood direction to obtain the weighting coefficients for each reference pixel; the smaller the distance, the larger the corresponding weighting coefficient; based on the reference pixels in each neighborhood direction and the corresponding weighting coefficients, performing a weighted summation of the color vectors of each reference pixel to obtain the repaired color vector for the corresponding remaining pixel to be repaired. The repaired medical image is shown below. Figure 5 As shown.
[0067] It should be noted that by fitting and repairing the connecting lines based on the matching points, and by weighting and fitting the remaining discrete pixels based on the proximity distance, the texture structure features of the image are restored and the transition is smooth, so as to achieve high-quality repair of various marker interferences and provide more accurate basic data for subsequent artificial intelligence applications.
[0068] It should be added that... The set of remaining pixels to be repaired after edge matching and fitting of the marked region is used. for The coordinates of any pixel in the image. for No. The first one in the neighborhood direction does not belong to The coordinates of the first repaired pixel are determined. A weighted fitting method is used for repair; the shorter the distance to the repaired point in the neighborhood, the larger the weighting coefficient. Pixel The repaired color vector is represented as follows: in, Indicates the first The weighting coefficients corresponding to each neighborhood direction; Indicates the remaining pixels to be repaired. With the The coordinates of the first repaired pixel in each neighborhood direction The distance between them; Represents pixels The repaired color vector; express The color vector.
[0069] In an optional embodiment, after obtaining the repaired medical images, the method further includes: saving the repaired image matrix as an image file according to a preset encoding format.
[0070] In summary, this invention acquires the image to be repaired and filters it based on the difference function and target template threshold to determine the marked region. This, combined with a global threshold constraint and local feature filtering mechanism, initially reduces the complex medical image domain to a relatively simple marked subspace. Furthermore, for each marked region, the internal connected domain is precisely extracted, and edge points are strictly divided into inner and outer edge point sets based on their positional relationships. This cleverly establishes a decoupled mapping between the core topology of the region and the dynamic response of the edges, transforming the problem of ambiguous boundary degradation into a problem of the corresponding positional relationship between inner and outer point sets. This accurately removes the interference of false edges and complex overlaps on the repair target. Simultaneously, by finding matching points through the inner and outer edge point sets and performing linear fitting repair on the connected pixels, the spatial symmetry prior and local linear constraints of the opposite edge points are utilized to achieve high-fidelity directional reconstruction of degraded pixels with extremely low computational complexity. This not only avoids the structural ambiguity and texture smoothing caused by traditional global diffusion repair but also achieves excellent capabilities for efficient, accurate, and adaptive repair of complex medical image marked regions while effectively eliminating residual marker artifacts and ensuring seamless integration of the repaired area with the surrounding native tissue structure.
[0071] The medical image restoration system for universal marker interference provided by the present invention will be described below. The medical image restoration system for universal marker interference described below can be referred to in correspondence with the medical image restoration method for universal marker interference described above.
[0072] Figure 5 A schematic diagram of a general marker interference medical image restoration system is shown. The system includes: The region filtering module 51 acquires the medical image to be repaired, determines the difference function value between each pixel in the medical image to be repaired and the predefined color template set, and filters the pixels in the medical image to be repaired in combination with the target template threshold to obtain the marked region. The point set partitioning module 52 extracts each internal connected component within each marked region, performs edge point detection on the marked region, and partitions the detected edge points into point sets according to their positional relationship with each internal connected component, thereby obtaining the inner edge point set belonging to the corresponding internal connected component and the outer edge point set not belonging to any internal connected component. The image restoration module 53 finds matching points for each edge point based on the outer edge point set and each inner edge point set, and performs linear fitting restoration on the pixels on the line connecting the matching point pairs based on the matching point pairs to obtain the restored medical image.
[0073] 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.
[0074] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6 As shown, the electronic device may include: a processor 610, a communications interface 620, a memory 630, and a communications bus 640, wherein the processor 610, the communications interface 620, and the memory 630 communicate with each other through the communications bus 640. The processor 610 can call logic instructions in the memory 630 to execute a general medical image restoration method for marked interference. The method includes: acquiring a medical image to be restored; determining the difference function value between each pixel in the medical image to be restored and a predefined color template set; and filtering the pixels in the medical image to be restored by combining the target template threshold to obtain marked regions; for each marked region, extracting each internal connected component within the corresponding marked region, and performing edge point detection on the marked region; dividing the detected edge points into point sets according to their positional relationship with each internal connected component to obtain an inner edge point set belonging to the corresponding internal connected component and an outer edge point set not belonging to any internal connected component; finding matching points for each edge point based on the outer edge point set and each inner edge point set, and performing linear fitting restoration on the pixels on the line connecting the matching point pairs based on the matching point pairs to obtain the restored medical image.
[0075] Furthermore, the logical instructions in the aforementioned memory 630 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, in essence, 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.
[0076] 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 general medical image restoration method for marked interference provided by the above methods. The method includes: acquiring a medical image to be restored; determining the difference function value between each pixel in the medical image to be restored and a predefined color template set; and filtering the pixels in the medical image to be restored by combining a target template threshold to obtain marked regions; for each marked region, extracting each internal connected component within the corresponding marked region, and performing edge point detection on the marked region; dividing the detected edge points into point sets according to their positional relationship with each internal connected component to obtain an inner edge point set belonging to the corresponding internal connected component and an outer edge point set not belonging to any internal connected component; finding matching points for each edge point based on the outer edge point set and each inner edge point set, and performing linear fitting restoration on the pixels on the line connecting the matching point pairs based on the matching point pairs to obtain the restored medical image.
[0077] 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 general labeled interference provided by the methods described above. The method includes: acquiring a medical image to be restored; determining the difference function value between each pixel in the medical image to be restored and a predefined color template set; and filtering the pixels in the medical image to be restored by combining a target template threshold to obtain labeled regions; for each labeled region, extracting each internal connected component within the corresponding labeled region, and performing edge point detection on the labeled region; dividing the detected edge points into point sets according to their positional relationship with each internal connected component to obtain an inner edge point set belonging to the corresponding internal connected component and an outer edge point set not belonging to any internal connected component; finding matching points for each edge point based on the outer edge point set and each inner edge point set, and performing linear fitting restoration on the pixels on the line connecting the matching point pairs based on the matching point pairs to obtain the restored medical image.
[0078] 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.
[0079] 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.
[0080] 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 universal method for restoring medical images to mitigate marker interference, characterized in that, include: The medical image to be repaired is acquired, the difference function value between each pixel in the medical image to be repaired and the predefined color template set is determined, and the pixels in the medical image to be repaired are filtered in combination with the target template threshold to obtain the marked area. For each marked region, extract each internal connected component within the corresponding marked region, and perform edge point detection on the marked region. Divide the detected edge points into point sets according to their positional relationship with each internal connected component to obtain the inner edge point set belonging to the corresponding internal connected component and the outer edge point set not belonging to any internal connected component. Based on the outer edge point set and each of the inner edge point sets, matching points for each edge point are found, and based on the matching point pairs, the pixels on the line connecting the matching point pairs are linearly fitted and repaired to obtain the repaired medical image.
2. The medical image restoration method for universal marker interference according to claim 1, characterized in that, Based on the outer edge point set and each of the inner edge point sets, find matching points for each edge point, including: For any outer edge point in the set of outer edge points, the outer candidate matching set of the corresponding outer edge point is determined based on the edge point number of each outer edge point in the set of outer edge points, the total number of edge points in the set of outer edge points, the thickness of the marker line, and the preset sequence number spacing coefficient. In the candidate matching set of the outer edge point and the set of all inner edge points, find the edge point that is closest to the corresponding outer edge point, and use it as the matching point for the corresponding outer edge point; and / or, Based on the outer edge point set and each inner edge point set, for any inner edge point in each inner edge point set, select the remaining inner edge point set other than the inner edge point set to which the inner edge point belongs, as the inner candidate matching set of the corresponding inner edge point; In the set of outer edge points and the set of inner candidate matches, find the edge point that is closest to the corresponding inner edge point and use it as the matching point of the corresponding inner edge point.
3. The medical image restoration method for universal marker interference according to claim 2, characterized in that, For any outer edge point in the set of outer edge points, based on the edge point number of each outer edge point in the set, the total number of edge points in the set, the thickness of the marker line, and a preset sequence spacing coefficient, a candidate matching set for the corresponding outer edge point is determined, including: For any outer edge point in the set of outer edge points, the difference in number between the remaining outer edge points and the outer edge point is determined based on the edge point number of each outer edge point in the set of outer edge points. Based on the number difference and the total number of edge points in the outer edge point set, determine the difference value and select the minimum value between the difference value and the number difference; When the minimum value is determined to be greater than or equal to the number filtering threshold, the remaining outer edge points of the corresponding number are assigned to the outer candidate matching set of the corresponding outer edge points; the number filtering threshold is obtained in advance based on the thickness of the marker line and the preset number spacing coefficient.
4. The medical image restoration method for universal marker interference according to claim 2, characterized in that, In the candidate matching set of the outer edge point and the set of all inner edge points, find the edge point that is closest to the corresponding outer edge point, including: Based on the corresponding outer edge point, the candidate matching set of the outer edge point and the edge points in all inner edge point sets are searched. When the absolute value of the difference between the pixel row coordinate and the pixel column coordinate between the outer edge point and the searched edge point is less than or equal to the first search range threshold, the corresponding edge point is assigned to the first target range point set. The first search range threshold is obtained in advance based on the thickness of the marker line and the first preset search range coefficient. Within the first target range point set, find the edge point that is closest to the corresponding outer edge point and use it as the matching point for the corresponding outer edge point.
5. The medical image restoration method for universal marker interference according to claim 2, characterized in that, In the set of outer edge points and the set of inner candidate matches, the edge point closest to the corresponding inner edge point is found, including: Based on the corresponding inner edge point, edge points in the outer edge point set and the inner candidate matching set are searched. When the absolute value of the difference between the pixel row coordinate and pixel column coordinate between the inner edge point and the searched edge point is less than or equal to the second search range threshold, the corresponding edge point is assigned to the second target range point set. The second search range threshold is obtained in advance based on the thickness of the marker line and the second preset search range coefficient. In the second target range point set, find the edge point that is closest to the corresponding inner edge point, and use it as the matching point of the corresponding inner edge point.
6. The medical image restoration method for universal marker interference according to claim 4 or 5, characterized in that, Before assigning the corresponding edge point to the first target range point set when the absolute values of the differences between the pixel row coordinates and pixel column coordinates between the outer edge point and the found edge point are both less than or equal to the first search range threshold, and / or before assigning the corresponding edge point to the second target range point set when the absolute values of the differences between the pixel row coordinates and pixel column coordinates between the inner edge point and the found edge point are both less than or equal to the second search range threshold, the method further includes: Based on the preset initial marker line thickness, determine the initial first search range threshold or the second search range threshold, and obtain the initial first target range point set or the second target range point set; Based on the initial first target range point set or the second target range point set, obtain the total number of edge points of the matching points; When the total number of edge points of the matching point is less than the number of points threshold, the preset initial marker line thickness is updated using a preset thickness update coefficient, and the corresponding first target range point set or second target range point set is updated using the updated marker line thickness; the number of points threshold is obtained in advance based on a preset proportion coefficient and the total number of edge points of the corresponding marked area; Based on the updated first target range point set or second target range point set, determine the total number of edge points of the updated matching points, and determine whether the total number of edge points of the updated matching points is less than the point count threshold, until the total number of edge points of the updated matching points is greater than or equal to the point count threshold. Based on the final obtained identifier line thickness, obtain the final first search range threshold or second search range threshold.
7. The medical image restoration method for universal marker interference according to claim 1, characterized in that, Linear fitting and repair are performed on the pixels on the connecting lines of the matching points to obtain the repaired medical image, including: For any pair of matching points consisting of an edge point and a corresponding matching point, determine the distance between the edge point and the matching point, and determine the unit step size component of the connection in the pixel row direction and the pixel column direction. Starting from the edge point, the coordinates of the pixel to be repaired are determined based on the unit step size components in the pixel row direction and pixel column direction, along the connecting line direction at each integer step distance from the edge point. For each pixel to be repaired determined along the direction of the connecting line, the color vector of the corresponding pixel to be repaired is determined by linear interpolation based on the distance of the connecting line, the integer step size corresponding to each pixel to be repaired, the color vector of the edge point and the color vector of the matching point, so as to obtain the repaired medical image.
8. The medical image restoration method for universal marker interference according to claim 1, characterized in that, After performing linear fitting repair on the pixels along the line connecting the matching point pairs to obtain the repaired medical image, the process includes: For each remaining unrepaired pixel in the marked region, the first repaired neighboring pixel is found in each neighborhood direction and used as the reference pixel in the corresponding neighborhood direction; For each remaining pixel to be repaired, the distance between it and the reference pixel in each of the neighborhood directions is determined, and the weighting coefficients of each reference pixel are obtained. Based on the reference pixels in each of the neighborhood directions and the corresponding weighting coefficients, the color vectors of each of the reference pixels are weighted and summed to obtain the color vectors of the remaining pixels to be repaired.
9. The medical image restoration method for universal marker interference according to claim 1, characterized in that, Before filtering pixels in the medical image to be repaired by combining the target template threshold, the process includes: Based on the difference function value between each pixel in the medical image to be repaired and the predefined color template set, each element in the difference matrix is compared with a preset initial target template threshold. Pixels that are less than or equal to the element corresponding to the preset initial target template threshold are marked as first preset markers, and pixels that are greater than the element corresponding to the element corresponding to the preset initial target template threshold are marked as second preset markers, thus obtaining the target matrix. Based on the target matrix, each connected component is extracted, the number of connected components and the area of each connected component are determined, and the target area of the target matrix is obtained based on the area of each connected component. The preset initial target template threshold is updated using a preset threshold update coefficient to obtain the updated target template threshold. Each element in the difference matrix is compared with the updated target template threshold to update the target matrix, the number of connected components in the target matrix, and the target area. When it is determined that the number of connected components is greater than or equal to a preset connected component threshold, and the target area of the updated target matrix is greater than or equal to the product of the target area of the target matrix before the update and the preset area comparison coefficient, the updated target template threshold is used as the current target template threshold, and each element in the difference matrix is compared with the updated current target template threshold to update the corresponding target matrix and the number of connected components and the target area of the corresponding target matrix. The number of connected components corresponding to the current target template threshold is re-determined to be greater than or equal to the preset connected component threshold, and the target area corresponding to the updated current target template threshold is re-determined to be greater than or equal to the product of the target area corresponding to the current target template threshold and the preset area comparison coefficient, until the number of connected components corresponding to the current target template threshold is less than the preset connected component threshold or the target area corresponding to the updated current target template threshold is less than the product of the target area corresponding to the current target template threshold and the preset area comparison coefficient. The finally determined updated current target template threshold is taken as the target template threshold.
10. A universal marker-based interference medical image restoration system, characterized in that, include: The region filtering module acquires the medical image to be repaired, determines the difference function value between each pixel in the medical image to be repaired and a predefined color template set, and filters the pixels in the medical image to be repaired in combination with the target template threshold to obtain the marked region. The point set partitioning module extracts each internal connected component within each marked region, performs edge point detection on the marked region, and partitions the detected edge points into point sets according to their positional relationship with each internal connected component, thereby obtaining the inner edge point set belonging to the corresponding internal connected component and the outer edge point set not belonging to any internal connected component. The image restoration module finds matching points for each edge point based on the outer edge point set and each inner edge point set, and performs linear fitting restoration on the pixels on the line connecting the matching point pairs based on the matching point pairs to obtain the restored medical image.
