Center line generation method and system
Patent Information
- Application Number
- CN202410693745.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-09-24
AI Technical Summary
[0005]本发明的目的在于克服上述技术不足,提供一种中心线生成方法及系统,以解决相关技术中髓腔中心线提取准确度不高的技术问题
[0032] The centerline generation method of the present invention uses preoperative CT data to interactively, semi-automatically, quickly and accurately extract the centerline of the medullary cavity area through the RANSAC method. The entire extraction process is completed within 3 seconds. The extraction efficiency is high, the extraction accuracy is accurate, and it is helpful to Consult with your doctor for preoperative planning.
Smart Images

Figure CN118691664A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of medical image processing, and in particular to a centerline generation method and system. Background Art
[0002] Currently, the extraction of the medullary cavity centerline in clinical practice is mainly done manually by doctors, who visually observe the medullary cavity center, and the accuracy is not high.
[0003] The centerline generation method based on deep learning in the existing technology has a slow processing speed and is data-dependent. It is not a general algorithm and has low adaptability. At the same time, errors are prone to occur during center fitting.
[0004] Therefore, the prior art needs to be further developed. Summary of the invention
[0005] The purpose of the present invention is to overcome the above technical deficiencies and provide a centerline generation method and system to solve the technical problem of low accuracy in extracting the centerline of the medullary cavity in the related art.
[0006] In order to achieve the above technical objectives, the present invention adopts the following technical solutions: a center line generation method is provided, including: processing the CT images in a preset CT image database based on a preset method to obtain a corresponding standard image; solving the obtained standard image to obtain a bone area and a non-bone area; screening the obtained non-bone area to obtain a medullary cavity area; calculating the center point of the medullary cavity area in each standard image to obtain a center point database; fitting the center point data in the center point database to generate a center line.
[0007] Furthermore, the method for processing the CT images in the preset CT image database based on the preset method includes: normalizing the CT images in the preset CT image database using the z-score method, wherein the z-score method is specifically:
[0008]
[0009] Wherein, x is the original pixel value, μ is the pixel average of all CT images in the preset CT image database; σ is the variance of the pixels of all CT images in the preset CT image database;
[0010] The normalized CT image is thresholded as follows:
[0011]
[0012] Where x is the original pixel value, x0 is the pixel median of all CT images in the preset CT image database;
[0013] The screened CT images were smoothed using a Gaussian filter kernel with a pixel size of 3 mm to obtain a standard image database.
[0014] Furthermore, the method of solving the obtained standard image database to obtain the bone area and the non-bone area includes: dividing the pixel points in the standard image database based on a preset rule to obtain different pixel units; calculating the average variance of each pixel unit, and the specific formula is as follows:
[0015]
[0016] Among them, n0 is the number of low pixels in each pixel unit, n1 is the number of high pixels in each pixel unit, x0 is the average value of low pixels in each pixel unit, x1 is the average value of high pixels in each pixel unit, x is the average value of all pixels in each pixel unit, N is the number of all pixels in each pixel unit, and α is the average variance of each pixel unit; the pixel unit with the largest average variance is selected as the division threshold, and all pixel units are divided into bone area and non-bone area based on the division threshold.
[0017] Furthermore, the centerline generation method further includes: performing expansion processing on the bone region using a core with a size of 4 mm to eliminate noise points in the bone region.
[0018] Furthermore, the method for screening the obtained non-bone area includes: extracting an area in the non-bone area that is surrounded by the bone area and meets the preset conditions as the medullary cavity area, wherein the preset conditions include that the volume of the medullary cavity area is greater than or equal to 100mm 3 .
[0019] Furthermore, the method for calculating the center point of the medullary cavity region in each standard image includes an image position centroid algorithm, specifically:
[0020] x c =∑(x i *γ i ) / Ny c =∑(y i *γ i ) / N
[0021] Where N is the number of pixels in the medullary cavity area of the standard image, x i ,y i is the coordinate position of the pixel, γ i is the pixel value of the medullary cavity area in the standard image.
[0022] Furthermore, the center point data in the center point database are fitted to generate a center line, specifically including: randomly selecting two center points in the center point database, and using the two-point method to calculate the fitting line, as follows:
[0023]
[0024] Among them, p1 and p2 are the coordinates of two randomly selected center points.
[0025] Furthermore, the shortest distances from all the center points in the center point database except p1 and p2 to the fitting straight line are calculated in parallel, as follows:
[0026]
[0027] Among them, p3 represents all the center points except p1 and p2, D p3-line Indicates the shortest distance from p3 to the fitting line;
[0028] Compare the calculated shortest distance with the preset threshold d. If D p3-line >d, then the shortest distance D p3-line The corresponding center point is divided into out-of-line points; the number of out-of-line points m is calculated i , where i is an integer greater than or equal to 2; if m i <m i-1 , then m i The corresponding fitting straight line is taken as the center line; if m i If the number of points outside the line is greater than the preset number m, p1 and p2 are randomly selected again; if m i =0, the corresponding fitting straight line is output as the center line.
[0029] A centerline generation system is applicable to the above-mentioned centerline generation method, characterized in that the centerline generation system includes: a data processing module, the data processing module is used to normalize a preset CT image database to obtain a standard image database; a region division module, the region division module is used to solve the obtained standard image database to obtain a bone region and a non-bone region; a screening module, the screening module is used to screen the obtained non-bone region to obtain a medullary cavity region; a calculation module, the calculation module is used to calculate the center point of the medullary cavity region, and fit the calculated center point to generate a centerline.
[0030] A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the above method.
[0031] Beneficial effects:
[0032] The centerline generation method of the present invention utilizes preoperative CT data and uses the RANSAC method to interactively and semi-automatically quickly and accurately extract the centerline of the medullary cavity area. The entire extraction process is completed within 3 seconds, with high extraction efficiency and accurate extraction accuracy, which helps doctors to carry out preoperative planning. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is a flow chart of a centerline generation method used in an embodiment of the present invention;
[0034] Figure 2 is a side view of the medullary cavity region obtained by the centerline generation method adopted in the embodiment of the present invention;
[0035] Figure 3 is a top view of the medullary cavity region obtained by the centerline generation method adopted in the embodiment of the present invention;
[0036] Figure 4 It is a schematic diagram of center point data fitting in the center line generation method adopted in an embodiment of the present invention. DETAILED DESCRIPTION
[0037] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0038] Embodiment 1:
[0039] Provides a method for generating center lines, see Figures 1 to 4 ,include:
[0040] S100 processes the CT image in the preset CT image database based on a preset method to obtain a corresponding standard image;
[0041] It should be noted that the preset CT image database includes a plurality of two-dimensional CT images, the plurality of two-dimensional CT images are synthesized into a three-dimensional CT image, and the three-dimensional CT image is normalized.
[0042] In specific practice, the z-score method is used to normalize the preset three-dimensional CT image, wherein the z-score method is specifically as follows:
[0043]
[0044] Wherein, z is the normalized pixel value, x is the original pixel value, μ is the pixel average value of the preset three-dimensional CT image; σ is the variance of the pixels of all CT images in the preset CT image database;
[0045] It can be understood that image normalization refers to the process of performing a series of standard processing transformations on an image to transform it into a fixed standard form.
[0046] The normalized three-dimensional CT image is subjected to threshold screening. Since the CT image is composed of multiple pixels, each pixel has a corresponding pixel value. The image threshold is an appropriate value. In this embodiment, the threshold is the median of the pixel values of the three-dimensional CT image. The value of each pixel is compared with the threshold, and different pixels are processed differently according to the comparison result. The specific processing method is:
[0047]
[0048] Where Z is the pixel value corresponding to each pixel point of the three-dimensional CT image after threshold screening, x is the original pixel value, and x0 is the pixel median of the normalized three-dimensional CT image;
[0049] After threshold screening of the normalized three-dimensional CT images, a Gaussian filter kernel of a certain size, such as 3 mm, is designed according to the image spacing to smooth the screened three-dimensional CT images and remove noise from the three-dimensional CT images, thereby obtaining a standard image database consisting of processed three-dimensional CT images.
[0050] S200 solves the obtained standard image to obtain the bone area and the non-bone area;
[0051] In specific practice, the obtained standard image database is solved. The three-dimensional CT images in the standard image database can be regarded as composed of multiple two-dimensional CT images. The method of obtaining bone area and non-bone area is used to loop each two-dimensional CT image after the above standard image is solved, and the binarization threshold is automatically calculated by statistical method.
[0052] Specifically, the method includes dividing the pixel points of each two-dimensional CT image based on a preset rule to obtain different pixel units; wherein the preset rule is to bin the two-dimensional CT image obtained after smoothing and denoising to obtain pixel units.
[0053] Calculate the average variance of each pixel unit. In practice, traverse each bin in turn and calculate the average variance α of the binary image under the threshold corresponding to this bin. At this time, the image is divided into low-pixel area and high-pixel area according to the threshold. The specific formula is as follows:
[0054]
[0055] Where n0 is the number of low pixels in each pixel unit, n1 is the number of high pixels in each pixel unit, x0 is the average value of low pixels in each pixel unit, x1 is the average value of high pixels in each pixel unit, x is the average value of all pixels in each pixel unit, N is the number of all pixels in each pixel unit, and α is the average variance of each pixel unit;
[0056] The bin with the largest average variance is selected as the partition threshold, that is, the bin value corresponding to the largest variance α is the partition threshold, and all pixel units are divided into bone areas and non-bone areas based on the partition threshold. In this way, the bone area and non-bone area in the obtained CT image are preliminary partitions.
[0057] In the centerline generation method of this embodiment, the centerline generation method further includes: dilating the skeleton region using a core (also called a filter kernel) with a size of, for example, 4 mm to eliminate noise points in the skeleton region. Other dilating processing methods may also be used.
[0058] Specifically, the bone area in the preliminary partition is expanded and denoised, wherein the expansion operation is similar to expanding the edge of an image. In this embodiment, the portion of the CT image that is initially divided into the non-bone area is screened through the expansion operation, and the partition belonging to the bone part in the non-bone area is expanded and merged into the bone area to obtain a complete bone area and non-bone area.
[0059] S300 screens the obtained non-bone area to obtain the medullary cavity area;
[0060] In specific practice, the method for screening the obtained non-bone area includes: extracting an area in the non-bone area that is surrounded by the bone area and meets the preset conditions as the medullary cavity area, wherein the preset conditions include that the volume of the medullary cavity area is greater than or equal to a preset volume, for example, 100 mm 3 .
[0061] Specifically, independent connected domains are extracted from non-skeletal regions, such as Figures 2 to 3 As shown, the bone area is white and the non-bone area is black, wherein the non-bone area includes the medullary cavity area and other areas.
[0062] In practice, the medullary cavity area does not exist at the edge of the CT image, so it is necessary to extract the non-bone area surrounded by the bone area as the medullary cavity area; at the same time, since the volume of the medullary cavity area is usually large, the volume is smaller than the preset volume (such as 100mm 3 ) are not identified as medullary cavity areas.
[0063] In actual practice, the medullary cavity area can also be selected from the binarized CT image by manual selection.
[0064] S400 calculates the center point of the medullary cavity region in each two-dimensional standard image to obtain a center point database;
[0065] Specifically, a binary image with marked medullary cavity area is input, the center point of each layer of medullary cavity area is calculated, and finally a straight line is fitted by the RANSAC method.
[0066] In specific practice, the image position centroid algorithm is used to calculate the center point of the medullary cavity area in each standard image. The center position x of the medullary cavity area in each standard image is c The following formula:
[0067] x c =∑(x i *γ i ) / Ny c =∑(y i *γ i ) / N
[0068] Where N is the number of pixels in the medullary cavity area of the standard image, x c ,y c is the coordinate value of the center point, x i ,y i is the coordinate position of the pixel, γ i is the pixel value of the medullary cavity area in the standard image.
[0069] S500 fits the center point data in the center point database to generate a center line.
[0070] In specific practice, the center point data in the center point database are fitted to generate the center line, such as Figure 4 As shown, specifically including:
[0071] Randomly select two center points in the center point database and use the two-point method to calculate the fitting line line, as follows:
[0072]
[0073] Among them, p1 and p2 are the coordinates of two randomly selected center points.
[0074] Specifically, the shortest distances from all the center points in the center point database except p1 and p2 to the fitting line are calculated in parallel. Specifically, the properties of the matrix can be used to calculate the shortest distance from each point to the fitting line at the same time. The calculation process is as follows:
[0075]
[0076] Among them, p3 is the coordinate of other center points except p1 and p2, D p3-lineis the shortest distance from p3 to the fitted line.
[0077] Compare the calculated shortest distance with the preset threshold d. If D p3-line >d, the center point is divided into an off-line point;
[0078] In this embodiment, for a CT pixel spacing of 1 mm, 5 mm is selected as the threshold d, and the number of all out-of-line points is recorded, denoted as m. i .
[0079] Calculate the number of off-line points m corresponding to the fitted straight line i , where i is an integer greater than or equal to 2;
[0080] Specifically, for a certain threshold d, find all the points whose distances are greater than the threshold d.
[0081] If m i <m i-1 , then m i The corresponding fitted straight line is taken as the center line; that is, if the number of out-of-line points corresponding to the current fitted straight line is less than the number of out-of-line points corresponding to the previous fitted straight line, the current fitted straight line is taken as the latest fitted straight line;
[0082] If m i If the number of out-of-line points corresponding to the fitted straight line is greater than the preset number of out-of-line points m, p1 and p2 are randomly selected again; that is, if the number of out-of-line points corresponding to the fitted straight line is greater than the preset threshold value of the number of out-of-line points, two points are reselected to form a new fitted straight line, and the process returns to step S500 to recalculate the number of out-of-line points corresponding to the fitted straight line;
[0083] If m i =0, the corresponding fitting straight line is output as the center line; or the number of iterations of the fitting straight line reaches the maximum value, the fitting straight line with the least number of corresponding off-line points in the iteration process is output as the center line; in specific practice, the number of iterations varies according to the different extension lengths of the medullary cavity area along the axial direction. Specifically, the calculation method is:
[0084] k=[K in mm ] 2
[0085] Wherein, K represents the axial length in mm and is rounded to the square.
[0086] The present embodiment provides a centerline generation system, which is applicable to the above-mentioned centerline generation method, and is characterized in that the centerline generation system includes: a data processing module, which is used to normalize a preset CT image database to obtain a standard image database; a region division module, which is used to solve the obtained standard image database to obtain a bone region and a non-bone region; a screening module, which is used to screen the obtained non-bone region to obtain a medullary cavity region; and a calculation module, which is used to calculate the center point of the medullary cavity region, and fit the calculated center point to generate a centerline.
[0087] This embodiment provides a non-transitory computer-readable storage medium storing computer instructions, where the computer instructions are used to enable a computer to execute the above method.
[0088] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0089] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.
[0090] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0091] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0092] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A centerline generation method, characterized in that: include: Processing the CT images in the preset CT image database to obtain corresponding standard images; Solve the obtained standard image to obtain the bone area and the non-bone area; The obtained non-bone area is screened to obtain the medullary cavity area; Calculate the center point of the medullary cavity area in each standard image to obtain a center point database; Fit the center point data in the center point database to generate the center line.
2. The centerline generation method according to claim 1, characterized in that: The method for processing the CT image in the preset CT image database includes: The z-score method is used to normalize the CT images in the preset CT image database, wherein the z-score method is specifically as follows: Wherein, x is the original pixel value, μ is the pixel average value of all CT images in the preset CT image database; σ is the pixel variance of all CT images in the preset CT image database; The normalized CT image is thresholded as follows: Where x is the original pixel value, x0 is the pixel median of all CT images in the preset CT image database; The screened CT images are smoothed to obtain a standard image database.
3. The centerline generation method according to claim 1, characterized in that: The method of solving the obtained standard image database to obtain the bone area and the non-bone area includes: Divide the pixels in the standard image database based on preset rules to obtain different pixel units; Calculate the average variance of each pixel unit. The specific formula is as follows: Where n0 is the number of low pixels in each pixel unit, n1 is the number of high pixels in each pixel unit, x0 is the average value of low pixels in each pixel unit, x1 is the average value of high pixels in each pixel unit, x is the average value of all pixels in each pixel unit, N is the number of all pixels in each pixel unit, and α is the average variance of each pixel unit; The pixel unit with the largest average variance is selected as the segmentation threshold, and all pixel units are divided into bone areas and non-bone areas based on the segmentation threshold.
4. The centerline generation method according to claim 3, characterized in that: The centerline generation method further includes: performing expansion processing on the skeleton region to eliminate noise points in the skeleton region.
5. The centerline generation method according to claim 1, characterized in that: The method for screening the obtained non-bone area includes: extracting an area in the non-bone area that is surrounded by the bone area and meets the preset conditions as the medullary cavity area, wherein the preset conditions include that the volume of the medullary cavity area is greater than or equal to 100mm 3 .
6. The centerline generation method according to claim 1, characterized in that: The method for calculating the center point of the medullary cavity region in each standard image includes an image position centroid algorithm, specifically: x c ∑(x i *γ i ) / Who c =∑(y i *γ i ) / N Where N is the number of pixels in the medullary cavity area of the standard image, x i ,y i is the coordinate position of the pixel, γ i is the pixel value of the medullary cavity area in the standard image.
7. The centerline generation method according to claim 1, characterized in that: Fit the center point data in the center point database to generate the center line, specifically including: Two center points are randomly selected in the center point database, and the fitting line is calculated using the two-point method, as follows: Among them, p1 and p2 are the coordinates of two randomly selected center points; The resulting fitted straight line is iterated to generate the center line.
8. The centerline generation method according to claim 7, characterized in that: Methods for iterating the obtained fitted straight line multiple times to generate the center line include: The shortest distances from all the center points in the center point database except p1 and p2 to the fitting straight line are calculated in parallel, as follows: Among them, p3 represents all the center points except p1 and p2, D p3-line Indicates the shortest distance from p3 to the fitting line; The shortest distance D p3-line Compared with the preset threshold d, if D p3-line >d, then the shortest distance D p3-line The corresponding center point is divided into off-line points; Calculate the number of off-line points m corresponding to the fitted straight line i , where i is an integer greater than or equal to 2; If m i <m i-1 , then m i The corresponding fitted straight line is taken as the center line; If m i If the number of points outside the line is greater than the preset number m, p1 and p2 are randomly selected again; If m i =0, the corresponding fitting straight line is output as the center line.
9. A centerline generation system, applicable to the centerline generation method according to any one of claims 1 to 8, characterized in that: The centerline generation system includes: A data processing module, wherein the data processing module is used to normalize a preset CT image database to obtain a standard image database; A region division module, the region division module is used to solve the obtained standard image database to obtain a bone region and a non-bone region; A screening module, wherein the screening module is used to screen the obtained non-bone area to obtain a medullary cavity area; The calculation module is used to calculate the center point of the medullary cavity area and fit the calculated center point to generate a center line.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to make a computer execute the method according to any one of claims 1 to 8.
