Intelligent measurement method and system for medical sutures
By using two cameras to acquire images and combining the grayscale transformation relationship, the problem of low efficiency of line diameter and cutting position measurement during suture cutting process is solved, high-precision line diameter measurement and cutting position position positioning are achieved, and uniformity and length consistency of suture segments are improved.
Patent Information
- Application Number
- CN202510161155.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-13
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2045-02-13
AI Technical Summary
During the suture cutting process, it is difficult for the prior art to accurately measure the line diameter and position the cutting position of the suture at the same time, resulting in low measurement efficiency and insufficient detection of the line diameter uniformity.
Two cameras are used to collect the first image and the second image respectively, the line diameter of the suture is detected through the first image, and the cutting position is positioned using the second image. Through the grayscale transformation relationship between the grayscale transition region and the matching region, the first threshold value is transformed into a second threshold value, used to divide the suture region and position the cutting position, and update the first threshold value according to the uniformity of the line diameter.
It realizes that the line diameter and positioning cutting position are accurately obtained during the suture cutting process, improves the measurement and detection efficiency, ensures the uniformity and length consistency of the suture segments, and avoids the use of uneven and uneven suture segments.
Smart Images

Figure CN119624996B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of object measurement, and in particular to an intelligent measurement method and system for medical sutures. Background Art
[0002] Medical sutures are important consumables used in modern medicine for surgical wound suturing and tissue fixation. Their quality and processing accuracy are directly related to the surgical effect and the patient's recovery. The need to cut them into equal lengths and uniform diameters is one of the links that requires special attention when producing and processing medical sutures, because it directly affects the safety, reliability and ease of operation of the sutures in actual use. On the one hand, the diameter (thickness) of medical sutures needs to be uniform to avoid being too thin (easy to break) or too thick (difficult to puncture tissue). On the other hand, in order to facilitate the operation of surgeons, sutures are usually cut into single sections of specified lengths. In terms of length consistency, the error is required to be extremely small to ensure the convenience of operation and the consistency of the product.
[0003] During the cutting process of the suture thread, the measurement process of the cutting length (or cutting position) and the detection process of the wire diameter uniformity are generally carried out separately. The measurement and detection efficiency is low, and it is impossible to further control the wire diameter uniformity of the suture thread. Summary of the invention
[0004] In order to solve the above problems, the present invention provides an intelligent measurement method and system for medical sutures.
[0005] The intelligent measurement method and system of medical sutures of the present invention adopt the following technical solutions:
[0006] An embodiment of the present invention provides an intelligent measurement method for medical sutures, the method comprising the following steps:
[0007] During the suture cutting process, the diameter of the suture is detected using the first image captured by the first camera, and the cutting position is located using the second image captured by the second camera; the field of view of the first image is smaller than the field of view of the second image;
[0008] The wire diameter of the suture and the positioning cutting position are obtained by a preset first threshold, and the specific process is as follows:
[0009] The first image is segmented using a first threshold to obtain a line diameter, and a matching area in the second image that matches the grayscale change relationship of the grayscale transition area is obtained, where the grayscale transition area is a transition area between the stitching line and the background in the first image;
[0010] Based on the grayscale transformation relationship between the grayscale transition area and the matching area, the first threshold is transformed into a second threshold, the second threshold is used to segment the suture area in the second image and locate the cutting position, the line widths of several sampling positions are obtained in the suture area segmented by the second image, and the line diameter uniformity is obtained according to the line widths of the several positions;
[0011] The first threshold is updated according to the wire diameter uniformity, including:
[0012] A target threshold is obtained. For the suture area segmented by the target threshold on the second image, the line widths of several sampling positions in the suture area have the maximum target uniformity. According to the difference between the target threshold and the second threshold, the difference between the line diameter uniformity and the maximum value of the target uniformity, and the grayscale transformation relationship between the transition area and the transition matching area, the target threshold is transformed into grayscale to obtain an updated first threshold. When the suture is cut next time, the updated first threshold is used to obtain the line diameter of the suture and locate the cutting position.
[0013] Preferably, the step of transforming the first threshold into the second threshold based on the grayscale transformation relationship between the grayscale transition area and the matching area includes the following specific steps:
[0014] Preset a plurality of gamma coefficients, use each gamma coefficient to perform gamma transformation on the grayscale values of all pixels in the grayscale transition region to obtain a first transformation region of each gamma coefficient, and use each gamma coefficient to perform gamma transformation on the grayscale values of all pixels in the first image to obtain a second transformation region of each gamma coefficient;
[0015] Obtain the grayscale difference between the first transformation area and the matching area, recorded as the local transformation difference; obtain the grayscale difference between the second transformation area and the first image, recorded as the global transformation difference, and record the mean of the local transformation difference and the global transformation difference as the transformation error of each gamma coefficient;
[0016] A gamma coefficient with the smallest transformation error is obtained, recorded as a target gamma coefficient, and a gamma transformation is performed on the first threshold using the target gamma coefficient to obtain a second threshold.
[0017] Preferably, the grayscale transformation of the target threshold is performed according to the difference between the target threshold and the second threshold, the difference between the maximum value of the line diameter uniformity and the target uniformity, and the grayscale transformation relationship between the transition area and the transition matching area to obtain the updated first threshold, which includes the following specific steps:
[0018] The difference between the target threshold and the second threshold is recorded as the first difference, and the difference between the maximum value of the wire diameter uniformity and the target uniformity is recorded as the second difference;
[0019] Obtaining a transformation attention factor f according to the first difference and the second difference, wherein the transformation attention factor f and the target threshold are positively correlated with the first difference and the second difference respectively;
[0020] For several preset gamma coefficients, the local transformation difference of each gamma coefficient is recorded as Q1, and the global transformation difference is recorded as Q2. The corrected transformation error of each gamma coefficient is Q=Q1+f×Q2, and the gamma coefficient with the smallest corrected transformation error is recorded as the corrected target gamma coefficient. According to the corrected target gamma coefficient, the target threshold is subjected to an inverse gamma transformation to obtain an updated first threshold.
[0021] Preferably, the specific steps of obtaining the target threshold and the target uniformity are as follows:
[0022] The mean of the line widths at all sampling positions is recorded as the reference line width;
[0023] Preset a number of third thresholds, use each third threshold to segment the second image, record the obtained stitching line area as the reference area of each third threshold, record the absolute value of the difference between the line width of each sampling position in the reference area and the reference mean as the line width deviation amplitude of each third threshold at each sampling position, obtain the mean value of the line width deviation amplitude of each third threshold at all sampling positions, and record it as the target uniformity of each third threshold;
[0024] The third threshold with the largest target uniformity is recorded as the target threshold.
[0025] Preferably, the specific steps of obtaining the grayscale difference are as follows:
[0026] The first transformation area, the matching area, the second transformation area and the first image are all recorded as pixel sets, and all the pixels in each pixel set are smoothed; the grayscale histogram of all the pixels in each pixel set after smoothing is obtained, the similarity x1 of the grayscale histograms of any two pixel sets is obtained, the mean grayscale value of all the pixels in any pixel set after smoothing is obtained, the absolute value x2 of the difference between the mean grayscale values of any two pixel sets is obtained, x2×exp(-x1) is taken as the grayscale difference between any two pixel sets, and exp() represents an exponential function with a natural constant as the base.
[0027] Preferably, the step of obtaining a matching area in the second image that matches the grayscale change relationship of the grayscale transition area comprises the following specific steps:
[0028] For two parallel contour lines on the stitching line area in the first image, any pixel point on any contour line is recorded as a target pixel point, a straight line passing through the target pixel point and perpendicular to the contour line is obtained, and N1 pixel points closest to the target pixel point are obtained on the straight line, and the N1 pixel points are recorded as transition area pixel points of the target pixel point, and the grayscale sequence composed of the grayscale values of the transition area pixel points is recorded as the first sequence of the target pixel point, and the first sequences of all pixel points on each contour line are averaged, and the obtained average sequence is recorded as the grayscale transition sequence;
[0029] Any pixel point in the second image is recorded as a reference pixel point, the gradient direction of the reference pixel point is obtained, and the N2 pixel points closest to the reference pixel point are obtained on the straight line where the gradient direction is located, and the sequence composed of the grayscale values of the N2 pixel points is recorded as the second sequence of reference pixels;
[0030] Obtain the DTW distance d between the second sequence of any pixel point in the second image and the grayscale transition sequence, record exp(-d) as the matching similarity of any pixel point in the second image, cluster all the pixels of the second image using the matching similarity of all the pixels in the second image, and obtain the matching area;
[0031] exp() represents an exponential function with a natural constant as the base, and N1 and N2 are preset values.
[0032] Preferably, the method of clustering all the pixels of the second image by using the matching similarity of all the pixels in the second image to obtain the matching area includes the following specific steps:
[0033] Obtain the mean of the matching similarity between any two pixels, recorded as the average similarity y, record the product of the Euclidean distance between any two pixels and exp(-y) as the metric distance between any two pixels, perform mean shift clustering on all pixels of the second image based on the metric distance, and obtain all categories;
[0034] The stitching line in the first image corresponds to two contour lines, where the category obtained corresponding to one contour line is recorded as the first category, and the category obtained corresponding to the other contour line is recorded as the second category;
[0035] The symmetry of any first category and any second category is obtained, and the first category and the second category whose symmetry is greater than a preset symmetry threshold are retained, and the area formed by the retained first category and the second category is recorded as a matching area.
[0036] Preferably, the step of obtaining the symmetry of any first category and any second category includes the following specific steps:
[0037] KM matching is performed on the pixels in the first category and the second category so that the Euclidean distance of the matching pixels is minimized. For any pair of matching pixels, the absolute value of the difference in matching similarity of the pixel pairs is calculated and recorded as the symmetric difference of the pixel pairs. The mean of the symmetric differences of all pixel pairs is recorded as q, and exp(-q) is recorded as the symmetry between the first category and any second category.
[0038] Preferably, the suture cutting process includes a current cutting process and a previous cutting process;
[0039] The wire diameter obtained in the current cutting process is recorded as a1, and the wire diameter uniformity is recorded as b1. The wire diameter obtained in the previous cutting process is recorded as a2, and the wire diameter uniformity is recorded as b2.
[0040] When the average of b1 and b2 is less than or equal to the first preset threshold, but the absolute value of the difference between a1 and a2 is greater than the average of b1 and b2, the first threshold is updated;
[0041] When the average of b1 and b2 is greater than the first preset threshold, or the absolute value of the difference between a1 and a2 is not greater than the average of b1 and b2, the first threshold is not updated.
[0042] Another embodiment of the present invention provides an intelligent measurement system for medical sutures, the system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned intelligent measurement method for medical sutures when executing the computer program.
[0043] The beneficial effects of the technical solution of the present invention are:
[0044] The present invention segments the first image by a first threshold value, segments the second image by a second threshold value reached after the first threshold value is transformed, and finally updates the first threshold value according to the wire diameter uniformity obtained by the segmentation result of the second threshold value in the cutting process, and applies it to the next cutting process. On the one hand, the wire diameter can be obtained more accurately according to the details of the suture line in the first image, and at the same time, the wire diameter uniformity and the accurate cutting position can be obtained, ensuring that the cut suture line segments meet the use requirements, avoiding the use of uneven and uneven length suture line segments, and improving the measurement and detection efficiency; on the other hand, by updating the first threshold value and applying it to the next cutting process, the first threshold value and the obtained wire diameter uniformity can adapt to the cutting process in real time, avoiding the interference caused by changes in the cutting environment and changes in noise distribution, resulting in inaccurate acquisition of wire diameter, uniformity and cutting position. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 A flowchart of the steps of an intelligent measurement method for medical sutures provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0047] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the intelligent measurement method and system of a medical suture according to the present invention, its specific implementation, structure, features and effects, in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0048] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0049] The specific scheme of the intelligent measurement method and system for medical sutures provided by the present invention is described in detail below with reference to the accompanying drawings.
[0050] See also Figure 1 , which shows a flowchart of a method for intelligently measuring a medical suture provided by an embodiment of the present invention, the method comprising the following steps:
[0051] Step S001: During the seam cutting process, a first camera is used to capture a first image, and a second camera is used to capture a second image; the field of view of the first image is smaller than the field of view of the second image.
[0052] The purpose of cutting the suture thread in this embodiment is to cut the suture thread on the wire roll into suture thread segments of required length. This process is a continuous process, and a suture thread segment is obtained after each cutting. After multiple cuttings, the suture thread on the wire roll is cut into multiple suture thread segments. These suture thread segments are packaged and sealed for subsequent use or sale.
[0053] In order to ensure that the length of the cut suture segment is equal to the required length and that the suture segment has a suitable and uniform wire diameter, the accurate cutting position needs to be obtained during the cutting process, and the wire diameter of the suture needs to be detected in real time.
[0054] In this embodiment, two cameras are installed during cutting, namely, a first camera and a second camera. The first camera captures a first image, and the first image is used to obtain the wire diameter. The second camera captures a second image, and the second image is used to determine the cutting position of the suture. In this embodiment, a laser cutter is used to cut at the cutting position. Since the wire diameter of the suture is small, the first camera uses a telephoto lens and shoots the suture with a longer focal length, so that the local details of the suture can be displayed in the first image, so the first image has a smaller field of view; the second camera needs to shoot the suture with a shorter focal length, so that the suture in the second image has a certain length, so as to obtain the cutting position, so the second image has a larger field of view.
[0055] In this embodiment, the first image and the second image are both grayscale images. In addition, this embodiment does not limit the models of the first camera and the second camera.
[0056] Step S002: segment the first image using a first threshold and obtain the diameter of the suture line.
[0057] The first image includes both the stitching line and the background area, and the stitching line needs to be segmented from the background area.
[0058] As an example, methods for segmenting seam lines from background areas include:
[0059] The Gaussian filter algorithm is used to remove the Gaussian noise in the first image, and the size of the Gaussian filter kernel used is 5×5.
[0060] A first threshold is preset, and the first image is threshold segmented using the first threshold. In this embodiment, the area formed by the pixels whose grayscale values in the first image are greater than the first threshold is recorded as the stitching line area, and the area formed by the pixels whose grayscale values are less than or equal to the first threshold is recorded as the background area.
[0061] In this example, the first threshold is 110 as an example for description. In other embodiments, the first threshold may be set to other values, which are not specifically limited in this embodiment.
[0062] In some embodiments, when there is an object with a grayscale value similar to that of the stitching line in the background, or when there is noise interference, multiple stitching line regions are obtained. In this case, the region with the largest area is used as the stitching line region to be obtained.
[0063] As another example, a method of segmenting the seam line from the background area includes:
[0064] The Gaussian filter algorithm is used to remove the Gaussian noise in the first image, and the size of the Gaussian filter kernel used is 5×5.
[0065] A set of first thresholds is preset, and the first thresholds include a high threshold and a low threshold. All edges in the first image are obtained using a canny edge detection algorithm, and the double thresholds used by the canny edge detection algorithm are the high threshold and the low threshold.
[0066] Two edge lines that are parallel to each other and run through the first image are taken as edges of a stitching line, and a connected domain enclosed by the edges of the stitching line is taken as a stitching line region.
[0067] In this example, the first threshold includes a high threshold and a low threshold of 10 and 80 respectively. In other embodiments, the first threshold may be set to other values.
[0068] As an example, the method for obtaining the line diameter according to the suture area is:
[0069] On the two parallel contour lines of the stitching area (that is, the edge lines mentioned above), take a pixel point to form a pixel pair, obtain the distance between the pixel pairs in the direction perpendicular to the contour lines, and take the average of the distances of all pixel pairs on the two parallel contour lines in the direction perpendicular to the contour lines as the line diameter.
[0070] Step S003, obtaining a matching area in the second image that matches the grayscale change relationship of the grayscale transition area, transforming the first threshold into a second threshold based on the grayscale transformation relationship between the grayscale transition area and the matching area, and using the second threshold to segment the stitching line area in the second image.
[0071] Furthermore, the second image is segmented to obtain the suture area in the second image. The purpose of segmenting the second image is, on the one hand, to further obtain the cutting position of the suture according to the suture area obtained after segmentation; more importantly, on the other hand, it is considered that the first image with a smaller field of view only contains the local position of the suture, and the wire diameter obtained in step S002 can only represent the diameter of the suture at the local position. In order to more comprehensively and reliably detect the distribution of wire diameters at different positions on the suture, such as the uniformity of wire diameters at different positions, it is necessary to obtain the wire diameters at multiple positions of the suture. Since the second image has a larger field of view, the suture area segmented in the second image can contain the wire diameters at multiple positions of the suture.
[0072] Further consideration is that there is less detailed information about the suture line in the second image (for example, less detailed information about the edge), and it is seriously affected by noise or lighting environment. It is difficult to obtain the accurate suture line area by directly using the threshold segmentation algorithm or the edge detection algorithm (even after filtering), which not only leads to errors in the acquisition of the cutting position, but also causes errors in the detection results of the wire diameter uniformity.
[0073] In this embodiment, a matching area that matches the grayscale change relationship of the first image is obtained in the second image, and based on the grayscale change relationship between the first image and the transition matching area, the first threshold is transformed into a second threshold, and the second threshold is used to segment the seam line in the second image. This process uses the detailed information of the seam line contained in the first image to indirectly segment the second image, thereby improving the accuracy of the segmentation as much as possible.
[0074] As an example, obtaining a matching area in the second image that matches the grayscale change relationship of the first image includes the following method:
[0075] For the two parallel contour lines (or edge lines) of the stitching line area obtained in the first image, any pixel point on any contour line is recorded as the target pixel point, a straight line passing through the target pixel point and perpendicular to the contour line is obtained, and N1 other pixel points (including the target pixel point) closest to the target pixel point are obtained on the straight line, and the other pixel points are recorded as transition area pixel points of the target pixel point. The area formed by the transition area pixel points of all the pixels on the two parallel contour lines is recorded as the grayscale transition area.
[0076] The grayscale transition area is used as a template, and the second image is matched using a template matching algorithm, and several (for example, 5) matching areas with the largest matching coefficients are used as matching areas that match the grayscale change relationship to be obtained.
[0077] It should be noted that this method has certain problems: since the field of view of the second image and the first image are different, the edge information, width information, etc. of the stitching line in the second image and the first image are quite different, resulting in low accuracy of the matching area obtained in this example. Therefore, this example is only used as an optional example.
[0078] This embodiment is described by taking N1=11 as an example. In other embodiments, N1 may be set to other values, which are not specifically limited in this embodiment.
[0079] As a preferred example, obtaining a matching area in the second image that matches the grayscale change relationship of the first image includes the following method:
[0080] For the two parallel contour lines (or edge lines) on the stitching line area obtained in the first image, any pixel point on any contour line is recorded as the target pixel point, a straight line passing through the target pixel point and perpendicular to the contour line is obtained, and N1 other pixels (including the target pixel point) closest to the target pixel point are obtained on the straight line, and the other pixels are recorded as the transition area pixels of the target pixel point. The grayscale sequence composed of the grayscale values of these transition area pixels is recorded as the first sequence of the target pixel point, and the first sequence of all pixels on each contour line is averaged, and the obtained average sequence is recorded as the grayscale transition sequence. Among them, the area composed of the transition area pixels of all pixels on the two parallel contour lines is recorded as the grayscale transition area.
[0081] The grayscale transition sequence describes the grayscale change in the grayscale transition area between the stitching line area and the background area in the first image.
[0082] Any pixel in the second image is recorded as a reference pixel. The sobel operator is used to obtain the gradient direction of the reference pixel. The N2 other pixels (including the reference pixel) closest to the reference pixel are obtained on the straight line where the gradient direction lies. The sequence composed of the grayscale values of these pixels is recorded as the second sequence of reference pixels.
[0083] This embodiment is described by taking N2=7 as an example. In other embodiments, N2 may be set to other values, which are not specifically limited in this embodiment.
[0084] Obtain the DTW distance d between the second sequence of any pixel in the second image and the grayscale transition sequence, record exp(-d) as the matching similarity of any pixel in the second image, obtain the matching similarity of all pixels in the second image, and cluster all pixels in the second image using the matching similarity to obtain the matching area.
[0085] The DTW distance d is obtained by the DTW algorithm, which is a well-known technique and will not be described in detail in this embodiment. exp() represents an exponential function with a natural constant as the base.
[0086] As an example, all pixels of the second image are clustered using matching similarity to obtain matching areas, including the following methods:
[0087] The mean of the matching similarity between any two pixels is obtained, recorded as the average similarity y, and the product of the Euclidean distance between any two pixels and exp(-y) is recorded as the metric distance between any two pixels. All pixels of the second image are clustered by mean shift based on the metric distance to obtain all categories.
[0088] It should be noted that the stitching line in the first image corresponds to two contour lines, each contour line corresponds to a grayscale transition sequence, and all categories are obtained using the above method, where the category corresponding to one contour line is recorded as the first category, and the category corresponding to the other contour line is recorded as the second category.
[0089] The symmetry of any first category and any second category is obtained, and the first category and the second category whose symmetry is greater than a preset symmetry threshold are retained, and the area formed by the retained first category and the second category is recorded as a matching area.
[0090] In this embodiment, the symmetry threshold is 0.35. In other embodiments, the symmetry threshold may be set to other values, which are not specifically limited in this embodiment.
[0091] As an example, a method for obtaining the symmetry of any first category and any second category includes:
[0092] KM matching is performed on the pixels in the first category and the second category so that the Euclidean distance of the mutually matched pixels is minimized. For any pair of matched pixel pairs, the absolute value of the difference in matching similarity of the pixel pair is calculated and recorded as the symmetric difference of the pixel pair. The mean of the symmetric differences of all pixel pairs is recorded as q, and exp(-q) is recorded as the symmetry of the first category and any second category. The KM matching algorithm is a well-known technology and will not be described in detail in this embodiment.
[0093] As an example, based on the grayscale change relationship between the first image and the transition matching area, the first threshold is transformed into the second threshold, including the following method:
[0094] The matching area on the second image and the grayscale transition area on the first image are obtained above.
[0095] Several gamma coefficients are preset, and the gamma coefficients in this embodiment are respectively: 0.01, 0.05, 0.1, 0.15, ..., 3. In other embodiments, the gamma coefficient can be set to other values, which are not specifically limited in this embodiment.
[0096] Each gamma coefficient is used to perform gamma transformation on the grayscale values of all pixels in the grayscale transition area to obtain a first transformation area of each gamma coefficient, and each gamma coefficient is used to perform gamma transformation on the grayscale values of all pixels in the first image to obtain a second transformation area of each gamma coefficient.
[0097] The grayscale difference between the first transformation area and the matching area is obtained, which is recorded as the local transformation difference. The grayscale difference between the second transformation area and the first image is obtained, which is recorded as the global transformation difference. The mean of the local transformation difference and the global transformation difference is recorded as the transformation error of each gamma coefficient.
[0098] A gamma coefficient with the smallest transformation error is obtained, recorded as a target gamma coefficient, and a gamma transformation is performed on the first threshold using the target gamma coefficient to obtain a second threshold.
[0099] The second image is segmented using the second threshold to obtain a stitching line region in the second image.
[0100] The transformation error of each gamma coefficient in the above process is used to describe the error when adapting the stitching line with detail information in the first image to the stitching line with some detail information missing in the second image. The smaller the local transformation difference is, the more segmentation can be performed based on the same grayscale change as the first image when using the second threshold, avoiding the situation where the stitching line area of the first image and the second image is segmented based on different local grayscale changes, resulting in a situation where the stitching line area obtained on the first image and the second image has a more obvious difference. The smaller the overall difference, the more it means that the same grayscale change is not just local, but is based on the same grayscale change under the global illumination environment or global noise interference. Because the first image and the second image are collected under the same global illumination environment or global noise interference, the second threshold reached when the overall difference is the smallest is more accurate; on the contrary, the larger the overall difference, the more likely it is that the local accidental same grayscale change exists under the local illumination environment or global noise. This accidental same grayscale change is not caused by the global illumination environment or global noise interference, and cannot accurately describe the actual grayscale change of the first image and the second image collected under the same global illumination environment or global noise interference. Therefore, it is not suitable to obtain the second threshold using a gamma coefficient with a large overall difference.
[0101] It is a well-known technique to perform gamma transformation on grayscale values using gamma coefficients, which will not be described in detail in this embodiment.
[0102] In other embodiments, the gamma transformation technology described above can be replaced with a linear transformation technology, in which a linear function is used to transform the grayscale value mapping of a pixel point into other values. In other embodiments, grayscale transformation can be performed by presetting multiple different linear functions to obtain the transformation error of each linear function, and the linear function with the largest transformation error is used to perform a linear transformation on the first threshold to obtain the second threshold; in some other embodiments, multiple different linear functions can be replaced with multiple nonlinear functions (such as sigmoid functions). The method for obtaining the second threshold in other embodiments is the same as that in this embodiment, and the linear transformation technology is a well-known technology, which is not described in detail in this embodiment.
[0103] As an example, a method for obtaining a grayscale difference between the first transformed region and the matching region, and a grayscale difference between the second transformed region and the first image includes:
[0104] The first transformation area, the matching area, the second transformation area and the first image are all recorded as pixel sets, and all the pixels in each pixel set are smoothed. In this embodiment, the mean filter is used for smoothing, and the mean filter kernel size used is 7×7. Obtain the grayscale histogram of all the pixels in each pixel set after smoothing, obtain the similarity x1 of the grayscale histogram of any two pixel sets, obtain the grayscale value mean of all the pixels in any pixel set after smoothing, obtain the absolute value x2 of the difference between the grayscale value means of any two pixel sets, and use x2×exp(-x1) as the grayscale difference between any two pixel sets. The lower the similarity of the grayscale histogram of the pixel set and the greater the difference in the grayscale value mean, the greater the grayscale difference.
[0105] As an example, the similarity x1 of the grayscale histograms of any two pixel sets is equal to the cosine similarity of the two grayscale histograms.
[0106] Step S004: using the suture line area segmented from the second image to locate the cutting position and obtain the line diameter uniformity.
[0107] The long axis of the stitching line region is obtained by segmenting the stitching line region in the second image. One method of obtaining the long axis is to reduce the two-dimensional coordinates of all pixels in the stitching line region into one-dimensional coordinates using a PCA algorithm, and the line segments formed by these one-dimensional coordinates are used as the long axis.
[0108] A number of sampling positions (for example, 6 sampling positions) are set at equal intervals on the long axis, and the line width of each sampling position is obtained. The line width is equivalent to the line diameter obtained on the second image, but the line width obtained here is not used as the final line diameter of the suture line. The final line diameter of the suture line refers to the line diameter of the suture line obtained in step S002.
[0109] The standard deviation of the line width at all sampling positions is taken as the line diameter uniformity F0 of the suture line.
[0110] As an example, the method for obtaining the line width includes: obtaining a straight line passing through each sampling position and perpendicular to the long axis, and using the line segment length of the straight line in the stitching line area as the line width.
[0111] A cutting position is obtained on the long axis so that the length of the suture segment obtained after cutting at the cutting position is equal to the required length. For example, the required length in this embodiment is 10 cm. In other embodiments, the required length can be set to other values, which is not specifically limited in this embodiment.
[0112] In addition, in this embodiment, a laser cutter is used for cutting. In other embodiments, other cutting methods or cutting devices may be used. The specific cutting process is well known and will not be described in detail in this embodiment.
[0113] At this point, in the suture cutting process, the first and second images are segmented using the first threshold set in the first image, and the cutting position is obtained at the same time as the diameter of the suture in step S002, and the diameter uniformity at different positions on the suture is also obtained. When the diameter uniformity F0 is greater than the first preset threshold, it means that the diameter distribution of the suture segment obtained by cutting is uneven, and the suture segment is discarded at this time. If the diameter uniformity F0 is less than or equal to the first preset threshold, it is not discarded.
[0114] In this embodiment, the first preset threshold is 5 pixels. In other embodiments, the first preset threshold may be set to other values, which is not specifically limited in this embodiment.
[0115] In other embodiments, several suture segments are packaged and encapsulated, the average of the wire diameters of these suture segments is recorded as the reference wire diameter, the difference between the wire diameter of each suture segment and the reference wire diameter is recorded as the wire diameter error of each suture segment, the interval formed by the wire diameter errors of these suture segments is recorded as the wire diameter error interval, and the reference wire diameter and the wire diameter error interval are marked on the packaged packaging.
[0116] Step S005: update the first threshold value according to the uniformity of the wire diameter and by using the grayscale transformation relationship between the transition area and the transition matching area. The next time the suture line is cut, the updated first threshold value is used to obtain the wire diameter of the suture line and locate the cutting position.
[0117] During the suture cutting process, as the cutting process proceeds, the cutting environment at different times is different, such as different interference from ambient light and noise (such as noise caused by mechanical vibration, equipment heating, etc.). As a result, when cutting twice (or more times), in the first image, the first threshold set will have differences in the segmentation line area obtained after segmenting the first image, which in turn causes errors in the cutting position and wire diameter uniformity obtained in the second image, ultimately resulting in the length of the cut suture segment not meeting expectations and the inability to accurately screen out uneven sutures.
[0118] The wire diameter a1 and the wire diameter uniformity b1 obtained in the current cutting process, and the wire diameter a2 and the wire diameter uniformity b2 obtained in the previous cutting process are obtained.
[0119] When the average of b1 and b2 is less than or equal to the first preset threshold, but the absolute value of the difference between a1 and a2 is greater than the average of b1 and b2, it means that the change in the cutting process introduces interference (such as interference from changes in ambient light or interference from changes in global noise), resulting in errors in the wire diameter and wire diameter uniformity obtained in the cutting process. At this time, the first threshold is updated so that the process of obtaining the wire diameter and wire diameter uniformity can adapt to the cutting environment of the cutting process in real time. In the current cutting process, the wire diameter, wire diameter uniformity, and cutting position are re-obtained according to the updated first threshold using the method of steps S002 to S004. The next cutting process also obtains the wire diameter, wire diameter uniformity, and cutting position according to the updated first threshold.
[0120] When the average of b1 and b2 is greater than the first preset threshold, or the absolute value of the difference between a1 and a2 is not greater than the average of b1 and b2, it indicates that the wire diameter is uneven during the cutting process, or the interference introduced by the change in the cutting process does not increase the error of the wire diameter, and the first threshold is not updated at this time. In particular, it is not updated when there is no previous cutting process.
[0121] As an example, the first threshold is updated, including the following method:
[0122] The average value of the line widths of all sampling positions during the current cropping is recorded as the reference line width. Note that the method for obtaining the line widths of the sampling positions has been described in step S004.
[0123] A number of third thresholds are preset, and each third threshold is used to segment the second image. The obtained stitching line area is recorded as the reference area of each third threshold. The absolute value of the difference between the line width at each sampling position on the reference area and the reference mean is recorded as the line width deviation amplitude of each third threshold at each sampling position. The mean value of the line width deviation amplitude of each third threshold at all sampling positions is obtained and recorded as the target uniformity of each third threshold.
[0124] The several third thresholds of this embodiment are: T1×80%, T1×85%, T1×90%, ... T1×120%, where T1 represents the second threshold. In other embodiments, the third threshold may be set to other values, which is not specifically limited in this embodiment.
[0125] A third threshold value with the maximum target uniformity is obtained and recorded as the target threshold value. The suture line area segmented under the target threshold value has a more uniform diameter relative to the second threshold value.
[0126] The absolute value of the difference between the target threshold and the second threshold is obtained, and the ratio of the absolute value of the difference to the second threshold is recorded as F1. F1×|F-F0| / F0 is obtained and recorded as the transformation attention factor f, where F represents the maximum value of the target uniformity, and F0 represents the wire diameter uniformity obtained during the current cutting.
[0127] The larger the transformation attention factor is, the larger the second threshold with a larger error will be introduced in the second image segmentation process during the current cropping, and the more obvious error in line diameter uniformity will be brought. At this time, if the original first threshold is continued to be used to indirectly segment the second image, the obtained line diameter uniformity will have a larger error. The reason for this error is that when transforming the first threshold into the second threshold, too much attention is paid to the local same or similar grayscale change features. Such same or similar grayscale change features only appear accidentally in the global lighting environment or noise interference, or such same or similar grayscale change features cannot represent the grayscale change features of the global lighting environment or noise interference.
[0128] Preset a number of gamma coefficients (the same as the preset method in step S003), obtain the local transformation difference Q1 and the global transformation difference Q2 of each gamma coefficient (the acquisition method has been described in step S003), set the modified transformation error Q=Q1+f×Q2 of each gamma coefficient, and record the gamma coefficient with the smallest modified transformation error as the modified target gamma coefficient. Perform gamma inverse transformation on the target threshold according to the modified target gamma coefficient to obtain the updated first threshold, or make the updated first threshold equal to the target threshold after gamma transformation using the modified target gamma coefficient.
[0129] When the transformation attention factor f is large, the modified transformation error Q pays more attention to the global transformation difference Q2, reducing the error problem caused by the same or similar grayscale change features that occur accidentally.
[0130] So far, this embodiment segments the first image by setting the first threshold, segments the second image by the second threshold reached after the first threshold is transformed, and finally updates the first threshold according to the segmentation results of the second threshold of different cutting processes, and applies it to the next cutting process. On the one hand, it can obtain the wire diameter more accurately according to the details of the suture line in the first image, and at the same time, it can obtain the uniformity of the wire diameter and the accurate cutting position, ensuring that the cut suture line segments meet the use requirements and avoiding the use of uneven and uneven length suture line segments; on the other hand, by updating the first threshold and applying it to the next cutting process, the first threshold can adapt to the cutting process in real time, avoiding the interference caused by changes in the cutting environment and changes in noise distribution, resulting in inaccurate acquisition of wire diameter, uniformity and cutting position.
[0131] In another embodiment of the present invention, an intelligent measurement system for medical sutures is provided, the system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the methods in steps S001 to S005 above when executing the computer program.
[0132] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An intelligent measurement method for medical sutures, characterized in that: The method comprises the following steps: During the suture cutting process, the diameter of the suture is detected using the first image captured by the first camera, and the cutting position is located using the second image captured by the second camera; the field of view of the first image is smaller than the field of view of the second image; The wire diameter of the suture and the positioning cutting position are obtained by a preset first threshold, and the specific process is as follows: The first image is segmented using a first threshold to obtain a line diameter, and a matching area in the second image that matches the grayscale change relationship of the grayscale transition area is obtained, where the grayscale transition area is a transition area between the stitching line and the background in the first image; Based on the grayscale transformation relationship between the grayscale transition area and the matching area, the first threshold is transformed into a second threshold, the second threshold is used to segment the suture area in the second image and locate the cutting position, the line widths of several sampling positions are obtained in the suture area segmented by the second image, and the line diameter uniformity is obtained according to the line widths of the several positions; The first threshold is updated according to the wire diameter uniformity, including: A target threshold is obtained. For the suture area segmented by the target threshold on the second image, the line widths of several sampling positions in the suture area have the maximum target uniformity. According to the difference between the target threshold and the second threshold, the difference between the line diameter uniformity and the maximum value of the target uniformity, and the grayscale transformation relationship between the transition area and the transition matching area, the target threshold is transformed into grayscale to obtain an updated first threshold. When the suture is cut next time, the updated first threshold is used to obtain the line diameter of the suture and locate the cutting position.
2. The intelligent measurement method for medical suture according to claim 1, characterized in that: The step of transforming the first threshold into the second threshold based on the grayscale transformation relationship between the grayscale transition area and the matching area includes the following specific steps: Preset a plurality of gamma coefficients, use each gamma coefficient to perform gamma transformation on the grayscale values of all pixels in the grayscale transition region to obtain a first transformation region of each gamma coefficient, and use each gamma coefficient to perform gamma transformation on the grayscale values of all pixels in the first image to obtain a second transformation region of each gamma coefficient; Obtain the grayscale difference between the first transformation area and the matching area, recorded as the local transformation difference; obtain the grayscale difference between the second transformation area and the first image, recorded as the global transformation difference, and record the mean of the local transformation difference and the global transformation difference as the transformation error of each gamma coefficient; A gamma coefficient with the smallest transformation error is obtained, recorded as a target gamma coefficient, and a gamma transformation is performed on the first threshold using the target gamma coefficient to obtain a second threshold.
3. The intelligent measurement method for medical suture according to claim 2, characterized in that: According to the difference between the target threshold and the second threshold, the difference between the maximum value of the line diameter uniformity and the target uniformity, and the grayscale transformation relationship between the transition area and the transition matching area, the target threshold is grayscale transformed to obtain the updated first threshold, and the specific steps include the following: The difference between the target threshold and the second threshold is recorded as the first difference, and the difference between the maximum value of the wire diameter uniformity and the target uniformity is recorded as the second difference; Obtaining a transformation attention factor f according to the first difference and the second difference, wherein the transformation attention factor f and the target threshold are positively correlated with the first difference and the second difference respectively; For several preset gamma coefficients, the local transformation difference of each gamma coefficient is recorded as Q1, and the global transformation difference is recorded as Q2. The corrected transformation error of each gamma coefficient is Q=Q1+f×Q2, and the gamma coefficient with the smallest corrected transformation error is recorded as the corrected target gamma coefficient. According to the corrected target gamma coefficient, the target threshold is subjected to an inverse gamma transformation to obtain an updated first threshold.
4. The intelligent measurement method for medical suture according to claim 1 or 3, characterized in that: The specific steps for obtaining the target threshold and the target uniformity are as follows: The mean of the line widths at all sampling positions is recorded as the reference line width; Preset a number of third thresholds, use each third threshold to segment the second image, record the obtained stitching line area as the reference area of each third threshold, record the absolute value of the difference between the line width of each sampling position in the reference area and the reference mean as the line width deviation amplitude of each third threshold at each sampling position, obtain the mean value of the line width deviation amplitude of each third threshold at all sampling positions, and record it as the target uniformity of each third threshold; The third threshold with the largest target uniformity is recorded as the target threshold.
5. The intelligent measurement method for medical suture according to claim 2, characterized in that: The specific steps of obtaining the grayscale difference are as follows: The first transformation area, the matching area, the second transformation area and the first image are all recorded as pixel sets, and all the pixels in each pixel set are smoothed; the grayscale histogram of all the pixels in each pixel set after smoothing is obtained, the similarity x1 of the grayscale histograms of any two pixel sets is obtained, the mean grayscale value of all the pixels in any pixel set after smoothing is obtained, the absolute value x2 of the difference between the mean grayscale values of any two pixel sets is obtained, x2×exp(-x1) is taken as the grayscale difference between any two pixel sets, and exp() represents an exponential function with a natural constant as the base.
6. The intelligent measurement method for medical suture according to claim 1, characterized in that: The step of obtaining a matching area in the second image that matches the grayscale change relationship of the grayscale transition area includes the following specific steps: For two parallel contour lines on the stitching line area in the first image, any pixel point on any contour line is recorded as a target pixel point, a straight line passing through the target pixel point and perpendicular to the contour line is obtained, and N1 pixel points closest to the target pixel point are obtained on the straight line, and the N1 pixel points are recorded as transition area pixel points of the target pixel point, and the grayscale sequence composed of the grayscale values of the transition area pixel points is recorded as the first sequence of the target pixel point, and the first sequences of all pixel points on each contour line are averaged, and the obtained average sequence is recorded as the grayscale transition sequence; Any pixel point in the second image is recorded as a reference pixel point, the gradient direction of the reference pixel point is obtained, and the N2 pixel points closest to the reference pixel point are obtained on the straight line where the gradient direction is located, and the sequence composed of the grayscale values of the N2 pixel points is recorded as the second sequence of reference pixels; Obtain the DTW distance d between the second sequence of any pixel point in the second image and the grayscale transition sequence, record exp(-d) as the matching similarity of any pixel point in the second image, cluster all the pixels of the second image using the matching similarity of all the pixels in the second image, and obtain the matching area; exp() represents an exponential function with a natural constant as the base, and N1 and N2 are preset values.
7. The intelligent measurement method for medical suture according to claim 6, characterized in that: The method of clustering all the pixels of the second image by using the matching similarity of all the pixels in the second image to obtain the matching area includes the following specific steps: Obtain the mean of the matching similarity between any two pixels, recorded as the average similarity y, record the product of the Euclidean distance between any two pixels and exp(-y) as the metric distance between any two pixels, perform mean shift clustering on all pixels of the second image based on the metric distance, and obtain all categories; The stitching line in the first image corresponds to two contour lines, where the category obtained corresponding to one contour line is recorded as the first category, and the category obtained corresponding to the other contour line is recorded as the second category; The symmetry of any first category and any second category is obtained, and the first category and the second category whose symmetry is greater than a preset symmetry threshold are retained, and the area formed by the retained first category and the second category is recorded as a matching area.
8. The intelligent measurement method for medical suture according to claim 7, characterized in that: The specific steps of obtaining the symmetry of any first category and any second category are as follows: KM matching is performed on the pixels in the first category and the second category so that the Euclidean distance of the matching pixels is minimized. For any pair of matching pixels, the absolute value of the difference in matching similarity of the pixel pairs is calculated and recorded as the symmetric difference of the pixel pairs. The mean of the symmetric differences of all pixel pairs is recorded as q, and exp(-q) is recorded as the symmetry between the first category and any second category.
9. The intelligent measurement method for medical suture according to claim 1, characterized in that: The suture cutting process includes a current cutting process and a previous cutting process; The wire diameter obtained in the current cutting process is recorded as a1, and the wire diameter uniformity is recorded as b1. The wire diameter obtained in the previous cutting process is recorded as a2, and the wire diameter uniformity is recorded as b2. When the average of b1 and b2 is less than or equal to the first preset threshold, but the absolute value of the difference between a1 and a2 is greater than the average of b1 and b2, the first threshold is updated; When the average of b1 and b2 is greater than the first preset threshold, or the absolute value of the difference between a1 and a2 is not greater than the average of b1 and b2, the first threshold is not updated.
10. An intelligent measurement system for medical sutures, the system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the intelligent measurement method for medical sutures as described in any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Suture line real-time regulating method based on target block detection
CN103489154A
Video stitching method based on dynamic optimal stitching line
CN107203970A