Three-dimensional volume data visualization method, device and equipment based on ray casting, medium and program product
Through the three-dimensional volume data visualization method based on ray projection, the sampling step size is dynamically adjusted, which solves the problem of low rendering efficiency of large-scale three-dimensional data in the existing technology, and realizes a more efficient sampling and rendering process.
Patent Information
- Application Number
- CN202411708888.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-11
AI Technical Summary
When processing large-scale three-dimensional data, the prior art has low rendering efficiency, large calculation amount and high processing complexity.
The three-dimensional volume data visualization method based on light projection is adopted. By acquiring the volume data to be processed, multiple rays are projected to the data according to the preset light starting point and field of view angle, and non-equal sampling is performed in the direction of light travel. The sampling step is dynamically adjusted according to the difference between the noise area and the non-noise area.
The sampling efficiency and overall rendering efficiency are improved, and redundant sampling is reduced by fine sampling in areas with dense voxel information.
Smart Images

Figure CN119600225A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image rendering technology, and in particular to a three-dimensional volume data visualization method, apparatus, computer equipment, computer-readable storage medium and computer program product based on ray casting. Background Art
[0002] With the development of information technology, 3D data visualization technology has been widely used in the fields of medical imaging, engineering design, and geographic information. By converting complex 3D data into intuitive graphics, users can more conveniently perform data analysis and make decisions. However, when processing large-scale 3D data, the visualization methods in the existing technology often have a large amount of overall calculation and high processing complexity, and there is a problem of low rendering efficiency. Summary of the invention
[0003] Based on this, it is necessary to provide a three-dimensional volume data visualization method, device, computer equipment, computer-readable storage medium and computer program product based on ray casting to address the above technical problems.
[0004] In a first aspect, the present application provides a three-dimensional volume data visualization method based on ray casting, comprising:
[0005] Obtaining volume data to be processed;
[0006] Projecting a plurality of light rays to the volume data to be processed according to a preset light starting point and field of view angle;
[0007] The volume data to be processed is sampled in the traveling direction of each of the light rays, and sampling values corresponding to a plurality of sampling points are obtained in sequence; wherein the sampling step length between a noise sampling point and the next sampling point is greater than the sampling step length between a non-noise sampling point and the next sampling point; the noise sampling point is the sampling point belonging to the noise region of the volume data to be processed, and the non-noise sampling point is the sampling point belonging to the non-noise region of the volume data to be processed;
[0008] Obtaining a synthetic output value corresponding to each light ray according to the sampling value obtained at each sampling point of each light ray;
[0009] A rendering image corresponding to the volume data to be processed is obtained according to the synthetic output value corresponding to each of the light rays.
[0010] In one of the embodiments, sampling the volume data to be processed in the direction of travel of each of the light rays to sequentially obtain sampling values corresponding to a plurality of sampling points includes: sampling a first sampling point of the volume data to be processed in the direction of travel of the light ray to obtain a first sampling value of the first sampling point; judging, based on the first sampling value, whether the first sampling point is the noise sampling point belonging to the noise area; if so, obtaining a first sampling step length based on a current sampling step length and a step length increasing parameter; the first sampling step length is greater than the current sampling step length; if not, obtaining the first sampling step length based on an initial sampling step length; the initial sampling step length is not greater than the current sampling step length; and determining, based on the first sampling step length, a second sampling point of the light ray for the volume data to be processed.
[0011] In one of the embodiments, judging whether the first sampling point is the noise sampling point belonging to the noise area according to the first sampling value includes: converting the first sampling value using a transfer function to obtain a first opacity corresponding to the first sampling value; if the first opacity is less than a noise threshold, judging that the first sampling point is the noise sampling point; if the first opacity is not less than the noise threshold, judging that the first sampling point is the non-noise sampling point.
[0012] In one of the embodiments, projecting multiple light rays to the volume data to be processed according to a preset light starting point and field of view angle includes: determining the number of the multiple light rays according to the number of target pixels; determining the travel direction corresponding to each of the light rays according to the target pixel distribution, the light starting point and the field of view angle; and projecting each of the light rays from the light starting point to the volume data to be processed according to the travel direction corresponding to each of the light rays.
[0013] In one embodiment, obtaining a synthetic output value corresponding to the light according to the sampling value obtained at each sampling point of each light includes: after obtaining the sampling value of the initial sampling point of the light, using a transfer function to convert the sampling value to obtain a sampling conversion value corresponding to the sampling value; using the sampling conversion value as a pre-output value; after each acquisition of the sampling value of the non-initial sampling point of the light, using a transfer function to convert the sampling value to obtain a sampling conversion value corresponding to the sampling value; synthesizing the sampling conversion value with the pre-output value to obtain an updated pre-output value; after the sampling of the light is terminated, obtaining the synthetic output value according to the updated pre-output value.
[0014] In one of the embodiments, the method further includes: if the cumulative opacity contained in the updated pre-output value corresponding to the light meets the opacity termination condition, or the light exceeds the boundary of the volume data to be processed, then terminating the sampling of the light.
[0015] In a second aspect, the present application also provides a three-dimensional volume data visualization device based on ray casting, comprising:
[0016] An acquisition module, used for acquiring volume data to be processed;
[0017] A projection module, used for projecting a plurality of light rays to the volume data to be processed according to a preset light starting point and field of view angle;
[0018] A sampling module, used for sampling the volume data to be processed in the traveling direction of each of the light rays, and sequentially obtaining sampling values corresponding to a plurality of sampling points; wherein the sampling step length between a noise sampling point and the next sampling point is greater than the sampling step length between a non-noise sampling point and the next sampling point; the noise sampling point is the sampling point belonging to the noise region of the volume data to be processed, and the non-noise sampling point is the sampling point belonging to the non-noise region of the volume data to be processed;
[0019] A synthesis module, used for obtaining a synthesis output value corresponding to the light according to the sampling value obtained by each light at each sampling point;
[0020] A rendering module is used to obtain a rendering image corresponding to the volume data to be processed according to the synthetic output value corresponding to each of the light rays.
[0021] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0022] Obtaining volume data to be processed;
[0023] Projecting a plurality of light rays to the volume data to be processed according to a preset light starting point and field of view angle;
[0024] The volume data to be processed is sampled in the traveling direction of each of the light rays, and sampling values corresponding to a plurality of sampling points are obtained in sequence; wherein the sampling step length between a noise sampling point and the next sampling point is greater than the sampling step length between a non-noise sampling point and the next sampling point; the noise sampling point is the sampling point belonging to the noise region of the volume data to be processed, and the non-noise sampling point is the sampling point belonging to the non-noise region of the volume data to be processed;
[0025] Obtaining a synthetic output value corresponding to each light ray according to the sampling value obtained at each sampling point of each light ray;
[0026] A rendering image corresponding to the volume data to be processed is obtained according to the synthetic output value corresponding to each of the light rays.
[0027] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0028] Obtaining volume data to be processed;
[0029] Projecting a plurality of light rays to the volume data to be processed according to a preset light starting point and field of view angle;
[0030] The volume data to be processed is sampled in the traveling direction of each of the light rays, and sampling values corresponding to a plurality of sampling points are obtained in sequence; wherein the sampling step length between a noise sampling point and the next sampling point is greater than the sampling step length between a non-noise sampling point and the next sampling point; the noise sampling point is the sampling point belonging to the noise region of the volume data to be processed, and the non-noise sampling point is the sampling point belonging to the non-noise region of the volume data to be processed;
[0031] Obtaining a synthetic output value corresponding to each light ray according to the sampling value obtained at each sampling point of each light ray;
[0032] A rendering image corresponding to the volume data to be processed is obtained according to the synthetic output value corresponding to each of the light rays.
[0033] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0034] Obtaining volume data to be processed;
[0035] Projecting a plurality of light rays to the volume data to be processed according to a preset light starting point and field of view angle;
[0036] The volume data to be processed is sampled in the traveling direction of each of the light rays, and sampling values corresponding to a plurality of sampling points are obtained in sequence; wherein the sampling step length between a noise sampling point and the next sampling point is greater than the sampling step length between a non-noise sampling point and the next sampling point; the noise sampling point is the sampling point belonging to the noise region of the volume data to be processed, and the non-noise sampling point is the sampling point belonging to the non-noise region of the volume data to be processed;
[0037] Obtaining a synthetic output value corresponding to each light ray according to the sampling value obtained at each sampling point of each light ray;
[0038] A rendering image corresponding to the volume data to be processed is obtained according to the synthetic output value corresponding to each of the light rays.
[0039] The above-mentioned three-dimensional volume data visualization method, device, computer equipment, computer-readable storage medium and computer program product based on ray casting first obtain the volume data to be processed, then cast multiple rays to the volume data to be processed according to the preset ray starting point and field of view, and sample the volume data to be processed in the direction of travel of each ray, and obtain the sampling values corresponding to multiple sampling points in turn, and make the sampling step length between the noise sampling point and the next sampling point belonging to the noise area of the volume data to be processed greater than the sampling step length between the non-noise sampling point and the next sampling point belonging to the non-noise area, and then obtain the synthetic output value corresponding to the ray according to the sampling value obtained by each ray at each sampling point, and finally obtain the rendering image corresponding to the volume data to be processed according to the synthetic output value corresponding to each ray. Therefore, the scheme can optimize the sampling link in the ray casting process, based on the voxel distribution of the volume data to be processed, fine sampling is performed with a smaller sampling step length in the non-noise area with dense voxel information, and the sampling step length is increased in the noise area with sparse voxel information to reduce redundant sampling, thereby improving the sampling efficiency and thus improving the overall rendering efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 is a schematic flow chart of a three-dimensional volume data visualization method based on ray casting in one embodiment;
[0042] Figure 2 A schematic diagram of a process for obtaining sampling values corresponding to multiple sampling points in one embodiment;
[0043] Figure 3 It is a schematic diagram of a flow chart of determining whether a first sampling point is a noise sampling point belonging to a noise area in one embodiment;
[0044] Figure 4 is a schematic diagram of a process of projecting multiple rays to volume data to be processed in one embodiment;
[0045] Figure 5 A schematic diagram of a process for obtaining a synthetic output value corresponding to a light beam in one embodiment;
[0046] Figure 6is a schematic flow chart of a three-dimensional volume data visualization method based on ray casting in another embodiment;
[0047] Figure 7 is a structural block diagram of a three-dimensional volume data visualization device based on ray casting in one embodiment;
[0048] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] In one embodiment, Figure 1 As shown, a 3D volume data visualization method based on ray casting is provided. This embodiment takes the method applied to a terminal as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0051] Step S101, obtaining volume data to be processed.
[0052] The volume data to be processed may be three-dimensional volume data that needs to be rendered into a visual image.
[0053] Among them, volume data refers to data that describes the internal structure or scene information of an object in three-dimensional space, usually represented in the form of a voxel grid. Among them, voxel is a volume pixel in three-dimensional space and is the basic unit of volume data. Similar to pixels in two-dimensional images, voxels are cubic units in three-dimensional space with a certain size and position. Each voxel can contain various attribute information, such as density, color, material, etc., to describe the internal structure and characteristics of the object. Exemplarily, volume data can be used in medical imaging, geological exploration, fluid simulation and other fields to describe objects or scenes with volume.
[0054] Step S102 : Projecting a plurality of light rays to the volume data to be processed according to the preset light starting point and field of view angle.
[0055] The starting point of the light and the field of view angle can be determined according to the projection method for rendering the three-dimensional volume data and the rendering scene requirements.
[0056] Exemplarily, when the orthogonal projection mode is adopted, the starting point of the light ray may correspond to each pixel point on the screen plane, and starting from the starting point of the light ray, multiple light rays may be projected to the volume data to be processed within the field of view angle. Exemplarily, when the perspective projection mode is adopted, the starting point of the light ray may be a three-dimensional coordinate point corresponding to the position of the viewpoint (or camera) in the three-dimensional space, and triggered from the starting point of the light ray, multiple light rays with different travel directions may be projected to the volume data to be processed within the field of view angle.
[0057] Step S103 , sampling the volume data to be processed in the traveling direction of each light ray, and sequentially obtaining sampling values corresponding to a plurality of sampling points.
[0058] Each ray projected on the volume data to be processed may advance in its traveling direction, and when reaching the boundary of the volume data to be processed, non-uniformly spaced sampling is performed, thereby obtaining sampling values corresponding to multiple sampling points in the traveling direction of the ray. The sampling step length of the ray in the traveling direction may be determined based on the previous sampling point.
[0059] Specifically, the volume data to be processed can be divided into a noise region with sparse voxel information and a non-noise region with dense voxel information according to the density of voxel information of the volume data to be processed. Since the sampling value of the light at the sampling point can reflect the voxel attribute of the volume data to be processed at the sampling point, it is possible to judge whether the sampling point is a noise sampling point or a non-noise sampling point according to the sampling value of the sampling point.
[0060] Among them, when the previous sampling point of the light in the traveling direction is a noise sampling point belonging to the noise area of the volume data to be processed, the next sampling point can be determined starting from the noise sampling point using a larger sampling step, and when the previous sampling point is a non-noise sampling point belonging to the non-noise area of the volume data to be processed, the next sampling point can be determined starting from the non-noise sampling point using a smaller sampling step. Optionally, the sampling step used by the light in different situations can be a pre-set distance or a distance dynamically adjusted in combination with other parameters.
[0061] Step S104, obtaining a synthetic output value corresponding to each light ray according to the sampling value obtained by each light ray at each sampling point.
[0062] According to the sampling values obtained by each light at each sampling point, the sampling values can be mapped to corresponding colors and opacities by using a transfer function. Then, by synthesizing the colors and opacities corresponding to different sampling points of the same light, the synthetic output value corresponding to the light can be obtained.
[0063] Step S105 , obtaining a rendered image corresponding to the volume data to be processed according to the synthetic output values corresponding to the light rays.
[0064] Among them, according to the synthetic output values corresponding to different light rays, the color value corresponding to each pixel in the rendered image can be obtained, thereby constructing a rendered image corresponding to the volume data to be processed.
[0065] In the above-mentioned three-dimensional volume data visualization method based on ray casting, the volume data to be processed is first obtained, and then multiple rays are cast to the volume data to be processed according to the preset ray starting point and field angle, and the volume data to be processed is sampled in the direction of travel of each ray, and the sampling values corresponding to multiple sampling points are obtained in turn, and the sampling step length between the noise sampling point and the next sampling point belonging to the noise area of the volume data to be processed is made greater than the sampling step length between the non-noise sampling point and the next sampling point belonging to the non-noise area, and then the synthetic output value corresponding to the ray is obtained according to the sampling value obtained by each ray at each sampling point, and finally the rendering image corresponding to the volume data to be processed is obtained according to the synthetic output value corresponding to each ray. Therefore, the scheme can optimize the sampling link in the ray casting process, based on the voxel distribution of the volume data to be processed, fine sampling is performed with a smaller sampling step length in the non-noise area with dense voxel information, and the sampling step length is increased in the noise area with sparse voxel information to reduce redundant sampling, thereby improving the sampling efficiency and thus improving the overall rendering efficiency.
[0066] In an exemplary embodiment, Figure 2 As shown, sampling the volume data to be processed in the traveling direction of each light ray, and sequentially obtaining sampling values corresponding to multiple sampling points may include:
[0067] Step S201 : sampling a first sampling point of the volume data to be processed in the traveling direction of the light to obtain a first sampling value of the first sampling point.
[0068] Specifically, in this implementation, the initial sampling step size and the step size increasing rate parameter can be combined to achieve dynamic adjustment of the sampling step size.
[0069] In this step, the first sampling point of the volume data to be processed may be sampled and its corresponding first sampling value may be obtained. The first sampling point may be one of the sampling points of the volume data to be processed in the traveling direction of the light.
[0070] Step S202: judging whether the first sampling point is a noise sampling point belonging to a noise area according to the first sampling value.
[0071] According to the first sampling value of the first sampling point, it can be determined whether the first sampling point is a noise sampling point or a non-noise sampling point.
[0072] Step S203: If yes, a first sampling step size is obtained according to the current sampling step size and the step size increasing rate parameter.
[0073] Wherein, when the first sampling point is a noise sampling point, the first sampling step length can be obtained based on the current sampling step length and the preset step length increasing parameter. Wherein, when the first sampling point is not the first sampling point of the light in the volume data to be processed, the current sampling step length can be the distance between the first sampling point and its previous sampling point; and when the first sampling point is the first sampling point of the light in the volume data to be processed, the current sampling step length can be the preset initial sampling step length. Exemplarily, the step length increasing parameter can be a preset positive number, and according to the current sampling step length and the step length increasing parameter, the first sampling step length greater than the current sampling step length can be obtained by adding the two.
[0074] Step S204: if not, obtain a first sampling step length according to the initial sampling step length.
[0075] Wherein, when the first sampling point is not a noise sampling point (that is, the first sampling point is a non-noise sampling point), the preset initial sampling step length can be used as the first sampling step length. It can be understood that, since the current sampling step length can only be equal to the initial sampling step length or greater than the initial sampling step length, the initial sampling step length is not greater than the current sampling step length.
[0076] Step S205 , determining a second sampling point of the light beam on the volume data to be processed according to the first sampling step length.
[0077] According to the first sampling step length obtained in the above process, the second sampling point of the volume data to be processed can be determined from the first sampling point in the direction of travel of the light. The distance between the first sampling point and the second sampling point in the direction of travel of the light is the first sampling step length.
[0078] In this embodiment, by judging whether each sampling point is a noise sampling point according to the sampling value thereof, and after judging it as a noise sampling point, increasing the current sampling step length in combination with the step speed increasing parameter to obtain the first sampling step length, redundant sampling in the noise area can be further reduced, and after judging that the sampling point is not a noise sampling point, using the initial sampling step length as the first sampling step length can ensure fine sampling in the non-noise area. Therefore, this embodiment can realize adaptive dynamic adjustment of the sampling step length in different areas, which is conducive to further improving the rendering speed.
[0079] In an exemplary embodiment, Figure 3 As shown, judging whether the first sampling point is a noise sampling point belonging to the noise area according to the first sampling value may include:
[0080] Step S301: Use a transfer function to convert a first sampling value to obtain a first opacity corresponding to the first sampling value.
[0081] Step S302: If the first opacity is less than the noise threshold, the first sampling point is determined to be a noise sampling point.
[0082] Step S303: If the first opacity is not less than the noise threshold, the first sampling point is determined to be a non-noise sampling point.
[0083] Specifically, in this embodiment, after obtaining the first sampling value of the first sampling point, the first sampling value can be converted into a first opacity using a transfer function, wherein a higher first opacity represents denser voxel information corresponding to the first sampling point, and a lower first opacity represents sparser voxel information corresponding to the first sampling point.
[0084] Then, the first opacity corresponding to the first sampling point can be compared with a preset noise threshold. The noise threshold can be an opacity value used to distinguish between noise sampling points and non-noise sampling points. When the first opacity is less than the noise threshold, the first sampling point can be determined to be a noise sampling point belonging to a noise area. When the first opacity is not less than the noise threshold, the first sampling point can be determined to be a non-noise sampling point belonging to a non-noise area.
[0085] In this embodiment, by using a transfer function to convert the sampling value into opacity, and then comparing it with the noise threshold, it is possible to objectively and accurately distinguish between noise sampling points and non-noise sampling points.
[0086] In an exemplary embodiment, Figure 4 As shown, according to the preset light starting point and field of view angle, multiple light rays are projected to the volume data to be processed, which may include:
[0087] Step S401, determining the number of multiple light rays according to the number of target pixels.
[0088] The target number of pixels may be the number of pixels on the screen, or the number of pixels of the rendered image to be finally obtained. The number of rays projected to the volume data to be processed may be determined according to the target number of pixels. For example, the number of rays may be consistent with the target number of pixels.
[0089] Step S402, determining the traveling direction corresponding to each light ray according to the target pixel distribution, the starting point of the light ray and the field angle.
[0090] The target pixel distribution may be a pixel distribution on a screen or a pixel distribution in a final rendered image. According to the target pixel distribution, the direction of travel of the light corresponding to each pixel may be determined within the field of view angle, starting from the starting point of the light.
[0091] Step S403 : Projecting each light ray from the starting point of the light ray to the volume data to be processed according to the traveling direction corresponding to each light ray.
[0092] According to the traveling direction corresponding to each light ray, a plurality of light rays for sampling may be projected from the starting point of the light ray to the volume data to be processed.
[0093] In this embodiment, the number of light rays is determined according to the number of target pixels, and the travel direction of each light ray is determined according to the target pixel distribution, the starting point of the light ray and the field of view angle, so that the sampling data of each light ray can correspond to a pixel of the rendered image, which is beneficial to improving the fineness of the rendered image.
[0094] In an exemplary embodiment, Figure 5 As shown, according to the sampling values of each light ray at each sampling point, the synthetic output value corresponding to the light ray is obtained, which may include:
[0095] Step S501, after acquiring the sampling value of the initial sampling point of the light, use the transfer function to convert the sampling value to obtain a sampling conversion value corresponding to the sampling value; and use the sampling conversion value as a pre-output value.
[0096] When the light reaches the volume data to be processed and obtains the sampling value of the initial sampling point, the sampling value can be converted using a transfer function to obtain a sampling conversion value corresponding to the initial sampling point. The sampling conversion value may include color and opacity. Then, the sampling conversion value of the initial sampling point can be used as a pre-output value.
[0097] Step S502, after acquiring the sampling value of the non-initial sampling point of the light each time, convert the sampling value using the transfer function to obtain the sampling conversion value corresponding to the sampling value; synthesize the sampling conversion value with the pre-output value to obtain the updated pre-output value.
[0098] It is understandable that, after passing through the initial sampling point, the light may sequentially pass through a plurality of non-initial sampling points of the volume data to be processed, and obtain the corresponding sampling values respectively.
[0099] Among them, after each acquisition of the sampling value of a non-initial sampling point of the volume data to be processed, the sampling value of the non-initial sampling point can be converted into a sampling conversion value using a transfer function, and the sampling value can be synthesized with the pre-output value corresponding to the light to obtain an updated pre-output value. It can be understood that after the light passes through multiple non-initial sampling points, the pre-output value can be updated to a composite value of the sampling conversion values of the initial sampling point and multiple non-initial sampling points. Exemplarily, the synthesis of the pre-output value and the sampling conversion value can be performed by alpha blending technology.
[0100] Step S503: after the sampling of the light is terminated, a synthetic output value is obtained according to the updated pre-output value.
[0101] Among them, after the sampling of the light is terminated, the updated pre-output value corresponding to the light can be data synthesized based on the sampling conversion values corresponding to the initial sampling point of the light at the volume data to be processed and multiple non-initial sampling points, so that the pre-output value can be used as the final synthesized output value of the light.
[0102] In this embodiment, by synthesizing the sample conversion values obtained by the transfer function conversion after each sampling, sampling and data synthesis can be performed synchronously, which is beneficial to reducing the storage space occupied and improving the real-time performance of rendering.
[0103] In an exemplary embodiment, the method may further include: if the accumulated opacity contained in the updated pre-output value corresponding to the ray satisfies an opacity termination condition, or the ray exceeds the boundary of the volume data to be processed, terminating the sampling of the ray.
[0104] In the process of sampling the volume data to be processed by the light, the accumulated opacity contained in the pre-output value can be monitored, and when it meets the preset opacity termination condition, the sampling of the volume data to be processed by the light can be terminated.
[0105] Optionally, the cumulative opacity can be synthesized based on the opacity in the sampled conversion values of each sampling point through which the light passes, and the opacity termination condition can refer to the cumulative opacity being greater than a preset opacity threshold or being within a preset opacity value range. For example, when the cumulative opacity is greater than 1, it can be considered that the opacity termination condition is met.
[0106] Among them, during the sampling process of the light ray for the volume data to be processed, it is also possible to monitor whether the sampling of the light ray exceeds the boundary of the volume data to be processed. For example, it can be determined whether, based on the previous sampling point, the light ray has exceeded the boundary of the volume data to be processed after advancing the sampling step distance. If so, the previous sampling point can be used as the last sampling point of the light ray in the volume data to be processed, and the sampling of the volume data to be processed by the light ray is terminated.
[0107] In this embodiment, by setting an opacity termination condition for the accumulated opacity of the light, the sampling of the light and the data calculation can be stopped in time, which is conducive to saving computing resources.
[0108] In an exemplary embodiment, the process of the ray casting-based three-dimensional volume data visualization method of the present application can be as follows: Figure 6 The method may include:
[0109] Step S601, initialization of three-dimensional data and viewing angle: read in the volume data to be processed, set the transfer function to assign color and opacity to the data, and set the light starting point and viewing angle.
[0110] Step S602, initialization of adaptive step size data: setting the initial sampling step size, step size increase parameter, and noise threshold.
[0111] Step S603, a plurality of light rays are simultaneously emitted from the light starting point within the field of view angle range, and each light ray is adaptively sampled at non-equidistant intervals along the traveling direction.
[0112] The sampling step size on each ray is adaptively and dynamically adjusted according to the opacity value converted from the sampling value of the previous sampling point. If the opacity value of the previous sampling point is lower than the noise threshold, the previous sampling point is considered to be a noise sampling point in the noise area, and the next sampling step size will be increased based on the current sampling step size according to the step size increase parameter to increase the sampling speed. If the opacity value of the previous sampling point is greater than or equal to the noise threshold, the previous sampling point is considered to be a non-noise sampling point in the non-noise area, and the next sampling step size will be restored to the initial sampling step size for fine sampling.
[0113] For example, assuming that the previous sampling point is i, the opacity of the sampling value after being mapped by the transfer function is , the noise threshold is set to T, and the current sampling step is , the step speed parameter is , initial sampling step , then the next sampling step length It can be set as follows:
[0114]
[0115] Step S604, the sampled data of each ray are synthesized according to the alpha blending technology to obtain a pre-output value. When the cumulative opacity contained in the pre-output value is greater than 1 or the ray passes through the volume data boundary, the sampling of the volume data to be processed by the ray can be terminated. According to the final pre-output value of the ray, the synthesized output value of the ray can be obtained. According to the color value contained in the synthesized output value, the color of the corresponding pixel can be determined, and then the rendered image can be obtained.
[0116] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0117] Based on the same inventive concept, the embodiment of the present application also provides a ray-casting-based 3D volume data visualization device for implementing the ray-casting-based 3D volume data visualization method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations of one or more ray-casting-based 3D volume data visualization device embodiments provided below can refer to the limitations of the ray-casting-based 3D volume data visualization method above, and will not be repeated here.
[0118] In an exemplary embodiment, Figure 7 As shown, a three-dimensional volume data visualization device 700 based on ray casting is provided, comprising:
[0119] The acquisition module 701 is used to acquire volume data to be processed.
[0120] The projection module 702 is used to project multiple rays to the volume data to be processed according to the preset ray starting point and field angle.
[0121] The sampling module 703 is used to sample the volume data to be processed in the direction of travel of each light ray, and obtain sampling values corresponding to multiple sampling points in sequence; wherein the sampling step length between a noise sampling point and the next sampling point is greater than the sampling step length between a non-noise sampling point and the next sampling point; the noise sampling point is a sampling point belonging to the noise area of the volume data to be processed, and the non-noise sampling point is a sampling point belonging to the non-noise area of the volume data to be processed.
[0122] The synthesis module 704 is used to obtain a synthesis output value corresponding to each light ray according to the sampling value obtained by each light ray at each sampling point.
[0123] The rendering module 705 is used to obtain a rendering image corresponding to the volume data to be processed according to the synthetic output value corresponding to each light ray.
[0124] In an exemplary embodiment, the sampling module 703 is also used to: sample the first sampling point of the processed volume data in the direction of travel of the light to obtain a first sampling value of the first sampling point; determine whether the first sampling point is a noise sampling point belonging to a noise area according to the first sampling value; if so, obtain the first sampling step length according to the current sampling step length and the step length increase rate parameter; the first sampling step length is greater than the current sampling step length; if not, obtain the first sampling step length according to the initial sampling step length; the initial sampling step length is not greater than the current sampling step length; determine the second sampling point of the light for the processed volume data according to the first sampling step length.
[0125] In an exemplary embodiment, the sampling module 703 is further used to: use a transfer function to convert the first sampling value to obtain a first opacity corresponding to the first sampling value; if the first opacity is less than a noise threshold, determine that the first sampling point is a noise sampling point; if the first opacity is not less than the noise threshold, determine that the first sampling point is a non-noise sampling point.
[0126] In an exemplary embodiment, the projection module 702 is also used to: determine the number of multiple light rays according to the number of target pixels; determine the travel direction corresponding to each light ray according to the target pixel distribution, the starting point of the light ray and the field of view; and project each light ray from the starting point of the light ray to the volume data to be processed according to the travel direction corresponding to each light ray.
[0127] In an exemplary embodiment, the synthesis module 704 is also used to: after obtaining the sampling value of the initial sampling point of the light, use the transfer function to convert the sampling value to obtain the sampling conversion value corresponding to the sampling value; use the sampling conversion value as the pre-output value; after each acquisition of the sampling value of the non-initial sampling point of the light, use the transfer function to convert the sampling value to obtain the sampling conversion value corresponding to the sampling value; synthesize the sampling conversion value with the pre-output value to obtain an updated pre-output value; after the sampling of the light is terminated, obtain the synthesized output value according to the updated pre-output value.
[0128] In an exemplary embodiment, the apparatus further includes: a sampling termination module for terminating the sampling of a ray if the accumulated opacity contained in the updated pre-output value corresponding to the ray satisfies an opacity termination condition, or the ray exceeds the boundary of the volume data to be processed.
[0129] Each module in the above-mentioned three-dimensional volume data visualization device based on ray casting can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0130] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a three-dimensional volume data visualization method based on ray projection is realized. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0131] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0132] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0133] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0134] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0135] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0136] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0137] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0138] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A three-dimensional volume data visualization method based on ray casting, characterized in that: The method comprises: Obtaining volume data to be processed; Projecting a plurality of light rays to the volume data to be processed according to a preset light starting point and field of view angle; The volume data to be processed is sampled in the traveling direction of each of the light rays, and sampling values corresponding to a plurality of sampling points are obtained in sequence; wherein the sampling step length between a noise sampling point and the next sampling point is greater than the sampling step length between a non-noise sampling point and the next sampling point; the noise sampling point is the sampling point belonging to the noise region of the volume data to be processed, and the non-noise sampling point is the sampling point belonging to the non-noise region of the volume data to be processed; Obtaining a synthetic output value corresponding to each light ray according to the sampling value obtained at each sampling point of each light ray; A rendering image corresponding to the volume data to be processed is obtained according to the synthetic output value corresponding to each of the light rays.
2. The method according to claim 1, characterized in that The step of sampling the volume data to be processed in the traveling direction of each of the light rays to sequentially obtain sampling values corresponding to a plurality of sampling points comprises: Sampling a first sampling point of the volume data to be processed in the traveling direction of the light to obtain a first sampling value of the first sampling point; According to the first sampling value, determining whether the first sampling point is the noise sampling point belonging to the noise area; If yes, a first sampling step length is obtained according to the current sampling step length and the step length increasing parameter; the first sampling step length is greater than the current sampling step length; If not, the first sampling step length is obtained according to the initial sampling step length; the initial sampling step length is not greater than the current sampling step length; A second sampling point of the light beam on the volume data to be processed is determined according to the first sampling step length.
3. The method according to claim 2, characterized in that The step of judging, according to the first sampling value, whether the first sampling point is the noise sampling point belonging to the noise area includes: Convert the first sampling value using a transfer function to obtain a first opacity corresponding to the first sampling value; If the first opacity is less than the noise threshold, determining that the first sampling point is the noise sampling point; If the first opacity is not less than the noise threshold, the first sampling point is determined to be the non-noise sampling point.
4. The method according to claim 1, characterized in that: The step of projecting a plurality of light rays to the volume data to be processed according to a preset light starting point and field of view angle comprises: Determining the number of the plurality of rays according to the number of target pixels; Determine the travel direction corresponding to each of the light rays according to the target pixel distribution, the starting point of the light rays and the field of view angle; According to the traveling direction corresponding to each of the light rays, each of the light rays is projected from the starting point of the light rays toward the volume data to be processed.
5. The method according to any one of claims 1 to 4, characterized in that: The step of obtaining a synthetic output value corresponding to each light ray according to the sampling value obtained at each sampling point of each light ray comprises: After obtaining the sampling value of the initial sampling point of the light, converting the sampling value using a transfer function to obtain a sampling conversion value corresponding to the sampling value; and using the sampling conversion value as a pre-output value; After acquiring the sampling value of the non-initial sampling point of the light each time, converting the sampling value using a transfer function to obtain a sampling conversion value corresponding to the sampling value; synthesizing the sampling conversion value with the pre-output value to obtain an updated pre-output value; After the sampling of the light is terminated, the synthesized output value is obtained according to the updated pre-output value.
6. The method according to claim 5, characterized in that The method further comprises: If the accumulated opacity included in the updated pre-output value corresponding to the light ray satisfies an opacity termination condition, or the light ray exceeds the boundary of the volume data to be processed, the sampling of the light ray is terminated.
7. A three-dimensional volume data visualization device based on ray casting, characterized in that: The device comprises: An acquisition module, used for acquiring volume data to be processed; A projection module, used for projecting a plurality of light rays to the volume data to be processed according to a preset light starting point and field of view angle; A sampling module, used for sampling the volume data to be processed in the traveling direction of each of the light rays, and sequentially obtaining sampling values corresponding to a plurality of sampling points; wherein the sampling step length between a noise sampling point and the next sampling point is greater than the sampling step length between a non-noise sampling point and the next sampling point; the noise sampling point is the sampling point belonging to the noise region of the volume data to be processed, and the non-noise sampling point is the sampling point belonging to the non-noise region of the volume data to be processed; A synthesis module, used for obtaining a synthesis output value corresponding to the light according to the sampling value obtained by each light at each sampling point; A rendering module is used to obtain a rendering image corresponding to the volume data to be processed according to the synthetic output value corresponding to each of the light rays.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.