Volume rendering processing method and device for medical image

By using the CUDA architecture and Lambert illumination model on the GPU, the medical image volume rendering method is optimized, solving the problem of large calculations in the ray casting algorithm, improving the rendering speed and real-time performance, and achieving a more efficient processing process.

CN118799475AActive Publication Date: 2024-10-18BEIJING ANDE YIZHI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411071879.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-06
Publication Date
2024-10-18
Estimated Expiration
2044-08-06

Smart Images

  • Figure CN118799475A_ABST
    Figure CN118799475A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a volume rendering processing method and device for a medical image. The method comprises the following steps: receiving an image sequence, a visual angle point coordinate / visual distance and an imaging size; confirming a visual angle point, and constructing a three-dimensional texture data space; the constructor draws an imaging surface and performs grid division on the imaging surface to obtain a pixel point set, and a projection light ray is made towards the three-dimensional texture data space from each pixel point to form a projection light ray set; the method comprises the following steps: storing a three-dimensional texture data space, a visual angle orthogonal plane and a pixel point / projection light set in a GPU video memory based on a CUDA architecture, and planning an RGB pixel group storage area; creating a thread for calling a kernel function of a customized ray casting algorithm for each pixel point in a GPU operation environment, and executing all the threads in parallel; and performing image construction based on all the RGB pixel groups obtained in the RGB pixel group storage area to obtain a volume rendering image, and displaying the volume rendering image. According to the invention, the real-time drawing effect of medical image volume rendering can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a volume rendering processing method and device for medical images. Background Art

[0002] Volume rendering of medical images is an image processing technology that generates color two-dimensional images based on medical image sequences. The ray casting algorithm is currently the most commonly used algorithm for volume rendering. The ray casting algorithm is a basic graphics rendering technology, first proposed by Arthur Appel in 1968. The algorithm reconstructs and renders three-dimensional volume data by simulating the propagation path of light in three-dimensional data. The ray casting algorithm can better balance the computational complexity and reconstruction effect, but because of the large number of rays, the amount of calculation is large, the rendering speed is slow, and the real-time performance of the drawing is poor.

[0003] As the computing power of graphics processing units (GPUs) increases, using GPUs for parallel computing has become an important way to solve the bottleneck of large-scale data processing and improve real-time computing. The calculation mode of each ray in the ray casting algorithm is consistent, which matches the parallel computing structure characteristics of the GPU. If GPU resources can be used to process the calculation work of the ray casting algorithm, it will inevitably improve computing efficiency, speed up drawing, and improve drawing real-time performance. The ray casting algorithm of the traditional architecture GPU maps the calculation to the graphics API. Although this processing method is convenient for users to call, it cannot optimize the processing flow.

[0004] In 2007, NVIDIA released the Computer Unified Device Architecture (CUDA). The CUDA architecture provides programming interfaces for direct access to GPU hardware. Through these interfaces, GPU memory resources can be directly configured / read and written, CUDA kernel functions in the GPU operating environment can be customized, and the number of parallel threads in the GPU operating environment can be dynamically set according to application requirements. If the CUDA architecture can be applied to the volume rendering processing solution of medical images, it can not only improve computing efficiency, speed up rendering, and improve the real-time performance of rendering, but also customize the processing flow of the ray casting algorithm. Summary of the invention

[0005] The purpose of the present invention is to provide a volume rendering processing method, device, electronic device and computer-readable storage medium for medical images in view of the defects of the prior art. Before calling the CUDA architecture for processing, the present invention will first confirm the viewpoint and construct a normalized three-dimensional texture data space T according to the medical image sequence, the viewpoint coordinates and the viewpoint viewing distance, and select any point on the line connecting the viewpoint to the center point of the viewpoint orthogonal plane of the three-dimensional texture data space T as the corresponding imaging plane point, and make a plane at the imaging plane point that is the same size as the viewpoint orthogonal plane and parallel to all four sides as the corresponding volume rendering imaging plane, and mesh the volume rendering imaging plane based on the volume rendering imaging size to obtain a plurality of imaging plane pixel points p to form a corresponding pixel point set, and make a ray perpendicular to the viewpoint orthogonal plane from each imaging plane pixel point p toward the direction of the three-dimensional texture data space T, which is recorded as the corresponding pixel point projection ray, and all the obtained pixel point projection rays form a corresponding projection ray set; after completing the above data preparation work, a data storage area will be planned in the GPU video memory based on the CUDA architecture to store the three-dimensional texture data space T , viewing angle orthogonal plane, pixel point set and projection ray set, and plan an RGB pixel group storage area for storing subsequent calculation results; and based on the CUDA architecture, create a thread that calls the ray casting algorithm kernel function for each imaging surface pixel point p in the GPU operating environment as the corresponding first pixel point thread, and execute all first pixel point threads in parallel in the GPU operating environment; the ray casting algorithm kernel function is a customized CUDA kernel function, which is used to calculate the RGB pixels of the pixel points corresponding to the projection ray according to the 3D texture data space T, the viewing angle orthogonal plane and a specified projection ray stored in the GPU video memory according to the ray casting algorithm and the Lambert lighting model, and update the RGB pixel group storage area based on the calculation results; finally, when all RGB pixel groups in the RGB pixel group storage area in the GPU video memory are not empty, all RGB pixel groups are used to construct images to obtain the corresponding volume rendering image and display it. The present invention applies the CUDA architecture to the volume rendering processing solution of medical images, which can improve the computational efficiency, rendering speed and real-time rendering effect of medical image volume rendering; the present invention implements a ray casting algorithm processing flow for coloring imaging pixels based on the light intensity-pixel mapping relationship under the Lambert lighting model by customizing the CUDA kernel function, which can improve the processing flexibility and optimization convenience of medical image volume rendering.

[0006] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present invention provides a volume rendering processing method for medical images, the method comprising:

[0007] Receive a first medical image sequence, viewpoint coordinates, viewpoint viewing distance and volume rendering imaging size w0×h0; the first medical image sequence is formed by sequentially sorting a plurality of first medical images; the first medical image is a three-dimensional CT image or a three-dimensional MRI image; each of the first medical images is composed of a plurality of image pixels; each of the image pixels corresponds to at least one three-dimensional image coordinate (x, y, z) and an image grayscale; the three-dimensional image coordinate (x, y, z) is a spatial coordinate in an XYZ coordinate system, and the XYZ coordinate system is a three-dimensional Cartesian coordinate system composed of X, Y and Z axes; w0 and h0 in the volume rendering imaging size w0×h0 are the pixel width and pixel height of the volume rendering imaging, respectively;

[0008] A three-dimensional texture data space is constructed by confirming and normalizing the viewpoint according to the first medical image sequence, the viewpoint coordinates and the viewpoint viewing distance to obtain the corresponding first viewpoint and three-dimensional texture data space T; the three-dimensional texture data space T is a cube space with a shape of 1×1×1 in the WHD coordinate system, and the WHD coordinate system is a three-dimensional Cartesian coordinate system composed of a width W axis, a height H axis and a depth D axis; the three-dimensional texture data space T includes a plurality of texture voxel points t; the texture voxel points t correspond to the image pixels one by one; each of the texture voxel points t corresponds to a three-dimensional coordinate (w, h, d) and a texture voxel grayscale, and the value range of the three-dimensional coordinate values ​​w, h, d is between 0 and 1, and the texture voxel grayscale is consistent with the corresponding image grayscale; the side surface of the eight sides of the three-dimensional texture data space T that is closest to the first viewpoint is recorded as the corresponding viewpoint orthogonal surface; the line connecting the center point of the viewpoint orthogonal surface and the first viewpoint is perpendicular to the viewpoint orthogonal surface;

[0009] A point is selected on the line connecting the first viewing point to the center point of the viewing angle orthogonal plane of the three-dimensional texture data space T as the corresponding imaging plane point; and a plane with the same size as the viewing angle orthogonal plane and four sides parallel is made at the imaging plane point, recorded as the corresponding volume rendering imaging plane; based on the volume rendering imaging size w0×h0, the volume rendering imaging plane is grid-divided to obtain corresponding w0×h0 imaging plane pixel points p to form a corresponding first pixel point set; and a ray perpendicular to the viewing angle orthogonal plane is made from each imaging plane pixel point p toward the direction of the three-dimensional texture data space T, recorded as the corresponding pixel point projection ray, and all the obtained pixel point projection rays form a corresponding first projection ray set;

[0010] Based on the processing functions for planning memory space and reading and writing memory data in the CUDA function set, a three-dimensional texture data storage area, an orthogonal surface data storage area, a pixel point data storage area and a projection light data storage area are planned in the GPU video memory for storing the corresponding three-dimensional texture data space T, the viewing angle orthogonal surface of the three-dimensional texture data space T, the first pixel point set and the first projection light set; and an RGB pixel group storage area is planned in the GPU video memory; the RGB pixel group storage area is used to store a plurality of RGB pixel groups, each of which is composed of an R channel pixel value, a G channel pixel value and a B channel pixel value, the number of the RGB pixel groups in the RGB pixel group storage area matches the number of the imaging surface pixel points p in the pixel point data storage area, and the RGB pixel groups correspond to the imaging surface pixel points p one by one, and all the RGB pixel groups stored in the RGB pixel group storage area are initialized to empty;

[0011] In the GPU operating environment, a thread that calls the ray casting algorithm kernel function is created for each pixel point p on the imaging surface, which is recorded as the corresponding first pixel point thread; and all the first pixel point threads are executed in parallel in the GPU operating environment; the ray casting algorithm kernel function is a CUDA kernel function that can only be run in the GPU operating environment and can only use the GPU video memory; the input parameter of the ray casting algorithm kernel function is the first pixel point index; the first pixel point index is a unique index number corresponding to one of the imaging surface pixel points p in the first pixel point set stored in the GPU video memory; the ray casting algorithm kernel function is used to take the imaging surface pixel point p corresponding to the pixel point index in the first pixel point set stored in the GPU video memory as the corresponding The current pixel point, and the pixel point projection light corresponding to the current imaging surface pixel point in the first pixel point set stored in the GPU video memory is used as the corresponding current projection light, and the RGB pixel of the current pixel point is calculated according to the three-dimensional texture data space T stored in the GPU video memory, the viewing angle orthogonal surface and the current projection light according to the ray casting algorithm and the Lambert illumination model, and the RGB pixel group storage area is updated based on the calculation result; the input parameter of each of the first pixel point threads is the second pixel point index; each of the first pixel point threads is used to input the input second pixel point index as the corresponding first pixel point index to the ray casting algorithm kernel function and run the ray casting algorithm kernel function for calculation;

[0012] When all the RGB pixel groups in the RGB pixel group storage area in the GPU display memory are not empty, an image is constructed based on all the obtained RGB pixel groups and the obtained constructed image is used as a corresponding volume rendering image and displayed.

[0013] Preferably, the three-dimensional texture data space construction by confirming and normalizing the viewpoint according to the first medical image sequence, the viewpoint coordinates and the viewpoint viewing distance to obtain the corresponding first viewpoint and the three-dimensional texture data space T specifically includes:

[0014] Identify the largest X, Y, and Z axis coordinates among all the three-dimensional image coordinates (x, y, z) in the first medical image sequence to obtain the corresponding maximum value x max ,y max 、z max ; and the maximum value x max ,y max and z max as the corresponding maximum side length b; and in the XYZ coordinate system, based on the maximum side length b, construct a cube space with a shape of b×b×b and record it as the corresponding three-dimensional volume data space R1; and record the spatial coordinate point corresponding to each of the image pixel points in the first medical image sequence in the three-dimensional volume data space R1 as the corresponding voxel point v; the voxel point v corresponds to the image pixel point one by one;

[0015] The viewpoint is marked in the XYZ coordinate system based on the viewpoint coordinates to obtain the corresponding first viewpoint; and the straight-line distance from the center points of the eight side surfaces of the three-dimensional volume data space R1 to the first viewpoint is calculated, and the side surface with the shortest distance is used as the corresponding viewpoint orthogonal surface; and the three-dimensional volume data space R1 is rotated and displaced in the XYZ coordinate system until the line between the center point of the viewpoint orthogonal surface of the three-dimensional volume data space R2 obtained after the rotation and displacement and the first viewpoint is perpendicular to the viewpoint orthogonal surface and the length of the line matches the viewpoint viewing distance; and during the rotation and displacement process, the spatial coordinates of each voxel point v in the three-dimensional volume data space R1 are rotated and displaced equally to obtain the corresponding voxel point v in the three-dimensional volume data space R2 * ; The voxel point v * One-to-one correspondence with the voxel point v;

[0016] The opposite side of the viewing angle orthogonal plane in the three-dimensional volume data space R2 is recorded as the corresponding orthogonal face; and a three-dimensional Cartesian coordinate system is constructed with the lower left corner vertex of the viewing angle orthogonal plane as the origin, the direction from the lower left corner vertex to the lower right corner vertex of the viewing angle orthogonal plane as the width W axis direction, the direction from the lower left corner vertex to the upper left corner vertex of the viewing angle orthogonal plane as the height H axis direction, and the direction from the lower left corner vertex of the viewing angle orthogonal plane to the lower left corner vertex of the orthogonal face as the depth D axis direction, and recorded as the corresponding WHD coordinate system; and the three-dimensional volume data space corresponding to the three-dimensional volume data space R2 in the XYZ coordinate system in the WHD coordinate system is recorded as the corresponding three-dimensional volume data space R3; and each of the voxel points v in the three-dimensional volume data space R2 is rotated and displaced based on the rotational displacement relationship between the WHD coordinate system and the XYZ coordinate system. * The spatial coordinates of are rotated and displaced equally to obtain the corresponding voxel point v in the three-dimensional volume data space R3 ’ ; The voxel point v ’ The three-dimensional coordinates are expressed as (w ’ ,h ’ ,d ’ ); the voxel point v ’ With the voxel point v * One to one correspondence;

[0017] The three-dimensional size of the three-dimensional volume data space R3 and each of the voxel points v are calculated based on the maximum side length b in the WHD coordinate system. ’ The three-dimensional coordinates of the voxel point v are normalized, and the obtained normalized data space is used as the corresponding three-dimensional texture data space T, and the three-dimensional texture data space T corresponding to each voxel point v is ’ The corresponding spatial coordinate point is used as the corresponding texture voxel point t; the three-dimensional texture data space T is a cube space with a shape of (b / b)×(b / b)×(b / b)=1×1×1; the texture voxel point t and the voxel point v ’ One-to-one correspondence; the three-dimensional coordinates (w, h, d) of the texture voxel point t and the voxel point v ’ The three-dimensional coordinates (w ’ ,h ’ ,d ’ ) is w=w ’ / b,h=h ’ / b,d=d ’ / b;

[0018] The viewing distance of the viewing point is normalized based on the maximum side length b to obtain the corresponding normalized viewing distance = viewing distance of the viewing point / b; and the center point of the viewing angle orthogonal plane of the three-dimensional texture data space T is recorded as the corresponding current center point; and at the current center point, a perpendicular line of the viewing angle orthogonal plane is drawn from the current center point to the outside direction of the three-dimensional texture data space T as the corresponding outer edge vertical line; and the coordinates of the spatial point on the outer edge vertical line whose distance from the current center point matches the normalized viewing distance are taken as the new coordinates of the first viewing point.

[0019] Preferably, the calculating the RGB pixel of the current pixel point according to the three-dimensional texture data space T stored in the GPU video memory, the viewing angle orthogonal surface and the current projection light according to the ray casting algorithm and the Lambert illumination model and updating the RGB pixel group storage area based on the calculation result specifically includes:

[0020] Step 31, the ray casting algorithm kernel function sets a corresponding pixel illumination intensity I for the current pixel; and initializes the pixel illumination intensity I to a preset negative intensity threshold value less than 0; and records the spatial coordinate point corresponding to the preset volume rendering light source point coordinate as the corresponding volume rendering light source point;

[0021] Step 32, calculating the intersection of the current projection light and the plane orthogonal to the viewing angle to obtain a corresponding starting intersection; and using the starting intersection as the corresponding light sampling point s;

[0022] Step 33, and identify the sampling point grayscale corresponding to the light sampling point s, specifically: confirm whether there is the texture voxel point t matching the spatial coordinates of the light sampling point s in the three-dimensional texture data space T; if so, use the texture voxel grayscale of the texture voxel point t matching the spatial coordinates of the light sampling point s as the corresponding sampling point grayscale; if not, search for pairs of neighboring texture voxel points in the three groups of directions of front and back, left and back, and top and bottom of the light sampling point s in the three-dimensional texture data space T. If only a pair of neighboring texture voxel points in one of the directions is found, root search is performed based on the one-dimensional linear interpolation method. A one-dimensional linear interpolation calculation is performed on the texture voxel grayscale of the currently searched pair of neighborhood texture voxel points, and the calculation result is used as the corresponding sampling point grayscale; if two pairs of neighborhood texture voxel points in two groups of directions are searched, a bilinear interpolation calculation is performed on the texture voxel grayscale of the two pairs of neighborhood texture voxel points currently searched based on the bilinear interpolation method, and the calculation result is used as the corresponding sampling point grayscale; if three pairs of neighborhood texture voxel points in three groups of directions are searched, a trilinear interpolation calculation is performed on the texture voxel grayscale of the three pairs of neighborhood texture voxel points currently searched based on the trilinear interpolation method, and the calculation result is used as the corresponding sampling point grayscale;

[0023] Step 34, and identify whether the grayscale of the sampling point exceeds a preset grayscale threshold; if so, go to step 35; if not, go to step 36;

[0024] Step 35: determine the corresponding unit normal vector N based on the gradient of the light sampling point s; determine the corresponding unit light source vector L based on the straight line direction from the light sampling point s to the volume rendering light source point; and calculate the illumination intensity based on the preset ambient light diffuse reflection coefficient K according to the illumination intensity calculation method of the Lambert illumination model. a , preset ambient light intensity I a , preset light source diffuse reflectance K d , preset light source illumination intensity I d The unit normal vector N and the unit light source vector L are used to calculate the illumination intensity to obtain the corresponding illumination intensity I * ; and based on the light intensity I * Reset the pixel illumination intensity I; and identify whether the pixel illumination intensity I after reset is greater than 0, if so, go to step 36, if not, go to step 37;

[0025] Among them, I * =K a ×I a +K a ×I d (L·N);

[0026] Step 36, identifying whether the distance from the light sampling point s to the starting intersection exceeds a preset first length; if so, going to step 37; if not, taking the spatial coordinate point on the current projection light that is after the light sampling point s and is at a preset incremental step length △d from the light sampling point s as the new light sampling point s, and going back to step 33; the first length is defaulted to

[0027] Step 37, record the RGB pixel group corresponding to the current pixel in the RGB pixel group storage area as the corresponding current pixel group; and identify whether the pixel illumination intensity I is greater than 0; if the pixel illumination intensity I is less than or equal to 0, the corresponding R channel pixel value, the G channel pixel value and the B channel pixel value in the current pixel group are set by the preset background R channel pixel value, the preset background G channel pixel value and the preset background B channel pixel value; if the pixel illumination intensity I is greater than 0, the corresponding first pixel value = r0×I, the second pixel value = g0×I and the third pixel value = b0×I are calculated based on the preset R channel pixel coefficient r0, the preset G channel pixel coefficient g0, the preset B channel pixel coefficient b0 and the pixel illumination intensity I, and the corresponding R channel pixel value, the G channel pixel value and the B channel pixel value in the current pixel group are set by the calculated first, second and third pixel values.

[0028] A second aspect of an embodiment of the present invention provides a device for implementing the volume rendering processing method of medical images described in the first aspect, the device comprising: a data receiving module, a first data preprocessing module, a second data preprocessing module, a first CUDA processing module, a second CUDA processing module and a volume rendering image composition module;

[0029] The data receiving module is used to receive a first medical image sequence, viewpoint coordinates, viewpoint viewing distance and volume rendering imaging size w0×h0; the first medical image sequence is formed by sequentially sorting a plurality of first medical images; the first medical image is a three-dimensional CT image or a three-dimensional MRI image; each of the first medical images is composed of a plurality of image pixels; each of the image pixels corresponds to at least one three-dimensional image coordinate (x, y, z) and an image grayscale; the three-dimensional image coordinate (x, y, z) is a spatial coordinate in an XYZ coordinate system, and the XYZ coordinate system is a three-dimensional Cartesian coordinate system composed of X, Y and Z axes; w0 and h0 in the volume rendering imaging size w0×h0 are the pixel width and pixel height of the volume rendering imaging, respectively;

[0030] The first data preprocessing module is used to construct a three-dimensional texture data space for viewpoint confirmation and normalization according to the first medical image sequence, the viewpoint coordinates and the viewpoint viewing distance to obtain the corresponding first viewpoint and three-dimensional texture data space T; the three-dimensional texture data space T is a cube space with a shape of 1×1×1 in the WHD coordinate system, and the WHD coordinate system is a three-dimensional Cartesian coordinate system composed of a width W axis, a height H axis and a depth D axis; the three-dimensional texture data space T includes a plurality of texture voxel points t; the texture voxel points t correspond to the image pixels one by one; each of the texture voxel points t corresponds to a three-dimensional coordinate (w, h, d) and a texture voxel grayscale, and the value range of the three-dimensional coordinate values ​​w, h, d is between 0 and 1, and the texture voxel grayscale is consistent with the corresponding image grayscale; the side surface of the eight sides of the three-dimensional texture data space T that is closest to the first viewpoint is recorded as the corresponding viewpoint orthogonal surface; the line connecting the center point of the viewpoint orthogonal surface and the first viewpoint is perpendicular to the viewpoint orthogonal surface;

[0031] The second data preprocessing module is used to select any point on the line connecting the first viewpoint to the center point of the view orthogonal plane of the three-dimensional texture data space T as the corresponding imaging plane point; and make a plane with the same size as the view orthogonal plane and four sides parallel at the imaging plane point as the corresponding volume rendering imaging plane; based on the volume rendering imaging size w0×h0, the volume rendering imaging plane is grid-divided to obtain corresponding w0×h0 imaging plane pixel points p to form a corresponding first pixel point set; and from each imaging plane pixel point p, a ray perpendicular to the view orthogonal plane is made toward the direction of the three-dimensional texture data space T, which is recorded as the corresponding pixel point projection ray, and all the obtained pixel point projection rays form a corresponding first projection ray set;

[0032] The first CUDA processing module is used to plan a three-dimensional texture data storage area, an orthogonal surface data storage area, a pixel point data storage area and a projection light data storage area in the GPU video memory based on the processing functions used for planning memory space and for reading and writing memory data in the CUDA function set, for storing the corresponding three-dimensional texture data space T, the viewing angle orthogonal surface of the three-dimensional texture data space T, the first pixel point set and the first projection light set; and plan an RGB pixel group storage area in the GPU video memory; the RGB pixel group storage area is used to store multiple RGB pixel groups, each of which is composed of an R channel pixel value, a G channel pixel value and a B channel pixel value, the number of the RGB pixel groups in the RGB pixel group storage area matches the number of the imaging surface pixel points p in the pixel point data storage area, and the RGB pixel groups correspond to the imaging surface pixel points p one by one, and all the RGB pixel groups stored in the RGB pixel group storage area are initialized to empty;

[0033] The second CUDA processing module is used to create a thread that calls the ray casting algorithm kernel function for each pixel point p on the imaging surface in the GPU operating environment, which is recorded as the corresponding first pixel point thread; and all the first pixel point threads are executed in parallel in the GPU operating environment; the ray casting algorithm kernel function is a CUDA kernel function that can only be run in the GPU operating environment and can only use the GPU video memory; the input parameter of the ray casting algorithm kernel function is the first pixel point index; the first pixel point index is the unique index number corresponding to one of the imaging surface pixel points p in the first pixel point set stored in the GPU video memory; the ray casting algorithm kernel function is used to convert the imaging surface pixel point corresponding to the pixel point index in the first pixel point set stored in the GPU video memory point p is taken as the corresponding current pixel point, and the pixel point projection light corresponding to the current imaging surface pixel point in the first pixel point set stored in the GPU video memory is taken as the corresponding current projection light, and the RGB pixel of the current pixel point is calculated according to the three-dimensional texture data space T stored in the GPU video memory, the viewing angle orthogonal surface and the current projection light according to the ray casting algorithm and the Lambert illumination model, and the RGB pixel group storage area is updated based on the calculation result; the input parameter of each of the first pixel point threads is the second pixel point index; each of the first pixel point threads is used to input the input second pixel point index as the corresponding first pixel point index to the ray casting algorithm kernel function and run the ray casting algorithm kernel function for calculation;

[0034] The volume rendering image composition module is used for constructing an image based on all the obtained RGB pixel groups when all the RGB pixel groups in the RGB pixel group storage area in the GPU display memory are not empty, and displaying the obtained constructed image as the corresponding volume rendering image.

[0035] A third aspect of an embodiment of the present invention provides an electronic device, including: a memory, a processor, and a transceiver;

[0036] The processor is used to be coupled to the memory, read and execute instructions in the memory, so as to implement the method steps described in the first aspect above;

[0037] The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.

[0038] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed by a computer, the computer executes the instructions of the method described in the first aspect above.

[0039] The embodiment of the present invention provides a volume rendering processing method, device, electronic device and computer-readable storage medium for medical images. As can be seen from the above content, before calling the CUDA architecture for processing, the embodiment of the present invention will first confirm the viewpoint and construct a normalized three-dimensional texture data space T according to the medical image sequence, the viewpoint coordinates and the viewpoint viewing distance, and select any point on the line connecting the viewpoint to the center point of the viewpoint orthogonal plane of the three-dimensional texture data space T as the corresponding imaging plane point, and make a plane at the imaging plane point that is the same size as the viewpoint orthogonal plane and has four parallel sides as the corresponding volume rendering imaging plane, and mesh the volume rendering imaging plane based on the volume rendering imaging size to obtain a plurality of imaging plane pixel points p to form a corresponding pixel point set, and make a ray perpendicular to the viewpoint orthogonal plane from each imaging plane pixel point p toward the direction of the three-dimensional texture data space T, which is recorded as the corresponding pixel point projection ray, and all the obtained pixel point projection rays form a corresponding projection ray set; after completing the above data preparation work, a data storage area will be planned in the GPU video memory based on the CUDA architecture to store the three-dimensional texture. The invention relates to a method for processing a data space T, a viewing angle orthogonal surface, a pixel point set and a projection light point set, and planning an RGB pixel group storage area for storing subsequent calculation results; and based on the CUDA architecture, a thread calling a ray casting algorithm kernel function is created for each imaging surface pixel point p in a GPU operating environment, recorded as a corresponding first pixel point thread, and all first pixel point threads are executed in parallel in the GPU operating environment; the ray casting algorithm kernel function is a customized CUDA kernel function, which is used to calculate the RGB pixels of the pixel points corresponding to the projection light according to the three-dimensional texture data space T, the viewing angle orthogonal surface and a specified projection light stored in the GPU video memory according to the ray casting algorithm and the Lambert lighting model, and update the RGB pixel group storage area based on the calculation results; finally, when all RGB pixel groups in the RGB pixel group storage area in the GPU video memory are not empty, an image is constructed by all RGB pixel groups to obtain a corresponding volume rendering image and display it. The embodiment of the present invention applies the CUDA architecture to the volume rendering processing solution of medical images, thereby improving the computational efficiency, rendering speed and real-time rendering effect of medical image volume rendering; the embodiment of the present invention implements a ray casting algorithm processing flow for coloring imaging pixels based on the light intensity-pixel mapping relationship under the Lambert lighting model through customized CUDA kernel functions, thereby improving the processing flexibility and optimization convenience of medical image volume rendering. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 A schematic diagram of a volume rendering processing method for medical images provided in Embodiment 1 of the present invention;

[0041] Figure 2A schematic diagram of conversion of a three-dimensional volume data space R1, a three-dimensional volume data space R2, a three-dimensional volume data space R3 and a three-dimensional texture data space T provided in the first embodiment of the present invention;

[0042] Figure 3 A schematic diagram of a volume rendering imaging surface, an imaging surface pixel point p, a pixel point projection light, and a light sampling point s provided in the first embodiment of the present invention;

[0043] Figure 4 A schematic diagram of a unit normal vector N and a unit light source vector L of a volume rendering light source point and a light sampling point s provided in the first embodiment of the present invention;

[0044] Figure 5 A module structure diagram of a volume rendering processing device for medical images provided in Embodiment 2 of the present invention;

[0045] Figure 6 A schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] Embodiment 1 of the present invention provides a volume rendering processing method for medical images, such as Figure 1 As shown in a schematic diagram of a volume rendering processing method for medical images provided in Embodiment 1 of the present invention, the method mainly comprises the following steps:

[0048] Step 1: Receive a first medical image sequence, viewpoint coordinates, viewpoint viewing distance, and volume rendering imaging size w0×h0.

[0049] Here, the first medical image sequence is formed by sequentially sorting a plurality of first medical images; the first medical image is a three-dimensional CT image or a three-dimensional MRI image; each first medical image is composed of a plurality of image pixels; each image pixel corresponds to at least one three-dimensional image coordinate (x, y, z) and an image grayscale; wherein the three-dimensional image coordinate (x, y, z) is a spatial coordinate in an XYZ coordinate system, and the XYZ coordinate system is a three-dimensional Cartesian coordinate system composed of X, Y, and Z axes; w0 and h0 in the volume rendering imaging size w0×h0 are respectively the pixel width and pixel height of the volume rendering imaging.

[0050] Step 2, according to the first medical image sequence, the viewpoint coordinates and the viewpoint distance, the viewpoint is confirmed and the normalized three-dimensional texture data space is constructed to obtain the corresponding first viewpoint and three-dimensional texture data space T;

[0051] Among them, the three-dimensional texture data space T is a cube space with a shape of 1×1×1 in the WHD coordinate system, and the WHD coordinate system is a three-dimensional Cartesian coordinate system composed of a width W axis, a height H axis and a depth D axis; the three-dimensional texture data space T includes multiple texture voxel points t; the texture voxel points t correspond to image pixels one by one; each texture voxel point t corresponds to a three-dimensional coordinate (w, h, d) and a texture voxel grayscale, and the value range of the three-dimensional coordinate values ​​w, h, and d is between 0 and 1, and the texture voxel grayscale is consistent with the corresponding image grayscale; among the eight sides of the three-dimensional texture data space T, the side closest to the first viewing point is recorded as the corresponding viewing orthogonal plane; the line connecting the center point of the viewing orthogonal plane and the first viewing point is perpendicular to the viewing orthogonal plane;

[0052] Specifically, step 21 is to identify the largest X, Y, and Z axis coordinates among all three-dimensional image coordinates (x, y, z) in the first medical image sequence to obtain the corresponding maximum value x max ,y max 、z max ; and set the maximum value x max ,y max and z max The maximum value of is taken as the corresponding maximum side length b; and in the XYZ coordinate system, a cube space with a shape of b×b×b is constructed based on the maximum side length b and recorded as the corresponding three-dimensional volume data space R1; and the spatial coordinate point corresponding to each image pixel point in the first medical image sequence in the three-dimensional volume data space R1 is recorded as the corresponding voxel point v;

[0053] Among them, the voxel point v corresponds one-to-one to the image pixel point;

[0054] Here, the three-dimensional volume data space R1 is as follows Figure 2 The conversion diagram of the three-dimensional volume data space R1, the three-dimensional volume data space R2, the three-dimensional volume data space R3 and the three-dimensional texture data space T provided in the first embodiment of the present invention is shown;

[0055] Step 22, mark the viewpoint based on the viewpoint coordinates in the XYZ coordinate system to obtain the corresponding first viewpoint; calculate the straight-line distance from the center points of the eight side surfaces of the three-dimensional volume data space R1 to the first viewpoint, and use the side surface with the shortest distance as the corresponding viewpoint orthogonal surface; rotate and displace the three-dimensional volume data space R1 in the XYZ coordinate system until the line between the center point of the viewpoint orthogonal surface of the three-dimensional volume data space R2 obtained after the rotation and displacement and the first viewpoint is perpendicular to the viewpoint orthogonal surface and the length of the line matches the viewpoint viewing distance; and during the rotation and displacement process, perform an equivalent rotation and displacement on the spatial coordinates of each voxel point v in the three-dimensional volume data space R1 to obtain the corresponding voxel point v in the three-dimensional volume data space R2 * ;

[0056] Among them, the voxel point v * One-to-one correspondence with voxel point v;

[0057] Here, the first viewpoint, the viewpoint orthogonal plane, and the three-dimensional volume data space R2 are as follows: Figure 2 As shown;

[0058] Step 23, record the opposite side of the viewing angle orthogonal plane in the three-dimensional volume data space R2 as the corresponding orthogonal face; and construct a three-dimensional Cartesian coordinate system as the corresponding WHD coordinate system with the lower left corner vertex of the viewing angle orthogonal plane as the origin, the direction from the lower left corner vertex to the lower right corner vertex of the viewing angle orthogonal plane as the width W axis direction, the direction from the lower left corner vertex to the upper left corner vertex of the viewing angle orthogonal plane as the height H axis direction, and the direction from the lower left corner vertex of the viewing angle orthogonal plane to the lower left corner vertex of the orthogonal face as the depth D axis direction; and record the three-dimensional volume data space R2 in the XYZ coordinate system under the WHD coordinate system The corresponding three-dimensional volume data space is recorded as the corresponding three-dimensional volume data space R3; and based on the rotational displacement relationship between the WHD coordinate system and the XYZ coordinate system, each voxel point v in the three-dimensional volume data space R2 is rotated. * The spatial coordinates of are rotated and displaced equally to obtain the corresponding voxel point v in the three-dimensional volume data space R3 ’ ;

[0059] Among them, the voxel point v ’ The three-dimensional coordinates are expressed as (w ’ ,h ’ ,d ’ ); voxel point v ’ With voxel point v * One to one correspondence;

[0060] Here, the orthogonal face-to-face, WHD coordinate system, and three-dimensional volume data space R3 are as follows Figure 2 As shown;

[0061] Step 24: In the WHD coordinate system, the three-dimensional size of the three-dimensional volume data space R3 and each voxel point v are calculated based on the maximum side length b. ’ The three-dimensional coordinates of the voxel point v are normalized, and the obtained normalized data space is used as the corresponding three-dimensional texture data space T, and the three-dimensional texture data space T is ’ The corresponding spatial coordinate point is taken as the corresponding texture voxel point t;

[0062] The three-dimensional texture data space T is a cube space with a shape of (b / b)×(b / b)×(b / b)=1×1×1; the texture voxel point t and the voxel point v ’ One-to-one correspondence; the three-dimensional coordinates (w, h, d) of the texture voxel point t and the voxel point v ’ The three-dimensional coordinates (w ’ ,h ’ ,d ’ ) is w=w ’ / b,h=h ’ / b,d=d ’ / b;

[0063] Here, the three-dimensional texture data space T is as follows Figure 2 As shown;

[0064] Step 25, normalize the viewing distance of the viewing point based on the maximum side length b to obtain the corresponding normalized viewing distance = viewing distance of the viewing point / b; and record the center point of the viewing orthogonal plane of the three-dimensional texture data space T as the corresponding current center point; and at the current center point, draw a perpendicular line of the viewing orthogonal plane from the current center point to the outside direction of the three-dimensional texture data space T as the corresponding outer edge vertical line; and use the coordinates of the spatial point on the outer edge vertical line whose distance from the current center point matches the normalized viewing distance as the new coordinates of the first viewing point.

[0065] Step 3, randomly select a point on the line connecting the first viewing point to the center point of the viewing orthogonal plane of the three-dimensional texture data space T as the corresponding imaging plane point; and make a plane at the imaging plane point that is the same size as the viewing orthogonal plane and has four parallel sides, recorded as the corresponding volume rendering imaging plane; based on the volume rendering imaging size w0×h0, the volume rendering imaging plane is gridded to obtain the corresponding w0×h0 imaging plane pixel points p to form the corresponding first pixel point set; and from each imaging plane pixel point p, make a ray perpendicular to the viewing orthogonal plane toward the direction of the three-dimensional texture data space T, recorded as the corresponding pixel point projection ray, and all the obtained pixel point projection rays form the corresponding first projection ray set.

[0066] Here, the volume rendering imaging surface, the imaging surface pixel point p, and the pixel point projection light are as follows: Figure 3The schematic diagram of the volume rendering imaging surface, the imaging surface pixel point p, the pixel point projection light and the light sampling point s provided in the first embodiment of the present invention is shown.

[0067] Step 4, based on the processing functions for planning memory space and reading and writing memory data in the CUDA function set, a three-dimensional texture data storage area, an orthogonal surface data storage area, a pixel point data storage area and a projection light data storage area are planned in the GPU video memory to store the corresponding three-dimensional texture data space T, the viewing angle orthogonal surface of the three-dimensional texture data space T, the first pixel point set and the first projection light set; and an RGB pixel group storage area is planned in the GPU video memory;

[0068] Among them, the RGB pixel group storage area is used to store multiple RGB pixel groups, each RGB pixel group is composed of an R channel pixel value, a G channel pixel value and a B channel pixel value, the number of RGB pixel groups in the RGB pixel group storage area matches the number of imaging surface pixel points p in the pixel point data storage area, and the RGB pixel groups correspond to the imaging surface pixel points p one by one, and all RGB pixel groups stored in the RGB pixel group storage area are initialized to empty.

[0069] Here, the 3D texture / orthogonal surface / pixel point / projected light data storage areas in the GPU video memory can all be regarded as input data storage areas, while the RGB pixel group storage area is the output data storage area; the CUDA architecture also provides many upper-level data objects, which can perform read and write operations on some data storage structures with fixed formats; after the data storage area is created, 1) either custom data objects can be constructed based on these custom data structures to perform data read and write operations, or 2) the stored data can be converted into a format according to some data storage structures with fixed formats, so that the ready-made data objects can be directly called for data read and write access; both methods are supported in the embodiments of the present invention. For example, the CUDA architecture provides a three-dimensional texture data storage structure with a fixed format and corresponding data objects. Therefore, when storing data in the three-dimensional texture data storage area and the orthogonal surface data storage area, the first processing method can be used to convert the three-dimensional texture data space T and the viewing angle orthogonal surface according to the CUDA three-dimensional texture data storage structure and then store them. For another example, the CUDA architecture does not have a good point set and line set data storage structure. Therefore, when storing data in the pixel point data storage area and the projection ray data storage area, the second processing method must be used to customize the data objects based on the data structure of the first pixel point set and the first projection ray set to perform data reading and writing operations.

[0070] Step 5: Create a thread for each pixel point p on the imaging surface under the GPU operating environment, which calls the kernel function of the ray casting algorithm and records it as the corresponding first pixel point thread; and execute all the first pixel point threads in parallel under the GPU operating environment;

[0071] Here, the ray casting algorithm kernel function of the embodiment of the present invention is a customized CUDA kernel function that can only be run in a GPU operating environment and can only use GPU video memory;

[0072] The input parameter of the kernel function of the ray casting algorithm is the first pixel point index; the first pixel point index is a unique index number corresponding to an imaging surface pixel point p in the first pixel point set stored in the GPU video memory;

[0073] The ray casting algorithm kernel function is used to take the imaging surface pixel point p corresponding to the pixel point index in the first pixel point set stored in the GPU video memory as the corresponding current pixel point; and take the pixel point projection light corresponding to the current imaging surface pixel point in the first pixel point set stored in the GPU video memory as the corresponding current projection light; and calculate the RGB pixel of the current pixel point according to the three-dimensional texture data space T stored in the GPU video memory, the orthogonal plane of the viewing angle and the current projection light according to the ray casting algorithm and the Lambert illumination model, and update the RGB pixel group storage area based on the calculation result;

[0074] The input parameter of each first pixel point thread is the second pixel point index; each first pixel point thread is used to input the input second pixel point index as the corresponding first pixel point index to the ray casting algorithm kernel function and run the ray casting algorithm kernel function for calculation;

[0075] According to the ray casting algorithm and Lambert illumination model, the RGB pixel of the current pixel is calculated according to the three-dimensional texture data space T stored in the GPU video memory, the orthogonal plane of the viewing angle and the current projection light, and the RGB pixel group storage area is updated based on the calculation result, specifically including:

[0076] Step A1, the kernel function of the ray casting algorithm sets a corresponding pixel illumination intensity I for the current pixel; and initializes the pixel illumination intensity I to a preset negative intensity threshold value less than 0; and records the spatial coordinate point corresponding to the preset volume rendering light source point coordinate as the corresponding volume rendering light source point;

[0077] Here, the negative intensity threshold is a preset illumination intensity value, but a negative number less than 0; the volume rendering light source point coordinate is a preset WHD coordinate system coordinate; the volume rendering light source point is as follows Figure 4 The schematic diagram of the unit normal vector N and the unit light source vector L of the volume rendering light source point and the light sampling point s provided in the first embodiment of the present invention is shown;

[0078] Step A2, calculating the intersection of the current projection light and the plane orthogonal to the viewing angle to obtain the corresponding starting intersection; and using the starting intersection as the corresponding light sampling point s;

[0079] Here, the light sampling point s is Figure 4 As shown;

[0080] Step A3, identifying the sampling point grayscale corresponding to the light sampling point s;

[0081] Specifically, step A3-1, confirming whether there is a texture voxel point t matching the spatial coordinates of the light sampling point s in the three-dimensional texture data space T;

[0082] Step A3-2: if it exists, the texture voxel grayscale of the texture voxel point t that matches the spatial coordinates of the light sampling point s is used as the corresponding sampling point grayscale;

[0083] Step A3-3, if it does not exist, then search for pairs of neighboring texture voxel points in the three groups of directions of front and back, left and back, and top and bottom of the light sampling point s in the three-dimensional texture data space T; if only one pair of neighboring texture voxel points in one of the directions is found, then one-dimensional linear interpolation calculation is performed based on the texture voxel grayscale of the currently searched pair of neighboring texture voxel points based on the one-dimensional linear interpolation method, and the calculation result is used as the corresponding sampling point grayscale; if two pairs of neighboring texture voxel points in two of the directions are found, then bilinear interpolation calculation is performed based on the texture voxel grayscale of the two pairs of neighboring texture voxel points currently searched based on the bilinear interpolation method, and the calculation result is used as the corresponding sampling point grayscale; if three pairs of neighboring texture voxel points in three groups of directions are found, then trilinear interpolation calculation is performed based on the texture voxel grayscale of the three pairs of neighboring texture voxel points currently searched based on the trilinear interpolation method, and the calculation result is used as the corresponding sampling point grayscale;

[0084] Step A4, and identify whether the grayscale of the sampling point exceeds the preset grayscale threshold; if so, go to step A5; if not, go to step A6;

[0085] Here, the grayscale threshold is a preset grayscale value; in certain cases, it can also be set to a grayscale range. If the grayscale threshold is a grayscale range, then exceeding the preset grayscale threshold means exceeding the preset grayscale range;

[0086] Step A5: determine the corresponding unit normal vector N based on the gradient of the light sampling point s; determine the corresponding unit light source vector L based on the straight line direction from the light sampling point s to the volume rendering light source point; and calculate the illumination intensity based on the preset ambient light diffuse reflection coefficient K according to the illumination intensity calculation method of the Lambert illumination model. a , preset ambient light intensity Ia , preset light source diffuse reflectance K d , preset light source illumination intensity I d And the unit normal vector N and the unit light source vector L are used to calculate the illumination intensity to obtain the corresponding illumination intensity I * ; and based on the light intensity I * Reset the pixel illumination intensity I; and identify whether the reset pixel illumination intensity I is greater than 0, if so, go to step A6, if not, go to step A7;

[0087] Among them, I * =K a ×I a +K d ×I d (L·N);

[0088] Here, the unit normal vector N and the unit light source vector L are as follows Figure 4 As shown;

[0089] Step A6, identifying whether the distance from the light sampling point s to the starting intersection exceeds a preset first length; if so, going to step A7; if not, taking a spatial coordinate point on the current projection light that is after the light sampling point s and is at a preset incremental length △d from the light sampling point s as a new light sampling point s, and going back to step A3;

[0090] Here, the first length defaults to √3, which is actually the diagonal length of the three-dimensional texture data space T; the incremental step length △d is a preset length less than 1; the first length and the incremental step length △d are as follows Figure 3 As shown;

[0091] Step A7, record the RGB pixel group corresponding to the current pixel in the RGB pixel group storage area as the corresponding current pixel group; and identify whether the pixel illumination intensity I is greater than 0; if the pixel illumination intensity I is less than or equal to 0, the corresponding R channel pixel value, G channel pixel value and B channel pixel value in the current pixel group are set by the preset background R channel pixel value, the preset background G channel pixel value and the preset background B channel pixel value; if the pixel illumination intensity I is greater than 0, the corresponding first pixel value = r0×I, the second pixel value = g0×I and the third pixel value = b0×I are calculated based on the preset R channel pixel coefficient r0, the preset G channel pixel coefficient g0, the preset B channel pixel coefficient b0 and the pixel illumination intensity I, and the corresponding R channel pixel value, G channel pixel value and B channel pixel value in the current pixel group are set by the calculated first, second and third pixel values;

[0092] Here, the preset background R / G / B channel pixel values ​​are three preset pixel values; the preset R channel pixel coefficient r0, G channel pixel coefficient g0, and B channel pixel coefficient b0 are three preset pixel coefficients, which reflect the mapping relationship between light intensity and R / G / B channel pixels.

[0093] Step 6: when all RGB pixel groups in the RGB pixel group storage area in the GPU display memory are not empty, an image is constructed based on all the obtained RGB pixel groups and the obtained constructed image is used as the corresponding volume rendering image and displayed.

[0094] Figure 5 This is a module structure diagram of a volume rendering processing device for medical images provided in the second embodiment of the present invention. The device is a terminal device or server that implements the aforementioned method embodiment, or can be a device that enables the aforementioned terminal device or server to implement the aforementioned method embodiment. For example, the device can be a device or chip system of the aforementioned terminal device or server. Figure 5 As shown, the device includes: a data receiving module 201, a first data preprocessing module 202, a second data preprocessing module 203, a first CUDA processing module 204, a second CUDA processing module 205 and a volume rendering image composition module 206.

[0095] The data receiving module 201 is used to receive a first medical image sequence, viewpoint coordinates, viewpoint viewing distance and volume rendering imaging size w0×h0; the first medical image sequence is formed by sequentially sorting a plurality of first medical images; the first medical image is a three-dimensional CT image or a three-dimensional MRI image; each first medical image is composed of a plurality of image pixels; each image pixel corresponds to at least one three-dimensional image coordinate (x, y, z) and an image grayscale; the three-dimensional image coordinate (x, y, z) is a spatial coordinate in an XYZ coordinate system, and the XYZ coordinate system is a three-dimensional Cartesian coordinate system composed of X, Y and Z axes; in the volume rendering imaging size w0×h0, w0 and h0 are respectively the pixel width and pixel height of the volume rendering imaging.

[0096] The first data preprocessing module 202 is used to construct a three-dimensional texture data space for viewpoint confirmation and normalization according to the first medical image sequence, viewpoint coordinates and viewpoint viewing distance to obtain the corresponding first viewpoint and three-dimensional texture data space T; the three-dimensional texture data space T is a cube space with a shape of 1×1×1 in the WHD coordinate system, and the WHD coordinate system is a three-dimensional Cartesian coordinate system composed of a width W axis, a height H axis and a depth D axis; the three-dimensional texture data space T includes multiple texture voxel points t; the texture voxel points t correspond to image pixels one by one; each texture voxel point t corresponds to a three-dimensional coordinate (w, h, d) and a texture voxel grayscale, the value range of the three-dimensional coordinate values ​​w, h, d are all between 0 and 1, and the texture voxel grayscale is consistent with the corresponding image grayscale; the side surface of the eight sides of the three-dimensional texture data space T that is closest to the first viewpoint is recorded as the corresponding view orthogonal surface; the line connecting the center point of the view orthogonal surface and the first viewpoint is perpendicular to the view orthogonal surface.

[0097] The second data preprocessing module 203 is used to select any point on the line connecting the first viewing point to the center point of the viewing orthogonal plane of the three-dimensional texture data space T as the corresponding imaging plane point; and make a plane at the imaging plane point that is the same size as the viewing orthogonal plane and has four parallel sides, which is recorded as the corresponding volume rendering imaging plane; based on the volume rendering imaging size w0×h0, the volume rendering imaging plane is gridded to obtain the corresponding w0×h0 imaging plane pixel points p to form the corresponding first pixel point set; and from each imaging plane pixel point p, a ray perpendicular to the viewing orthogonal plane is made in the direction of the three-dimensional texture data space T, which is recorded as the corresponding pixel point projection ray, and all the obtained pixel point projection rays form the corresponding first projection ray set.

[0098] The first CUDA processing module 204 is used to plan a three-dimensional texture data storage area, an orthogonal surface data storage area, a pixel point data storage area and a projection light data storage area in the GPU video memory based on the processing functions in the CUDA function set for planning memory space and for reading and writing memory data, and to store the corresponding three-dimensional texture data space T, the viewing angle orthogonal surface of the three-dimensional texture data space T, the first pixel point set and the first projection light set; and plan an RGB pixel group storage area in the GPU video memory; the RGB pixel group storage area is used to store multiple RGB pixel groups, each RGB pixel group consists of an R channel pixel value, a G channel pixel value and a B channel pixel value, the number of RGB pixel groups in the RGB pixel group storage area matches the number of imaging surface pixel points p in the pixel point data storage area, and the RGB pixel groups correspond to the imaging surface pixel points p one by one, and all RGB pixel groups stored in the RGB pixel group storage area are initialized to empty.

[0099] The second CUDA processing module 205 is used to create a thread that calls the ray casting algorithm kernel function for each imaging surface pixel point p in the GPU operating environment, and record it as the corresponding first pixel point thread; and execute all first pixel point threads in parallel in the GPU operating environment; the ray casting algorithm kernel function is a CUDA kernel function that can only be run in the GPU operating environment and can only use the GPU video memory; the input parameter of the ray casting algorithm kernel function is the first pixel point index; the first pixel point index is a unique index number corresponding to an imaging surface pixel point p in the first pixel point set stored in the GPU video memory; the ray casting algorithm kernel function is used to convert the component corresponding to the pixel point index in the first pixel point set stored in the GPU video memory The image plane pixel p is taken as the corresponding current pixel, and the pixel projection light corresponding to the current imaging plane pixel in the first pixel set stored in the GPU video memory is taken as the corresponding current projection light, and the RGB pixel of the current pixel is calculated according to the ray casting algorithm and the Lambert illumination model according to the three-dimensional texture data space T stored in the GPU video memory, the viewing angle orthogonal surface and the current projection light, and the RGB pixel group storage area is updated based on the calculation result; the input parameter of each first pixel thread is the second pixel index; each first pixel thread is used to input the input second pixel index as the corresponding first pixel index to the ray casting algorithm kernel function and run the ray casting algorithm kernel function for calculation.

[0100] The volume rendering image composition module 206 is used to construct an image based on all the obtained RGB pixel groups when all the RGB pixel groups in the RGB pixel group storage area in the GPU display memory are not empty and to display the obtained constructed image as the corresponding volume rendering image.

[0101] An embodiment of the present invention provides a volume rendering processing device for medical images, which can execute the method steps in the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail here.

[0102] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the data receiving module can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The function of the above-mentioned module is determined. The implementation of other modules is similar. In addition, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.

[0103] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital signal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0104] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the above method embodiments are generated. The above computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The above-mentioned computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the above-mentioned computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, Bluetooth, microwave, etc.) methods. The above-mentioned computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The above-mentioned available medium can be a magnetic medium (such as a floppy disk, a hard disk, a tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.

[0105] Figure 6 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. The electronic device may be a terminal device or a server for implementing the method of the aforementioned embodiment, or may be a terminal device or a server for implementing the method of the aforementioned embodiment connected to the aforementioned terminal device or server. Figure 6 As shown, the electronic device may include: a processor 301 (such as a CPU), a memory 302, and a transceiver 303; the transceiver 303 is coupled to the processor 301, and the processor 301 controls the transceiver 303. Various instructions may be stored in the memory 302 to complete various processing functions and implement the processing steps described in the aforementioned embodiment method. Preferably, the electronic device involved in the embodiment of the present invention also includes: a power supply 304, a system bus 305 and a communication port 306. The system bus 305 is used to realize the communication connection between components. The above-mentioned communication port 306 is used for connecting and communicating between the electronic device and other peripherals.

[0106] exist Figure 6The system bus 305 mentioned in the figure can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface is used to realize the communication between the database access device and other devices (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM), and may also include non-volatile memory (Non-Volatile Memory), such as at least one disk storage.

[0107] The above-mentioned processor can be a general-purpose processor, including a central processing unit CPU, a network processor (Network Processor, NP), a graphics processing unit (Graphics Processing Unit, GPU), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0108] It should be noted that an embodiment of the present invention further provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the method and processing process provided in the above embodiments.

[0109] An embodiment of the present invention further provides a chip for executing instructions, wherein the chip is used to execute the processing steps described in the aforementioned method embodiment.

[0110] The embodiment of the present invention provides a volume rendering processing method, device, electronic device and computer-readable storage medium for medical images. As can be seen from the above content, before calling the CUDA architecture for processing, the embodiment of the present invention will first confirm the viewpoint and construct a normalized three-dimensional texture data space T according to the medical image sequence, the viewpoint coordinates and the viewpoint viewing distance, and select any point on the line connecting the viewpoint to the center point of the viewpoint orthogonal plane of the three-dimensional texture data space T as the corresponding imaging plane point, and make a plane at the imaging plane point that is the same size as the viewpoint orthogonal plane and has four parallel sides as the corresponding volume rendering imaging plane, and mesh the volume rendering imaging plane based on the volume rendering imaging size to obtain a plurality of imaging plane pixel points p to form a corresponding pixel point set, and make a ray perpendicular to the viewpoint orthogonal plane from each imaging plane pixel point p toward the direction of the three-dimensional texture data space T, which is recorded as the corresponding pixel point projection ray, and all the obtained pixel point projection rays form a corresponding projection ray set; after completing the above data preparation work, a data storage area will be planned in the GPU video memory based on the CUDA architecture to store the three-dimensional texture. The invention relates to a method for processing a data space T, a viewing angle orthogonal surface, a pixel point set and a projection light point set, and planning an RGB pixel group storage area for storing subsequent calculation results; and based on the CUDA architecture, a thread calling a ray casting algorithm kernel function is created for each imaging surface pixel point p in a GPU operating environment, recorded as a corresponding first pixel point thread, and all first pixel point threads are executed in parallel in the GPU operating environment; the ray casting algorithm kernel function is a customized CUDA kernel function, which is used to calculate the RGB pixels of the pixel points corresponding to the projection light according to the three-dimensional texture data space T, the viewing angle orthogonal surface and a specified projection light stored in the GPU video memory according to the ray casting algorithm and the Lambert lighting model, and update the RGB pixel group storage area based on the calculation results; finally, when all RGB pixel groups in the RGB pixel group storage area in the GPU video memory are not empty, an image is constructed by all RGB pixel groups to obtain a corresponding volume rendering image and display it. The embodiment of the present invention applies the CUDA architecture to the volume rendering processing solution of medical images, thereby improving the computational efficiency, rendering speed and real-time rendering effect of medical image volume rendering; the embodiment of the present invention implements a ray casting algorithm processing flow for coloring imaging pixels based on the light intensity-pixel mapping relationship under the Lambert lighting model through customized CUDA kernel functions, thereby improving the processing flexibility and optimization convenience of medical image volume rendering.

[0111] The professionals should further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0112] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0113] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A volume rendering processing method for medical images, It is characterized in that The method comprises: Receive the first medical image sequence, viewpoint coordinates, viewpoint viewing distance and volume rendering imaging size w 0 ×h 0 ; The first medical image sequence is formed by sequentially sorting a plurality of first medical images; The first medical image is a three-dimensional CT image or a three-dimensional MRI image; Each of the first medical images is composed of a plurality of image pixels; Each of the image pixels corresponds to at least one three-dimensional image coordinate (x, y, z) and an image grayscale; The three-dimensional image coordinate (x, y, z) is a spatial coordinate in an XYZ coordinate system, and the XYZ coordinate system is a three-dimensional Cartesian coordinate system composed of X, Y, and Z axes; The volume rendering imaging size w 0 ×h 0 w in 0 、h 0 are the pixel width and pixel height of volume rendering imaging respectively; A three-dimensional texture data space is constructed by confirming and normalizing the viewpoint according to the first medical image sequence, the viewpoint coordinates and the viewpoint viewing distance to obtain the corresponding first viewpoint and three-dimensional texture data space T; the three-dimensional texture data space T is a cube space with a shape of 1×1×1 in the WHD coordinate system, and the WHD coordinate system is a three-dimensional Cartesian coordinate system composed of a width W axis, a height H axis and a depth D axis; the three-dimensional texture data space T includes a plurality of texture voxel points t; the texture voxel points t correspond to the image pixels one by one; each of the texture voxel points t corresponds to a three-dimensional coordinate (w, h, d) and a texture voxel grayscale, and the value range of the three-dimensional coordinate values ​​w, h, d is between 0 and 1, and the texture voxel grayscale is consistent with the corresponding image grayscale; the side surface of the eight sides of the three-dimensional texture data space T that is closest to the first viewpoint is recorded as the corresponding viewpoint orthogonal surface; the line connecting the center point of the viewpoint orthogonal surface and the first viewpoint is perpendicular to the viewpoint orthogonal surface; A point is selected from the line connecting the first viewing point to the center point of the viewing angle orthogonal plane of the three-dimensional texture data space T as the corresponding imaging plane point; and a plane having the same size as the viewing angle orthogonal plane and four parallel sides is made at the imaging plane point as the corresponding volume rendering imaging plane; based on the volume rendering imaging size w 0 ×h 0 The volume rendering imaging surface is meshed to obtain the corresponding w 0 ×h 0 imaging surface pixel points p form a corresponding first pixel point set; and from each of the imaging surface pixel points p, a ray perpendicular to the viewing angle orthogonal plane is made toward the direction of the three-dimensional texture data space T as the corresponding pixel point projection ray, and all the obtained pixel point projection rays form a corresponding first projection ray set; Based on the processing functions for planning memory space and reading and writing memory data in the CUDA function set, a three-dimensional texture data storage area, an orthogonal surface data storage area, a pixel point data storage area and a projection light data storage area are planned in the GPU video memory for storing the corresponding three-dimensional texture data space T, the viewing angle orthogonal surface of the three-dimensional texture data space T, the first pixel point set and the first projection light set; and an RGB pixel group storage area is planned in the GPU video memory; the RGB pixel group storage area is used to store a plurality of RGB pixel groups, each of which is composed of an R channel pixel value, a G channel pixel value and a B channel pixel value, the number of the RGB pixel groups in the RGB pixel group storage area matches the number of the imaging surface pixel points p in the pixel point data storage area, and the RGB pixel groups correspond to the imaging surface pixel points p one by one, and all the RGB pixel groups stored in the RGB pixel group storage area are initialized to empty; In the GPU operating environment, a thread that calls the ray casting algorithm kernel function is created for each pixel point p on the imaging surface, which is recorded as the corresponding first pixel point thread; and all the first pixel point threads are executed in parallel in the GPU operating environment; the ray casting algorithm kernel function is a CUDA kernel function that can only be run in the GPU operating environment and can only use the GPU video memory; the input parameter of the ray casting algorithm kernel function is the first pixel point index; the first pixel point index is a unique index number corresponding to one of the imaging surface pixel points p in the first pixel point set stored in the GPU video memory; the ray casting algorithm kernel function is used to take the imaging surface pixel point p corresponding to the pixel point index in the first pixel point set stored in the GPU video memory as the corresponding The current pixel point, and the pixel point projection light corresponding to the current imaging surface pixel point in the first pixel point set stored in the GPU video memory is used as the corresponding current projection light, and the RGB pixel of the current pixel point is calculated according to the three-dimensional texture data space T stored in the GPU video memory, the viewing angle orthogonal surface and the current projection light according to the ray casting algorithm and the Lambert illumination model, and the RGB pixel group storage area is updated based on the calculation result; the input parameter of each of the first pixel point threads is the second pixel point index; each of the first pixel point threads is used to input the input second pixel point index as the corresponding first pixel point index to the ray casting algorithm kernel function and run the ray casting algorithm kernel function for calculation; When all the RGB pixel groups in the RGB pixel group storage area in the GPU display memory are not empty, an image is constructed based on all the obtained RGB pixel groups and the obtained constructed image is used as a corresponding volume rendering image and displayed.

2. The method for volume rendering of medical images according to claim 1, It is characterized in that The constructing of the three-dimensional texture data space by performing viewpoint confirmation and normalization according to the first medical image sequence, the viewpoint coordinates and the viewpoint viewing distance to obtain the corresponding first viewpoint and the three-dimensional texture data space T specifically includes: Identify the largest X, Y, and Z axis coordinates among all the three-dimensional image coordinates (x, y, z) in the first medical image sequence to obtain the corresponding maximum value x max ,y max 、z max ; and the maximum value x max ,y max and z max As the corresponding maximum side length b; and in the XYZ coordinate system, a cube space with a shape of b×b×b is constructed based on the maximum side length b and recorded as the corresponding three-dimensional volume data space R 1 ; and each of the image pixels in the first medical image sequence is located in the three-dimensional volume data space R 1 The corresponding spatial coordinate point in the image is recorded as the corresponding voxel point v; the voxel point v corresponds to the image pixel point one by one; In the XYZ coordinate system, the viewpoint is marked based on the viewpoint coordinates to obtain the corresponding first viewpoint; and the three-dimensional volume data space R 1 The straight-line distances from the center points of the eight sides to the first viewing point are calculated, and the side with the shortest distance is used as the corresponding viewing orthogonal plane; and the three-dimensional volume data space R is mapped in the XYZ coordinate system. 1 Rotate and displace until the three-dimensional volume data space R is obtained after rotation and displacement 2 until the line between the center point of the orthogonal plane of the viewing angle and the first viewing point is perpendicular to the orthogonal plane of the viewing angle and the length of the line matches the viewing distance of the viewing point; and during the rotation and displacement process, the three-dimensional volume data space R 1 The spatial coordinates of each voxel point v in the 3D volume data space R are rotated and displaced in an equal manner. 2 The corresponding voxel point v in * ; The voxel point v * One-to-one correspondence with the voxel point v; The three-dimensional volume data space R 2 The opposite side of the orthogonal plane of the viewing angle is recorded as the corresponding orthogonal face; and a three-dimensional Cartesian coordinate system is constructed with the lower left corner vertex of the orthogonal plane of the viewing angle as the origin, the direction from the lower left corner vertex of the orthogonal plane of the viewing angle to the lower right corner vertex as the width W axis direction, the direction from the lower left corner vertex of the orthogonal plane of the viewing angle to the upper left corner vertex as the height H axis direction, and the direction from the lower left corner vertex of the orthogonal plane of the viewing angle to the lower left corner vertex of the orthogonal face is the depth D axis direction, and recorded as the corresponding WHD coordinate system; and the three-dimensional volume data space R in the XYZ coordinate system is constructed as the corresponding WHD coordinate system. 2 The corresponding three-dimensional volume data space in the WHD coordinate system is denoted as the corresponding three-dimensional volume data space R 3 ; and based on the rotational displacement relationship between the WHD coordinate system and the XYZ coordinate system, the three-dimensional volume data space R 2 Each of the voxel points v in * The spatial coordinates of the three-dimensional volume data space R are obtained by performing equal rotation and displacement 3 The corresponding voxel point v in ’ ; The voxel point v ’ The three-dimensional coordinates are expressed as (w ’ ,h ’ ,d ’ ); the voxel point v ’ With the voxel point v * One to one correspondence; In the WHD coordinate system, the three-dimensional volume data space R is 3 The three-dimensional size of each voxel point v ’ The three-dimensional coordinates of the voxel point v are normalized, and the obtained normalized data space is used as the corresponding three-dimensional texture data space T, and the three-dimensional texture data space T corresponding to each voxel point v is ’ The corresponding spatial coordinate point is used as the corresponding texture voxel point t; the three-dimensional texture data space T is a cube space with a shape of (b / b)×(b / b)×(b / b)=1×1×1; the texture voxel point t and the voxel point v ’ One-to-one correspondence; the three-dimensional coordinates (w, h, d) of the texture voxel point t and the voxel point v ’ The three-dimensional coordinates (w ’ ,h ’ ,d ’ ) is w=w ’ / b,h=h ’ / b,d=d ’ / b; The viewing distance of the viewing point is normalized based on the maximum side length b to obtain the corresponding normalized viewing distance = viewing distance of the viewing point / b; and the center point of the viewing angle orthogonal plane of the three-dimensional texture data space T is recorded as the corresponding current center point; and at the current center point, a perpendicular line of the viewing angle orthogonal plane is drawn from the current center point to the outside direction of the three-dimensional texture data space T as the corresponding outer edge vertical line; and the coordinates of the spatial point on the outer edge vertical line whose distance from the current center point matches the normalized viewing distance are taken as the new coordinates of the first viewing point.

3. The volume rendering processing method of medical images according to claim 1, It is characterized in that The method of calculating the RGB pixel of the current pixel point according to the three-dimensional texture data space T stored in the GPU video memory, the viewing angle orthogonal surface and the current projection light according to the ray casting algorithm and the Lambert illumination model and updating the RGB pixel group storage area based on the calculation result specifically includes: Step 31, the ray casting algorithm kernel function sets a corresponding pixel illumination intensity I for the current pixel; and initializes the pixel illumination intensity I to a preset negative intensity threshold value less than 0; and records the spatial coordinate point corresponding to the preset volume rendering light source point coordinate as the corresponding volume rendering light source point; Step 32, calculating the intersection of the current projection light and the plane orthogonal to the viewing angle to obtain a corresponding starting intersection; and using the starting intersection as the corresponding light sampling point s; Step 33, and identify the sampling point grayscale corresponding to the light sampling point s, specifically: confirm whether there is the texture voxel point t matching the spatial coordinates of the light sampling point s in the three-dimensional texture data space T; if so, use the texture voxel grayscale of the texture voxel point t matching the spatial coordinates of the light sampling point s as the corresponding sampling point grayscale; if not, search for pairs of neighboring texture voxel points in the three groups of directions of front and back, left and back, and top and bottom of the light sampling point s in the three-dimensional texture data space T. If only a pair of neighboring texture voxel points in one of the directions is found, root search is performed based on the one-dimensional linear interpolation method. A one-dimensional linear interpolation calculation is performed on the texture voxel grayscale of the currently searched pair of neighborhood texture voxel points, and the calculation result is used as the corresponding sampling point grayscale; if two pairs of neighborhood texture voxel points in two groups of directions are searched, a bilinear interpolation calculation is performed on the texture voxel grayscale of the two pairs of neighborhood texture voxel points currently searched based on the bilinear interpolation method, and the calculation result is used as the corresponding sampling point grayscale; if three pairs of neighborhood texture voxel points in three groups of directions are searched, a trilinear interpolation calculation is performed on the texture voxel grayscale of the three pairs of neighborhood texture voxel points currently searched based on the trilinear interpolation method, and the calculation result is used as the corresponding sampling point grayscale; Step 34, and identify whether the grayscale of the sampling point exceeds a preset grayscale threshold; if so, go to step 35; if not, go to step 36; Step 35: determine the corresponding unit normal vector N based on the gradient of the light sampling point s; determine the corresponding unit light source vector L based on the straight line direction from the light sampling point s to the volume rendering light source point; and calculate the illumination intensity based on the preset ambient light diffuse reflection coefficient K according to the illumination intensity calculation method of the Lambert illumination model. a , preset ambient light intensity I a , preset light source diffuse reflectance K d , preset light source illumination intensity I d The unit normal vector N and the unit light source vector L are used to calculate the illumination intensity to obtain the corresponding illumination intensity I * ; and based on the light intensity I * Reset the pixel illumination intensity I; and identify whether the pixel illumination intensity I after reset is greater than 0, if so, go to step 36, if not, go to step 37; Among them, I * =K a ×I a +K d ×I d (L·N); Step 36, identifying whether the distance from the light sampling point s to the starting intersection exceeds a preset first length; if so, going to step 37; if not, taking the spatial coordinate point on the current projection light that is after the light sampling point s and is at a preset incremental step length △d from the light sampling point s as the new light sampling point s, and going back to step 33; the first length is defaulted to Step 37, record the RGB pixel group corresponding to the current pixel in the RGB pixel group storage area as the corresponding current pixel group; and identify whether the pixel illumination intensity I is greater than 0; if the pixel illumination intensity I is less than or equal to 0, set the corresponding R channel pixel value, G channel pixel value and B channel pixel value in the current pixel group by the preset background R channel pixel value, the preset background G channel pixel value and the preset background B channel pixel value; if the pixel illumination intensity I is greater than 0, then based on the preset R channel pixel coefficient r 0 , preset G channel pixel coefficient g 0 , preset B channel pixel coefficient b 0 The first pixel value corresponding to the pixel illumination intensity I is calculated = r 0 ×I, second pixel value = g 0 ×I and the third pixel value = b 0 ×I, and the R channel pixel value, the G channel pixel value, and the B channel pixel value corresponding to the current pixel group are set according to the calculated first, second, and third pixel values.

4. A device for executing the volume rendering processing method of medical images according to any one of claims 1 to 3, It is characterized in that The device comprises: a data receiving module, a first data preprocessing module, a second data preprocessing module, a first CUDA processing module, a second CUDA processing module and a volume rendering image composition module; The data receiving module is used to receive the first medical image sequence, the viewpoint coordinates, the viewpoint viewing distance and the volume rendering imaging size w 0 ×h 0 ; The first medical image sequence is formed by sequentially sorting a plurality of first medical images; The first medical image is a three-dimensional CT image or a three-dimensional MRI image; Each of the first medical images is composed of a plurality of image pixels; Each of the image pixels corresponds to at least one three-dimensional image coordinate (x, y, z) and an image grayscale; The three-dimensional image coordinate (x, y, z) is a spatial coordinate in an XYZ coordinate system, and the XYZ coordinate system is a three-dimensional Cartesian coordinate system composed of X, Y, and Z axes; The volume rendering imaging size w 0 ×h 0 w in 0 、h 0 are the pixel width and pixel height of volume rendering imaging respectively; The first data preprocessing module is used to construct a three-dimensional texture data space for viewpoint confirmation and normalization according to the first medical image sequence, the viewpoint coordinates and the viewpoint viewing distance to obtain the corresponding first viewpoint and three-dimensional texture data space T; the three-dimensional texture data space T is a cube space with a shape of 1×1×1 in the WHD coordinate system, and the WHD coordinate system is a three-dimensional Cartesian coordinate system composed of a width W axis, a height H axis and a depth D axis; the three-dimensional texture data space T includes a plurality of texture voxel points t; the texture voxel points t correspond to the image pixels one by one; each of the texture voxel points t corresponds to a three-dimensional coordinate (w, h, d) and a texture voxel grayscale, and the value range of the three-dimensional coordinate values ​​w, h, d is between 0 and 1, and the texture voxel grayscale is consistent with the corresponding image grayscale; the side surface of the eight sides of the three-dimensional texture data space T that is closest to the first viewpoint is recorded as the corresponding viewpoint orthogonal surface; the line connecting the center point of the viewpoint orthogonal surface and the first viewpoint is perpendicular to the viewpoint orthogonal surface; The second data preprocessing module is used to select any point on the line connecting the first view point to the center point of the view orthogonal plane of the three-dimensional texture data space T as the corresponding imaging plane point; and make a plane with the same size as the view orthogonal plane and four sides parallel at the imaging plane point as the corresponding volume rendering imaging plane; based on the volume rendering imaging size w 0 ×h 0 The volume rendering imaging surface is meshed to obtain the corresponding w 0 ×h 0 imaging surface pixel points p form a corresponding first pixel point set; and from each of the imaging surface pixel points p, a ray perpendicular to the viewing angle orthogonal plane is made toward the direction of the three-dimensional texture data space T as the corresponding pixel point projection ray, and all the obtained pixel point projection rays form a corresponding first projection ray set; The first CUDA processing module is used to plan a three-dimensional texture data storage area, an orthogonal surface data storage area, a pixel point data storage area and a projection light data storage area in the GPU video memory based on the processing functions used for planning memory space and for reading and writing memory data in the CUDA function set, for storing the corresponding three-dimensional texture data space T, the viewing angle orthogonal surface of the three-dimensional texture data space T, the first pixel point set and the first projection light set; and plan an RGB pixel group storage area in the GPU video memory; the RGB pixel group storage area is used to store multiple RGB pixel groups, each of which is composed of an R channel pixel value, a G channel pixel value and a B channel pixel value, the number of the RGB pixel groups in the RGB pixel group storage area matches the number of the imaging surface pixel points p in the pixel point data storage area, and the RGB pixel groups correspond to the imaging surface pixel points p one by one, and all the RGB pixel groups stored in the RGB pixel group storage area are initialized to empty; The second CUDA processing module is used to create a thread that calls the ray casting algorithm kernel function for each pixel point p on the imaging surface in the GPU operating environment, which is recorded as the corresponding first pixel point thread; and all the first pixel point threads are executed in parallel in the GPU operating environment; the ray casting algorithm kernel function is a CUDA kernel function that can only be run in the GPU operating environment and can only use the GPU video memory; the input parameter of the ray casting algorithm kernel function is the first pixel point index; the first pixel point index is the unique index number corresponding to one of the imaging surface pixel points p in the first pixel point set stored in the GPU video memory; the ray casting algorithm kernel function is used to convert the imaging surface pixel point corresponding to the pixel point index in the first pixel point set stored in the GPU video memory point p is taken as the corresponding current pixel point, and the pixel point projection light corresponding to the current imaging surface pixel point in the first pixel point set stored in the GPU video memory is taken as the corresponding current projection light, and the RGB pixel of the current pixel point is calculated according to the three-dimensional texture data space T stored in the GPU video memory, the viewing angle orthogonal surface and the current projection light according to the ray casting algorithm and the Lambert illumination model, and the RGB pixel group storage area is updated based on the calculation result; the input parameter of each of the first pixel point threads is the second pixel point index; each of the first pixel point threads is used to input the input second pixel point index as the corresponding first pixel point index to the ray casting algorithm kernel function and run the ray casting algorithm kernel function for calculation; The volume rendering image composition module is used for constructing an image based on all the obtained RGB pixel groups when all the RGB pixel groups in the RGB pixel group storage area in the GPU display memory are not empty, and displaying the obtained constructed image as the corresponding volume rendering image.

5. An electronic device, It is characterized in that include: memory, processors, and transceivers; The processor is used to couple with the memory, read and execute instructions in the memory, so as to implement the method according to any one of claims 1 to 3; The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.

6. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a computer, the computer is enabled to execute the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • CT (computerized tomography) on-line reconstruction and real-time visualization method based on CUDA (compute unified device architecture)

    CN103077547A

  • A man-machine interactive editing method for segmentation results of volume data

    CN109147061A

  • Rendering device, rendering method, and program

    JP2020086803A

  • COMPUTER PROGRAM, IMAGE PROCESSING APPARATUS AND IMAGE PROCESSING METHOD

    JP6418344B1

  • Raycasting program, search control data, search control data generation method, raycasting device

    JP6443574B1