Method for generating simulated X-ray image in hip joint prosthesis planning and electronic equipment
By processing the three-dimensional CT images and setting the prosthesis model color, a simulated three-dimensional CT image was generated, which solved the problem that the hip prosthesis planning results in the prior art are difficult to visually present in X-ray images, and improved the accuracy of the planning.
Patent Information
- Application Number
- CN202411550281.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-01
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-11-01
AI Technical Summary
The prior art is difficult to visually present the results of hip prosthesis planning in X-ray images, which affects the accuracy of the planning.
By acquiring three-dimensional CT images and processing them based on the femoral model, images showing only the left femur, the right femur, and the femur are generated. After hip prosthesis planning, the voxel color located inside the prosthesis model in the third image is set to the color corresponding to the prosthesis model, and the image is synthesized to generate a simulated three-dimensional CT image.
The results of hip prosthesis planning are presented to users through simulated three-dimensional CT images, which improves the accuracy of hip prosthesis planning.
Smart Images

Figure CN119498954A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method for generating a simulated X-ray image in hip joint prosthesis planning and an electronic device. Background Art
[0002] In hip reconstruction surgery, it is crucial to ensure that the hip offset and hip length on the operated and non-operated sides are equal. Therefore, doctors need to perform preoperative hip prosthesis planning in order to ensure that patients recover hip function after surgery and reduce complications.
[0003] Currently, during the preoperative hip prosthesis planning stage, doctors usually simulate the placement of the prosthesis model in the patient's CT image as a reference for prosthesis installation during surgery.
[0004] However, doctors prefer to use CT (Computed Tomography), DRR (Digitally Reconstructed Radiograph) and other medical images for auxiliary planning. However, the current preoperative hip prosthesis planning method can only present a three-dimensional reconstructed model, and generally cannot present the model splicing results after hip prosthesis planning in the X-ray image. This makes it impossible for doctors to intuitively see the results of hip prosthesis planning when referring to X-ray images, which often affects the accuracy of hip prosthesis planning. Summary of the invention
[0005] In response to the shortcomings of the prior art, the present application provides a method and electronic device for generating simulated X-ray images in hip prosthesis planning. A fourth image is obtained by setting the color of all first voxels in a third image to the color corresponding to the prosthesis model, and then the first image, the second image and the fourth image are synthesized to obtain a simulated three-dimensional CT image. The result of hip prosthesis planning can be presented to the user for reference through a simulated three-dimensional CT image, thereby improving the accuracy of hip prosthesis planning.
[0006] To solve the above problems, the present invention provides the following technical solutions:
[0007] In a first aspect, an embodiment of the present application provides a method for generating a simulated X-ray image in hip prosthesis planning, comprising: acquiring a left femur model, a right femur model and a three-dimensional CT image of a target object; processing the three-dimensional CT image based on the left femur model and the right femur model to obtain a first image showing only the left femur of the target object, a second image showing only the right femur of the target object, and a third image not showing the left femur and the right femur, wherein the first image, the second image and the third image are all three-dimensional images; after hip prosthesis planning, determining all first voxels in the third image located inside the prosthesis model based on the coordinates of each voxel in the third image in a three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in a three-dimensional space coordinate system, and setting the colors of all first voxels in the third image to the colors corresponding to the prosthesis model to obtain a fourth image, wherein the prosthesis model is composed of multiple vertices; synthesizing the first image, the second image and the fourth image to obtain a simulated three-dimensional CT image.
[0008] In some embodiments, the processing of the three-dimensional CT image based on the left femur model and the right femur model to obtain a first image showing only the left femur of the target object, a second image showing only the right femur of the target object, and a third image not showing the left femur and the right femur comprises:
[0009] intercepting the three-dimensional CT image according to the left femur model or the right femur model to obtain the intercepted three-dimensional CT image;
[0010] The captured three-dimensional CT image is processed based on the left femur model and the right femur model to obtain a first image that only displays the left femur of the target object, a second image that only displays the right femur of the target object, and a third image that does not display the left femur and the right femur.
[0011] In some embodiments, intercepting the three-dimensional CT image according to the left femur model or the right femur model to obtain the intercepted three-dimensional CT image includes:
[0012] Determining the principal axis of the model based on the coordinates of each vertex on the left femur model or the right femur model;
[0013] Selecting a point on the main axis close to the first end point of the main axis and at a distance from the first end point equal to a preset ratio multiplied by the length of the main axis as the first calculation point, wherein the physiological position of the first end point is close to the pelvis of the target object;
[0014] The three-dimensional CT image is intercepted according to a plane that passes through the first calculation point and is parallel to a horizontal plane of a three-dimensional space coordinate system to obtain the intercepted three-dimensional CT image.
[0015] In some embodiments, the left femur model and the right femur model are both composed of multiple vertices, and the three-dimensional CT image is processed based on the left femur model and the right femur model to obtain a first image that only displays the left femur of the target object, a second image that only displays the right femur of the target object, and a third image that does not display the left femur and the right femur, including: determining all second voxels in the three-dimensional CT image located inside the left femur model based on the coordinates of each voxel in the three-dimensional CT image in a three-dimensional space coordinate system and the coordinates of each vertex on the surface of the left femur model in a three-dimensional space coordinate system; The colors of all voxels in the three-dimensional CT image except the second voxel are set to a preset background color to obtain the first image; based on the coordinates of each voxel in the three-dimensional CT image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the right femur model in the three-dimensional space coordinate system, all third voxels in the three-dimensional CT image located inside the right femur model are determined; the colors of all voxels in the three-dimensional CT image except the third voxel are set to the background color to obtain the second image; the colors of all the second voxels and the third voxels in the three-dimensional CT image are set to the background color to obtain the third image.
[0016] In some embodiments, after hip prosthesis planning is performed, all first voxels in the third image located inside the prosthesis model are determined based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in the three-dimensional space coordinate system, and the colors of all first voxels in the third image are set to the colors corresponding to the prosthesis model, before obtaining the fourth image, the method further includes: acquiring a first position transformation matrix of the left femoral model, a second position transformation matrix of the right femoral model, and a third position transformation matrix of the pelvic model after hip prosthesis planning; multiplying the first position transformation matrix by the first image, thereby moving the first image so that the position of the first image corresponds to the position of the left femoral model after hip prosthesis planning; multiplying the second position transformation matrix by the second image, thereby moving the second image so that the position of the second image corresponds to the position of the right femoral model after hip prosthesis planning; multiplying the third position transformation matrix by the third image, thereby moving the third image so that the position of the third image corresponds to the position of the pelvic model after hip prosthesis planning.
[0017] In some embodiments, the prosthesis model includes multiple sub-prosthesis models, and after hip prosthesis planning, all first voxels in the third image located inside the prosthesis model are determined based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in the three-dimensional space coordinate system, and the colors of all first voxels in the third image are set to the colors corresponding to the prosthesis model to obtain a fourth image, including: after hip prosthesis planning, a subset of first voxels in the third image located inside each sub-prosthesis model is determined based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of each sub-prosthesis model in the three-dimensional space coordinate system to obtain multiple first voxel subsets; the colors of all voxels in each first voxel subset are set to the colors corresponding to the first voxel subset to obtain the fourth image.
[0018] In some embodiments, the hip prosthesis planning mode includes a hip offset planning mode and a hip length planning mode, and after performing hip prosthesis planning, based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in the three-dimensional space coordinate system, all first voxels in the third image located inside the prosthesis model are determined, and the colors of all first voxels in the third image are set to the colors corresponding to the prosthesis model, to obtain a fourth image, comprising: after performing hip prosthesis planning, based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in the hip offset planning mode All first voxels in the third image located inside the prosthesis model are determined based on their coordinates in the three-dimensional space coordinate system, and the colors of all first voxels in the third image are set to the colors corresponding to the prosthesis model, to obtain a fourth image corresponding to the hip joint offset planning mode; all first voxels in the third image located inside the prosthesis model are determined based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in the hip joint length planning mode in the three-dimensional space coordinate system, and the colors of all first voxels in the third image are set to the colors corresponding to the prosthesis model, to obtain a fourth image corresponding to the hip joint length planning mode.
[0019] In some embodiments, the synthesizing the first image, the second image, and the fourth image to obtain a simulated three-dimensional CT image includes: resampling the first image based on the first image and the fourth image so that the size of the first image is the same as the size of the fourth image; resampling the second image based on the second image and the fourth image so that the size of the second image is the same as the size of the fourth image; and adding the first image, the second image, and the fourth image to obtain the simulated three-dimensional CT image.
[0020] In some embodiments, the method further comprises: inputting the simulated three-dimensional CT image into a ray projection model to obtain a simulated two-dimensional DRR image, wherein the prosthesis model is displayed in the simulated two-dimensional DRR image.
[0021] In a second aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for generating simulated X-ray images in hip prosthesis planning as described in the first aspect.
[0022] The present application provides a method and electronic device for generating simulated X-ray images in hip prosthesis planning. The present application obtains a fourth image by setting the color of all first voxels in a third image to the color corresponding to a prosthesis model, and then synthesizes the first image, the second image and the fourth image to obtain a simulated three-dimensional CT image. The result of hip prosthesis planning can be presented to the user for reference through a simulated three-dimensional CT image, thereby improving the accuracy of hip prosthesis planning. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a flowchart of a first implementation method of a method for generating simulated X-ray images in hip prosthesis planning provided in an embodiment of the present application.
[0024] Figure 2 It is a flow chart of a second implementation of the method for generating simulated X-ray images in hip prosthesis planning provided in an embodiment of the present application.
[0025] Figure 3 It is a schematic diagram of a cross-sectional two-dimensional X-ray image of a cut-off three-dimensional CT image provided in an embodiment of the present application.
[0026] Figure 4 yes Figure 1 Detailed flowchart of step S200.
[0027] Figure 5A yes Figure 4 Schematic diagram of the principle of step S210.
[0028] Figure 5B yes Figure 4 Schematic diagram of the principle of step S230.
[0029] Figure 6 It is a schematic diagram of a cross-sectional two-dimensional X-ray image of the third image provided in an embodiment of the present application.
[0030] Figure 7 yes Figure 1 A first detailed flow chart of step S300 in FIG.
[0031] Figure 8 yes Figure 1 A second detailed flow chart of step S300 in FIG.
[0032] Fig. 9 yes Figure 1 Detailed flowchart of step S400.
[0033] Fig. 10A It is a schematic diagram of the first combination model provided in an embodiment of the present application.
[0034] Fig. 10B It is a schematic diagram of a first simulated two-dimensional X-ray image provided in an embodiment of the present application.
[0035] Fig. 10C It is a schematic diagram of the second combination model provided in an embodiment of the present application.
[0036] Fig. 10D It is a schematic diagram of a second simulated two-dimensional X-ray image provided in an embodiment of the present application.
[0037] Fig.11 It is a flowchart of a third implementation of the method for generating simulated X-ray images in hip prosthesis planning provided in an embodiment of the present application.
[0038] Fig. 12A It is a schematic diagram of a first simulated two-dimensional DRR image provided in an embodiment of the present application.
[0039] Fig. 12B Schematic diagram of a second simulated two-dimensional DRR image provided in an embodiment of the present application.
[0040] Fig.13 It is a structural schematic diagram of a device for generating simulated X-ray images in hip prosthesis planning provided in an embodiment of the present application.
[0041] Fig.14 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application.
[0042] Fig.15 It is a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions 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 are within the scope of protection of this application.
[0044] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0045] The present application provides a method and electronic device for generating simulated X-ray images in hip prosthesis planning. A fourth image is obtained by setting the colors of all first voxels in a third image to the colors corresponding to a prosthesis model, and then the first image, the second image and the fourth image are synthesized to obtain a simulated three-dimensional CT image. The result of hip prosthesis planning can be presented to a user for reference through a simulated three-dimensional CT image, thereby improving the accuracy of hip prosthesis planning.
[0046] The method for generating simulated X-ray images in hip prosthesis planning provided by the present application will be described in detail below with reference to the accompanying drawings.
[0047] See also Figure 1 , Figure 1 FIG. 1 is a flow chart of a first embodiment of a method for generating a simulated X-ray image in hip prosthesis planning provided in an embodiment of the present application. Figure 1 As shown, the method for generating a simulated X-ray image in hip prosthesis planning includes: steps S100 to S400.
[0048] Step S100: Acquire a left femur model, a right femur model and a three-dimensional CT image of the target object.
[0049] A 3D CT image is a 3D image formed by superimposing 2D X-ray images through computer post-processing technology using 3D reconstruction technology. A 3D CT image includes multiple voxels. Voxel is the abbreviation of volume pixel, which is the smallest division unit of a 3D CT image in 3D space and corresponds to a pixel in 2D space. A 3D CT image is a 3D image in a 3D space coordinate system, and each voxel in the 3D CT image has coordinates in the 3D space coordinate system.
[0050] In some embodiments, a pelvic model, a left femur model, and a right femur model of the target object are obtained based on a three-dimensional CT image of the target object.
[0051] Optionally, the method of obtaining the pelvic model, the left femur model and the right femur model of the target object based on the three-dimensional CT image of the target object includes a manual segmentation method and an artificial intelligence algorithm.
[0052] In some embodiments, in step S100, the left femur model, the right femur model and the three-dimensional CT image of the target object have been predetermined, and the left femur model, the right femur model and the three-dimensional CT image of the target object are directly acquired.
[0053] See also Figure 2 , Figure 2 FIG. 2 is a flow chart of a second embodiment of a method for generating a simulated X-ray image in hip prosthesis planning provided in an embodiment of the present application. Figure 2 As shown, in some embodiments, before step S200, the method for generating simulated X-ray images in hip prosthesis planning further includes: step S110.
[0054] Step S110: intercepting a three-dimensional CT image according to the left femur model or the right femur model to obtain a intercepted three-dimensional CT image.
[0055] Because the prosthesis model is mainly located near the pelvic bone model in hip prosthesis planning, only the intercepted three-dimensional CT image can be further processed. In this way, the amount of calculation can be reduced.
[0056] In some embodiments, step S110 includes steps (110.1) to (110.3).
[0057] (110.1) Determine the principal axes of the model based on the coordinates of each vertex on the left femur model or the right femur model.
[0058] In some embodiments, the left femur model and the right femur model are each composed of a plurality of vertices.
[0059] Optionally, both the left femur model and the right femur model are mesh models, the mesh models are composed of a plurality of polygonal patches, and each polygonal patch has a plurality of vertices.
[0060] In some embodiments, a grid data tool library is used to model and process all models in the method.
[0061] Optionally, the mesh data tool library includes VTK (Visualization Toolkit), Meshmixer, CloudCompare, ParaView and MeshLab, etc.
[0062] Optionally, when using the VTK tool library, the type of surface mesh data of all models is vtkPolyData.
[0063] In some embodiments, when the coordinate value of a vertex on the left femur model or the right femur model in the vertical direction is the maximum value among all vertices, the vertex is determined as the first endpoint of the main axis of the model.
[0064] Optionally, in a three-dimensional space coordinate system, the coordinate axis in the vertical direction is the Z axis, and the coordinate value of the vertex in the vertical direction is the Z axis coordinate value.
[0065] In some embodiments, when the coordinate value of a vertex on the left femur model or the right femur model in the vertical direction is the minimum value among all vertices, the vertex is determined as the second endpoint of the main axis of the model.
[0066] Optionally, the first end point and the second end point of the main axis are connected to obtain the main axis of the model.
[0067] In some embodiments, the first endpoint and the second endpoint of the principal axis of the model are determined using a PCA (Principal Component Analysis) method.
[0068] (110.2) A point on the main axis close to the first endpoint of the main axis and whose distance from the first endpoint is a preset ratio multiplied by the length of the main axis is selected as the first calculation point.
[0069] The physiological position of the first endpoint is close to the pelvis of the target object.
[0070] Optionally, the length of the main axis is obtained by subtracting the coordinate value of the first end point of the main axis in the vertical direction from the coordinate value of the second end point in the vertical direction.
[0071] Optionally, the preset ratio ranges from one-fifth to one-half, for example, the preset ratio is one-fifth, one-quarter, one-third or one-half.
[0072] (110.3) The three-dimensional CT image is intercepted according to a plane that passes through the first calculation point and is parallel to the horizontal plane of the three-dimensional space coordinate system to obtain a intercepted three-dimensional CT image.
[0073] As mentioned above, the three-dimensional CT image is a three-dimensional image in a three-dimensional space coordinate system, and each voxel in the three-dimensional CT image has coordinates in the three-dimensional space coordinate system.
[0074] In some embodiments, a plane parallel to the horizontal plane of the three-dimensional space coordinate system is drawn through the first calculation point, and the three-dimensional CT image is intercepted by the plane, and a portion of the three-dimensional CT image showing the pelvis of the target object is retained to obtain a intercepted three-dimensional CT image. The intercepted three-dimensional CT image is also a three-dimensional image.
[0075] Optionally, the horizontal plane of the three-dimensional space coordinate system is the XOY plane.
[0076] In some implementations, the user may specify a section in the three-dimensional image where the two-dimensional image needs to be viewed according to his or her needs.
[0077] In some embodiments, a designated cross section is determined according to a selection instruction, and then the three-dimensional image is intercepted using the designated cross section to obtain a two-dimensional image.
[0078] See also Figure 3 , Figure 3 Schematic diagram of a cross-sectional two-dimensional X-ray image of a three-dimensional CT image provided in an embodiment of the present application. Figure 3 As shown, a cross-sectional two-dimensional X-ray image 1 of the three-dimensional CT image shows the pelvis and a portion of the left femur and the right femur of the target object.
[0079] It can be understood that the left femur of the target object is located on the right side of a cross-sectional two-dimensional X-ray image 1 of the intercepted three-dimensional CT image, and the right femur of the target object is located on the left side of a cross-sectional two-dimensional X-ray image 1 of the intercepted three-dimensional CT image.
[0080] After the three-dimensional CT image is intercepted, the three-dimensional CT images processed in the following steps are all intercepted three-dimensional CT images.
[0081] Step S200: Process the three-dimensional CT image based on the left femur model and the right femur model to obtain a first image showing only the left femur of the target object, a second image showing only the right femur of the target object, and a third image not showing the left femur and the right femur.
[0082] The first image, the second image and the third image are all three-dimensional images.
[0083] In some embodiments, step S200 includes: processing the intercepted three-dimensional CT image based on the left femur model and the right femur model to obtain a first image that only shows a portion of the left femur of the target object, a second image that only shows a portion of the right femur of the target object, and a third image that does not show the left femur and the right femur.
[0084] See also Figure 4 , Figure 4 yes Figure 1 Detailed flow chart of step S200 in FIG. Figure 4 As shown, in some embodiments, step S200 includes: steps S210 to S250.
[0085] Step S210: Determine all second voxels in the three-dimensional CT image located inside the left femur model based on the coordinates of each voxel in the three-dimensional CT image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the left femur model in the three-dimensional space coordinate system.
[0086] See also Figure 5A , Figure 5A yes Figure 4 The schematic diagram of the principle of step S210 in FIG. Figure 5A As shown, in some embodiments, the left femur model 10 has a position in a three-dimensional space coordinate system, and the intercepted three-dimensional CT image also has a position in a three-dimensional space coordinate system. Figure 5A FIG. 1 shows a cross-sectional two-dimensional X-ray image 1 of a three-dimensional CT image after being cut behind the left femur model 10. It can be understood that in the three-dimensional CT image 1 after being cut, the voxel area showing the left femur of the target object is located inside the left femur model 10.
[0087] In some embodiments, whether each voxel in the three-dimensional CT image is inside the left femur model is determined based on the coordinates of each voxel in the three-dimensional CT image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the left femur model in the three-dimensional space coordinate system. If so, the voxel is determined as the second voxel inside the left femur model.
[0088] In some embodiments, a first ray is generated with a voxel in the three-dimensional CT image as the endpoint of the first ray. When the number of intersections where the first ray intersects with the surface of the left femur model is an odd number, the voxel is judged to be inside the left femur model. When the number of intersections where the first ray intersects with the surface of the left femur model is an even number, the voxel is judged not to be inside the left femur model.
[0089] Step S220: setting the colors of all voxels except the second voxel in the three-dimensional CT image to a preset background color to obtain a first image.
[0090] The first image only shows the left femur of the target object.
[0091] Optionally, the grayscale values of all voxels except the second voxel in the three-dimensional CT image are set to a preset background grayscale value.
[0092] Optionally, the background grayscale value is 0.
[0093] Optionally, when using the VTK tool library, the left femur model is constructed as the first image template of the vtkPolyDataToImageStencil class, the first image template and the three-dimensional CT image are input into the vtkImageStencil function, and the SetBackgroundValue function is used in the vtkImageStencil function to set the grayscale value of the background voxels (all voxels except the first voxel) output by the vtkImageStencil function to 0. The output of the vtkImageStencil function is the first image.
[0094] Step S230: Determine all third voxels in the three-dimensional CT image located inside the right femur model based on the coordinates of each voxel in the three-dimensional CT image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the right femur model in the three-dimensional space coordinate system.
[0095] See also Figure 5B , Figure 5B yes Figure 4 The schematic diagram of the principle of step S230 in FIG. Figure 5B As shown, in some embodiments, the right femur model 20 has a position in a three-dimensional space coordinate system, and the intercepted three-dimensional CT image also has a position in a three-dimensional space coordinate system. Figure 5A FIG. 1 shows a cross-sectional two-dimensional X-ray image 1 of a three-dimensional CT image after being cut behind the right femur model 20. It can be understood that in the three-dimensional CT image after being cut, the voxel area showing the right femur of the target object is located inside the right femur model 20.
[0096] In some embodiments, whether each voxel in the three-dimensional CT image is inside the right femur model is determined based on the coordinates of each voxel in the three-dimensional CT image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the right femur model in the three-dimensional space coordinate system. If so, the voxel is determined as the third voxel inside the right femur model.
[0097] In some embodiments, a second ray is generated with a voxel in the three-dimensional CT image as the endpoint of the second ray. When the number of intersections where the second ray intersects with the surface of the right femur model is an odd number, the voxel is judged to be inside the right femur model. When the number of intersections where the second ray intersects with the surface of the right femur model is an even number, the voxel is judged not to be inside the right femur model.
[0098] Step S340: setting the colors of all voxels except the third voxel in the three-dimensional CT image to the background color to obtain a second image.
[0099] The second image only shows the right femur of the target object.
[0100] Optionally, the grayscale values of all voxels except the third voxel in the three-dimensional CT image are set to a preset background grayscale value.
[0101] Optionally, when using the VTK tool library, the right femur model is constructed as a second image template of the vtkPolyDataToImageStencil class, the second image template and the three-dimensional CT image are input into the vtkImageStencil function, and the SetBackgroundValue function is used in the vtkImageStencil function to set the grayscale value of the background voxels (all voxels except the third voxel) output by the vtkImageStencil function to 0. The output of the vtkImageStencil function is the second image.
[0102] Step S250: setting the colors of all second voxels and third voxels in the three-dimensional CT image to the background color to obtain a third image.
[0103] In some embodiments, the first image and the second image are simultaneously subtracted from the three-dimensional CT image to obtain a third image.
[0104] Specifically, the voxel value of each voxel in the three-dimensional CT image is simultaneously subtracted from the voxel value of the voxel at the same position in the first image and the voxel value of the voxel at the same position in the second image to obtain the third image.
[0105] In some embodiments, when using the VTK tool library, the right femur model is constructed as a second image template of the vtkPolyDataToImageStencil class, the first image template and the first image are input into the vtkImageStencil function, the SetBackgroundValue function is used in the vtkImageStencil function to set the grayscale value of the background voxel output by the vtkImageStencil function to 0, and the reverse stencil option of the ReverseStencilOn function is additionally enabled, and the output of the vtkImageStencil function is the third image.
[0106] See also Figure 6 , Figure 6 is a schematic diagram of a cross-sectional two-dimensional X-ray image of the third image provided in an embodiment of the present application. Figure 6 As shown, a cross-sectional two-dimensional X-ray image 2 of the third image does not show the left femur and the right femur of the target object.
[0107] In some embodiments, before step S300, the method for generating a simulated X-ray image in hip prosthesis planning also includes: moving the first image, the second image, and the third image respectively so that the position of the first image corresponds to the position of the left femoral model after hip prosthesis planning, the position of the second image corresponds to the position of the right femoral model after hip prosthesis planning, and the position of the third image corresponds to the position of the pelvic model after hip prosthesis planning.
[0108] In some embodiments, the modes of hip prosthesis planning include a hip offset planning mode and a hip length planning mode.
[0109] Optionally, the first image, the second image and the third image are moved according to movement instructions in the hip offset planning mode and the hip length planning mode, respectively, so that the positions of the images and the model in the current hip prosthesis planning mode correspond.
[0110] In some embodiments, before step S300, the method for generating a simulated X-ray image in hip prosthesis planning further includes: steps (260.1) to (260.4).
[0111] (260.1) Obtain the first position transformation matrix of the left femoral model, the second position transformation matrix of the right femoral model, and the third position transformation matrix of the pelvic model after hip prosthesis planning.
[0112] (260.2) Multiply the first position transformation matrix by the first image, thereby moving the first image so that the position of the first image corresponds to the position of the left femoral model after hip prosthesis planning.
[0113] Optionally, the coordinates of each voxel in the first image are multiplied by the first position transformation matrix, thereby moving the first image.
[0114] (260.3) Multiply the second position transformation matrix by the second image, thereby moving the second image so that the position of the second image corresponds to the position of the right femoral model after hip prosthesis planning.
[0115] Optionally, the coordinates of each voxel in the second image are multiplied by the second position transformation matrix, thereby moving the second image.
[0116] (260.4) Multiply the third position transformation matrix by the third image, thereby moving the third image so that the position of the third image corresponds to the position of the pelvic model after hip prosthesis planning.
[0117] Optionally, the coordinates of each voxel in the third image are multiplied by a third position transformation matrix, thereby moving the third image.
[0118] Step S300: After planning the hip prosthesis, determine all first voxels in the third image that are located inside the prosthesis model based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in the three-dimensional space coordinate system, and set the colors of all first voxels in the third image to the colors corresponding to the prosthesis model to obtain a fourth image.
[0119] The method for determining all first voxels located inside the prosthesis model in the third image in step S300 refers to the method for determining all second voxels located inside the left femur model in the three-dimensional CT image in step S210.
[0120] The prosthesis model is composed of multiple vertices.
[0121] Optionally, the prosthesis model is a mesh model, which is composed of a plurality of polygonal patches, and each polygonal patch has a plurality of vertices.
[0122] Exemplarily, the grayscale values of all first voxels in the third image are set to the grayscale values corresponding to the prosthesis model to obtain a fourth image.
[0123] Optionally, because the prosthesis is mostly made of high-density polymer or metal material, its grayscale value in the real CT image is often very high (for example, the grayscale value is above 2000), so the grayscale value corresponding to the prosthesis model ranges from 2000 to 3500, for example, the grayscale value corresponding to the prosthesis model is 2000, 2500, 3000 or 3500, etc.
[0124] Exemplarily, when using the VTK tool library, the prosthesis model is constructed as the third image template of the vtkPolyDataToImageStencil class, the third image template and the third image are input into the vtkImageStencil function, and the SetBackgroundValue function is used in the vtkImageStencil function to set the grayscale value of the background voxel output by the vtkImageStencil function to 3000, and the reverse stencil option of the ReverseStencilOn function is additionally enabled. The output of the vtkImageStencil function is the fourth image.
[0125] In some embodiments, the prosthesis model includes a plurality of sub-prosthesis models.
[0126] In some embodiments, the prosthesis model includes a pelvic prosthesis model and a femoral prosthesis model.
[0127] Optionally, the pelvic prosthesis model includes an acetabular cup model and a liner model, and the femoral prosthesis model includes a ball head model and a femoral stem model. In hip reconstruction surgery, the acetabular cup and the liner are installed on the pelvis of the target object, and the ball head and the femoral stem are installed on the femur of the target object.
[0128] Optionally, the entire pelvic prosthesis model is used as a sub-prosthesis model.
[0129] Optionally, the entire femoral prosthesis model is used as a sub-prosthesis model.
[0130] Optionally, the acetabular cup model, the liner model, the ball head model and the femoral stem model are each used as a sub-prosthesis model.
[0131] In some embodiments, each sub-prosthesis model is displayed differently.
[0132] See also Figure 7 , Figure 7 yes Figure 1 The first detailed flow chart of step S300 in FIG. Figure 7 As shown, in some implementations, step S300 includes: step S310 to step S320.
[0133] Step S310: After hip prosthesis planning, determine the first voxel subset located inside each sub-prosthesis model in the third image based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of each sub-prosthesis model in the three-dimensional space coordinate system, and obtain multiple first voxel subsets.
[0134] The method for determining the first voxel subset located inside each sub-prosthesis model in the third image in step S310 refers to the method for determining all second voxels located inside the left femur model in the three-dimensional CT image in step S210.
[0135] Step S320: setting the colors of all voxels in each first voxel subset to the color corresponding to the first voxel subset to obtain a fourth image.
[0136] By setting the colors of all voxels in each first voxel subset to the color corresponding to the first voxel subset, each sub-prosthesis model can be displayed differentiatedly, making it easier for the user to determine the exact position of each sub-prosthesis model based on the simulated three-dimensional CT image subsequently obtained based on the fourth image, thereby further improving the accuracy of hip prosthesis planning.
[0137] In some embodiments, step S320 includes steps (320.1) to (320.3).
[0138] (320.1) Set the grayscale values of all voxels in each first voxel subset to the grayscale value corresponding to the first voxel subset.
[0139] Different first voxel subsets correspond to different grayscale values.
[0140] Exemplarily, the grayscale values of all voxels in the first voxel subset corresponding to the pelvic prosthesis model are set to 2500, and the grayscale values of all voxels in the first voxel subset corresponding to the femoral prosthesis model are set to 3000.
[0141] (320.2) Obtain color mapping relationship information of the prosthesis model.
[0142] Optionally, the color mapping relationship information of the prosthesis model is used to map all voxels of multiple different grayscale values to different colors respectively.
[0143] Exemplarily, the color mapping relationship information is used to map all voxels with a grayscale value of 2500 to green, and to map all voxels with a grayscale value of 3000 to red.
[0144] Optionally, the color mapping relationship information is also used to set the transparency of the color.
[0145] For example, when using the VTK tool library, a new vtkLookupTable color transparency mapping table is created, in which the SetTableValue function can accept 5 input values. The first input value is the pixel value index value, the second to fourth input values are the ratio values of the RGB colors respectively, and the fifth input value is the opacity value.
[0146] (320.3) According to the color mapping relationship information, the colors of all voxels in the third image whose grayscale values are a preset grayscale value are set to corresponding colors.
[0147] Exemplarily, according to the color mapping relationship information, all voxels with a grayscale value of 2500 in the third image are mapped to green, and all voxels with a grayscale value of 3000 are mapped to red, to obtain a fourth image.
[0148] For example, when the VTK tool library is used, the SetTableValue function is used to bind all voxels with a gray value of 2500 in the color transparency mapping table to green and completely opaque, and the input of the SetTableValue function is (1, 0, 1, 0, 1). After all colors in the color transparency mapping table are bound according to the color mapping relationship information, the color transparency mapping table is applied to the third image to set the colors of all voxels with a preset gray value in the third image to the corresponding colors.
[0149] As described above, in some embodiments, the modes of hip prosthesis planning include a hip offset planning mode and a hip length planning mode.
[0150] Optionally, a fourth image corresponding to each hip prosthesis planning mode is determined respectively, and then the corresponding first image, second image and fourth image are synthesized in each hip prosthesis planning mode to obtain a simulated three-dimensional CT image. In this way, the result of hip prosthesis planning in each hip prosthesis planning mode can be presented to the user for reference through the simulated three-dimensional CT image, thereby further improving the accuracy of hip prosthesis planning.
[0151] See also Figure 8 , Figure 8 yes Figure 1 A second detailed flow chart of step S300 in FIG. Figure 8 As shown, in some implementations, step S300 includes: step S330 to step S340.
[0152] Step S330: After performing hip prosthesis planning, determine all first voxels in the third image that are located inside the prosthesis model based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in the hip offset planning mode in the three-dimensional space coordinate system, and set the colors of all first voxels in the third image to the colors corresponding to the prosthesis model to obtain a fourth image corresponding to the hip offset planning mode.
[0153] Step S340: Based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in the hip joint length planning mode in the three-dimensional space coordinate system, determine all first voxels in the third image located inside the prosthesis model, and set the colors of all first voxels in the third image to the colors corresponding to the prosthesis model to obtain a fourth image corresponding to the hip joint length planning mode.
[0154] The specific method of obtaining the fourth image in step S330 and step S340 refers to the above description.
[0155] Step S400: synthesizing the first image, the second image and the fourth image to obtain a simulated three-dimensional CT image.
[0156] In some embodiments, the corresponding first image, second image, and fourth image are synthesized in each hip prosthesis planning mode to obtain a simulated three-dimensional CT image.
[0157] See also Fig. 9 , Fig. 9 yes Figure 1 Detailed flow chart of step S400 in FIG. Fig. 9 As shown, in some implementations, step S400 includes: step S410 to step S430.
[0158] Step S410: resampling the first image based on the first image and the fourth image so that the size of the first image is the same as the size of the fourth image.
[0159] Exemplarily, when the VTK tool library is used, the ResampleImageFilter class is used to resample the first image based on the first image and the fourth image. Specifically, the fourth image is used as a reference image, and a suitable interpolator (such as the BSplineInterpolateImageFunction interpolator) is selected to resample the first image so that the size of the first image is the same as the size of the fourth image.
[0160] Step S420: resample the second image based on the second image and the fourth image so that the size of the second image is the same as the size of the fourth image.
[0161] Exemplarily, when using the VTK tool library, the ResampleImageFilter class is used to resample the second image based on the second image and the fourth image. Specifically, the fourth image is used as a reference image, and a suitable interpolator (such as a BSplineInterpolateImageFunction interpolator) is selected to resample the second image so that the size of the second image is the same as the size of the fourth image.
[0162] Step S430: Add the first image, the second image and the fourth image to obtain a simulated three-dimensional CT image.
[0163] Exemplarily, when the VTK tool library is used, the fourth image is added to the first image and the second image in sequence using the AddImageFilter function to obtain a simulated three-dimensional CT image.
[0164] In some embodiments, when the colors of all first voxels in the fourth image have been set to the color corresponding to the phantom model, each voxel in the simulated 3D CT image having the same position as the first voxel is set to the color corresponding to the first voxel.
[0165] In some embodiments, the user can specify a section in the simulated three-dimensional CT image where a two-dimensional X-ray image needs to be viewed according to his or her needs, and then the simulated two-dimensional X-ray image corresponding to the section can be obtained through the method of the present application.
[0166] In some embodiments, a designated section is determined according to a selection instruction, and then the simulated three-dimensional CT image is intercepted using the designated section to obtain a simulated two-dimensional X-ray image.
[0167] See also Fig. 10A and Fig. 10B , Fig. 10A is a schematic diagram of a first combination model provided in an embodiment of the present application, Fig. 10B It is a schematic diagram of a first simulated two-dimensional X-ray image provided in an embodiment of the present application.
[0168] like Fig. 10A As shown, the first combined model 3 is a combined model obtained in the hip joint offset planning mode. In some embodiments, the pelvic model 30 partially overlaps with the pelvic prosthesis model 40 to form a pelvic-pelvic prosthesis combined body model. The pelvic prosthesis model 40 includes an acetabular cup model 41 and a liner model 42.
[0169] In some embodiments, the right femur model 20 overlaps with the femoral prosthesis model 50 to form a femur-femoral prosthesis combined model. The femoral prosthesis model 50 includes a ball head model 51 and a femoral stem model 52.
[0170] like Fig. 10B As shown, the first simulated two-dimensional X-ray image 4 is a simulated two-dimensional X-ray image corresponding to the hip joint offset planning mode, and the bright white part in the first simulated two-dimensional X-ray image 4 represents the position of the prosthesis model in the hip joint offset planning mode. It can be seen that the first simulated two-dimensional X-ray image 4 is very clear, and the display effect is equivalent to that of a real two-dimensional X-ray image, indicating that the method for generating simulated X-ray images in hip joint prosthesis planning provided in the embodiment of the present application can achieve better processing effects.
[0171] See also Fig. 10C and Fig. 10D , Fig. 10C is a schematic diagram of a second combination model provided in an embodiment of the present application, Fig. 10D It is a schematic diagram of a second simulated two-dimensional X-ray image provided in an embodiment of the present application.
[0172] like Fig. 10C As shown, the second combined model 5 is a combined model obtained in the hip joint length planning mode.
[0173] like Fig. 10D As shown, the second simulated two-dimensional X-ray image 6 is a two-dimensional X-ray image corresponding to the hip joint length planning mode, and the bright white part in the second simulated two-dimensional X-ray image 6 represents the position of the prosthesis model in the hip joint length planning mode. It can be seen that the second simulated two-dimensional X-ray image 6 is very clear, and the display effect is equivalent to the real two-dimensional X-ray image, indicating that the method for generating simulated X-ray images in hip joint prosthesis planning provided in the embodiment of the present application can achieve a good processing effect.
[0174] See also Fig.11 , Fig.11 FIG. 1 is a flow chart of a third embodiment of a method for generating a simulated X-ray image in hip prosthesis planning provided in an embodiment of the present application. Fig.11 As shown, in some embodiments, the method for generating a simulated X-ray image in hip prosthesis planning further includes: step S500.
[0175] Step S500: inputting the simulated three-dimensional CT image into the ray projection model to obtain a simulated two-dimensional DRR image.
[0176] Among them, the prosthesis model is displayed in the simulated two-dimensional DRR image.
[0177] DRR (Digitally Reconstructed Radiograph) is a digitally reconstructed radiograph. DRR images are two-dimensional projection images obtained by computer simulation of the user's three-dimensional CT image observed from a specific perspective. In this way, the results of hip prosthesis planning can be presented to the user for reference on the simulated two-dimensional DRR image, thereby further improving the accuracy of hip prosthesis planning.
[0178] Exemplarily, when using the VTK tool library, the simulated three-dimensional CT image is used as the input image of the ResampleImageFilter class, wherein the RayCastInterpolateImageFunction function and the SetFocalPoint function are used to place the simulated X-ray light source at a preset distance directly in front of the simulated three-dimensional CT image, thereby obtaining a simulated two-dimensional DRR image.
[0179] In some embodiments, the user can specify an observation position in the simulated three-dimensional CT image where a simulated two-dimensional DRR image needs to be viewed according to his or her needs, and then the simulated two-dimensional DRR image corresponding to the observation position can be obtained through the method of the present application.
[0180] In some implementations, in step S500, a designated observation position is determined according to a selection instruction, and then relevant parameters in the ray casting model are adjusted to obtain a simulated two-dimensional DRR image corresponding to the observation position.
[0181] As described above, in some embodiments, the modes of hip prosthesis planning include a hip offset planning mode and a hip length planning mode.
[0182] Optionally, the simulated three-dimensional CT images corresponding to the hip joint offset planning pattern and the hip joint length planning pattern are respectively input into the ray projection model to obtain a simulated two-dimensional DRR image corresponding to the hip joint offset planning pattern and a simulated two-dimensional DRR image corresponding to the hip joint length planning pattern.
[0183] See also Fig. 12A and Fig. 12B , Fig. 12A is a schematic diagram of a first simulated two-dimensional DRR image provided in an embodiment of the present application, Fig. 12B is a schematic diagram of a second simulated two-dimensional DRR image provided in an embodiment of the present application. Fig. 12A and Fig. 12B As shown, the first simulated two-dimensional DRR image 7 and the second simulated two-dimensional DRR image 8 are very clear, and the display effect is equivalent to the real two-dimensional DRR image, indicating that the method for generating simulated X-ray images in hip prosthesis planning provided in the embodiment of the present application can achieve better processing effects.
[0184] In summary, the method for generating simulated X-ray images in hip prosthesis planning provided in the embodiment of the present application has the following advantages:
[0185] 1. By setting the colors of all the first voxels in the third image to the colors corresponding to the prosthesis model, a fourth image is obtained, and then the first image, the second image and the fourth image are synthesized to obtain a simulated three-dimensional CT image. The result of hip prosthesis planning can be presented to the user for reference through the simulated three-dimensional CT image, thereby improving the accuracy of hip prosthesis planning.
[0186] 2. By setting the colors of all voxels in each first voxel subset to the color corresponding to the first voxel subset, each sub-prosthesis model can be displayed differentiatedly, making it easier for the user to determine the exact position of each sub-prosthesis model based on the simulated three-dimensional CT image obtained based on the fourth image, thereby further improving the accuracy of hip prosthesis planning.
[0187] 3. By synthesizing the corresponding first image, second image and fourth image in each hip prosthesis planning mode to obtain a simulated three-dimensional CT image, the results of hip prosthesis planning in each hip prosthesis planning mode can be presented to the user for reference through the simulated three-dimensional CT image, thereby further improving the accuracy of hip prosthesis planning.
[0188] 4. By generating a simulated two-dimensional DRR image, the result of hip prosthesis planning can be presented to the user for reference on the simulated two-dimensional DRR image, thereby further improving the accuracy of hip prosthesis planning.
[0189] See also Fig.13 , Fig.13 Schematic diagram of the structure of a device for generating simulated X-ray images in hip prosthesis planning provided in an embodiment of the present application. Fig.13 As shown, the device 300 for generating simulated X-ray images in hip prosthesis planning includes an acquisition module 310 and a processing module 320 .
[0190] In some embodiments, the acquisition module 310 is used to acquire a three-dimensional CT image of the left femur model, the right femur model, and the target object.
[0191] In some embodiments, the processing module 320 is used to process the three-dimensional CT image based on the left femur model and the right femur model to obtain a first image that only displays the left femur of the target object, a second image that only displays the right femur of the target object, and a third image that does not display the left femur and the right femur; after hip prosthesis planning, all first voxels in the third image located inside the prosthesis model are determined based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in the three-dimensional space coordinate system, and the colors of all first voxels in the third image are set to the colors corresponding to the prosthesis model to obtain a fourth image, wherein the prosthesis model is composed of multiple vertices; the first image, the second image, and the fourth image are synthesized to obtain a simulated three-dimensional CT image.
[0192] See also Fig.14 , Fig.14 Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.14 As shown, the electronic device 400 includes: one or more processors 410 and a memory 420, Fig.14 A processor 410 is taken as an example.
[0193] In some implementations, the processor 410 and the memory 420 may be connected via a bus or other means. Fig.14 The example of connecting through bus is taken in the following.
[0194] In some embodiments, the processor 410 is used to obtain a three-dimensional CT image of a left femur model, a right femur model, and a target object; process the three-dimensional CT image based on the left femur model and the right femur model to obtain a first image that only displays the left femur of the target object, a second image that only displays the right femur of the target object, and a third image that does not display the left femur and the right femur; after hip prosthesis planning, determine all first voxels in the third image that are located inside the prosthesis model based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in the three-dimensional space coordinate system, and set the colors of all first voxels in the third image to the colors corresponding to the prosthesis model to obtain a fourth image, wherein the prosthesis model is composed of multiple vertices; synthesize the first image, the second image, and the fourth image to obtain a simulated three-dimensional CT image.
[0195] In some embodiments, the memory 420, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as the program instructions / modules of the method for generating simulated X-ray images in hip prosthesis planning in the embodiment of the present application. The processor 410 executes various functional applications and data processing of the electronic device 400 by running the non-volatile software programs, instructions and modules stored in the memory 420, that is, the method for generating simulated X-ray images in hip prosthesis planning in the above method embodiment is implemented.
[0196] In some embodiments, the memory 420 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device 400, etc. In addition, the memory 420 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 420 may optionally include a memory remotely arranged relative to the processor 410, and these remote memories may be connected to the controller via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0197] In some embodiments, one or more modules are stored in the memory 420, and when executed by one or more processors 410, the method for generating a simulated X-ray image in hip prosthesis planning in any of the above method embodiments is executed, for example, the method described above is executed. Figure 1 The method comprises steps S100 to S400.
[0198] Please refer to Fig.15 , Fig.15The computer-readable storage medium 500 stores a program code 510, which can be called by a processor to execute the method for generating a simulated X-ray image in hip prosthesis planning described in the above method embodiment.
[0199] The computer-readable storage medium 500 can be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk or a ROM. Optionally, the computer-readable storage medium includes a non-volatile computer-readable medium (non transitory computer readable storage medium). The computer-readable storage medium 500 has a storage space for program codes that execute any method steps in the method for generating simulated X-ray images in the above-mentioned hip prosthesis planning. These program codes can be read from or written into one or more computer program products. The program code can be compressed, for example, in an appropriate form.
[0200] In some embodiments, the embodiments of the present application also provide a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned method for generating simulated X-ray images in hip prosthesis planning.
[0201] In summary, the present application provides a method for generating simulated X-ray images in hip prosthesis planning and an electronic device, the method for generating simulated X-ray images in hip prosthesis planning comprising: obtaining a left femur model, a right femur model and a three-dimensional CT image of a target object; processing the three-dimensional CT image based on the left femur model and the right femur model to obtain a first image showing only the left femur of the target object, a second image showing only the right femur of the target object, and a third image not showing the left femur and the right femur; after hip prosthesis planning, determining all first voxels in the third image located inside the prosthesis model based on the coordinates of each voxel in the third image in a three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in a three-dimensional space coordinate system, and setting the colors of all first voxels in the third image to the colors corresponding to the prosthesis model to obtain a fourth image, wherein the prosthesis model is composed of multiple vertices; synthesizing the first image, the second image and the fourth image to obtain a simulated three-dimensional CT image. The present application obtains a fourth image by setting the color of all first voxels in the third image to the color corresponding to the prosthesis model, and then synthesizes the first image, the second image and the fourth image to obtain a simulated three-dimensional CT image. The result of hip prosthesis planning can be presented to the user for reference through a simulated three-dimensional CT image, thereby improving the accuracy of hip prosthesis planning.
[0202] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for generating a simulated X-ray image in hip prosthesis planning, characterized in that: include: Acquire a three-dimensional CT image of a left femur model, a right femur model, and a target object; Processing the three-dimensional CT image based on the left femur model and the right femur model to obtain a first image showing only the left femur of the target object, a second image showing only the right femur of the target object, and a third image not showing the left femur and the right femur, wherein the first image, the second image, and the third image are all three-dimensional images; After hip prosthesis planning is performed, all first voxels in the third image located inside the prosthesis model are determined based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in the three-dimensional space coordinate system, and the colors of all first voxels in the third image are set to the colors corresponding to the prosthesis model, to obtain a fourth image, wherein the prosthesis model is composed of a plurality of vertices; The first image, the second image and the fourth image are synthesized to obtain a simulated three-dimensional CT image.
2. The method for generating simulated X-ray images in hip prosthesis planning according to claim 1, characterized in that: The three-dimensional CT image is processed based on the left femur model and the right femur model to obtain a first image showing only the left femur of the target object, a second image showing only the right femur of the target object, and a third image not showing the left femur and the right femur, including: intercepting the three-dimensional CT image according to the left femur model or the right femur model to obtain the intercepted three-dimensional CT image; The captured three-dimensional CT image is processed based on the left femur model and the right femur model to obtain a first image that only displays the left femur of the target object, a second image that only displays the right femur of the target object, and a third image that does not display the left femur and the right femur.
3. The method for generating simulated X-ray images in hip prosthesis planning according to claim 2, characterized in that: The method of intercepting the three-dimensional CT image according to the left femur model or the right femur model to obtain the intercepted three-dimensional CT image includes: Determining the principal axis of the model based on the coordinates of each vertex on the left femur model or the right femur model; Selecting a point on the main axis close to the first end point of the main axis and at a distance from the first end point equal to a preset ratio multiplied by the length of the main axis as the first calculation point, wherein the physiological position of the first end point is close to the pelvis of the target object; The three-dimensional CT image is intercepted according to a plane that passes through the first calculation point and is parallel to a horizontal plane of a three-dimensional space coordinate system to obtain the intercepted three-dimensional CT image.
4. The method for generating a simulated X-ray image in hip prosthesis planning according to any one of claims 1 to 3, characterized in that: The left femur model and the right femur model are both composed of a plurality of vertices, and the three-dimensional CT image is processed based on the left femur model and the right femur model to obtain a first image showing only the left femur of the target object, a second image showing only the right femur of the target object, and a third image not showing the left femur and the right femur, including: Determine all second voxels in the three-dimensional CT image that are located inside the left femur model based on the coordinates of each voxel in the three-dimensional CT image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the left femur model in the three-dimensional space coordinate system; Setting the colors of all voxels in the three-dimensional CT image except the second voxel to a preset background color to obtain the first image; Determine all third voxels in the three-dimensional CT image that are located inside the right femur model based on the coordinates of each voxel in the three-dimensional CT image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the right femur model in the three-dimensional space coordinate system; Setting the colors of all voxels in the three-dimensional CT image except the third voxel to the background color to obtain the second image; The colors of all the second voxels and the third voxels in the three-dimensional CT image are set to the background color to obtain the third image.
5. The method for generating simulated X-ray images in hip prosthesis planning according to claim 1, characterized in that: After performing hip prosthesis planning, all first voxels in the third image located inside the prosthesis model are determined based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in the three-dimensional space coordinate system, and the colors of all first voxels in the third image are set to the colors corresponding to the prosthesis model, before obtaining the fourth image, the method further includes: Acquire a first position conversion matrix of the left femur model, a second position conversion matrix of the right femur model, and a third position conversion matrix of the pelvic model after hip joint prosthesis planning; Multiplying the first position conversion matrix by the first image, thereby moving the first image so that the position of the first image corresponds to the position of the left femoral model after hip prosthesis planning; multiplying the second position transformation matrix by the second image, thereby moving the second image so that the position of the second image corresponds to the position of the right femur model after hip prosthesis planning; The third position conversion matrix is multiplied by the third image, thereby moving the third image so that the position of the third image corresponds to the position of the pelvic model after hip joint prosthesis planning.
6. The method for generating simulated X-ray images in hip prosthesis planning according to claim 1, characterized in that: The prosthesis model includes a plurality of sub-prosthesis models. After hip joint prosthesis planning is performed, all first voxels in the third image located inside the prosthesis model are determined based on the coordinates of each voxel in the third image in a three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in a three-dimensional space coordinate system, and the colors of all first voxels in the third image are set to the colors corresponding to the prosthesis model, to obtain a fourth image, including: After hip prosthesis planning is performed, a first voxel subset located inside each sub-prosthesis model in the third image is determined based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of each sub-prosthesis model in the three-dimensional space coordinate system, to obtain a plurality of the first voxel subsets; The colors of all voxels in each of the first voxel subsets are set to the color corresponding to the first voxel subset to obtain the fourth image.
7. The method for generating simulated X-ray images in hip prosthesis planning according to claim 1, characterized in that: The hip prosthesis planning modes include a hip joint offset planning mode and a hip joint length planning mode. After the hip prosthesis planning is performed, all first voxels in the third image located inside the prosthesis model are determined based on the coordinates of each voxel in the third image in a three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in a three-dimensional space coordinate system, and the colors of all first voxels in the third image are set to the colors corresponding to the prosthesis model, to obtain a fourth image, including: After hip joint prosthesis planning is performed, all first voxels in the third image located inside the prosthesis model are determined based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in the hip joint offset planning mode in the three-dimensional space coordinate system, and the colors of all first voxels in the third image are set to the colors corresponding to the prosthesis model, so as to obtain a fourth image corresponding to the hip joint offset planning mode; Based on the coordinates of each voxel in the third image in the three-dimensional space coordinate system and the coordinates of each vertex on the surface of the prosthesis model in the hip joint length planning mode in the three-dimensional space coordinate system, all first voxels in the third image located inside the prosthesis model are determined, and the colors of all first voxels in the third image are set to the colors corresponding to the prosthesis model, so as to obtain a fourth image corresponding to the hip joint length planning mode.
8. The method for generating simulated X-ray images in hip prosthesis planning according to claim 1, characterized in that: The synthesizing the first image, the second image and the fourth image to obtain a simulated three-dimensional CT image includes: resampling the first image based on the first image and the fourth image so that a size of the first image is the same as a size of the fourth image; resampling the second image based on the second image and the fourth image so that a size of the second image is the same as a size of the fourth image; The simulated three-dimensional CT image is obtained by adding the first image, the second image and the fourth image.
9. The method for generating simulated X-ray images in hip prosthesis planning according to claim 1, characterized in that: The method further comprises: The simulated three-dimensional CT image is input into a ray projection model to obtain a simulated two-dimensional DRR image, in which the prosthesis model is displayed.
10. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method for generating simulated X-ray images in hip prosthesis planning as described in any one of claims 1 to 9.
Citation Information
Patent Citations
X-ray visual angle image generation method, storage medium and terminal equipment
CN109615602A
Image processing method and computing equipment
CN110428483A
Image processing method and device, electronic equipment and storage medium
CN114299177A
Knee joint replacement operation planning method, device and equipment based on X-ray image and storage medium
CN116019548A
Data processing method and device, equipment, medium and program product
CN118526284A
Cited By
Method for simulating imaging effect of X-ray film by using CT (Computed Tomography) image in prosthesis planning
CN120392291A
Method of using CT images to simulate X-ray imaging effects in prosthesis planning
CN120392291B