A multi-model virtual X-ray image generation method and related equipment
Through the multi-model virtual X-ray image generation method, tetrahedral mesh data and GPU parallel processing are used to solve the problems of low computational efficiency and insufficient imaging accuracy in the existing technology, and efficient and accurate virtual X-ray image generation is achieved, which is suitable for X-ray imaging simulation in various scenarios.
Patent Information
- Application Number
- CN202411522595.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2044-10-29
AI Technical Summary
The existing technology for generating virtual X-ray images has low computational efficiency and insufficient imaging accuracy, is difficult to process complex geometric structures and heterogeneous materials, and fails to fully utilize the parallel computing capabilities of GPUs.
A multi-model virtual X-ray image generation method is adopted. By receiving rays simulating real emission sources, using tetrahedral mesh data files for intersection detection and Beer-Lambert law calculation, combined with GPU parallel processing, high-quality virtual X-ray images are generated.
It improves computing efficiency, meets real-time application requirements, enhances imaging accuracy and authenticity, supports multi-object imaging, and is suitable for X-ray imaging simulation in various scenarios.
Smart Images

Figure CN119417926B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of X-ray digital imaging and computer graphics, and in particular to a multi-model virtual X-ray image generation method and related equipment. Background Art
[0002] Virtual X-ray imaging simulation has been widely used in medicine and engineering. In medical physics, X-rays are used to simulate their interaction with matter, improving the quality and accuracy of medical imaging, minimizing damage to normal tissue, and enhancing the effectiveness of treatments. Nondestructive testing, on the other hand, is a key application area in engineering. X-ray simulation can be used to detect defects, cracks, density distribution, and other aspects of materials to ensure product quality and safety without compromising the integrity of the object.
[0003] There are two main methods for simulating virtual X-ray images: Monte Carlo simulation and ray tracing. Jenu used Geant4 to develop an X-ray imaging dose simulator, creating a patient model based on CT scan data and simulating the absorbed X-ray dose. Research on ray tracing has primarily focused on the medical field. Frank proposed using triangular meshes to achieve real-time generation of virtual X-ray images in OpenGL, while Ehlke proposed using tetrahedral meshes to rapidly generate virtual X-ray images based on 3D anatomical models.
[0004] While Monte Carlo simulations can provide highly accurate X-ray absorption and scattering data, they are computationally expensive, especially for complex three-dimensional models. The large number of photon traces required during simulations results in lengthy computation times, making them difficult to implement in real-time or near-real-time applications.
[0005] Most existing technologies use point light sources to simulate X-rays. The light source model is relatively simple and cannot truly reflect the emission characteristics of the actual X-ray source, resulting in insufficient physical authenticity of the imaging results. Imaging processing is usually performed on a single model. When processing objects containing multiple materials or high heterogeneity, the accuracy and flexibility are often low, and there is a lack of support for multiple models or complex scenes, which affects the diagnostic or detection quality of the image. Summary of the Invention
[0006] In order to overcome the defects of the above-mentioned prior art, the purpose of the present invention is to provide a multi-model virtual X-ray image generation method and related equipment to solve the technical problems in the prior art such as low computational efficiency, insufficient imaging accuracy, difficulty in processing complex geometric structures and heterogeneous materials, and failure to fully utilize the parallel computing capabilities of GPUs.
[0007] The present invention is achieved through the following technical solutions:
[0008] In a first aspect, the present invention provides a method for generating a multi-model virtual X-ray image, comprising:
[0009] Receive the rays emitted by the X-ray source simulating the real emission source to each pixel point of the detector;
[0010] Loading model data to obtain a tetrahedral mesh data file, and extracting geometric information from the tetrahedral mesh data file;
[0011] detecting intersection information between the ray and the tetrahedral mesh data file, and outputting intersection data according to the intersection information;
[0012] The attenuation value of each ray penetrating the loading model and reaching the detector pixel is calculated based on the intersection data using the Bill-Lambert law;
[0013] The attenuation value is converted into a grayscale value, and a virtual X-ray image is generated through OpenCV based on the grayscale value.
[0014] Preferably, an OpenGL environment is initialized for the rays emitted by the X-ray source that simulates the real emission source to each pixel point of the detector and the detector position, the detector plane is divided into a pixel grid, the center coordinates of each pixel grid are calculated, and the ray direction is determined by the center coordinates, wherein initializing the OpenGL environment includes creating a context, setting the viewport and the projection matrix.
[0015] Preferably, the tetrahedral mesh data file of the model is loaded using the Assimp library, and the vertices and tetrahedral mesh data of the tetrahedral mesh data file are extracted.
[0016] Preferably, an intersection detection algorithm is used to detect whether the ray intersects with each face of the tetrahedral mesh data file. When the ray does not intersect with each face of the tetrahedral mesh data file, all other faces of the tetrahedral mesh data file are traversed and re-detected. When the ray intersects with each face of the tetrahedral mesh data file, intersection information is recorded to obtain intersection data.
[0017] Among them, the GPU is used to batch process the intersection detection information of all rays and tetrahedral mesh data files to obtain all intersection point data.
[0018] Furthermore, the specific process of obtaining intersection data according to the intersection information is as follows:
[0019] The path length of each ray within the tetrahedron is calculated based on the ray. When the number of intersections between the ray and the tetrahedron is even, the path length between each two intersections is calculated and accumulated according to the order of the intersections. Otherwise, the abnormal intersections are corrected and excluded, and the intersection information is re-recorded.
[0020] Furthermore, based on the initial intensity and path length of the ray, the set material properties and their corresponding attenuation coefficients, the Bill-Lambert law is applied to calculate the attenuation value of each ray penetrating the loading model and reaching the detector pixel. The attenuation value calculation task of each ray is assigned to the GPU, and the attenuation calculation of all rays is completed in parallel. The attenuation values are converted to grayscale values, normalized and mapped to the grayscale range to generate a complete grayscale image matrix. The final virtual X-ray image is displayed and saved using OpenCV.
[0021] Preferably, after generating a virtual X-ray image through OpenCV, a comprehensive image quality evaluation is performed based on the actual working conditions of smoke and filtrate sputtering conditions, motion blur, geometric blur caused by the size and shape of the X-ray light source, the energy spectrum of the X-ray light source, the radiation dose, and the imaging configuration, wherein the imaging configuration is optimized within the adjustable range of the source focal spot parameters, and a high-quality original image is obtained based on the quality evaluation indicators of the image signal-to-noise ratio and contrast; the high-quality original image is optimized by using a deep learning model based on a conditional generative adversarial network and / or a diffusion model to remove smoke and motion noise, and the X-ray image is optimized with high confidence under the established image quality evaluation system in combination with the light source parameters and imaging configuration during the actual shooting process.
[0022] In a second aspect, the present invention also provides a multi-model virtual X-ray image generation system, comprising
[0023] A ray receiving module is used to receive rays emitted by an X-ray source simulating a real emission source to each pixel point of the detector;
[0024] 3D model processing module, used to load model data to obtain tetrahedral mesh data file and extract geometric information of the tetrahedral mesh data file;
[0025] a ray projection module, configured to detect intersection information between the ray and the tetrahedral mesh data file, and output intersection point data according to the intersection information;
[0026] An attenuation calculation module is used to calculate the attenuation value of each ray penetrating the loading model and reaching the detector pixel using the Bill-Lambert law based on the intersection data;
[0027] The image processing module is used to convert the attenuation value into a grayscale value, and generate a virtual X-ray image based on the grayscale value through OpenCV.
[0028] In a third aspect, the present invention also provides a mobile terminal, characterized in that it includes a memory, a processor, and a computer program stored in the memory and runnable on the processor, and when the processor executes the computer program, it implements the multi-model virtual X-ray image generation method as described above.
[0029] In a fourth aspect, the present invention further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the multi-model virtual X-ray image generation method as described above.
[0030] Compared with the prior art, the present invention has the following beneficial technical effects:
[0031] The present invention provides a multi-model virtual X-ray image generation method. Through GPU acceleration technology, the computational efficiency of virtual X-ray image generation is improved, the computational time is reduced, and thus the needs of real-time applications are met. Secondly, combined with a more realistic Gaussian spherical source simulation, by optimizing tetrahedral mesh generation and processing technology, the present invention improves the accuracy and authenticity of imaging, reduces interpolation errors, and is closer to the actual radiation distribution. In addition, objects with different material properties and photon energies of different energy levels can be set, which can accurately simulate the X-ray interaction of heterogeneous materials, and on this basis support simultaneous imaging of multiple objects, thereby improving the flexibility and applicability of the simulation.
[0032] Furthermore, by loading different tetrahedral mesh data files, the X-ray attenuation effects of objects of varying shapes, materials, and structures can be easily simulated. This flexibility makes this method widely applicable in a variety of scenarios, such as X-ray imaging simulation of objects of varying shapes and non-destructive testing of internal material structures. Furthermore, as the model data is updated and expanded, the method can continue to adapt to new application needs.
[0033] Furthermore, the Beer-Lambert law is used to precisely calculate the attenuation of rays as they pass through an object, ensuring the accuracy of the generated image. Furthermore, by using an efficient algorithm to process intersection data and convert attenuation values, this method improves computational efficiency and reduces the time required to generate images while maintaining image quality.
[0034] Furthermore, the calculated attenuation values are converted into grayscale values, and virtual X-ray images are generated through image processing libraries such as OpenCV, making the results more intuitive and easy to understand. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 Schematic diagram of a method for generating a multi-model virtual X-ray image according to an embodiment of the present invention;
[0036] Figure 2 is a detailed flow chart of a method for generating a multi-model virtual X-ray image in an embodiment of the present invention;
[0037] Figure 3 3D spatial schematic diagram of the model and virtual X-ray imaging results in an embodiment of the present invention;
[0038] Figure 4 A virtual X-ray image of the armature displayed by the detector imaging plate in an embodiment of the present invention;
[0039] Figure 5 Schematic diagram of how a square iron sheet and a circular copper sheet set different energy levels for photon energies of X-rays penetrating the model in an embodiment of the present invention;
[0040] Figure 6 Schematic diagram of the structure of a multi-model virtual X-ray image generation system according to an embodiment of the present invention;
[0041] In the figure: 1-ray receiving module; 2-3D model processing module; 3-ray projection module; 4-attenuation calculation module; 5-image processing module. DETAILED DESCRIPTION
[0042] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0043] The present invention is described in further detail below with reference to the accompanying drawings:
[0044] The purpose of the present invention is to provide a multi-model virtual X-ray image generation method and related equipment to solve the technical problems in the existing technology, such as low computational efficiency, insufficient imaging accuracy, difficulty in processing complex geometric structures and heterogeneous materials, and failure to fully utilize the parallel computing capabilities of GPUs.
[0045] See also Figure 1 and Figure 2 In one embodiment of the present invention, a method for generating a multi-model virtual X-ray image is provided, comprising the following steps:
[0046] Step 1: receiving a ray emitted by an X-ray source simulating a real emission source toward each pixel of the detector, wherein the emission source follows a Gaussian probability density function;
[0047] Specifically, the OpenGL environment is initialized for the rays emitted by the X-ray source that simulates the real emission source to each pixel point of the detector and the detector position, the detector plane is divided into a pixel grid, the center coordinates of each pixel grid are calculated, and the ray direction is determined by the center coordinates. Initializing the OpenGL environment includes creating a context, setting the viewport and projection matrix.
[0048] The specific initialization process includes:
[0049] Detector Position and Attitude Setting: First, the detector position and its attitude in three-dimensional space (such as orientation and angle) need to be determined. This is usually based on the layout of the actual X-ray imaging equipment or according to simulation requirements.
[0050] Detector plane segmentation: The detector plane is divided into multiple small pixel grids. Each grid represents a pixel on the detector, which is used to receive radiation from the X-ray source and measure its intensity after attenuation.
[0051] The density of the grid (i.e., pixel size) determines the resolution of the image. Higher resolution means finer image details, but may also lead to increased computational effort.
[0052] The specific process of ray emission and direction determination includes:
[0053] X-ray source settings: Set the position, energy distribution, emission characteristics, and diameter of the X-ray source to simulate the behavior of a real source.
[0054] The energy distribution may include multiple energy levels to support simulation of multispectral or multienergy imaging.
[0055] Pixel grid center coordinate calculation: Calculates the center coordinates of each pixel grid. These coordinates will be used as the starting point or target point for ray shooting, depending on the specific implementation of the simulation.
[0056] In some cases, a ray may be emitted from an X-ray source toward the center of each pixel grid to simulate the response of each pixel on the detector.
[0057] Ray direction determination: The direction of each ray can be calculated using the center coordinates of the pixel grid and the position of the X-ray source.
[0058] The ray direction is usually a straight line from the X-ray source to the center of the detector pixel grid.
[0059] Initializing the OpenGL environment includes:
[0060] Create an OpenGL context: Create a window using GLFW, SDL, or other window libraries, and create an OpenGL context on the window, which is the execution environment for OpenGL rendering operations.
[0061] Set the viewport: By calling the glViewport function, set the viewport size for OpenGL rendering, that is, the window area that the rendering result will cover, to ensure that the rendered image fills the window correctly.
[0062] Set the projection matrix: Create the projection matrix: Calculate the projection matrix according to the desired visual effect (such as perspective projection or orthographic projection), and upload the calculated projection matrix to the OpenGL shader program through glUniformMatrix4fv (or other similar functions).
[0063] Step 2: Load the model data to obtain a tetrahedral mesh data file, and extract the geometric information of the tetrahedral mesh data file;
[0064] Specifically, the tetrahedral mesh data file of the model is loaded using the Assimp library, and the vertices and tetrahedral mesh data of the tetrahedral mesh data file are extracted.
[0065] To load a model using Assimp, call one of its import functions (e.g., aiImportFile) and pass in the file path containing the tetrahedral mesh data. Assimp parses the file and converts it into an internal scene graph representation, which includes information such as vertices, faces (tetrahedra in the case of tetrahedral meshes), textures, and materials. It then traverses the Assimp scene graph and extracts the vertex and tetrahedron data for the tetrahedral mesh (typically as an array of face indices, with each tetrahedron defined by four vertex indices).
[0066] Draw the tetrahedron mesh: Use glDrawElements (or similar function) and the VAO created earlier to draw the tetrahedron mesh. OpenGL will automatically render the tetrahedron mesh based on the vertex data and index array.
[0067] Step 3, detecting intersection information between the ray and the tetrahedral mesh data file, and outputting intersection data according to the intersection information;
[0068] Specifically, an intersection detection algorithm is used to detect whether the ray intersects with each face of the tetrahedral mesh data file. When the ray does not intersect with each face of the tetrahedral mesh data file, all other faces of the tetrahedral mesh data file are traversed and re-detected. When the ray intersects with each face of the tetrahedral mesh data file, intersection information is recorded to obtain intersection data.
[0069] Among them, the GPU is used to batch process the intersection detection information of all rays and tetrahedral mesh data files to obtain all intersection point data.
[0070] The specific process of obtaining intersection data according to intersection information is as follows:
[0071] The path length of each ray within the tetrahedron is calculated based on the ray. When the number of intersections between the ray and the tetrahedron is even, the path length between each two intersections is calculated and accumulated according to the order of the intersections. Otherwise, the abnormal intersections are corrected and excluded, and the intersection information is re-recorded.
[0072] The specific process of intersection detection in this embodiment is as follows:
[0073] Ray Shooting: For each ray shot from the X-ray source toward the center of the detector pixel grid, an intersection check is performed.
[0074] Face-by-face detection: For each ray, traverse each tetrahedron (also called "unit" or "voxel") in the tetrahedron mesh data file. For each tetrahedron, check whether the ray intersects any of its faces.
[0075] Geometric intersection test: Commonly used algorithms include the Möller-Trumbore algorithm or the Plücker coordinate method. These algorithms can efficiently detect whether a ray intersects a triangle (a face of a tetrahedron) and calculate the intersection point.
[0076] To improve efficiency, a space partitioning structure (such as an octree, KD tree, or BSP tree) can be used to reduce the number of tetrahedrons that need to be detected.
[0077] Intersection information and intersection sorting are recorded through intersection points.
[0078] In the path length calculation and exception handling of this embodiment, for the sorted intersections, the path length (i.e., the length of the ray segment) between each two adjacent intersections is calculated. This is typically achieved by calculating the Euclidean distance between the two points. If the number of intersections between the ray and the tetrahedron is even, this typically means that the ray completely penetrates a tetrahedron or a series of tetrahedrons (not considering reflections within the tetrahedron). In this case, the path lengths between each two adjacent intersections are accumulated to obtain the total path length. If the number of intersections is odd, there may be anomalies (e.g., the ray's starting point or end point is located within the tetrahedron), and these abnormal intersections need to be corrected and eliminated, and then the valid intersection information needs to be re-recorded.
[0079] This embodiment leverages the parallel processing capabilities of the GPU to significantly accelerate the intersection detection process between rays and tetrahedron meshes. By sending ray and tetrahedron data to the GPU and executing the intersection detection algorithm on the GPU, multiple rays and tetrahedrons can be processed simultaneously, significantly reducing processing time.
[0080] Step 4: Calculate the attenuation value of each ray on the detector pixel using the Beer-Lambert law based on the intersection data;
[0081] Specifically, based on the initial intensity, path length, set material properties and their corresponding attenuation coefficients of the ray, the Bill-Lambert law is applied to calculate the attenuation value of each ray on the detector pixel, and the attenuation value calculation task of each ray is assigned to the GPU to complete the attenuation calculation of all rays in parallel.
[0082] Among them, the mathematical expression of Bill-Lambert's law is:
[0083] I = I 0⋅ e −μ⋅x
[0084] in, I 0 is the initial intensity of the ray, I is the intensity of the ray after passing through the medium, μ is the attenuation coefficient of the medium, x is the path length that the ray travels in the medium.
[0085] For each ray, the attenuation value in each tetrahedral element it passes through is calculated based on the material properties and path length of the element. These attenuation values are then accumulated to obtain the total attenuation value of the ray before it reaches the detector.
[0086] Step 5: Convert the attenuation value to a grayscale value, and generate a virtual X-ray image based on the grayscale value using OpenCV.
[0087] Specifically, the attenuation values are converted to grayscale values, normalized and mapped to a grayscale range to generate a complete grayscale image matrix, and the final virtual X-ray image is displayed and saved using OpenCV.
[0088] Here, the attenuation values are linearly mapped to the grayscale range (usually 0 to 255). This can be achieved by normalizing the attenuation values to a fixed range (such as 0 to 1) and then multiplying them by 255. However, because the physical meaning and range of attenuation values can vary depending on different materials and ray energies, the attenuation values may need to be scaled or offset first to ensure that they can be reasonably mapped to the grayscale range.
[0089] A nonlinear transfer function (such as a logarithmic function, exponential function, or S-shaped curve) is used to map the attenuation value to the grayscale value. These functions can be adjusted as needed to produce a more natural image or to emphasize specific features.
[0090] Before converting the attenuation values to grayscale, it is usually necessary to normalize them to ensure that all values are within a comparable range. Normalization can be achieved by subtracting the minimum attenuation value from each value and dividing it by the difference between the maximum and minimum values, thereby scaling the values to between 0 and 1.
[0091] Once the attenuation values are normalized, they can be multiplied by 255 (or the maximum value of the grayscale range) and then rounded to the nearest integer to obtain the grayscale values. These grayscale values will form the elements of the grayscale image matrix.
[0092] The grayscale image matrix is a two-dimensional array where each element corresponds to the grayscale value of a pixel in the image. This matrix is populated based on the results of ray intersection checks with the tetrahedral mesh and attenuation calculations. Typically, the size of the matrix corresponds to the size of the detector pixel grid.
[0093] according to Figure 3 As shown, a 3D space schematic diagram of the model and virtual X-ray imaging results (taking the armature model as an example) includes a spherical Gaussian source, an armature model, and a detector imaging plate, all of which can be adjusted in position and direction.
[0094] according to Figure 4 As shown, the detector imaging plate displays a virtual X-ray image of the armature.
[0095] according to Figure 5 As shown in the figure, there are two models, a square iron sheet with a width of 100 mm and a thickness of 6 mm, and a circular copper sheet with a diameter of 50 mm and a thickness of 0.5 mm. Different energy levels of photon energy are set for the X-rays penetrating the models (equivalent to setting different attenuation coefficients for the models). The detector imaging board displays a virtual X-ray image of the armature.
[0096] In the present invention, after the virtual X-ray image is initially generated, a series of actual working conditions such as smoke and filtrate splashing conditions, motion blur, geometric blur caused by the size and shape of the X-ray source, X-ray source energy spectrum, radiation dose, and imaging configuration are considered to establish a comprehensive image quality evaluation method. The imaging configuration is optimized within the adjustable range of the source focal spot parameters, and quality evaluation indicators such as image signal-to-noise ratio and contrast are considered to obtain a high-quality original image.
[0097] Next, we employ deep learning-based image optimization methods, employing deep learning models based on conditional generative adversarial networks and / or diffusion models, to remove smoke and motion noise, improve contrast, and enhance signal-to-noise ratio. In combination with actual light source parameters and imaging configurations during the capture process, we optimize X-ray images with high confidence within an established image quality evaluation system.
[0098] In summary, the present invention provides a multi-model virtual X-ray image generation method, which improves the computational efficiency of virtual X-ray image generation and reduces the computational time through GPU acceleration technology, thereby meeting the needs of real-time applications. Secondly, combined with a more realistic Gaussian spherical source simulation, by optimizing the tetrahedral mesh generation and processing technology, the present invention improves the accuracy and authenticity of imaging, reduces interpolation errors, and is closer to the actual radiation distribution. In addition, objects with different material properties and photon energies of different energy levels can be set, which can accurately simulate the X-ray interaction of heterogeneous materials, and on this basis support the simultaneous imaging of multiple objects, thereby improving the flexibility and applicability of the simulation.
[0099] Example 2
[0100] according to Figure 6 As shown, this embodiment also provides a multi-model virtual X-ray image generation system, including
[0101] The ray receiving module 1 is used to receive the ray emitted by the X-ray source simulating the real emission source to each pixel point of the detector;
[0102] 3D model processing module 2, used for loading model data to obtain tetrahedral mesh data file and extracting geometric information of the tetrahedral mesh data file;
[0103] A ray projection module 3 is used to detect the intersection information between the ray and the tetrahedral mesh data file, and output the intersection data according to the intersection information;
[0104] Attenuation calculation module 4, used to calculate the attenuation value of each ray penetrating the loading model and reaching the detector pixel using the Beer-Lambert law according to the intersection data;
[0105] The image processing module 5 is configured to convert the attenuation value into a grayscale value, and generate a virtual X-ray image based on the grayscale value through OpenCV.
[0106] Example 3
[0107] The present invention also provides a mobile terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, such as a multi-model virtual X-ray image generation program.
[0108] When the processor executes the computer program, the steps of the above-mentioned multi-model virtual X-ray image generation method are implemented, for example:
[0109] Receive the rays emitted by the X-ray source simulating the real emission source to each pixel point of the detector;
[0110] Loading model data to obtain a tetrahedral mesh data file, and extracting geometric information from the tetrahedral mesh data file;
[0111] detecting intersection information between the ray and the tetrahedral mesh data file, and outputting intersection data according to the intersection information;
[0112] The attenuation value of each ray penetrating the loading model and reaching the detector pixel is calculated based on the intersection data using the Bill-Lambert law;
[0113] The attenuation value is converted into a grayscale value, and a virtual X-ray image is generated through OpenCV based on the grayscale value.
[0114] Alternatively, when the processor executes the computer program, the functions of each module in the above system are realized, for example:
[0115] The ray receiving module 1 is used to receive the ray emitted by the X-ray source simulating the real emission source to each pixel point of the detector;
[0116] 3D model processing module 2, used for loading model data to obtain tetrahedral mesh data file and extracting geometric information of the tetrahedral mesh data file;
[0117] A ray projection module 3 is used to detect the intersection information between the ray and the tetrahedral mesh data file, and output the intersection data according to the intersection information;
[0118] Attenuation calculation module 4, used to calculate the attenuation value of each ray penetrating the loading model and reaching the detector pixel using the Beer-Lambert law according to the intersection data;
[0119] The image processing module 5 is configured to convert the attenuation value into a grayscale value, and generate a virtual X-ray image based on the grayscale value through OpenCV.
[0120] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, and the instruction segments are used to describe the execution process of the computer program in the mobile terminal.
[0121] For example, the computer program may be divided into a ray receiving module 1 , a 3D model processing module 2 , a ray projection module 3 , an attenuation calculation module 4 and an image processing module 5 ;
[0122] The ray receiving module 1 is used to receive the ray emitted by the X-ray source simulating the real emission source to each pixel point of the detector;
[0123] 3D model processing module 2, used for loading model data to obtain tetrahedral mesh data file and extracting geometric information of the tetrahedral mesh data file;
[0124] A ray projection module 3 is used to detect the intersection information between the ray and the tetrahedral mesh data file, and output the intersection data according to the intersection information;
[0125] Attenuation calculation module 4, used to calculate the attenuation value of each ray penetrating the loading model and reaching the detector pixel using the Beer-Lambert law according to the intersection data;
[0126] The image processing module 5 is configured to convert the attenuation value into a grayscale value, and generate a virtual X-ray image based on the grayscale value through OpenCV.
[0127] The mobile terminal 6 may be a computing device such as a desktop computer, a notebook, a palmtop computer, a cloud server, etc. The mobile terminal may include, but is not limited to, a processor and a memory.
[0128] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the mobile terminal, connecting various parts of the entire mobile terminal using various interfaces and lines.
[0129] The memory may be used to store the computer programs and / or modules, and the processor implements various functions of the mobile terminal by running or executing the computer programs and / or modules stored in the memory and calling the data stored in the memory.
[0130] The memory may primarily include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function (such as sound playback or image playback); the data storage area may store data generated based on the use of the mobile phone (such as audio data and a phone book). Furthermore, the memory may include high-speed random access memory (RAM) and non-volatile memory, such as a hard disk, internal memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0131] Example 4
[0132] The present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the multi-model virtual X-ray image generation method.
[0133] If the module / unit integrated in the mobile terminal is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
[0134] Based on this understanding, the present invention can implement all or part of the processes in the above-mentioned method by using a computer program to instruct relevant hardware. The computer program can be stored in a computer-readable storage medium. When executed by a processor, the computer program can implement the steps of the above-mentioned multi-model virtual X-ray image generation method. The computer program includes computer program code, which can be in source code form, object code form, executable file, or some intermediate form.
[0135] The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc.
[0136] It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practices in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practices, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0137] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered by the scope of protection of the claims of the present invention.
Claims
1. A method for generating a multi-model virtual X-ray image, characterized in that: include: Receive the rays emitted by the X-ray source simulating the real emission source to each pixel point of the detector; Loading model data to obtain a tetrahedral mesh data file, and extracting geometric information from the tetrahedral mesh data file; detecting intersection information between the ray and the tetrahedral mesh data file, and outputting intersection data according to the intersection information; The attenuation value of each ray penetrating the loading model and reaching the detector pixel is calculated based on the intersection data using the Bill-Lambert law; Converting the attenuation value to a grayscale value, and generating a virtual X-ray image based on the grayscale value using OpenCV; wherein, an intersection detection algorithm is used to detect whether the ray intersects with each face of the tetrahedral mesh data file; if the ray does not intersect with each face of the tetrahedral mesh data file, all other faces of the tetrahedral mesh data file are traversed and re-detected; if the ray intersects with each face of the tetrahedral mesh data file, intersection information is recorded to obtain intersection data; Among them, the GPU is used to batch process the intersection detection information of all ray and tetrahedral mesh data files to obtain all intersection data; The specific process of obtaining intersection data based on intersection information is as follows: Calculate the path length of each ray within the tetrahedron. If the number of intersections between the ray and the tetrahedron is even, calculate and accumulate the path length between each two intersections in order of the intersections. Otherwise, correct and exclude abnormal intersections and re-record the intersection information. Based on the initial intensity of the ray, the path length, the set material properties and their corresponding attenuation coefficients, the Bill-Lambert law is applied to calculate the attenuation value of each ray penetrating the loading model and reaching the detector pixel.
2. The method for generating a multi-model virtual X-ray image according to claim 1, wherein: Initialize the OpenGL environment for the rays emitted by the X-ray source that simulates the real emission source to each pixel point of the detector and the detector position, divide the detector plane into pixel grids, calculate the center coordinates of each pixel grid, and determine the ray direction through the center coordinates. Initializing the OpenGL environment includes creating a context, setting the viewport and projection matrix.
3. The method for generating a multi-model virtual X-ray image according to claim 1, wherein: Use the Assimp library to load the tetrahedral mesh data file of the model and extract the vertices and tetrahedral mesh data of the tetrahedral mesh data file.
4. The method for generating a multi-model virtual X-ray image according to claim 1, wherein: The attenuation value calculation task of each ray is assigned to the GPU, and the attenuation calculation of all rays is completed in parallel. The attenuation value is converted to a grayscale value, normalized and mapped to a grayscale range to generate a complete grayscale image matrix. The final virtual X-ray image is displayed and saved using OpenCV.
5. The method for generating a multi-model virtual X-ray image according to claim 1, wherein: After generating a virtual X-ray image using OpenCV, a comprehensive image quality evaluation is performed based on the actual working conditions of smoke and filtrate splashing conditions, motion blur, geometric blur caused by the size and shape of the X-ray light source, the X-ray light source energy spectrum, radiation dose, and imaging configuration. The imaging configuration is optimized within the adjustable range of the source focal spot parameters, and a high-quality original image is obtained based on the quality evaluation indicators of image signal-to-noise ratio and contrast. The high-quality original image is optimized using a deep learning model based on a conditional generative adversarial network and / or a diffusion model to remove smoke and motion noise. Combined with the light source parameters and imaging configuration during the actual shooting process, the X-ray image is optimized with high confidence under the established image quality evaluation system.
6. A multi-model virtual X-ray image generation system, based on a multi-model virtual X-ray image generation method according to any one of claims 1 to 5, characterized in that: include A ray receiving module (1) is used to receive rays emitted by an X-ray source simulating a real emission source toward each pixel of the detector; 3D model processing module (2), used for loading model data to obtain tetrahedral mesh data file and extracting geometric information of the tetrahedral mesh data file; A ray projection module (3) is used to detect intersection information between the ray and the tetrahedral mesh data file, and output intersection data according to the intersection information; An attenuation calculation module (4) is used to calculate the attenuation value of each ray penetrating the loading model and reaching the detector pixel using the Bill-Lambert law based on the intersection data; An image processing module (5) is used to convert the attenuation value into a grayscale value, and generate a virtual X-ray image based on the grayscale value through OpenCV.
7. A mobile terminal, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for generating a multi-model virtual X-ray image according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the multi-model virtual X-ray image generation method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Image projection recovery method based on X ray source array imaging
CN106706681A
Neural network training method and system
CN112489189A