Surgical guide needle recognition method and system, electronic device, and storage medium

WO2025184986A8PCT designated stage Publication Date: 2025-10-02XIMU HIGH NEW TECH JIANGSU
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/094370
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-03-06
Filing Date
2024-05-21
Publication Date
2025-10-02

AI Technical Summary

Technical Problem

In the prior art, the efficiency and accuracy of identifying Kirschner wires by manual marking are low.

Method used

The edge extraction and Hough transform method is combined to extract the contour and edge information of the surgical guide needle through the Canny operator. The Hough transform is used to detect the straight line, filter and merge the straight line data, and determine the straight line data of the surgical guide needle.

Benefits of technology

The efficiency and accuracy of surgical guide needle identification are improved, ensuring the accurate positioning of surgical guide needles entering the human body.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024094370_02102025_PF_FP_ABST
    Figure CN2024094370_02102025_PF_FP_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of image recognition, and provides a surgical guide needle recognition method and system, an electronic device, and a storage medium. The surgical guide needle recognition method comprises: acquiring a first image having a surgical guide needle; performing edge extraction on the first image to obtain a second image; performing linear detection on the second image to obtain a first linear data set; screening the first linear data set to obtain a second linear data set; and determining linear data of the surgical guide needle on the basis of the second linear data set.
Need to check novelty before this filing date? Find Prior Art

Description

Method and system for identifying surgical guide needle, electronic device and storage medium Technical Field

[0001] The present invention relates to the field of image recognition technology, and in particular to a method and system for recognizing a surgical guide needle, an electronic device, and a storage medium. Background Art

[0002] In orthopedic applications, doctors often use K-wires for positioning and guidance. Before inserting a K-wire, they want to know its final position. Conventional techniques often rely on manual drawing of an extension line along the K-wire's orientation in an image. However, this approach is inefficient and lacks accuracy.

[0003] Summary of the Invention

[0004] The present invention aims to solve or improve at least one of the above technical problems.

[0005] To this end, a first object of the present invention is to provide a method for identifying a surgical guide needle.

[0006] A second object of the present invention is to provide a surgical guide needle identification system.

[0007] A third object of the present invention is to provide an electronic device.

[0008] A fourth object of the present invention is to provide a storage medium.

[0009] To achieve the first purpose of the present invention, the technical solution of the present invention provides a method for identifying a surgical guide needle, including: acquiring a first image with a surgical guide needle; performing edge extraction on the first image to obtain a second image; performing straight line detection on the second image to obtain a first straight line data set; screening the first straight line data set to obtain a second straight line data set; and determining the straight line data of the surgical guide needle based on the second straight line data set.

[0010] The method for identifying a surgical guide needle provided by the present invention specifically includes: first obtaining a first image with a surgical guide needle, which can be a Kirschner wire. Then, edge extraction is performed on the first image to obtain a second image, wherein the edge extraction method can be to perform edge extraction through a Canny operator, thereby extracting the contour and edge information of the surgical guide needle in the first image, and generating a second image based on these contours and edge information. Furthermore, straight line detection is performed on the second image to achieve the purpose of detecting the surgical guide needle, wherein the method for performing straight line detection on the second image can adopt Hough transform, which is a mature algorithm for straight line detection, and can convert image space into Hough space. A straight line in the image space corresponds to a point in the Hough space, that is, by performing straight line detection on the second image, the straight line in the second image is converted into straight line data, and the straight line data includes the position of the corresponding straight line in the image. Furthermore, because the second image contains not only the outline of the surgical guide needle but also the outline of the user's body, the first line data set obtained by performing line detection on the second image includes not only the line data for the surgical guide needle but also other line data. Therefore, the first line data set needs to be filtered to remove line data that does not represent the surgical guide needle. After removing the other line data, a second line data set is obtained. Furthermore, the final line data for the surgical guide needle is determined based on the second line data set. Specifically, because the surgical guide needle has a width, two line data sets in the second line data set will represent the upper and lower edge line data of the same surgical guide needle. Therefore, the upper and lower edge line data need to be processed to obtain the final line data for the surgical guide needle. The obtained line data for the surgical guide needle is then used to determine the final position of the surgical guide needle after entering the human body. The present invention processes images containing a surgical guide needle to determine the final position of the surgical guide needle after entering the human body, improving efficiency and accuracy compared to related technologies.

[0011] In addition, the technical solution provided by the present invention may also have the following additional technical features:

[0012] In some technical solutions, optionally, the step of screening the first straight line data set to obtain the second straight line data set includes: deleting inaccurate straight line data in the first straight line data set to obtain a third straight line data set; and merging similar straight line data in the third straight line data set to obtain the second straight line data set.

[0013] In this technical solution, the step of screening the first line data set to obtain the second line data set includes: first, deleting inaccurate line data from the first line data set to obtain a third line data set. Specifically, the line data in the first line data set is first determined and compared with the lines in the second image to determine whether the line data obtained after line detection is accurate. If it is inaccurate, that is, if a line data exists in the first line data set but does not correspond to a line in the second image, the line data is inaccurate. Therefore, the inaccurate line data is deleted, and the remaining line data is reassembled to obtain the third line data set. Secondly, similar line data in the third line data set is merged to obtain the second line data set. It is understood that when deleting inaccurate line data, some line data may remain because the error between the line data and the line in the second image is too small to be accurately determined. These line data with small errors are considered similar line data. That is, after removing the inaccurate line data, multiple similar line data may still exist. Therefore, these multiple similar line data need to be merged to obtain the second line data set that fully matches the lines in the second image.

[0014] In some technical solutions, optionally, the step of deleting inaccurate straight line data in the first straight line data set to obtain a third straight line data set includes: obtaining all straight line data in the first straight line data set; obtaining a first distance between a data point and an edge and a second distance between data points with consecutive edges on each straight line data; and deleting the straight line data corresponding to the first distance and the second distance based on the first distance being less than a first threshold and the second distance being less than a second threshold, to obtain the third straight line data set.

[0015] In this technical solution, the step of deleting inaccurate line data from the first line data set to obtain a third line data set includes: first, obtaining all line data from the first line data set. Since inaccurate line data needs to be identified, all line data from the first line data set needs to be acquired. Furthermore, determining whether each line data point has an edge. If an edge exists, traversing all data points in the line data set, then determining the minimum distance between a data point and an edge, i.e., a first distance, and calculating the maximum length of consecutive edge points, i.e., a second distance, between consecutive edge points. Furthermore, comparing the first distance with a first threshold, and the second distance with a second threshold. If, for the same line data, the first distance is less than the first threshold and the second distance is also less than the second threshold, it indicates that there are no consecutive edge points in the line data, or the total number of edge-hitting data points is too small, i.e., the line data is inaccurate. The line data is then deleted to obtain the third line data set. By utilizing the relationship between line data and edges, inaccurate line data obtained after line detection of the second image is determined.

[0016] In some technical solutions, optionally, the step of merging similar straight line data in the third straight line data set to obtain the second straight line data set includes: obtaining the degree of proximity between multiple straight line data in the third straight line data set; based on the degree of proximity being less than a third threshold, determining the first straight line data closest to the edge among the multiple straight line data; and determining the second straight line data set based on the first straight line data.

[0017] In this technical solution, the step of merging similar line data in the third line data set to obtain a second line data set includes the following steps: after filtering out inaccurate line data, multiple line data may still exist near the edge. These line data are all relatively close to the edge, and the lines corresponding to these line data are also close to each other. Therefore, a line algorithm can be used to find those close line data. Since it is not related to the edge, the degree of proximity of the multiple line data can be directly determined using the line equation. Furthermore, if the obtained degree of proximity is less than a third threshold, it indicates that the line data are sufficiently close. Therefore, it is necessary to determine the first line data closest to the edge from the multiple line data. The first line data is retained as the line data, and the other line data close to the first line data is deleted. Finally, the remaining multiple line data are combined to obtain the second line data set. By determining the degree of proximity between the multiple line data, multiple close line data are obtained. Then, within the multiple close line data, the first line data is determined based on the distance between the line data and the edge. Finally, the second line data set is obtained based on the first line data, thereby ensuring the accuracy of the line data in the second line data set.

[0018] In some technical solutions, optionally, the step of determining the linear data of the surgical guide needle based on the second linear data set includes: obtaining the data relationship between each two linear data in the second linear data set; determining the fourth linear data set based on the data relationship; and determining the linear data of the surgical guide needle based on the fourth linear data set.

[0019] In this technical solution, the step of determining the linear data for the surgical guide needle based on the second linear data set includes: Since the surgical guide needle has a certain width range, two linear data sets are obtained after the linear detection. Therefore, it is necessary to obtain the data relationship between each pair of linear data in the second linear data set. This data relationship may include angle data and radius variation data. Furthermore, based on the obtained data relationship, two linear data sets corresponding to the surgical guide needle are determined in the second linear data set and combined to obtain a fourth linear data set. Finally, the final linear data for the surgical guide needle is determined using the fourth linear data set.

[0020] In some technical solutions, optionally, the step of determining the fourth straight line data set based on the data relationship includes: based on the fact that the angle data between the two straight line data satisfies the fourth threshold and the radius deviation data satisfies the fifth threshold, the straight line data is used as the second straight line data; and the two second straight line data are combined to obtain the fourth straight line data set.

[0021] In this technical solution, the step of determining the fourth straight line data set based on the data relationship includes: after obtaining the data relationship between two straight line data in the second straight line data set, if the data relationship between two of the straight line data meets the preset conditions, that is, the angle data meets the fourth threshold, and the radius deviation data meets the fifth threshold, then it means that these two straight line data are straight line data corresponding to the surgical guide needle, so the straight line data is used as the second straight line data, and the fourth straight line data set is obtained based on the combination of multiple second straight line data.

[0022] In some technical solutions, optionally, the step of determining the linear data of the surgical guide needle based on the fourth linear data set includes: obtaining two second linear data in the fourth linear data set; and determining the linear data of the surgical guide needle based on the average value of the two second linear data.

[0023] In this technical solution, the step of determining the linear data of the surgical guide needle based on the fourth linear data set includes: obtaining two related second linear data from the fourth linear data set, wherein the related second linear data refers to the linear data corresponding to the surgical guide needle. Since the two second linear data are only the linear data of the upper and lower edges of the surgical guide needle, it is necessary to calculate the average of the two second linear data based on the two second linear data to finally determine the linear data of the surgical guide needle. In other words, the linear data of the surgical guide needle is the linear data located between the linear data of the upper and lower edges of the surgical guide needle.

[0024] To achieve the second purpose of the present invention, the technical solution of the present invention provides a surgical guide needle recognition system, wherein the surgical guide needle recognition system includes: an acquisition module, the acquisition module is used to acquire a first image with a surgical guide needle; an extraction module, the extraction module is used to perform edge extraction on the first image to obtain a second image; a detection module, the detection module is used to perform straight line detection on the second image to obtain a first straight line data set; a screening module, the screening module is used to screen the first straight line data set to obtain a second straight line data set; and a determination module, the determination module is used to determine the straight line data of the surgical guide needle based on the second straight line data set.

[0025] The present invention provides a surgical guide needle recognition system, wherein the surgical guide needle recognition system specifically includes: an acquisition module, an extraction module, a detection module, a screening module, and a determination module. The acquisition module first acquires a first image with a surgical guide needle, which may be a Kirschner wire. The extraction module then performs edge extraction on the first image to obtain a second image. The edge extraction method may be to use a Canny operator to extract the contour and edge information of the surgical guide needle from the first image, and then generate the second image based on this contour and edge information. Furthermore, the detection module performs line detection on the second image to detect the surgical guide needle. The line detection method for the second image may utilize a Hough transform, which is a mature algorithm for line detection. The Hough transform can convert an image space into a Hough space, where a line in the image space corresponds to a point in the Hough space. That is, by performing line detection on the second image, the lines in the second image are converted into line data, and the line data includes the position of the corresponding line in the image. Furthermore, because the second image contains not only the outline of the surgical guide needle but also the outline of the user's body, the first line data set obtained by performing line detection on the second image includes not only the line data for the surgical guide needle but also other line data. Therefore, the screening module needs to filter the first line data set, removing line data that does not represent the surgical guide needle. After removing the other line data, a second line data set is obtained. Furthermore, the determination module determines the final line data for the surgical guide needle based on the second line data set. Specifically, because the surgical guide needle has a width, two line data sets in the second line data set will represent the upper and lower edge line data of the same surgical guide needle, respectively. Therefore, the upper and lower edge line data need to be processed to obtain the final line data for the surgical guide needle. The obtained line data for the surgical guide needle is then used to determine the final position of the surgical guide needle after entering the human body. The present invention processes images containing a surgical guide needle to determine the final position of the surgical guide needle after entering the human body, improving efficiency and accuracy compared to related technologies.

[0026] To achieve the third purpose of the present invention, the technical solution of the present invention provides an electronic device including a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, the steps of the surgical guide needle identification method as in any technical solution of the present invention are implemented.

[0027] The electronic device provided by this technical solution implements the steps of the surgical guide needle identification method as in any technical solution of the present invention, and thus has all the beneficial effects of the surgical guide needle identification method as in any technical solution of the present invention, which will not be repeated here.

[0028] To achieve the fourth objective of the present invention, the technical solution of the present invention provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the surgical guide needle identification method of any of the above technical solutions are implemented.

[0029] The storage medium provided by this technical solution implements the steps of the surgical guide needle identification method of any technical solution of the present invention, and thus has all the beneficial effects of the surgical guide needle identification method of any technical solution of the present invention, which will not be repeated here.

[0030] Additional aspects and advantages of the invention will become apparent from the description which follows, or may be learned by practice of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments with reference to the accompanying drawings, in which:

[0032] FIG1 shows a schematic diagram of a flow chart of a method for identifying a surgical guide needle according to an embodiment of the present invention;

[0033] FIG2 shows a schematic diagram of a first image according to an embodiment of the present invention;

[0034] FIG3 shows a schematic diagram of a second image according to an embodiment of the present invention;

[0035] FIG4 shows a Hough transform principle diagram according to an embodiment of the present invention;

[0036] FIG5 shows a schematic diagram of a Hough transform model in polar coordinates according to an embodiment of the present invention;

[0037] FIG6 is a schematic diagram showing the signs of θ and ρ according to an embodiment of the present invention;

[0038] FIG7 shows a schematic diagram of Hough transform according to an embodiment of the present invention;

[0039] FIG8 is a schematic diagram showing the result of straight line detection according to an embodiment of the present invention;

[0040] FIG9 shows a second flow chart of a method for identifying a surgical guide needle according to an embodiment of the present invention;

[0041] FIG10 shows a third flow chart of a method for identifying a surgical guide needle according to an embodiment of the present invention;

[0042] FIG11 shows a schematic diagram of straight line data sampling according to an embodiment of the present invention;

[0043] FIG12 shows a fourth flow chart of a method for identifying a surgical guide needle according to an embodiment of the present invention;

[0044] FIG13 is a schematic diagram showing line data before merging according to an embodiment of the present invention;

[0045] FIG14 is a schematic diagram showing the merged straight line data according to an embodiment of the present invention;

[0046] FIG15 shows a fifth flow chart of a method for identifying a surgical guide needle according to an embodiment of the present invention;

[0047] FIG16 shows a sixth flow chart of a method for identifying a surgical guide needle according to an embodiment of the present invention;

[0048] FIG17 is a schematic diagram showing the positive and negative signs of parameters of a straight line data according to an embodiment of the present invention;

[0049] FIG18 is a schematic diagram showing the positive and negative signs of parameters of two straight line data according to an embodiment of the present invention;

[0050] FIG19 shows a seventh flow chart of a method for identifying a surgical guide needle according to an embodiment of the present invention;

[0051] FIG20 shows a diagram of the final recognition result according to an embodiment of the present invention;

[0052] FIG21 shows an eighth flow chart of a method for identifying a surgical guide needle according to an embodiment of the present invention;

[0053] FIG. 22 shows a schematic block diagram of a surgical guide needle identification system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0054] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present application and the features therein can be combined with each other.

[0055] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present invention is not limited to the specific embodiments disclosed below.

[0056] FIG1 shows a schematic flow chart of a method for identifying a surgical guide needle according to an embodiment of the present invention. The method comprises:

[0057] Step 102: Acquire a first image with a surgical guide needle;

[0058] Step 104: performing edge extraction on the first image to obtain a second image;

[0059] Step 106: performing line detection on the second image to obtain a first line data set;

[0060] Step 108: Filter the first line data set to obtain a second line data set;

[0061] Step 110: Determine the straight line data of the surgical guide needle according to the second straight line data set.

[0062] The method for identifying a surgical guide needle provided by the present invention specifically includes: first acquiring a first image with a surgical guide needle, which can be a Kirschner wire. Then, edge extraction is performed on the first image to obtain a second image, wherein the edge extraction method can be edge extraction through a canny operator, thereby extracting the contour and edge information of the surgical guide needle in the first image, and generating a second image based on these contours and edge information. Furthermore, straight line detection is performed on the second image to achieve the purpose of detecting the surgical guide needle, wherein the method for straight line detection on the second image can use Hough transform, which is a mature algorithm for straight line detection. It can convert the image space into Hough space. A straight line in the image space corresponds to a point in the Hough space. That is, by performing straight line detection on the second image, the straight line in the second image is converted into straight line data, and the straight line data includes the position of the corresponding straight line in the image. Furthermore, because the second image contains not only the outline of the surgical guide needle but also the outline of the user's body, the first line data set obtained by performing line detection on the second image includes not only the line data for the surgical guide needle but also other line data. Therefore, the first line data set needs to be filtered to remove line data that does not represent the surgical guide needle. After removing the other line data, a second line data set is obtained. Furthermore, the final line data for the surgical guide needle is determined based on the second line data set. Specifically, because the surgical guide needle has a width, two line data sets in the second line data set will represent the upper and lower edge line data of the same surgical guide needle. Therefore, the upper and lower edge line data need to be processed to obtain the final line data for the surgical guide needle. The obtained line data for the surgical guide needle is then used to determine the final position of the surgical guide needle after entering the human body. The present invention processes images containing a surgical guide needle to determine the final position of the surgical guide needle after entering the human body, improving efficiency and accuracy compared to related technologies.

[0063] Figure 2 is a schematic diagram of the first image, and Figure 3 is a schematic diagram of the second image. The process of edge extraction using the Canny operator is to first perform Gaussian filtering on Figure 2 to reduce noise, then use the Sobel operator to calculate the gradient values ​​in the horizontal and vertical directions to obtain the gradient strength and direction of each pixel point, and then use non-maximum suppression to retain only the gradient maximum in the gradient direction to suppress blur on the edge. A double threshold is used to classify the gradient value of each pixel into strong edges, weak edges, and non-edges. Finally, the weak edges are connected with the strong edges to form a complete edge, which is Figure 3.

[0064] Furthermore, FIG4 is a diagram showing the principle of Hough transform. As shown in FIG4 , Hough transform is a mature algorithm for line detection. A line y=k 1 x+q 1 It can be determined by two points A(x1, y1) and B(x2, y2), or it can be written as 1 ,q 1 )’s function expression (Hough space): Where x1 represents the horizontal coordinate of A in the Cartesian coordinate system, y1 represents the vertical coordinate of A in the Cartesian coordinate system, x2 represents the horizontal coordinate of B in the Cartesian coordinate system, y2 represents the vertical coordinate of B in the Cartesian coordinate system, k 1 represents the slope of the line, q 1 is a constant. In other words, a straight line in the Cartesian coordinate system corresponds to a point in Hough space. Figure 5 shows the Hough transform model in polar coordinates. Polar coordinates are commonly used to represent the Hough transform: x × cosθ + y × sinθ = ρ, where θ is the polar angle, ρ is the radius, and x and y are the horizontal and vertical coordinates of the line. As shown in Figure 5, a straight line in the polar coordinate system includes three coordinate points: (1, 0), (2, 1), and (3, 2). After applying the formula x × cosθ + y × sinθ = ρ and converting to Hough space, it can be found that the three coordinate points are represented by three curves in Hough space, and the three curves intersect at the same point. Figure 6 shows the definition of the signs of θ and ρ. As shown in Figure 6, θ is less than 0 in the upper half of the coordinate system. θ is greater than or equal to 0 in the lower half of the coordinate system. ρ is greater than or equal to 0 in the right half of the coordinate system. ρ is less than 0 in the left half of the coordinate system. Figure 7 is a schematic diagram of the Hough transform, and Figure 8 is a schematic diagram of the line detection results. Figures 7 and 8 show that a line in image space corresponds to a peak where a curve in Hough space intersects. By searching for a local peak in Hough space, the corresponding line in image space can be found.

[0065] FIG9 shows a second flow chart of a surgical guide needle identification method according to an embodiment of the present invention. The step of filtering the first straight line data set to obtain the second straight line data set includes:

[0066] Step 902: Deleting inaccurate line data in the first line data set to obtain a third line data set;

[0067] Step 904: merging similar straight line data in the third straight line data set to obtain a second straight line data set.

[0068] In this embodiment, the step of screening the first line data set to obtain the second line data set includes: first, deleting inaccurate line data in the first line data set to obtain a third line data set. That is, first, the line data in the first line data set is judged and compared with the lines in the second image to determine whether the line data obtained after line detection is accurate. If it is inaccurate, that is, a line data exists in the first line data set but does not correspond to the line in the second image, then the line data is inaccurate. Therefore, the inaccurate line data is deleted, and the remaining line data is reassembled to obtain the third line data set. Secondly, similar line data in the third line data set are merged to obtain the second line data set. That is, after removing the inaccurate line data, multiple similar line data may still exist. Therefore, it is necessary to merge the multiple similar line data to obtain the second line data set that completely matches the lines in the second image.

[0069] FIG10 shows a third flow chart of a surgical guide needle identification method according to an embodiment of the present invention. The step of deleting inaccurate straight line data in the first straight line data set to obtain a third straight line data set includes:

[0070] Step 1002: Acquire all straight line data in the first straight line data set;

[0071] Step 1004: Obtain a first distance between a data point and an edge on each line data and a second distance between data points with consecutive edges;

[0072] Step 1006: When the first distance is less than the first threshold and the second distance is less than the second threshold, the straight line data corresponding to the first distance and the second distance are deleted to obtain a third straight line data set.

[0073] In this embodiment, the step of deleting inaccurate line data from the first line data set to obtain a third line data set includes: first, obtaining all line data from the first line data set. Since inaccurate line data needs to be identified, all line data from the first line data set needs to be acquired. Furthermore, determining whether each line data item has an edge is determined. If an edge is present, traversing all data points in the line data, determining the minimum distance between a data point and an edge, i.e., a first distance, and calculating the maximum length of consecutive edge points, i.e., a second distance, between consecutive edge points is calculated. Furthermore, the first distance is compared with a first threshold, and the second distance is compared with a second threshold. If, for the same line data item, the first distance is less than the first threshold and the second distance is also less than the second threshold, it indicates that there are no consecutive edge points in the line data item, or the total number of edge-hitting data points is too small, i.e., the line data item is inaccurate. The line data item is then deleted to obtain the third line data set. By utilizing the relationship between line data and edges, inaccurate line data obtained by line detection is identified.

[0074] For example, after Hough transform, the straight line data identified by the threshold may have many inaccurate results, which need to be filtered out. Search the position near the identified straight line data. If there is an edge nearby, the straight line data is considered to be relatively accurate straight line data close to the edge. Specifically, first, as shown in Figure 11, all data points on the straight line data are traversed, and sampling is performed along the direction perpendicular to the straight line data (when θ>45°, sampling is performed along the direction of the vertical coordinate in the spatial coordinate system, and if θ<45°, sampling is performed along the direction of the horizontal coordinate in the spatial coordinate system). Record whether there is an edge near the data point and record the minimum distance between the data point and the edge. Furthermore, the process of recording whether each data point has an edge is as follows: first perform a linear morphological erosion operation to eliminate isolated data points, and then perform a slightly longer dilation to fill the gaps caused by errors. The result is recorded as the exist line variable (is Exist Line). At the same time, we also need to calculate the maximum length of the data points that continuously exist on the edge and record it as the maximum long line variable (long Line Max). At the same time, we also record the distance between each line data point and the edge. In other words, we average the distances of each data point from the edge and record it as the line distance variable (line Dist) for use in subsequent steps. Furthermore, when long Line Max and is Exist Line are less than the threshold, it means that there are no consecutive data points that hit the edge, or the total number of data points that hit the edge is too small, indicating that the line data is inaccurate and is deleted.

[0075] FIG12 shows a fourth flow chart of a surgical guide needle identification method according to an embodiment of the present invention. The step of merging similar straight line data in the third straight line data set to obtain the second straight line data set includes:

[0076] Step 1202: Obtain the proximity between multiple straight line data in the third straight line data set;

[0077] Step 1204: determining a first straight line data closest to the edge from the plurality of straight line data based on the proximity being less than a third threshold;

[0078] Step 1206: Determine a second straight line data set based on the first straight line data.

[0079] In this embodiment, the step of merging similar line data in the third line data set to obtain the second line data set includes the following steps: after filtering out inaccurate line data, multiple line data may still exist near the edge. These line data are all relatively close to the edge, and the lines corresponding to these line data are also close to each other. Therefore, a line algorithm can be used to find these close line data. Since the edge is not related, the degree of proximity of the multiple line data can be directly determined using the line equation. Furthermore, if the obtained degree of proximity is less than a third threshold, it indicates that the line data are sufficiently close. Therefore, it is necessary to determine the first line data closest to the edge from the multiple line data. The first line data is retained as the line data, and the other line data close to the first line data is deleted. Finally, the remaining multiple line data are combined to obtain the second line data set. By determining the degree of proximity between the multiple line data, multiple close line data are obtained. Then, within the multiple close line data, the first line data is determined based on the distance between the line data and the edge. Finally, the second line data set is obtained based on the first line data, thereby ensuring the accuracy of the line data in the second line data set.

[0080] For example, as shown in Figure 13 before the line data is merged, and Figure 14 after the line data is merged, after filtering out inaccurate line data, there may still be multiple line data near the edge. The statistical results of these line data all meet the above thresholds, namely the first threshold and the second threshold. In other words, these line data are relatively close to the edge and are also close to each other. Therefore, the degree of proximity of two line data can be directly determined using the line equation. The formula is as follows:

[0081] Y i =ρ i ÷sin(θ i )-x i ÷tan(θ i );Yj =ρ j ÷sin(θ j )-x j ÷tan(θ j );

[0082] Among them, i and j represent two straight line data, ρ i and θ i is the radius and polar angle of the line data i in the polar coordinate system, ρ j and θ j is the radius and polar angle of the line data j in the polar coordinate system, Y i and x i It represents the horizontal and vertical coordinates of the line data i in the spatial coordinate system, Y j and x j It represents the horizontal and vertical coordinates of the line data j in the spatial coordinate system.

[0083] Furthermore, the maximum, minimum and mean values ​​of the distance between the two straight line data are calculated, and the mean and minimum values ​​are weighted. If the maximum value and the weighted value are both less than the set threshold, the two straight lines are considered close enough. Then, the line distance variable (line Dist) is obtained by calculation, and the straight line data corresponding to the smaller value among multiple line Dist values, that is, the straight line data closer to the edge, is selected as the screening retention line, and the other straight line data are deleted.

[0084] FIG15 shows a fifth flow chart of a method for identifying a surgical guide needle according to an embodiment of the present invention; wherein the step of determining the straight line data of the surgical guide needle based on the second straight line data set includes:

[0085] Step 1502: Obtain the data relationship between every two straight line data in the second straight line data set;

[0086] Step 1504: Determine a fourth straight line data set based on the data relationship;

[0087] Step 1506: Determine the straight line data of the surgical guide needle according to the fourth straight line data set.

[0088] In this embodiment, the step of determining the linear data for the surgical guide needle based on the second linear data set includes: Since the surgical guide needle has a certain width range, two linear data sets are obtained after the linear detection. Therefore, it is necessary to obtain a data relationship between each pair of linear data sets in the second linear data set. This data relationship may include angle data and radius variation data. Furthermore, based on the obtained data relationship, two linear data sets corresponding to the surgical guide needle are determined in the second linear data set, and these two pieces of linear data are combined to obtain a fourth linear data set. Finally, the final linear data for the surgical guide needle is determined using the fourth linear data set.

[0089] FIG16 shows a sixth flow chart of a method for identifying a surgical guide needle according to an embodiment of the present invention; wherein the step of determining a fourth straight line data set based on a data relationship includes:

[0090] Step 1602: Based on the fact that the angle data between the two straight line data satisfies the fourth threshold value and the radius deviation data satisfies the fifth threshold value, the straight line data is used as the second straight line data;

[0091] Step 1604: Combine the two second straight line data to obtain a fourth straight line data set.

[0092] In this embodiment, the step of determining the fourth straight line data set based on the data relationship includes: after obtaining the data relationship between two straight line data in the second straight line data set, if the data relationship between two straight line data meets the preset conditions, that is, the angle data meets the fourth threshold, and the radius deviation data meets the fifth threshold, then it means that these two straight line data are straight line data corresponding to the surgical guide needle, so the straight line data is used as the second straight line data, and the fourth straight line data set is obtained based on multiple second straight line data sets.

[0093] Exemplarily, the straight line data is screened by judging the angle of the straight line data and the intercept of the straight line data. When the difference between the angle and radius of two straight line data meets the threshold condition, it is considered that the two straight line data can be paired, that is, the two straight line data are the upper edge straight line data and the lower edge straight line data of the surgical guide needle. Furthermore, in the definition of the polar coordinate Hough transform, the radius and the polar angle may have negative values. When calculating the difference between the parameters of two straight lines, different situations need to be judged. Specifically, as shown in FIG17 , the positive and negative signs of the parameters of a straight line data are shown. As shown in FIG17 , there are three situations for the parameters of a straight line data. The first is ①, θ≥0, ρ≥0, that is, θ is greater than or equal to 0, ρ is greater than or equal to 0; the second is ②, θ<0, ρ≥0, that is, θ is less than 0, ρ is greater than or equal to 0; the third is ③, θ<0, ρ<0, that is, θ is less than 0, ρ is less than 0. As shown in FIG18 , the positive and negative signs of the parameters of two straight line data are shown. Since there are three situations for the parameters of a straight line data, there are six situations for the parameters of two straight line data, which are respectively That is, θ and ρ in the two straight line data are both greater than or equal to 0; That is, in the two straight line data, θ is less than 0 and ρ is greater than or equal to 0; That is, in the two straight line data, θ and ρ are both less than 0. and In the equation, θ and ρ have the same sign, so and Can be placed in the same coordinate system and use θ i ×θ j ≥0,ρ i ×ρ j ≥0 means, where i and j represent different straight line data. Furthermore, there is a case where one straight line data is ① and the other straight line data is ②, so it is recorded as In this case, since the θ in one of the two straight line data is greater than or equal to 0 and the ρ is greater than or equal to 0; the θ in the other straight line data is less than 0 and the ρ is greater than or equal to 0, In the equation, θ1×θ2<0, ρ1×ρ2≥0, and there are two cases: |θ|<45 and |θ|>45. In addition, there is a case where one straight line data is ① and the other straight line data is ③, so it is recorded as In this case, since the θ of one of the two straight line data is greater than or equal to 0, ρ is greater than or equal to 0; the θ of the other straight line data is less than 0, ρ is less than 0. Therefore, In the equation, θ1×θ3<0, ρ1×ρ3<0, and there are two cases: |θ|<45 and |θ|>45. In addition, there is a case where one straight line data is ② and the other straight line data is ③, so it is recorded as In this case, since the θ of one of the two straight line data is less than 0, ρ is greater than or equal to 0; the θ of the other straight line data is less than 0, ρ is less than 0. Therefore, θ2×θ3>0, ρ2×ρ3<0. Further, for FIG. 18 and In these four cases, the absolute value of the deviation can be directly calculated, that is, Δθ=abs(θ i -θ j ), Δρ=abs(ρ i -ρ j ); where Δθ and Δρ are the polar angle difference and radius deviation between the two straight line data, i and j are the index numbers of the straight line data, and abs is a function used to calculate the absolute value of a number. and The polar angle deviation Δθ, when the two lines are close to parallel, can only be around 0° or 90°. Due to the existence of negative values, different situations need to be considered:

[0094] For the and The radius deviation Δρ also needs to be considered in different situations because it has positive and negative values:

[0095] Finally, traverse all the straight line data, determine the relationship between the two, and calculate their formation Δθ and Δρ, as shown in Table 1 below (taking 5 straight lines as an example):

[0096] Table 1

[0097] Since straight lines can only be paired in pairs, it is impossible for the same straight line to be paired with different straight lines at the same time. Therefore, it is necessary to screen each row and column in the table. When more than one pairing appears, the pairing with smaller Δθ and Δρ is selected to be retained. Among them, the pairing with smaller Δθ is preferred to be retained, and the rest of the pairs are deleted.

[0098] FIG19 shows a seventh flow chart of a method for identifying a surgical guide needle according to an embodiment of the present invention; wherein the step of determining the straight line data of the surgical guide needle based on the fourth straight line data set includes:

[0099] Step 1902: Obtain two second straight line data in the fourth straight line data set;

[0100] Step 1904: Determine the straight line data of the surgical guide needle according to the average value of the two second straight line data.

[0101] In this embodiment, the step of determining the linear data of the surgical guide needle based on the fourth linear data set includes: obtaining two related second linear data from the fourth linear data set, wherein the related second linear data refers to the linear data corresponding to the surgical guide needle. Since the two second linear data are only the linear data of the upper and lower edges of the surgical guide needle, it is necessary to perform a calculation based on the two second linear data and calculate the average of the two second linear data to finally determine the linear data of the surgical guide needle. In other words, the linear data of the surgical guide needle is the linear data located midway between the linear data of the upper and lower edges of the surgical guide needle.

[0102] As shown in Figure 20, the final recognition result is shown in Figure 20. By using the pairwise linear equations, the average value of each point is taken as the final linear data.

[0103] That is, X = 1: image width, Y i =ρ i ÷sin(θ i )-X÷tan(θ i );

[0104] Y j =ρ j ÷sin(θ)-X÷tan(θ j );

[0105] Y=(Y i +Y j )÷2;

[0106] Among them, image Width represents the width of the image, (X, Y) is the coordinate of the final line data, and Y i and Y j is the guide needle boundary line, i.e., the upper edge line data and the lower edge line data, θ i and ρ i is the polar angle and radius of the line data i, θ j and ρ j is the polar angle and radius of the line data j.

[0107] For example, as shown in FIG21 , FIG21 shows a flowchart of the eighth embodiment of a surgical guide needle identification method of the present invention; first, an image with a surgical guide needle is input, and then Canny edge extraction is performed to obtain an edge image. Further, Hough transform is used to identify straight lines to obtain multiple straight line data, and then inaccurate straight line data is eliminated and similar straight line data is merged. After processing the multiple straight line data, Kirschner wire, i.e., surgical guide needle, is straight line matched to obtain the upper edge straight line data and the lower edge straight line data of the surgical guide needle. Then, the straight line data of the surgical guide needle is obtained based on the upper edge straight line data and the lower edge straight line data. Finally, the straight line data of the surgical guide needle is displayed on the image.

[0108] FIG22 shows a schematic block diagram of a surgical guide needle identification system according to an embodiment of the present invention; wherein the surgical guide needle identification system 220 includes:

[0109] An acquisition module 2202 is configured to acquire a first image with a surgical guide needle;

[0110] An extraction module 2204 is configured to perform edge extraction on the first image to obtain a second image;

[0111] A detection module 2206 is configured to perform line detection on the second image to obtain a first line data set;

[0112] A screening module 2208 is configured to screen the first line data set to obtain a second line data set;

[0113] The determination module 2210 is configured to determine the straight line data of the surgical guide needle according to the second straight line data set.

[0114] The present invention provides a surgical guide needle recognition system 220, wherein the surgical guide needle recognition system 220 specifically includes: an acquisition module 2202, an extraction module 2204, a detection module 2206, a screening module 2208, and a determination module 2210. First, the acquisition module 2202 acquires a first image containing a surgical guide needle, which may be a Kirschner wire. Then, the extraction module 2204 performs edge extraction on the first image to obtain a second image. The edge extraction method may be to use a Canny operator to extract the contour and edge information of the surgical guide needle in the first image, and then generate the second image based on this contour and edge information. Furthermore, detection module 2206 performs line detection on the second image to detect the surgical guide needle. This line detection method can utilize the Hough transform, a mature algorithm for line detection that converts image space into Hough space. A line in the image space corresponds to a point in Hough space. In other words, by performing line detection on the second image, lines in the second image are converted into line data, and this line data includes the position of the corresponding line in the image. Furthermore, because the second image contains not only the outline of the surgical guide needle but also the outline of the user's body, the first line data set obtained by performing line detection on the second image includes not only the line data for the surgical guide needle but also other line data. Therefore, screening module 2208 filters the first line data set to remove line data that is not for the surgical guide needle. After removing the other line data, a second line data set is obtained. Furthermore, determination module 2210 determines the final line data for the surgical guide needle based on the second line data set. Specifically, because the surgical guide needle has width, that is, two linear data sets will be included in the second linear data set, representing the upper and lower edge linear data of the same surgical guide needle. Therefore, the upper and lower edge linear data must be processed to obtain the final linear data for the surgical guide needle. The final position of the surgical guide needle after entering the human body is then determined based on the obtained linear data. The present invention processes images containing the surgical guide needle to determine the final position of the surgical guide needle after entering the human body, improving efficiency and accuracy compared to related technologies.

[0115] An embodiment of the third aspect of the present invention provides an electronic device; wherein the electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the steps of the surgical guide needle identification method as described in any one of the above items are implemented.

[0116] The electronic device provided by the present invention implements the steps of the above-mentioned surgical guide needle identification method when the processor executes the computer program, which can achieve the technical effects of any of the above-mentioned embodiments and will not be repeated here.

[0117] An embodiment of the fourth aspect of the present invention provides a storage medium having a computer program stored thereon, which implements the steps of any of the above-mentioned methods for identifying a surgical guide needle when the computer program is executed by a processor.

[0118] The storage medium provided by the present invention implements the steps of the above-mentioned surgical guide needle identification method when the computer program is executed by the processor, and can achieve the technical effects of any of the above-mentioned embodiments, which will not be repeated here.

[0119] A storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The storage medium can be, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the above. A non-exhaustive list of more specific examples of storage media includes: a portable computer floppy disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory card, a floppy disk, an encoding mechanical device (such as a punched card or a groove with a raised structure on which instructions are recorded), and any suitable combination of the above. The storage medium used herein should not be understood as a transmission signal itself, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium, or electrical signals transmitted through wires.

[0120] In the present invention, the terms "first," "second," and "third" are used for descriptive purposes only and should not be understood as indicating or implying relative importance; the term "plurality" refers to two or more, unless otherwise expressly defined. Terms such as "installed," "connected," "connected," and "fixed" should be understood in a broad sense. For example, "connected" can mean a fixed connection, a detachable connection, or an integral connection; "connected" can mean a direct connection or an indirect connection through an intermediary. Those skilled in the art can understand the specific meanings of the above terms in the present invention based on specific circumstances.

[0121] In the description of the present invention, it should be understood that the directions or positional relationships indicated by terms such as "up", "down", "left", "right", "front" and "back" are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or unit referred to must have a specific direction, be constructed and operated in a specific direction. Therefore, they should not be understood as limiting the present invention.

[0122] Throughout this specification, terms such as "one embodiment," "some embodiments," and "specific embodiments" mean that the specific features, structures, materials, or characteristics described in conjunction with that embodiment or example are included in at least one embodiment or example of the present invention. In this specification, schematic representations of these terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.

[0123] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention shall be included within the scope of protection of the present invention.

Claims

1. A method for identifying a surgical guide needle, characterized in that: include: acquiring a first image with a surgical guide needle; Performing edge extraction on the first image to obtain a second image; performing line detection on the second image to obtain a first line data set; Filtering the first straight line data set to obtain a second straight line data set; The straight line data of the surgical guide needle is determined according to the second straight line data set.

2. The method for identifying a surgical guide needle according to claim 1, wherein: The step of screening the first straight line data set to obtain the second straight line data set includes: Deleting inaccurate straight line data in the first straight line data set to obtain a third straight line data set; Similar straight line data in the third straight line data set are merged to obtain the second straight line data set.

3. The method for identifying a surgical guide needle according to claim 2, wherein: The step of deleting inaccurate straight line data in the first straight line data set to obtain a third straight line data set includes: Obtain all straight line data in the first straight line data set; Obtaining a first distance between a data point and an edge on each of the straight line data and a second distance between data points having consecutive edges; When the first distance is less than a first threshold and the second distance is less than a second threshold, the straight line data corresponding to the first distance and the second distance are deleted to obtain the third straight line data set.

4. The method for identifying a surgical guide needle according to claim 2, wherein: The step of merging similar straight line data in the third straight line data set to obtain the second straight line data set includes: Obtaining the proximity between a plurality of straight line data in the third straight line data set; Based on the proximity being less than a third threshold, determining a first straight line data closest to the edge among the plurality of straight line data; The second straight line data set is determined according to the first straight line data.

5. The method for identifying a surgical guide needle according to any one of claims 1 to 4, characterized in that: The step of determining the straight line data of the surgical guide needle according to the second straight line data set includes: Acquire a data relationship between every two straight line data in the second straight line data set; determining a fourth straight line data set according to the data relationship; The straight line data of the surgical guide needle is determined according to the fourth straight line data set.

6. The method for identifying a surgical guide needle according to claim 5, wherein: The step of determining a fourth straight line data set according to the data relationship includes: Based on the fact that the angle data between the two straight line data satisfies the fourth threshold value, and the radius deviation data satisfies the fifth threshold value, the straight line data is used as the second straight line data; The two pieces of the second straight line data are combined to obtain the fourth straight line data set.

7. The method for identifying a surgical guide needle according to claim 6, wherein: The step of determining the straight line data of the surgical guide needle according to the fourth straight line data set includes: Obtaining two pieces of the second straight line data in the fourth straight line data set; The straight line data of the surgical guide needle is determined according to the average value of the two second straight line data.

8. A surgical guide needle identification system, characterized in that: include: an acquisition module, the acquisition module being configured to acquire a first image with a surgical guide needle; an extraction module, configured to perform edge extraction on the first image to obtain a second image; a detection module, configured to perform straight line detection on the second image to obtain a first straight line data set; a screening module, the screening module being configured to screen the first line data set to obtain a second line data set; A determination module is used to determine the straight line data of the surgical guide needle according to the second straight line data set.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method for identifying a surgical guide needle according to any one of claims 1 to 7 are implemented.

10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for identifying a surgical guide needle according to any one of claims 1 to 7 are implemented.