A postoperative image needle path extraction method
By combining multi-threshold segmentation and morphological closing operations with least squares method to fit straight lines, the problem of high-precision extraction of puncture needles in postoperative images was solved, and the accuracy of surgical outcome evaluation was improved.
Patent Information
- Application Number
- CN202210907854.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-29
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2042-07-29
AI Technical Summary
There is currently no reliable and highly accurate method for extracting puncture needles from postoperative images, especially in puncture biopsies and ablation procedures for deformed organs such as the lungs, where needle displacement makes it difficult to guarantee the success rate of the procedure.
The target segmentation threshold is calculated using a multi-threshold segmentation method. A straight line is fitted using morphological closing operation and least squares method. Combined with outlier detection and removal, needle tracks in postoperative images are accurately extracted.
It achieves high-precision and reliable needle tract extraction, eliminates errors such as metal artifacts, and improves the accuracy of surgical outcome evaluation.
Smart Images

Figure CN115239751B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method for extracting needle tracks from postoperative images. Background Technology
[0002] Medical surgical navigation robots make full use of patients' medical imaging information to provide doctors with more three-dimensional navigation. They have the advantages of precise angle positioning, high operational accuracy, good repeatability and high stability, and can achieve more precise minimally invasive surgery, thereby reducing patient wounds and accelerating patient recovery. Therefore, they are being used more and more widely in clinical practice.
[0003] In procedures such as puncture biopsies and ablation of organs like the lungs, which deform and move with respiration, the displacement of lesions within the organ can reach up to 5 cm due to the patient's continuous breathing, making it difficult to guarantee a 100% success rate. To improve the success rate, it is necessary to extract the needle tract post-surgery to assess the accuracy of the actual clinical outcome. The accuracy of needle extraction in post-operative images is crucial to the calculation of the accuracy of the clinical outcome, but currently, there is no reliable and highly accurate method for extracting the needle from post-operative images. Summary of the Invention
[0004] Purpose of the invention: To address the above-mentioned shortcomings, this invention provides a postoperative image needle track extraction method that can extract postoperative image needle tracks with high precision and reliability.
[0005] Technical solution:
[0006] A method for extracting needle tracks from postoperative images, comprising the following steps:
[0007] (1) Calculate the target segmentation threshold of the needle path in the postoperative image, and segment the postoperative image accordingly to obtain the suspected needle path region image.
[0008] (2) Based on the physical coordinates of each voxel point in the suspected needle path area image, a spatial fitting line is obtained by straight line fitting;
[0009] (3) Anomalies are detected and removed based on the distance between each voxel in the suspected needle path area image and the fitted spatial line.
[0010] (4) Update the suspected needle track area image and repeat steps (2) to (3) until all abnormal points are removed to obtain the final needle track area image.
[0011] The voxel values of each voxel point in the postoperative image are converted into Hu values, and the target segmentation threshold is calculated based on the Hu values of each voxel point.
[0012] The specific calculation of the target segmentation threshold for needle tracks in postoperative images is as follows:
[0013] Multiple segmentation thresholds are set to form a segmentation threshold group. The inter-class variance corresponding to the segmentation threshold group is calculated using the LM algorithm. The iteration step size is set according to the calculated inter-class variance, and the segmentation thresholds in the segmentation threshold group are adjusted. This process is repeated until the iteration termination condition is reached. The segmentation threshold group corresponding to the maximum inter-class variance is selected as the target segmentation threshold group, and the largest segmentation threshold in the target segmentation threshold group is selected as the target segmentation threshold.
[0014] The inter-class variance σp 2 The calculation is as follows:
[0015]
[0016]
[0017]
[0018]
[0019] Among them, c k p is the k-th segmentation threshold set, where k = 1, ..., m, and m is the number of segmentation thresholds set by the user; t This represents the frequency of the frequency histogram corresponding to the Hu value t in the frequency histogram constructed based on the Hu values of each voxel point in the postoperative images, where ω is the frequency. k This indicates that the Hu value t is within the threshold range (c k ,c k+1 The probability within ) μ k This indicates that the Hu value t is within the threshold range (c k ,c k+1 Mean Hu value within ) μ T This represents the mean Hu value for all voxel points.
[0020] The iteration termination condition is when the number of iterations reaches 100 or the infinity norm of the iteration step size is less than 1e. -6 .
[0021] The images obtained by segmenting the postoperative images to obtain the suspected needle tract area are as follows:
[0022] The postoperative image is binarized using the target segmentation threshold. Morphological closing operations are then performed on the processed postoperative image to connect isolated regions and obtain connected regions. The major and minor axes of each connected region are calculated to obtain the aspect ratio of each connected region. The connected region with the largest aspect ratio is retained as the suspected needle tract region image.
[0023] The specific steps for obtaining the spatial fitted line are as follows:
[0024] The physical coordinates of each voxel point in the suspected needle path region image are fitted using the least squares method to obtain the spatial fitting line, as shown in the following formula;
[0025] x = a1*z + b1
[0026] y = a² * z + b²
[0027] The coefficients a1, a2, b1, and b2 are obtained as follows:
[0028]
[0029]
[0030]
[0031]
[0032] Among them, (x i ,yi,z i ) T The denot represents the physical coordinates of each voxel point in the suspected acupuncture tract region image, where i represents the i-th voxel point in the suspected acupuncture tract region image, and n represents the number of voxel points in the suspected acupuncture tract region image.
[0033] The specific steps for anomaly detection and removal are as follows:
[0034] Calculate the distance d between the j-th voxel in the suspected needle path region image and the fitted spatial line. j The calculation formula is as follows:
[0035]
[0036] Among them, D j P is the j-th voxel in the suspected needle path region image. j The magnitude of the distance vector to the fitted line in space is calculated as follows:
[0037]
[0038] In the formula, A and B are any two points on the fitted line in space;
[0039] D represents j The mean, h gg Let H be the diagonal elements of matrix H, which is as follows:
[0040] H=D j *(D j T D j ) -1 *Dj T
[0041] like Then determine the j-th voxel point P j These are abnormal coordinate points; remove them.
[0042] Where fac is the adjustment factor. This represents the average distance between all voxel points in the suspected needle path region image and the fitted spatial straight line.
[0043] The process also includes the following steps: traversing the point-to-point distances of all voxel points in the final needle path region image obtained from the calculation, selecting the point pair with the farthest distance, and substituting the physical coordinates of the point pair into the latest fitted straight line to obtain the two endpoints of the needle path.
[0044] Beneficial effects: The present invention uses multi-threshold segmentation to obtain images of suspected needle tract areas for needle tract extraction in postoperative images. Then, abnormal points are detected and removed by fitting a spatial straight line to eliminate errors caused by metal artifacts in the images. The extracted needle tracts are highly accurate and reliable. Attached Figure Description
[0045] Figure 1 This is a flowchart of the postoperative image needle tract extraction method of the present invention;
[0046] Figure 2 This is a schematic diagram of the postoperative image;
[0047] Figure 3 A schematic diagram of the suspected needle track region image obtained through segmentation;
[0048] Figure 4 The image before binarization of the suspected needle track region;
[0049] Figure 5 This is the image after binarization of the suspected needle track area. Detailed Implementation
[0050] The present invention will be further explained below with reference to the accompanying drawings and specific embodiments.
[0051] like Figure 1 As shown, the postoperative image needle tract extraction method of the present invention includes the following steps:
[0052] (1) Calculate the target segmentation threshold of the needle path in the postoperative image;
[0053] like Figure 2As shown, postoperative lung images contain numerous tissues and implants, and a single threshold segmentation algorithm cannot accurately extract the threshold corresponding to the needle path. Therefore, this invention uses the OTSU algorithm to calculate the segmentation threshold, i.e., setting multiple segmentation thresholds to form a segmentation threshold group, four are recommended. The LM algorithm is used to calculate the inter-class variance σp corresponding to the segmentation threshold group. 2 Based on the calculated inter-class variance, set the iteration step size and adjust the thresholds in the current segmentation threshold group. Repeat the above steps until the number of iterations reaches 100 or the infinity norm of the iteration step size is less than the first threshold 1e. -6 The iteration stops when the inter-class variance reaches its maximum value. The segmentation threshold group corresponding to this maximum value is selected as the target segmentation threshold group. Then, the largest segmentation threshold in this target segmentation threshold group is selected as the target threshold, as follows:
[0054] σp 2 The calculation is as follows:
[0055]
[0056]
[0057]
[0058]
[0059] Among them, c k The k-th segmentation threshold is set, where k = 1, ..., m, and m is the number of segmentation thresholds in each segmentation threshold group set by the user; p t ω represents the frequency in the frequency histogram corresponding to the Hu value t. k This indicates that the Hu value t is within the threshold range (c k ,c k+1 The probability within ) μ k This indicates that the Hu value t is within the threshold range (c k ,c k+1 Mean Hu value within ) μ T This represents the mean Hu value of all voxel points;
[0060] (2) The image is binarized and the suspected needle track region image is extracted;
[0061] The image is segmented and binarized based on the target segmentation threshold obtained in step (1). Figure 3 The image shows the segmented suspected needle track region. Figure 4 , 5 These are the images before and after binarization.
[0062] The puncture needle is long and thin. After binarization, the needle path appears discontinuous in the image, that is, spatially fragmented. Therefore, morphological closing operation is performed on the image after binarization to connect the isolated parts of the image into a whole. The morphological closing operation of this invention uses a circular convolution kernel with a kernel size of 5.
[0063] Connectivity analysis is performed on each connected region after morphological closing operations to identify suspected needle tract regions. Specifically, external markers such as bones and tracers exist in lung images, creating foreground regions that can cause interference. Therefore, each connected region after morphological closing operations is labeled, and the major and minor axes of each region are calculated to obtain the aspect ratio. The connected region with the largest aspect ratio is retained as the suspected needle tract region image, and the physical space coordinate set of the suspected needle tract region image is output. Where (x) i ,yi,z i ) T The physical coordinates of each voxel point in the suspected acupuncture point region image are represented by i, where i represents the i-th voxel point in the suspected acupuncture point region image, and n represents the number of voxel points in the suspected acupuncture point region image.
[0064] (3) Perform spatial line fitting on each voxel point in the suspected needle path region image;
[0065] The set of coordinate points in the image of the suspected needle path region A robust regression least squares method is used to fit the spatial fitting line L, as shown in the following formula;
[0066] x = a1*z + b1
[0067] y = a² * z + b²
[0068] The coefficients a1, a2, b1, and b2 are obtained as follows:
[0069]
[0070]
[0071]
[0072]
[0073] (4) Abnormal coordinate point detection and removal;
[0074] The presence of metal artifacts, high-density attachments, and other connected objects near the needle path may cause the fitted spatial line to deviate from the actual needle path main axis. Therefore, it is necessary to traverse and detect whether there are abnormal coordinate points in all spatial coordinate points of the suspected needle path area image and remove the abnormal coordinate points before performing step (3) again to fit the spatial line until the final set of physical spatial coordinate points of the needle path area image is obtained.
[0075] The specific steps for detecting abnormal coordinate points are as follows:
[0076] Calculate the set of spatial coordinate points in the image of the suspected needle path region. The distance d between the j-th point in the figure and the fitted spatial line obtained by fitting. j Calculate using the following formula:
[0077]
[0078] Among them, D j For point j P j The magnitude of the distance vector to the spatially fitted line L is calculated as follows:
[0079]
[0080] In the formula, A and B are any two points on the fitted line in space;
[0081] D represents j The mean, h gg Let H be the diagonal elements of matrix H, which is as follows:
[0082]
[0083] like Then point j is an abnormal coordinate point, which is removed. The physical space coordinate point set of the suspected needle path area image is updated and returned to step (3) to obtain the latest spatial fitting line and continue to execute step (4). Otherwise, no removal is performed. Repeat this step until all abnormal points are removed to obtain the final physical space coordinate point set of the needle path area image.
[0084] Where fac is the adjustment factor, which is set to 3 in this invention; The set of spatial coordinate points in the suspected needle path region image The average distance between all points in the fitted spatial line;
[0085] (5) Calculate the two ends of the needle path;
[0086] By traversing all point pairs in the final needle path region image, the farthest point pair is obtained. The physical coordinates of this point pair are then substituted into the latest spatial fitting line to obtain the two endpoints of the needle path.
[0087] This invention extracts needle tracks from postoperative images through two parts: image recognition of suspected needle track regions and analysis of image point sets of suspected needle track regions. The first part obtains the coordinate point set of the suspected needle track region image through coarse recognition. Then, it eliminates errors caused by metal artifacts in the image by performing spatial straight line fitting of the suspected needle track point set, abnormal point coordinate detection, and removal. The latest fitted straight line is output and substituted into the physical coordinates of the farthest point pair in the final needle track region to calculate the two endpoints of the needle track. The extracted needle tracks are highly accurate and reliable.
[0088] The preferred embodiments of the present invention have been described in detail above. However, the present invention is not limited to the specific details in the above embodiments. Within the scope of the technical concept of the present invention, various equivalent transformations can be made to the technical solutions of the present invention, and these equivalent transformations all fall within the protection scope of the present invention.
Claims
1. A method for extracting needle tracks from postoperative images, characterized in that: Including the following steps: (1) Calculate the target segmentation threshold of the needle path in the postoperative image, use the target segmentation threshold to perform binarization processing on the postoperative image, perform morphological closing operation processing on the processed postoperative image to connect each isolated region to obtain each connected region, calculate the major axis and minor axis of each connected region, thereby obtaining the aspect ratio of each connected region, and retain the connected region corresponding to the largest aspect ratio as the suspected needle path region image. (2) Based on the physical coordinates of each voxel point in the suspected needle path area image, a spatial fitting line is obtained by straight line fitting; (3) Calculate the distance between each voxel point in the suspected needle path region image and the fitted spatial line obtained by fitting; If the distance is greater than If the corresponding voxel point is considered an abnormal coordinate point, it is removed, and the process proceeds to step (4); where fac is an adjustment factor. The average distance between all voxel points in the suspected needle path region image and the spatial fitting line obtained in step (2); (4) Update the suspected needle track area image and repeat steps (2) to (3) until all abnormal points are removed to obtain the final needle track area image.
2. The method for extracting needle tracts from postoperative images according to claim 1, characterized in that: The voxel values of each voxel point in the postoperative image are converted into Hu values, and the target segmentation threshold is calculated based on the Hu values of each voxel point.
3. The method for extracting needle tracts from postoperative images according to claim 2, characterized in that: The specific calculation of the target segmentation threshold for needle tracks in postoperative images is as follows: Multiple segmentation thresholds are set to form a segmentation threshold group. The inter-class variance corresponding to the segmentation threshold group is calculated. The iteration step size is set according to the calculated inter-class variance, and the segmentation thresholds in the segmentation threshold group are adjusted. This process is repeated until the iteration termination condition is reached. The segmentation threshold group corresponding to the maximum inter-class variance is selected as the target segmentation threshold group. The largest segmentation threshold in the target segmentation threshold group is selected as the target segmentation threshold.
4. The method for extracting needle tracts from postoperative images according to claim 3, characterized in that: The inter-class variance The calculation is as follows: ; ; ; ; in, The kth segmentation threshold is set, where k = 1, ..., m, and m is the number of segmentation thresholds set by the user. This represents the frequency of the frequency histogram corresponding to the Hu value t in the frequency histogram constructed based on the Hu values of each voxel point in the postoperative images. This indicates that the Hu value t is within the threshold range ( , The probability within ) This indicates that the Hu value t is within the threshold range ( , The mean of Hu values within ) This represents the mean Hu value for all voxel points.
5. The method for extracting needle tracts from postoperative images according to claim 3, characterized in that: The iteration termination condition is when the number of iterations reaches 100 or the infinity norm of the iteration step size is less than 1e. -6 .
6. The method for extracting needle tracts from postoperative images according to claim 1, characterized in that: The specific steps for obtaining the spatial fitted line are as follows: The physical coordinates of each voxel point in the suspected needle path region image are fitted using the least squares method to obtain the spatial fitting line, as shown in the following formula; ; ; Among them, coefficient , , and We obtain the following formula: ; ; ; ; in, The denot represents the physical coordinates of each voxel point in the suspected acupuncture tract region image, where i represents the i-th voxel point in the suspected acupuncture tract region image, and n represents the number of voxel points in the suspected acupuncture tract region image.
7. The method for extracting needle tracts from postoperative images according to claim 1, characterized in that: The specific steps for anomaly detection and removal are as follows: Calculate the distance between the j-th voxel in the suspected needle path region image and the fitted spatial line. The calculation formula is as follows: ; Where n represents the number of voxel points in the suspected needle path region image; The j-th voxel in the suspected needle path region image The magnitude of the distance vector to the fitted line in space is calculated as follows: ; In the formula, A and B are any two points on the fitted line in space; express The mean, Let H be the diagonal elements of matrix H, which is as follows: ; like Then determine the j-th voxel. These are abnormal coordinate points; remove them. Where fac is the adjustment factor. This represents the average distance between all voxel points in the suspected needle path region image and the fitted spatial straight line.
8. The method for extracting needle tracts from postoperative images according to claim 1, characterized in that: The process also includes the following steps: traversing the point-to-point distances of all voxel points in the final needle path region image obtained from the calculation, selecting the point pair with the farthest distance, and substituting the physical coordinates of the point pair into the latest fitted straight line to obtain the two endpoints of the needle path.
Citation Information
Patent Citations
Vector transcranial magnetic stimulation method on basis of trend of nerve fibers
CN104740781A