Main Content

Volume Properties

Display volume in 3-D viewer

Since R2022b

Volume properties control the appearance and behavior of a Volume object. By changing property values, you can modify certain aspects of the volume. Create a Volume object using the volshow function.

Use dot notation to query and set properties. For example, these commands show how to create a Volume object that displays 3-D volumetric data V, query the value of the Colormap property, and set the value of the Colormap property, respectively.

vol = volshow(V);
cmap = vol.Colormap;
vol.Colormap = parula;

Parent/Child

expand all

Parent of the Volume object, specified as a Viewer3D object. You can create a Viewer3D object using the viewer3d function. A Volume object cannot be reparented.

Data Display

expand all

Volumetric grayscale data displayed in the viewer, specified as one of these options:

  • An m-by-n-by-p numeric array with non-singleton dimensions.

  • An m-by-n-by-p-by-3 numeric array with non-singleton dimensions.

Transparency map for the volume content, specified as an n-element column vector with values in the range [0, 1]. The maximum length of the vector is 256.

  • For grayscale volumes, the intensity of each voxel controls the transparency of the voxel. The Alphamap property indicates how intensity values map to transparency values.

  • For RGB volumes, the object uses the luminance of the voxel in the CIE 1976 L*a*b* color space to control the transparency of the voxel. The Alphamap property indicates how luminance values map to transparency values.

When the AlphaData property is nonempty, the Alphamap property has no effect.

Transparency channel for the volume, specified as an empty vector ([]) or an m-by-n-by-p array that matches the size of the first three dimensions of the volume.

  • When AlphaData is empty, the transparency of each voxel is controlled by the intensity or luminance of the voxel according to the Alphamap property.

  • When AlphaData is nonempty, the transparency of each voxel is controlled by the corresponding element in AlphaData.

Colormap of grayscale volume content, specified as an n-by-3 numeric matrix with values in the range [0, 1]. The maximum number of colors n is 256. This property has no effect when viewing RGB volumes.

Object is visible in the 3-D scene, specified as "on" or "off", or as a numeric or logical 1 (true) or 0 (false). A value of "on" is equivalent to true, and "off" is equivalent to false. The value is stored as an on/off logical value of type OnOffSwitchState.

Transformation applied to the volume in the 3-D scene, specified as an affinetform3d, rigidtform3d, simtform3d, or transltform3d object. Use the Transformation property to increase the size of the volume, rotate the volume, or perform other affine transformations. The default value is an affinetform3d object that performs an identity transformation.

Clipping planes applied locally to the object, specified as an N-by-4 matrix where each row corresponds to the equation for a clipping plane. The maximum number of clipping planes, N, is six. Each clipping plane is specified as a 1-by-4 vector, in world coordinates, following the Hessian normal form where the first three values represent the plane's normal vector and the fourth value is the signed distance from the origin to the plane.

Volume Rendering

expand all

Rendering style, specified as one of the values in the table.

ValueDescription
"VolumeRendering"View the volume based on the specified color and transparency for each voxel.
"CinematicRendering"

View the volume based on the specified color and transparency for each voxel, with iterative postprocessing that produces photorealistic shadows and lighting.

This rendering style is useful for displaying opaque volumes.

"LightScattering"

View the volume using a volumetric light scattering model that simulates the absorption, inscattering, and outscattering of light through the volume.

This rendering style is useful for displaying translucent volumes that do not have large intensity gradients, such as smoke, fog, and clouds.

"MaximumIntensityProjection"View the voxel with the highest intensity value for each ray projected through the data. For RGB volumes, the luminance of the voxel in CIE 1976 L*a*b* color space.
"MinimumIntensityProjection"View the voxel with the lowest intensity value for each ray projected through the data. For RGB volumes, the luminance of the voxel in CIE 1976 L*a*b* color space.
"GradientOpacity"

View the volume based on the specified color and transparency with an additional transparency applied if the voxel is similar in intensity (grayscale volumes) or luminance (RGB volumes) to the previous voxel along the viewing ray. When a volume with uniform intensity is rendered using "GradientOpacity", the internal portion of the volume appears more transparent than the "VolumeRendering" rendering style, enabling better visualization of the intensity or luminance gradients in the volume.

"Isosurface"

View an isosurface of the volume specified by the value in IsosurfaceValue.

"SlicePlanes"

View three orthogonal slice planes.

Number of iterations, specified as a positive integer scalar. This property affects the visualization only when the RenderingStyle property value is "CinematicRendering". The default number of iterations is 100 for systems with hardware graphics rendering. This value is sufficient for most volumes and lighting scenarios. Decreasing the number of iterations increases rendering speed, but can decrease rendering quality.

If your system does not support hardware graphics rendering, the default number of iterations is 20. For details about graphics rendering in MATLAB®, see System Requirements for Graphics.

Light scattering quality, specified as "auto" or a numeric scalar in the range [0, 1]. This property affects the visualization only when the RenderingStyle property value is "LightScattering". A larger quality value generates a more realistic rendering, but requires longer rendering times. By default, the quality value adjusts automatically to manage performance during interactions such as pan and zoom.

Isosurface value, specified as a numeric scalar in the range [0, 1]. This property affects the visualization only when the RenderingStyle property value is "Isosurface".

Orthogonal or oblique slice planes of the volume, specified as an N-by-4 matrix where each row corresponds to the equation for a slice plane. The maximum number of slice planes, N, in SlicePlaneValues is six. The slice planes are visible only when the RenderingStyle property is "SlicePlanes". The default value is three orthogonal planes that slice through the center of the volume. Each slice plane is specified as a 1-by-4 vector in voxel coordinates following the Hessian normal form where the first three values represent the normal vector of the plane and the fourth value is the signed distance from the origin to the plane.

Gradient opacity value, specified as a numeric scalar in the range [0, 1]. When set to 0, no gradient opacity is applied. When set to 1, the maximum amount of gradient opacity is applied. This property affects the visualization when the RenderingStyle property value is "GradientOpacity" or the OverlayRenderingStyle property value is "GradientOverlay".

Specular reflectance, specified as a numeric scalar in the range [0, 1]. This value controls the amount of light reflected by the volume. Increase the reflectance to make the volume appear shinier.

Overlay

expand all

Overlay data to be blended with the object data during rendering, specified as a numeric array. The object shows the overlay only when the RenderingStyle property value is "SlicePlanes", "VolumeRendering", or "GradientOpacity". You can modify the appearance of the overlay by changing the OverlayRenderingStyle, OverlayColormap, and OverlayAlphamap properties.

Overlay color, specified as an n-by-3 numeric matrix with values in the range [0, 1]. The maximum number of colors n is 256. This property affects the visualization only when the OverlayData property is nonempty.

Transparency map for the volume overlay, specified as an n-by-1 column vector with values in the range [0, 1]. The maximum number of elements is 256. This property affects the visualization only when the OverlayData property is nonempty.

Overlay rendering style, specified as one of the values in the table.

ValueDescription
"LabelOverlay"

View the overlay based on the color and transparency of each labeled region. Use this rendering style to visualize ordinal data like binary or semantic segmentation results on top of your data.

"VolumeOverlay"

View the overlay based on the specified color and transparency for each voxel.

"GradientOverlay"

View the overlay based on the color and transparency for each voxel with an additional transparency applied based on the difference between the voxel and the previous voxel along the viewing ray.

Overlay threshold, specified as a number in the range [0, 1]. The threshold is a normalized value that defines the surface of the overlay data. You can use this value to hide background voxels in the overlay data. This property affects the visualization only when the OverlayData property is nonempty.

Version History

Introduced in R2022b

expand all