Linear accelerator plan verification anti-collision system

Through the virtual radiotherapy scene three-dimensional model and DICOM data three-dimensional reconstruction module combined with the rigid body collision detection module, the collision detection problem between the linear accelerator treatment head, treatment bed and patients is solved, the accuracy and safety of radiotherapy are improved, and the treatment plan is optimized. , and improve work efficiency.

CN119303250AInactive Publication Date: 2025-01-14THE FIRST AFFILIATED HOSPITAL OF FUJIAN MEDICAL UNIV
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411858637.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-01-14
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

During the radiation treatment process of medical linear accelerators, traditional methods are difficult to accurately determine whether there will be collisions between the treatment head, treatment bed and the patient, resulting in possible injuries and equipment damage, and cannot meet the accuracy, safety and efficiency of modern medical care. sexual requirements.

Method used

Using the virtual radiotherapy scene three-dimensional model building module and the DICOM data three-dimensional reconstruction model module, combining rigid body characteristics and collision detection module, through three-dimensional modeling and collision detection algorithm, simulate the treatment environment and detect the collision between the treatment head, treatment bed and patients. , provide real-time feedback.

Benefits of technology

Improve the accuracy and safety of radiotherapy, avoid equipment damage and patient injuries, optimize treatment plans, improve work efficiency and training results, and effectively utilize DICOM data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure QLYQS_1
    Figure QLYQS_1
  • Figure QLYQS_2
    Figure QLYQS_2
  • Figure QLYQS_9
    Figure QLYQS_9
Patent Text Reader

Abstract

The invention relates to the technical field of medical instruments, in particular to a linear accelerator plan verification anti-collision system. According to the invention, the problem of collision detection in medical linear accelerator treatment is solved by means of a virtual simulation technology. Three-dimensional modeling is carried out on the actual situation of a radiotherapy room, a virtual radiotherapy scene three-dimensional model is constructed, splitting modeling is carried out on all components of a therapy machine, and a real case therapy scene can be presented in combination with a DICOM data three-dimensional reconstruction model. Rigid body characteristics and a collision detection principle are utilized to perform collision detection on three groups of models of an accelerator treatment head, a treatment bed and a patient, and the motion condition of each component is accurately simulated and collision is detected by endowing a proper collider and researching an algorithm of the collider. The beneficial effects are that radiotherapy accuracy and safety are improved, and equipment damage and patient injury are avoided; the working efficiency is improved, and the treatment plan can be previewed and adjusted in real time; meanwhile, training of new employees is facilitated, data resources can be integrated, DICOM data and rigid body characteristics are better utilized, and the radiotherapy process is optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of medical equipment, in particular to a linear accelerator plan verification anti-collision system. Background Art

[0002] With the continuous development of medical technology, radiotherapy is increasingly used in tumor treatment. However, during the radiotherapy process of medical linear accelerators, the collision problem has always been a difficult problem for doctors and physicists.

[0003] At present, the traditional radiotherapy process mainly relies on the experience of doctors and physicists to judge whether there will be a collision between the treatment head, the treatment bed and the patient. This method is not only difficult to ensure accuracy, but also inefficient. Once a collision occurs, it may cause serious harm to the patient and damage expensive medical equipment.

[0004] In addition, with the development of three-dimensional imaging technology, such as the widespread use of DICOM file data, the demand for accurate simulation and visualization of radiotherapy processes is increasing; traditional radiotherapy planning and implementation methods can no longer meet the requirements of modern medical care for accuracy, safety and efficiency.

[0005] Therefore, a linear accelerator planning verification anti-collision system is proposed to address the above problems. Summary of the invention

[0006] The object of the present invention is to provide a linear accelerator plan verification and anti-collision system to solve the problems raised in the above background technology.

[0007] To achieve the above object, the present invention provides the following technical solutions:

[0008] A linear accelerator program verifies a collision avoidance system, comprising:

[0009] Virtual radiotherapy scene 3D model building module; used to perform 3D modeling of the actual situation in the radiotherapy room, split the treatment machine frame, treatment head, treatment bed and related equipment into 3D model components, and perform modeling based on the modeling software to simulate the real treatment environment and the patient's CT structure, and present and simulate the 3D information of the treatment room including the linear accelerator, treatment bed and multi-leaf light shed, various auxiliary tools, patient anatomical structure and dose distribution in real time;

[0010] DICOM data 3D reconstruction model module: used to perform 3D reconstruction and processing of DICOM file data, convert it into a CT 3D model of the patient, establish a corresponding DICOM 3D model database, and combine it with the virtual treatment scene to present and simulate the treatment scenario of real cases in real environment in real time;

[0011] Rigid body characteristics and collision detection module; including rigid body component setting unit and collision detection algorithm unit;

[0012] The rigid body component setting unit is used to assign one or more colliders among a ball collider, a box collider or a capsule collider to the three groups of models of the accelerator treatment head, the treatment bed and the patient according to the shape of the three-dimensional model;

[0013] The collision detection algorithm unit is used to study the principles and algorithms of collision detection of the three groups of models, simulate the movement of each component, detect the collision between components at different field angles and patient positions, and feedback the detection result information to the user interface.

[0014] As a preferred solution, the virtual treatment room constructed by the virtual radiotherapy scene three-dimensional model construction module also includes an external actual control device to operate the virtual accelerator for interactive operation training, as well as a display screen that can provide linear accelerator status information and a laser light for patient positioning.

[0015] As a preferred solution, the DICOM data 3D reconstruction model module uses a MarchingCubes algorithm based on surface rendering and / or a Ray-casting algorithm based on volume rendering to perform 3D reconstruction, wherein:

[0016] The MarchingCubes algorithm based on surface rendering regards the two-dimensional slice data as a three-dimensional data field, and constructs the surface mesh of the three-dimensional model by extracting the isosurface of the three-dimensional data, and then constructs the three-dimensional model;

[0017] The ray-casting algorithm based on volume rendering emits a ray from each pixel in the image plane along the line of sight. This ray passes through the volume data set and is sampled according to the set step size. The color value and opacity of each sampling point are calculated by interpolation, and then the accumulated color value and opacity value are calculated point by point from front to back or from back to front until the light is completely absorbed or passes through the object.

[0018] As a preferred solution, the collision detection algorithm unit of the rigid body characteristic and collision detection module specifically includes the following steps when performing collision detection:

[0019] All faces of a rigid body are intersected with all faces of another rigid body in turn, transforming the spatial problem into several plane problems;

[0020] For the intersection between faces, including:

[0021] Intersect all the edges of a face with all the planes of another face, then perform inclusion check on the intersection points and the face to extract valid intersection points;

[0022] All edges of another face are intersected with the plane where the face is located, and then the intersection points and the face are checked for inclusion to extract valid intersection points;

[0023] The midpoint of each pair of valid intersection points is checked for inclusion with the two faces respectively. If the midpoint is in both one face and the other face, then the pair of intersection points defines an intersection line segment, thereby converting the problem of finding the intersection between faces into a combined problem of finding the intersection between a line segment and an infinite plane and checking the inclusion of a point and a bounded plane.

[0024] As a preferred solution, a rigid body translation and rotation calculation module is also included to calculate the movement of the treatment system model. The movement of the treatment system model includes:

[0025] The movement of the frame, i.e. the clockwise or counterclockwise rotation of the vertical plane around the central axis;

[0026] Movement of the treatment bed, including left-right and front-back movement and rotation of the entire treatment bed;

[0027] The movement of the small head, that is, the rotation when realizing the dynamic multi-leaf grating; the rigid body translation and rotation calculation module uses a specific coordinate transformation formula to calculate the rigid body translation in any direction and rotation around any axis.

[0028] As a preferred solution, the rigid body translation and rotation calculation module calculates the translation of the rigid body in any direction. When the length is unit, according to the formula Calculate, where , , ,set up , and The cosines of the axis angles are the above values, where: , , Respectively, vector and The angle corresponding to the cosine value of the angle in the positive direction of the axis, For two points in space and The vector formed by and Represents the midpoint of space and The coordinate component on the x-axis, and Represents the midpoint of space and The coordinate component on the y-axis, and Represents the midpoint of space and The coordinate component on the z-axis.

[0029] As a preferred solution, the rigid body translation and rotation calculation module determines the rotation operator represented by quaternions when calculating the rotation angle θ of the rigid body around any axis in space. ,in, for The real part of yes The imaginary vector is a unit vector, and Any point in space The quaternions are expressed as , its position after rotating around the axis by angle θ The quaternions are expressed as , the calculation process first calculates ,in, ,but , then calculate , and finally calculate ,in, express and The dot product of ,set up ,but , , then transform Order Matrix It is expressed as: ; If you want to rotate an angle around any axis in space, you need to consider the problem of rotating an angle around any axis passing through the origin. This can be solved by the following steps: Assume is along The unit vector in the direction Translate to the origin; Rotation Angle; do the inverse transformation of step 1, The point is restored to its initial position, that is, ,in, Yes The transformation matrix for translating a point to the origin, It's around Rotation The transformation matrix of the angle, is the final rotation result transformation matrix, Represents the translation transformation matrix The inverse matrix of Matrix calculations are performed to save storage space and calculation time.

[0030] It can be seen from the technical solutions provided by the present invention that the linear accelerator plan verification anti-collision system provided by the present invention solves the problem of collision detection between the medical linear accelerator treatment head, the treatment bed and the patient through virtual simulation technology, and at the same time, through DICOM data three-dimensional reconstruction, a DICOM data three-dimensional model library is established to combine its virtual simulation scene, and a rigid body collision detection method is used to complete the medical linear accelerator collision detection verification; the beneficial effects are:

[0031] Improve the accuracy and safety of radiotherapy:

[0032] Collision detection to prevent injury: It can effectively avoid collisions between the treatment head, treatment bed and patient, prevent equipment damage and patient injury, and ensure that radiotherapy is carried out safely and accurately;

[0033] Accurate simulation and optimization of treatment plans: Through virtual models and data reconstruction, radiotherapy can be accurately simulated and treatment plans can be optimized, so that radiation can be more accurately focused on tumors and reduce damage to normal tissues;

[0034] Improve work efficiency and training effectiveness:

[0035] Real-time preview and adjustment: Therapists and physiotherapists can preview and adjust treatment plans in real time without patient participation, improving work efficiency;

[0036] Interactive operation training: The virtual treatment room can be used for operation training, so that new employees can become familiar with the operation process, improve their skills, and reduce the risks of actual training;

[0037] Data integration and resource utilization:

[0038] DICOM data utilization: 3D reconstruction and database building of DICOM data to enrich system information and help formulate reasonable treatment plans;

[0039] Application of rigid body characteristics: Collision detection using rigid body characteristics is accurate, reliable and improves system efficiency. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0041] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with specific implementation methods.

[0042] The embodiment of the present invention provides a linear accelerator plan verification and anti-collision system, which includes a virtual radiotherapy scene three-dimensional model construction module, a DICOM data three-dimensional reconstruction model module, a rigid body characteristic and collision detection module, and a rigid body translation and rotation calculation module.

[0043] In this embodiment, the virtual radiotherapy scene 3D model building module is used to perform 3D modeling of the actual situation of the radiotherapy room, split the frame, treatment head, treatment bed and related equipment of the treatment machine into 3D model components, and perform modeling based on the modeling software to simulate the real treatment environment and the patient's CT structure, and present and simulate the 3D information of the treatment room including the linear accelerator, treatment bed and multi-leaf light shed and various auxiliary tools, the patient's anatomical structure and dose distribution in real time;

[0044] Furthermore, the virtual treatment room constructed by the virtual radiotherapy scene 3D model construction module also includes an external actual control device to operate the virtual accelerator for interactive operation training, as well as a display screen that can provide linear accelerator status information and a laser light for patient positioning. Specifically:

[0045] 1. Analysis and disassembly of treatment machine components

[0046] Analysis of physical composition and operating principle:

[0047] Conduct detailed structural analysis of the physical system of the treatment machine and its operating principle; understand key information such as the mechanical structure, movement mode and relationship of the frame, treatment head, treatment bed and related equipment;

[0048] Component splitting is based on actual parameters:

[0049] According to the actual measured parameters of the radiotherapy equipment, the various parts of the treatment machine are split into simple 3D model components; these parameters include the size, shape, range of motion, etc. of the equipment, ensuring that the split components can accurately reflect the characteristics of the actual equipment;

[0050] 2. Software-based Modeling Process

[0051] Choose modeling software:

[0052] Use professional modeling software such as 3dmax and Zbrush for modeling; these software have powerful 3D modeling functions and can meet the needs of building complex radiotherapy equipment and environment models;

[0053] Build virtual treatment environment and equipment models;

[0054] Model the disassembled components one by one. First, build a complete linear accelerator model, including its main structure and internal key components. Then build a treatment bed model to accurately reflect its shape, size, and movable parts, such as the translation and rotation of the bed board. Then build a multi-leaf light shed model to simulate the shape and movement of its leaves.

[0055] When building the model, we should pay attention to details to ensure the accuracy and realism of the model; for example, we should make reasonable settings for the shell texture of the linear accelerator, the material texture of the treatment bed, and the fineness of the multi-leaf light shed leaves;

[0056] Simulate patient CT structure and radiotherapy information:

[0057] Combine the patient's CT data to simulate the patient's anatomical structure; through the analysis and processing of CT images, the patient's body contours, internal organs and other information are converted into a three-dimensional model and placed in the appropriate position in the virtual treatment environment;

[0058] At the same time, it simulates radiation therapy related information such as dose distribution; according to the radiation therapy plan and treatment parameters, it calculates and presents the dose distribution of different parts in the model, so that therapists and physicists can intuitively understand the radiation therapy effect;

[0059] Building virtual treatment rooms and supporting tools:

[0060] Construct the overall environment of the virtual treatment room, including walls, floors, ceilings, etc.; set appropriate lighting effects to simulate the lighting environment of a real treatment room;

[0061] Add various auxiliary tools in the virtual treatment room, such as external actual control devices to operate the virtual accelerator. The layout and operation methods of these control devices should be consistent with the actual situation for later interactive operation training; add a display screen that can provide linear accelerator status information to accurately display the various parameters and operating status of the accelerator; set up laser lights for patient positioning to simulate their positioning role in actual treatment.

[0062] In this embodiment, the DICOM data 3D reconstruction model module is used to perform 3D reconstruction and processing on the DICOM file data, convert it into a CT 3D model of the patient, establish a corresponding DICOM 3D model database, and combine it with the virtual treatment scene to present and simulate the treatment scenario of a real case in a real environment in real time;

[0063] The DICOM data 3D reconstruction model module uses the MarchingCubes algorithm based on surface rendering and / or the Ray-casting algorithm based on volume rendering to perform 3D reconstruction, where:

[0064] The MarchingCubes algorithm based on surface rendering regards the two-dimensional slice data as a three-dimensional data field. By extracting the isosurface of the three-dimensional data, the surface mesh of the three-dimensional model is constructed, and then the three-dimensional model is constructed. Specifically, the following steps are included:

[0065] 1. Data preprocessing and reading

[0066] Data preprocessing:

[0067] Check the integrity of the original 2D slice data to ensure there are no missing data points;

[0068] Normalize the data to map the data values ​​to a suitable interval for subsequent comparison and calculation; for example, if the data is grayscale, it may be normalized to the interval [0,1];

[0069] To remove noise from data, filtering techniques such as mean filtering and median filtering can be used; mean filtering calculates the average value of the data in the neighborhood around each data point to replace the value of the point, while median filtering takes the median value of the data in the neighborhood;

[0070] Data reading:

[0071] The preprocessed two-dimensional slice data is regarded as a three-dimensional data field; for example, if there is a series of two-dimensional slice images, stacking them up in the order of slices will form a three-dimensional data structure;

[0072] Read this three-dimensional data field into a specific array structure; you can use a three-dimensional array to store data, and the three dimensions of the array correspond to the x, y, and z coordinate directions of the data field respectively; if the amount of data is large, you can also consider using an octree structure to store the data. The octree can effectively reduce the demand for storage space and improve the efficiency of data access;

[0073] 2. Cube by cube processing

[0074] Starting from a corner of the 3D data field, cubes are selected one by one for processing in a certain order (such as from left to right, from front to back, from bottom to top); each cube has its specific position in the data field, which can be determined by its index in the x, y, and z directions;

[0075] 3. Vertex state judgment

[0076] Get vertex values:

[0077] For each cube being processed, obtain the values ​​of its eight vertices in the three-dimensional data field; these values ​​are the basis for determining the relative positions of the vertices and the isosurface;

[0078] Compare with equivalent par value:

[0079] Compare the value of each vertex with the preset isosurface value; the isosurface value is a threshold used to determine which areas belong to the isosurface; if the value of a vertex is greater than the isosurface value, then the vertex is considered to be outside the isosurface; if it is less than the isosurface value, it is considered to be inside the isosurface; if it is equal to the isosurface value, then the vertex is considered to be on the isosurface;

[0080] Record status table:

[0081] According to the comparison result, a state table is generated for each cube; the state table is an 8-bit binary number or an 8-element array, and each bit or element corresponds to the state of a vertex; for example, if the first vertex is outside the isosurface and the second vertex is inside the isosurface, then the state table may record [1,0,?,?,?,?,?] (where "?" indicates that the states of other vertices have not yet been determined);

[0082] 4. Determination of intersecting edges

[0083] Determine the cube edges that intersect with the isosurface according to the state table; when the states of two vertices connected by an edge are different (one is inside the isosurface and the other is outside the isosurface), the edge is considered to be an edge that intersects with the isosurface; for example, if the states of the vertices connected by an edge are [1,0] respectively, then this edge is an intersecting edge;

[0084] 5. Intersection coordinate calculation

[0085] For the edges that are determined to be intersecting, the coordinates of the intersection points are calculated using the linear interpolation method;

[0086] Determine the interpolation formula:

[0087] Assume that the two endpoints of the edge are and , and their values ​​are and , the equivalent face value is ;

[0088] The intersection point The coordinates can be calculated using the following linear interpolation formula:

[0089] ; ; ;

[0090] 6. Normal vector calculation

[0091] Calculate the vertex normal vector using the central difference method:

[0092] For the 8 vertices of the cube, the normal vectors are calculated using the central difference method; the central difference method is a numerical calculation method used to estimate the derivative of a function at a certain point;

[0093] Set Vertex The surrounding neighborhood points are , , , , and (in , , is the step size of the neighborhood), where is the coordinate of a vertex of the cube in three-dimensional space, , , , , , Vertex exist The coordinates of the neighboring points in the direction, , , is the step size of the neighborhood, which is used to determine the location of the neighborhood points;

[0094] Then the vertex The normal vector It can be calculated by the following formula:

[0095] ; ; ,in, The normal vectors are Components on the axis;

[0096] The normal vectors of each vertex of the triangle are obtained by linear interpolation:

[0097] For the triangular face formed by the intersection points, the normal vector of each vertex is obtained by linear interpolation method;

[0098] Let the three vertices of the triangle be , and , and their corresponding vertex normal vectors are , and ;

[0099] For a point inside a triangle , whose normal vector It can be calculated by the following linear interpolation formula:

[0100] ; ; ;

[0101] in, , , Vertex , , exist The coordinate values ​​on the axis, , , Vertex , , The normal vector of , , is the component of the corresponding normal vector on the coordinate axis, , , The components of the normal vector on the coordinate axes;

[0102] 7. Triangle surface connection

[0103] According to the coordinates and normal vectors of the triangle vertices, the triangles are connected to construct the surface mesh of the three-dimensional model;

[0104] Determine the connection order:

[0105] For each intersection point generated by the intersecting edges, determine how these intersection points should be connected into triangular facets according to the state tables of the cube in which they are located and the surrounding cubes; generally speaking, certain rules will be followed, such as the order of vertices, the direction of normal vectors, etc., to ensure that the connected triangular facets can correctly represent the isosurface;

[0106] Construct the surface mesh:

[0107] Combine the connected triangular facets together to form a surface mesh of the 3D model; this surface mesh is a polygonal mesh composed of triangles, which describes the surface shape of the 3D model;

[0108] 8. 3D model generation

[0109] Based on the constructed surface mesh, further improve and refine it, and finally build a three-dimensional model;

[0110] Mesh Optimization:

[0111] Optimize the surface mesh to improve the quality and visualization of the model. There are many ways to optimize it, such as mesh smoothing, which makes the mesh smoother by adjusting the position of vertices; mesh simplification, which reduces the number of vertices and triangles in the mesh without affecting the main features of the model, and improves the rendering efficiency of the model.

[0112] Check the quality of the mesh to make sure there are no overlapping triangles, non-manifold geometry, etc.

[0113] Model construction:

[0114] Based on the optimized surface mesh, a complete 3D model is constructed; this model can be used for subsequent visualization, analysis, simulation and other operations;

[0115] Ray-casting algorithm based on volume rendering sends a ray from each pixel of the image plane along the line of sight. This ray passes through the volume data set, samples according to the set step size, calculates the color value and opacity of each sampling point by interpolation, and then calculates the accumulated color value and opacity value point by point from front to back or from back to front until the light is completely absorbed or passes through the object. Specifically, it includes the following steps:

[0116] 1. Ray emission

[0117] Determine the direction of sight:

[0118] The viewing direction is determined based on the position and direction of the virtual camera and the position of the pixel in the image plane; assuming that the virtual camera is located at the origin of the coordinate system , its sight direction is along the positive direction of the axis (this is a simplified case, the sight direction can be in any direction in actual application); for pixels in the image plane , its sight direction can be determined as follows:

[0119] First calculate the vector from the pixel to the center of the camera ,in, is the distance from the camera to the image plane (this is a preset value);

[0120] Then the vector Normalize to get the sight direction vector ;in, , the purpose of normalization is to transform the vector Convert to unit vector so that It only represents the direction information and is calculated as ;

[0121] Emitting rays:

[0122] For each pixel in the image plane, along its corresponding view direction vector Send a ray; the ray can be expressed by the parametric equation: ,in, is the starting point of the ray (usually the position of the camera, i.e. ), Is a parameter, indicating that the ray moves along the direction vector The distance of propagation, Indicates that the ray propagation Position vector after distance;

[0123] 2. Volume dataset sampling

[0124] Determine the sampling step size;

[0125] Choose an appropriate sampling step size based on the required sampling accuracy and computational efficiency ; If you need a high-precision result, you can choose a smaller sampling step size, such as (The values ​​here are only examples and need to be adjusted according to specific circumstances in actual applications); If computing resources are limited, in order to increase the computing speed, a larger sampling step size can be selected, such as ;

[0126] Calculate the sampling point location:

[0127] Sampling is performed along the ray according to the sampling step size; for the ray equation , the position of the nth sampling point can be obtained by to calculate, and then Substitute into the ray equation to get the coordinates of the sampling point ,in, Indicates The ray propagation distance corresponding to each sampling point;

[0128] 3. Color value and opacity calculation (interpolation calculation)

[0129] Determine voxel properties:

[0130] A volume dataset is composed of a series of voxels, each of which has a color value and an opacity attribute; these attributes can be determined in a number of ways:

[0131] If it is based on medical image data, such as CT images, the color value of the voxel can be determined according to the density or grayscale value of the tissue, and the opacity can be determined according to the absorption characteristics of the tissue to X-rays;

[0132] The attributes of voxels can also be determined based on pre-set color mapping tables and opacity mapping tables, which can be designed according to different application scenarios and requirements;

[0133] Interpolate the sampling point properties:

[0134] For each sampling point , its color value needs to be calculated and opacity ;Since the sampling point may be located between two voxels, an interpolation calculation method is required;

[0135] Assuming sampling point Located in voxel and Between voxels The color value is , and opacity is , voxel The color value is , and opacity is ; Sampling point to voxel The distance is , to voxels The distance is ,and ;

[0136] The color value of the sampling point It can be calculated by linear interpolation:

[0137]

[0138] The opacity of the sampling point It can be calculated by linear interpolation:

[0139]

[0140] 4. Cumulative calculation

[0141] Initialize the cumulative value:

[0142] At the starting point of the light propagation, Initialize the accumulated color value and opacity ;

[0143] Accumulate point by point:

[0144] Starting from the starting point of the light, the accumulated color value and opacity value are calculated point by point in the order from front to back or from back to front; sampling points, whose color values ​​are , and opacity is , the accumulated color value and opacity Updated as follows:

[0145] ; ;

[0146] 5. Termination condition judgment

[0147] Determine whether the light passes through the object:

[0148] Check whether the ray has passed through the entire volume dataset; if the ray parameter exceeds the length of the volume dataset in the ray direction ,Right now , it is considered that the light has passed through the object and the algorithm terminates;

[0149] Determine whether the light is completely absorbed:

[0150] If the opacity of the light has reached or is close to 1, that is (The threshold here can be adjusted according to actual conditions), the light is considered to have been completely absorbed and the algorithm terminates.

[0151] In this embodiment, the rigid body property and collision detection module includes a rigid body component setting unit and a collision detection algorithm unit;

[0152] The rigid body component setting unit is used to assign one or more colliders among a ball collider, a box collider or a capsule collider to the three groups of models of the accelerator treatment head, the treatment bed and the patient according to the shape of the three-dimensional model, including the following steps:

[0153] All faces of a rigid body are intersected with all faces of another rigid body in turn, transforming the spatial problem into several plane problems;

[0154] For the intersection between faces, including:

[0155] Intersect all the edges of a face with all the planes of another face, then perform inclusion check on the intersection points and the face to extract valid intersection points;

[0156] All edges of another face are intersected with the plane where the face is located, and then the intersection points and the face are checked for inclusion to extract valid intersection points;

[0157] The midpoint of each pair of valid intersection points is checked for inclusion with the two faces respectively. If the midpoint is in both one face and the other face, then the pair of intersection points defines an intersection line segment, thus transforming the problem of finding the intersection between faces into a combined problem of finding the intersection between a line segment and an infinite plane and checking the inclusion between a point and a bounded plane.

[0158] When implementing:

[0159] 1. Transformation from overall space to plane

[0160] Intersection operation between faces:

[0161] Taking the accelerator treatment head rigid body (referred to as rigid body A) and the treatment bed rigid body (referred to as rigid body B) as examples, first consider the first surface of rigid body A;

[0162] Traverse each face of rigid body B and intersect the first face of rigid body A with the first face of rigid body B; this involves using mathematical methods to determine whether two faces intersect and the intersecting parts based on the geometric shapes and positional relationships of the faces;

[0163] Next, perform the same intersection operation on the first face of rigid body A and the second face of rigid body B, and so on, until the intersection operation is completed between the first face of rigid body A and all faces of rigid body B;

[0164] Then, repeat the above process for the second face of rigid body A, that is, perform intersection operations with each face of rigid body B in turn;

[0165] This cycle continues until all faces of rigid body A have completed the intersection operation with all faces of rigid body B;

[0166] The same method is applied to the intersection calculation between rigid body A and the patient's rigid body (referred to as rigid body C) and between rigid body B and rigid body C. Through this comprehensive face-to-face intersection process, the original complex collision detection problem between rigid bodies in space is gradually transformed into the intersection problem between multiple planes.

[0167] 2. Refinement steps for finding intersections between faces

[0168] Edge and plane intersection and intersection inclusion detection (first time):

[0169] For the intersection between faces, take face A and face B as an example, assuming face A has edge ;

[0170] For edge , and calculate the intersection between it and the plane where face B is located; this requires determining whether they intersect and the location of the intersection based on the straight line equation and plane equation of the edge;

[0171] After calculating the intersection point, perform an inclusion check on face B;

[0172] If surface B is a plane region defined by boundary conditions, for example, a region with four vertex coordinates , , , Determine the rectangular plane, then determine whether the intersection point is within this rectangular area;

[0173] The judgment is made by comparing the coordinates of the intersection point with the boundary conditions determined by the coordinates of the rectangle vertices; for example, if the intersection point The coordinates satisfy and Coordinates satisfy (Assuming that the intersection point is in the sub-region determined by a corner of the rectangle), the intersection point is within surface B and is a valid intersection point; otherwise, it is an invalid intersection point;

[0174] The same method is used for edge Find the intersection with the plane of face B and check the intersection inclusion, and extract all valid intersections that meet the inclusion test;

[0175] Edge and plane intersection and intersection inclusion detection (second time):

[0176] Conversely, turn the edge of face B , , , Intersect with the plane where face A is located respectively;

[0177] For edge , find the intersection point based on the equation of the straight line and the equation of the plane where surface A lies;

[0178] Then, the intersection point and face A are subjected to inclusion check to determine whether the intersection point is within the area defined by face A;

[0179] The same method is used for edge , , Find the intersection with the plane of face A and check the inclusion of the intersection points, and extract all valid intersection points that meet the inclusion test;

[0180] Determine the intersection segment:

[0181] For the valid intersection points obtained by the first and second intersections, assume that the valid intersection points obtained by the first intersection are , , The effective intersection point obtained by the second intersection is , , wait;

[0182] For each possible pair of corresponding intersection points (e.g. and may correspond), calculate their midpoints ;

[0183] The midpoint Perform inclusion detection with face A and face B respectively;

[0184] If surface A is a region defined by boundary conditions, determine the midpoint Whether the coordinates meet the boundary conditions of surface A; the same judgment is made for surface B;

[0185] If the midpoint is in both face A and face B, then and This pair of intersection points defines an intersection line segment;

[0186] By performing the above detection on all possible corresponding intersection point pairs, all intersection line segments are determined, thus transforming the problem of finding the intersection between faces into a combined problem of finding the intersection between a line segment and an infinite plane and the inclusion detection between a point and a bounded plane, providing a more convenient basis for subsequent collision detection.

[0187] The collision detection algorithm unit is used to study the principles and algorithms of collision detection of the three groups of models, simulate the movement of each component, detect the collision between components at different field angles and patient positions, and feedback the detection result information to the user interface. The specific operation includes the following steps:

[0188] 1. Motion simulation initialization

[0189] Get model information:

[0190] Geometry and size:

[0191] Obtain accurate geometric shape descriptions of the three models of the accelerator treatment head, treatment bed and patient from the virtual radiotherapy scene 3D model building module; this may include the complex structural shape of the treatment head (such as the shape of the collimator, radiation source and other parts), the shape of the bed board and supporting structure of the treatment bed, and the 3D shape details of the patient body model reconstructed based on CT data;

[0192] At the same time, the size information of each model is obtained, such as the length, width and height of the treatment head, the area and height of the treatment bed, the length, width and height of the patient's body model, and the size of each organ, etc.;

[0193] Initial location information:

[0194] Determine the initial position of each component in the virtual radiotherapy scene; the initial position of the treatment head may be related to the initial setting of the radiotherapy equipment, such as the position of the treatment head when the gantry is at a certain angle; the initial position of the treatment bed is usually the standard placement position in the radiotherapy room, with the bed board in a horizontal state and fixed position; the initial position of the patient model is determined according to the positioning requirements in the treatment plan, such as the initial placement direction and position of the patient's body on the treatment bed;

[0195] Range and type of motion:

[0196] Obtain the motion range parameters of each component; for the treatment head, understand the rotation angle range of the frame (e.g., from -180° to 180°) and the rotation angle range of the small head (if applicable); for the treatment bed, clarify its maximum left-right translation distance (e.g., ±20cm), maximum front-back translation distance (e.g., ±30cm), and its own rotation angle range (e.g., -90° to 90°);

[0197] Understand the movement of each component. For example, the movement of the treatment head is driven by the rotation of the frame and the rotation of the small head itself, and the movement of the treatment bed is driven by the motor to translate and rotate the bed plate;

[0198] Set simulation parameters:

[0199] Time step settings:

[0200] According to the actual time scale of the radiotherapy process and the required simulation accuracy, set the simulation time step; if a more detailed simulation of the motion process is required, the time step can be set to a smaller value, such as 0.1 second; if the accuracy requirement is not particularly high and in order to improve the simulation efficiency, the time step can be appropriately increased, such as 1 second;

[0201] Field angle change step setting:

[0202] Considering the possible range of changes and accuracy requirements of the field angle during radiotherapy, set the field angle change step size; for example, if the total range of the field angle change is from 0° to 360°, in order to fully and accurately simulate the conditions under different field angles, the field angle change step size can be set to 1° or less, so as to cover all possible combinations of field angles;

[0203] 2. Motion Simulation Process

[0204] Simulation of field angle changes:

[0205] Angle changes gradually:

[0206] According to the set field angle change step, starting from the initial field angle, the field angle is gradually changed in a cyclic or iterative manner; for example, if the initial field angle is 0° and the field angle change step is 1°, the simulated field angles are 1°, 2°, 3°, etc. in sequence until the set maximum field angle is reached or a complete angle cycle is completed (such as from 0° to 360° and then back to 0°);

[0207] Calculation of treatment head position change:

[0208] At each field angle, the position change of the treatment head is calculated according to the method provided by the rigid body translation and rotation calculation module;

[0209] For the rotation of the rack, the position of the rack after rotation is determined according to the rotation angle and the calculation method of the rigid body rotating around an arbitrary axis in space; for example, if the initial position of the rack and the angle to be rotated are known, the coordinate transformation matrix after rotation is calculated by the corresponding quaternions formula, thereby obtaining the new position of the rack after rotation;

[0210] For the rotation of the small handpiece (if applicable), the position of the small handpiece after rotation is calculated according to its rotation angle and the relevant rotation calculation method; then, the new position of the entire treatment head is determined in combination with the position of the frame after rotation;

[0211] Treatment bed position change calculation:

[0212] When the radiation field angle changes, the position change is calculated based on the movement mode of the treatment bed and the relevant coordinate transformation formula;

[0213] If the change in the radiation field angle requires the treatment bed to be translated left and right, the position of the treatment bed after translation is calculated based on the translation distance and the calculation method of the translation of a rigid body in any direction;

[0214] If the change in the radiation field angle requires the treatment bed to be translated forward and backward, the position of the treatment bed after translation is calculated based on the forward and backward translation distance and the corresponding calculation method;

[0215] If the change of the radiation field angle requires the treatment bed to rotate itself, the position of the treatment bed after rotation is calculated according to the angle of its own rotation and the calculation method of the rigid body rotation around any axis in space;

[0216] Patient position change simulation:

[0217] Determine the scope and method of change:

[0218] According to the actual possible situations, such as the slight movement of the patient's body, breathing movement, etc., determine the range and mode of change of the patient's position; for example, considering the movement of the patient's body in the front-to-back direction when breathing, set the movement range of the patient's body in the front-to-back direction to ±5cm, and the change mode is to move periodically according to a certain breathing frequency and amplitude;

[0219] Position change simulation:

[0220] When the radiation field angle is fixed, the change of the patient's position is simulated according to the set change range and method; for example, starting from the initial position of the patient's body, the position of the patient's body is gradually changed in a certain step length (such as 0.5 cm) in the front-to-back direction to simulate the patient's body movement during breathing;

[0221] Relative position relationship update:

[0222] When the patient's position changes, the radiation field angles of the treatment head and the treatment bed are kept unchanged, and the relative positional relationship between them and the patient model is recalculated; for example, by calculating the distance and angle relationship between the patient model and the treatment head and the treatment bed, the relative positional relationship information is updated;

[0223] 3. Collision Detection Process

[0224] Call the rigid body collision detection module:

[0225] Under each combination of field angle and patient position, the rigid body collision detection module is called to perform collision detection;

[0226] The rigid body collision detection module operates based on the collision detection foundation established by the rigid body component setting unit and uses the determined collision detection algorithm;

[0227] Specifically, it checks whether there are intersection line segments between the three models of the treatment head, the treatment bed and the patient. These intersection line segments are determined by the previous operations of surface-to-surface intersection, edge-to-plane intersection and intersection point inclusion detection of rigid bodies.

[0228] Determine the collision result:

[0229] Collision judgment criteria:

[0230] If it is detected that there is an intersection line segment between the three groups of models, and the intersection line segment meets certain length or position conditions (for example, the length of the intersection line segment is greater than a certain threshold to exclude some extremely small intersection line segments caused by calculation errors), it is considered that a collision has occurred;

[0231] If the intersection line segment is located at a critical position (such as the intersection line segment near the radiation emission area of ​​the treatment head and the important organ area of ​​the patient's body model), it is considered to have collided even if the length is short;

[0232] Results record:

[0233] According to the specific situation of the collision, the location information of the collision is recorded; this can be described by the coordinate system of the model, such as recording the coordinate value (x, y, z) of the collision point in three-dimensional space and the relative position on each model (such as the position on a certain part of the treatment head, the position in a certain area of ​​the treatment bed, and the position near a certain organ of the patient's body);

[0234] Record the components involved to identify which part of the treatment head, area of ​​the treatment table, and organ or part of the patient’s body was involved in the collision;

[0235] 4. Result Feedback

[0236] Information collation:

[0237] Comprehensively organize the results of collision detection;

[0238] First determine if a collision occurred, recording it as a Boolean value (yes or no);

[0239] In case of collision, the location information of the collision is recorded in detail, including the precise three-dimensional coordinates and the relative position description on each model;

[0240] Record the components involved, listing in detail the specific parts or locations involved in the collision in the order of the treatment head, treatment bed, and patient's body;

[0241] Organize the collated information in a certain format to facilitate subsequent feedback and processing;

[0242] Feedback to the UI:

[0243] Feedback method selection:

[0244] Choose an appropriate feedback method based on the design and function of the user interface. For example, a pop-up window can be used to indicate the location and components where the collision occurred. The pop-up window can display the 3D coordinates of the collision and the relative position on the relevant model as well as the information of the components involved in the collision in detail.

[0245] It is also possible to mark the collision area on the graphical interface, for example, by highlighting the area where the collision occurred with a marker of a different color or shape, while displaying relevant collision information next to it, such as a description of the collision location and the components involved;

[0246] Real-time feedback:

[0247] Ensure that collision detection results are fed back to the user interface in real time so that therapists and physiotherapists can understand the situation and take appropriate measures; for example, during the simulation, once a collision is detected, the results are fed back to the user interface immediately, rather than after the simulation is over.

[0248] In this embodiment, the rigid body translation and rotation calculation module is used to calculate the movement of the treatment system model. The movement of the treatment system model includes:

[0249] The movement of the frame, i.e. the clockwise or counterclockwise rotation of the vertical plane around the central axis;

[0250] Movement of the treatment bed, including left-right and front-back movement and rotation of the entire treatment bed;

[0251] The movement of the small head, that is, the rotation when realizing the dynamic multi-leaf grating; the rigid body translation and rotation calculation module uses a specific coordinate transformation formula to calculate the rigid body translation in any direction and rotation around any axis;

[0252] Furthermore, the rigid body translation and rotation calculation module calculates the translation of the rigid body in any direction. When the length is unit, according to the formula Calculate, where , , ,set up , and The cosines of the axis angles are the above values, where: , , Respectively, vector and The angle corresponding to the cosine value of the angle in the positive direction of the axis, For two points in space and The vector formed by and Represents the midpoint of space and The coordinate component on the x-axis, and Represents the midpoint of space and The coordinate component on the y-axis, and Represents the midpoint of space and The coordinate component on the z-axis;

[0253] in:

[0254] Represents two points in space and The coordinates of the vector formed are expressed as , here , as well as , They are the coordinate components of two points in different coordinate axis directions;

[0255] , , They are vectors and The angle corresponding to the cosine of the axis angle;

[0256] The rigid body is translated in any direction A transformation matrix of unit length is used to describe the coordinate transformation relationship of a rigid body during translation.

[0257] In this embodiment, the rigid body translation and rotation calculation module determines the rotation operator represented by quaternions when calculating the rotation angle θ of the rigid body around an arbitrary axis in space. ,in, for The real part of yes The imaginary vector is a unit vector, and Any point in space The quaternions are expressed as , its position after rotating around the axis by angle θ The quaternions are expressed as , the calculation process first calculates ,in, ,but , then calculate , and finally calculate ,in, express and The dot product of ,set up ,but , , then transform Order Matrix It is expressed as: ; If you want to rotate an angle around any axis in space, you need to consider the problem of rotating an angle around any axis passing through the origin. This can be solved by the following steps: Assume is along The unit vector in the direction Translate to the origin; Rotation Angle; do the inverse transformation of step 1, The point is restored to its initial position, that is, ,in, Yes The transformation matrix for translating a point to the origin, It's around Rotation The transformation matrix of the angle, is the final rotation result transformation matrix, Represents the translation transformation matrix The inverse matrix of Calculation is performed on matrices of 1 order to save storage space and calculation time;

[0258] in, It is the quaternions representation used in rotation calculations to describe the relevant parameters of the rigid body rotating around an axis;

[0259] θ represents the angle of rotation of the rigid body around any axis in space;

[0260] represents the position of a point in space before rotation. represents the position of the point after rotating around the axis by an angle θ. yes The inverse of

[0261] The following is a detailed description of the rigid body translation and rotation calculation module:

[0262] 1. Module Function Overview

[0263] The rigid body translation and rotation calculation module is mainly used to calculate the translation and rotation of each rigid body component (such as the frame, treatment bed, and small head) in the treatment system model, providing mathematical calculation support for the precise motion simulation of each component in the virtual radiotherapy scene, thereby realizing accurate simulation of the radiotherapy process under different field angles and patient positions, and providing accurate position information for subsequent collision detection;

[0264] 2. Therapeutic system model and motion freedom analysis

[0265] Rack Movement:

[0266] The movement of the gantry is mainly clockwise or counterclockwise rotation around the central axis in the vertical plane, with the clockwise direction generally being positive; its freedom of movement is rotation around one axis, and the rotation angle range is usually between -180° and 180°, and the specific range may vary depending on different radiotherapy equipment;

[0267] Treatment couch movement:

[0268] The movement of the treatment bed is relatively complex, including the following types of movement:

[0269] Left-right movement: The treatment bed can move left-right in the horizontal direction, and the moving distance is limited. For example, the maximum distance of left-right translation may be about ±20cm.

[0270] Forward and backward movement: The treatment bed can also move forward and backward in the horizontal direction, and the maximum distance of its forward and backward translation may be about ±30cm;

[0271] Rotation of the entire treatment bed: The treatment bed itself can rotate around a certain axis, and the rotation angle range may be between -90° and 90°;

[0272] The degrees of freedom of movement of the treatment bed include translation in three directions and rotation along one axis;

[0273] Small head movement:

[0274] The movement of the small head is the rotation when realizing the dynamic multi-leaf grating. Its rotation angle range is also limited to a certain extent. The specific value depends on the design parameters of the equipment. The degree of freedom of the small head movement is the rotation around its own axis.

[0275] 3. Calculation method of rigid body translation in any direction

[0276] Determine the correlation vector and the cosine of the angle:

[0277] set up ,in and are the coordinates of the relevant points; here Represents a vector in the translation direction;

[0278] calculate The cosine of the angles with the x, y, and z axes, that is , , ; These angle cosine values ​​will be used to construct the translation transformation matrix;

[0279] Construct the translation transformation matrix and calculate the translated position:

[0280] When a rigid body is translated t unit lengths in any direction, according to the formula Calculate; this matrix can be used to transform the coordinates of the rigid body to obtain the translated position; for example, if the original coordinates of the rigid body are (x, y, z), the translated coordinates are ;

[0281] 4. Calculation method of rigid body rotation around any axis in space

[0282] Introducing quaternions knowledge:

[0283] Quaternions are an extension of the concept of complex numbers, similar to vectors, consisting of a real part and three imaginary parts, namely ,in, , is the real part, is a vector ,and ; The addition and multiplication of quaternions have specific definitions and have advantages in three-dimensional coordinate rotation calculations, which can save a lot of storage space and calculation time compared to the application of the usual 4x4 matrix calculation. , , is a special symbol in quaternions operations and satisfies ;

[0284] Calculate the position after rotation:

[0285] The rigid body translation and rotation calculation module determines the rotation operator represented by quaternions when calculating the rotation angle θ of the rigid body around any axis in space. ,in, for The real part of yes The imaginary vector is a unit vector, and Any point in space The quaternions are expressed as , its position after rotating around the axis by angle θ The quaternions are expressed as , the calculation process first calculates ,in, ,but , then calculate , and finally calculate ,in, express and The dot product of ,set up ,but , , then transform Order Matrix It is expressed as: ; If you want to rotate an angle around any axis in space, you need to consider the problem of rotating an angle around any axis passing through the origin. This can be solved by the following steps: Assume is along The unit vector in the direction Translate to the origin; Rotation Angle; do the inverse transformation of step 1, The point is restored to its initial position, that is, ,in, Yes The transformation matrix for translating a point to the origin, It's around Rotation The transformation matrix of the angle, is the final rotation result transformation matrix, Represents the translation transformation matrix The inverse matrix of Matrix calculations are performed to save storage space and calculation time.

[0286] In this embodiment, the detection method of rigid body collision is as follows:

[0287] 1. Method Overview

[0288] Model abstraction and problem transformation:

[0289] Each rigid body in the system is abstracted as a Box class, that is, it is regarded as a cuboid composed of six faces. For the three models of the accelerator treatment head, the treatment bed and the patient, the collision detection problem between them is transformed into the intersection problem between the cuboids.

[0290] In order to facilitate calculation and judgment, the problem is further transformed from the spatial level to the plane level, that is, it is transformed into the intersection of line segments and planes and the inclusion detection of points and bounded planes, following the principle of transformation from space to plane and from finite to infinite.

[0291] 2. Specific testing steps

[0292] Transform from space to plane:

[0293] Take two rigid bodies (rigid body A and rigid body B) as an example. For each face of rigid body A:

[0294] First, select the first face of rigid body A and perform intersection operations on it with each face of rigid body B in turn; this requires using mathematical methods to determine whether two faces intersect and the intersecting parts based on the geometric shapes and spatial position relationships of the faces;

[0295] Then repeat the above process for the second face of rigid body A, that is, perform intersection calculation with each face of rigid body B again;

[0296] This cycle continues until all faces of rigid body A have completed the intersection operation with all faces of rigid body B;

[0297] Through this comprehensive surface-to-surface intersection process, the spatial collision problem between rigid bodies A and B is transformed into an intersection problem between multiple planes.

[0298] Intersection between faces:

[0299] For each pair of faces that need to be intersected (set as face 1 and face 2):

[0300] Edge and plane intersection and intersection inclusion detection (first time):

[0301] For each edge of face 1:

[0302] Take the first edge of face 1 and calculate the intersection between it and the plane where face 2 is located; this requires determining whether they intersect and the location of the intersection based on the line equation and plane equation of the edge;

[0303] After calculating the intersection point, perform an inclusion check on face 2; if face 2 is a plane area determined by boundary conditions (for example, a rectangular plane determined by four vertex coordinates), determine whether the intersection point is within face 2 by judging whether the coordinates of the intersection point meet the boundary conditions of face 2; the intersection point that meets the conditions is a valid intersection point and is extracted;

[0304] The same method is used to find the intersection of other edges of face 1 with the plane of face 2 and to detect the intersection inclusion.

[0305] Edge and plane intersection and intersection inclusion detection (second time):

[0306] For each edge of face 2:

[0307] Take the first edge of face 2 and intersect it with the plane where face 1 is located;

[0308] After calculating the intersection point, perform an inclusive check on face 1 to extract the valid intersection point;

[0309] The same method is used to intersect the other edges of face 2 with the plane of face 1 and to check the inclusion of the warm-up intersection points;

[0310] Determine the intersection segment:

[0311] For each pair of possible corresponding intersection points (for example, the intersection points obtained by the first intersection), The intersection point Q1 obtained by the second intersection may correspond to):

[0312] Calculate their midpoint M;

[0313] Perform inclusion check on the midpoint M and face 1 and face 2 respectively; if face 1 and face 2 are areas determined by boundary conditions, determine whether the coordinates of the midpoint M meet the boundary conditions of face 1 and face 2; if the midpoint M is in both face 1 and face 2, then the intersection point P1 and Q1 define an intersection line segment;

[0314] By performing the above detection on all possible corresponding intersection point pairs, all intersection line segments are determined, thereby converting the problem of finding the intersection between faces into a combined problem of finding the intersection between a line segment and an infinite plane and a problem of detecting the inclusion of a point and a bounded plane.

[0315] 3. Calculations related to the relationship between straight line segments and planes (to assist in understanding the intersection process)

[0316] Direction cosine representation of a straight line segment in space:

[0317] Assume that the space straight line segment The endpoint is and , then the two-point three-dimensional straight line equation is:

[0318]

[0319] Convert it to direction cosine form:

[0320] Depend on , , ,in , and is a vector The direction angle, , and for The direction cosines of For straight line segment , let this length be L, then we have , so the equation It can be expressed in the form of direction cosines of a straight line as , the direction cosines satisfy the spatial trigonometric function equations: , until all faces have completed the intersection with other faces;

[0321] 4. Intersection between faces

[0322] Edge and plane intersection and intersection inclusion detection (first time):

[0323] For each edge of face 1, perform intersection calculation with the plane where face 2 is located, perform inclusion check on face 2, and extract valid intersection points;

[0324] For each edge of face 2, perform intersection calculation with the plane where face 1 is located, perform inclusion check on face 1, and extract valid intersection points;

[0325] Determine the intersection line segment:

[0326] For the midpoint of each pair of valid intersection points, perform inclusion check on it and face 1 and face 2 respectively. If the midpoint is in both face 1 and face 2, then the pair of intersection points defines an intersection line segment.

[0327] 5. Calculations related to the relationship between straight line segments and planes (to assist in understanding the intersection process)

[0328] Direction cosine representation of a straight line segment in space:

[0329] Assume that the space straight line segment The endpoint is and , then the two-point three-dimensional straight line equation is:

[0330]

[0331] Its direction cosine form is , , ,in, , and is a vector The direction angle, , and for The direction cosines of For straight line segment of length, and satisfies ;

[0332] Determination of the coefficients of the plane equation:

[0333] Assume three non-collinear points , and Uniquely define a plane whose equations are generally expressed as: ;

[0334] The coefficients of the plane equation can be calculated using the following formula:

[0335] , , ,

[0336] Find the intersection of a line segment and a plane:

[0337] Let the intersection be , then it is both on the line segment On the plane superior;

[0338] Using the direction cosine representation of the line segment and the plane equation, the intersection point Satisfies the following system of equations:

[0339]

[0340] Solve have to: , , ,in ;in, ;

[0341] like , then the intersection point is on the line segment; otherwise, the intersection point is on the extension line of the straight line segment;

[0342] There are two possible relative positions of the intersection point relative to the polygon to which the three vertices belong: the intersection point is inside the polygon; the intersection point is outside the polygon.

[0343] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A linear accelerator plan verification anti-collision system, characterized by: include: Virtual radiotherapy scene 3D model building module; used to perform 3D modeling of the actual situation in the radiotherapy room, split the treatment machine frame, treatment head, treatment bed and related equipment into 3D model components, and perform modeling based on the modeling software to simulate the real treatment environment and the patient's CT structure, and present and simulate the 3D information of the treatment room including the linear accelerator, treatment bed and multi-leaf light shed, various auxiliary tools, patient anatomical structure and dose distribution in real time; DICOM data 3D reconstruction model module: used to perform 3D reconstruction and processing of DICOM file data, convert it into a CT 3D model of the patient, establish a corresponding DICOM 3D model database, and combine it with the virtual treatment scene to present and simulate the treatment scenario of real cases in real environment in real time; Rigid body properties and collision detection modules; Includes rigid body component setting unit and collision detection algorithm unit; The rigid body component setting unit is used to assign one or more colliders among a ball collider, a box collider or a capsule collider to the three groups of models of the accelerator treatment head, the treatment bed and the patient according to the shape of the three-dimensional model; The collision detection algorithm unit is used to study the principles and algorithms of collision detection of the three groups of models, simulate the movement of each component, detect the collision between the components at different field angles and patient positions, and feed back the detection result information to the user interface.

2. A linear accelerator plan verification and anti-collision system according to claim 1, characterized in that: The virtual treatment room constructed by the virtual radiotherapy scene three-dimensional model construction module also includes an external actual control device to operate the virtual accelerator for interactive operation training, as well as a display screen that can provide linear accelerator status information and a laser light for patient positioning.

3. A linear accelerator plan verification anti-collision system according to claim 1, characterized in that: The DICOM data three-dimensional reconstruction model module uses a MarchingCubes algorithm based on surface rendering and / or a Ray-casting algorithm based on volume rendering to perform three-dimensional reconstruction, wherein: The MarchingCubes algorithm based on surface rendering regards the two-dimensional slice data as a three-dimensional data field, and constructs the surface mesh of the three-dimensional model by extracting the isosurface of the three-dimensional data, and then constructs the three-dimensional model; The ray-casting algorithm based on volume rendering emits a ray from each pixel in the image plane along the line of sight. This ray passes through the volume data set and is sampled according to the set step size. The color value and opacity of each sampling point are calculated by interpolation, and then the accumulated color value and opacity value are calculated point by point from front to back or from back to front until the light is completely absorbed or passes through the object.

4. A linear accelerator plan verification anti-collision system according to claim 1, characterized in that: The collision detection algorithm unit of the rigid body characteristic and collision detection module specifically includes the following steps when performing collision detection: All faces of a rigid body are intersected with all faces of another rigid body in turn, transforming the spatial problem into several plane problems; For the intersection between faces, including: Intersect all the edges of a face with all the planes of another face, then perform inclusion check on the intersection points and the face to extract valid intersection points; All edges of another face are intersected with the plane where the face is located, and then the intersection points and the face are checked for inclusion to extract valid intersection points; The midpoint of each pair of valid intersection points is checked for inclusion with the two faces respectively. If the midpoint is in both one face and the other face, then the pair of intersection points defines an intersection line segment, thereby converting the problem of finding the intersection between faces into a combined problem of finding the intersection between a line segment and an infinite plane and checking the inclusion of a point and a bounded plane.

5. A linear accelerator plan verification anti-collision system according to claim 1, characterized in that: Also included is a rigid body translation and rotation calculation module for calculating the motion of the treatment system model, wherein the motion of the treatment system model includes: The movement of the frame, i.e. the clockwise or counterclockwise rotation of the vertical plane around the central axis; Movement of the treatment bed, including left-right and front-back movement and rotation of the entire treatment bed; The movement of the small head, that is, the rotation when the dynamic multi-leaf grating is realized; the rigid body translation and rotation calculation module uses a specific coordinate transformation formula to calculate the rigid body translation in any direction and rotation around any axis.

6. A linear accelerator plan verification anti-collision system according to claim 1, characterized in that: The rigid body translation and rotation calculation module calculates the rigid body translation along any direction When the length is unit, according to the formula Calculate, where , , ,set up , and The cosines of the axis angles are the above values, where: , , Respectively, vector and The angle corresponding to the cosine value of the angle in the positive direction of the axis, For two points in space and The vector formed by and Represents the midpoint of space and The coordinate component on the x-axis, and Represents the midpoint of space and The coordinate component on the y-axis, and Represents the midpoint of space and The coordinate component on the z-axis.

7. A linear accelerator plan verification and anti-collision system according to claim 1, characterized in that: The rigid body translation and rotation calculation module determines the rotation operator represented by quaternions when calculating the rotation angle θ of the rigid body around any axis in space. ,in, for The real part of yes The imaginary vector is a unit vector, and Any point in space The quaternions are expressed as , its position after rotating around the axis by angle θ The quaternions are expressed as , the calculation process first calculates ,in, ,but , then calculate , and finally calculate ,in, express and The dot product of ,set up ,but , , then transform Order Matrix It is expressed as: ; If you want to rotate an angle around any axis in space, you need to consider the problem of rotating an angle around any axis passing through the origin. This can be solved by the following steps: Assume is along The unit vector in the direction Translate to the origin; Rotation Angle; do the inverse transformation of step 1, The point is restored to its initial position, that is, ,in, Yes The transformation matrix for translating a point to the origin, It's around Rotation The transformation matrix of the angle, is the final rotation result transformation matrix, Represents the translation transformation matrix The inverse matrix of Matrix calculations are performed to save storage space and calculation time.

Citation Information

Patent Citations

  • High-efficiency data structure in space intersection and algorithm thereof

    CN102184223A

  • Mechanical arm collision detection method

    CN112179602A

  • Collision detection method and device and radiotherapy system

    CN115721872A

  • Radiotherapy device collision early warning method

    CN116672620A

  • Ray tracing for the detection and avoidance of collisions between radiotherapy devices and patient

    US20190329073A1