Volume Properties
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
Data Display
Data
— Volumetric data
m-by-n-by-p numeric
array | m-by-n-by-p-by-3 numeric
array
Volumetric 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.
DisplayRange
— Display range
2-element row vector | 3-by-2 numeric matrix
Display range used to map voxel values to the colormap and transparency map, specified as one of these options:
2-element row vector of the form
[min max]
— Scale data according to the valuesmin
andmax
. For RGB volumes, specifying a 2-element row vector applies the same data limits to all color channels.3-by-2 numeric matrix with each row of the form
[min max]
— Scale each RGB channel according to the valuesmin
andmax
in the corresponding row. The first, second, and third rows specify the data limits for the red, green, and blue color channels, respectively.
If you do not specify a DisplayRange
property value,
by default, the function automatically scales the data based on the
property value. If you
specify the DisplayRangeMode
DisplayRange
property value, the
DisplayRangeMode
property value changes to
"manual"
.
DisplayRangeMode
— Display range mode
"data-range"
(default) | "type-range"
| "10-bit"
| "12-bit"
| "manual"
Display range mode, specified as one of the options in the table.
Value | Description |
---|---|
"type-range" | Set the display range equal to the data type range. For example, for
uint8 images, the display range is [0,
255] . |
"data-range" | Set the display range equal to the data range of the volume. For RGB volumes, the data range is the overall minimum and maximum across channels. For example, given an RGB volume in which the minimum and maximum values of the R, G, and B channels are [2, 160], [5, 200], and [0, 140], respectively, the display range is [0, 200]. |
"10-bit" | Set the display range to [0, 1023] . This value is
useful for displaying medical images with 10-bit data ranges. |
"12-bit" | Set the display range to [0, 4095] . This value is
useful for displaying medical images with 12-bit data ranges. |
"manual" | Manually set a fixed display range using the DisplayRange property. Specifying the
DisplayRange automatically sets the
DisplayRangeMode property value to
"manual" . |
Alphamap
— Transparency map for volume content
linspace(0,1,256)'
(default) | n-element column vector | "linear"
| "quadratic"
| "cubic"
Transparency map for the volume, specified as one of the values in the table.
The DisplayRange
property determines how values of
Data
map to the transparency map. Values less than or equal to
the minimum of the DisplayRange
map to the first value of the
transparency range, and all values greater than or equal to the maximum of the
DisplayRange
map to the last value of the transparency
range.
When the AlphaData
property is nonempty, the
property has
no effect.Alphamap
Value | Description |
---|---|
n-element column vector with values in the range [0, 1] | Values in Data map linearly to the transparency
values in Alphamap . |
| Values in Data map linearly to transparencies in the
range [0, 1]. |
| Values in Data map quadratically to transparencies
in the range [0, 1]. Use this option to apply a more rapid change in
transparency between low and high values of Data compared
to "linear" . |
| Values in Data map cubically to transparencies in
the range [0, 1]. Use this option to apply the most rapid change in
transparency between low and high values of Data . |
AlphaData
— Transparency channel
[]
(default) | m-by-n-by-p array
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
is empty, the transparency of each voxel is controlled by the intensity or luminance of the voxel according to theAlphaData
Alphamap
property.When
is nonempty, the transparency of each voxel is controlled by the corresponding element inAlphaData
.AlphaData
Colormap
— Colormap
gray(256)
(default) | n-by-3 numeric matrix
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. You can specify the colormap as a numeric matrix
directly, or as the name of predefined colormap such as turbo
or
parula
. For a complete list of colormaps, see Colormaps. This property has no effect when viewing
RGB volumes.
Visible
— Object is visible
"on"
(default) | on/off logical value
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
— Transformation applied to volume
affinetform3d
object | rigidtform3d
object | simtform3d
object | transltform3d
object
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.
ClippingPlanes
— Clipping planes
[]
(default) | N-by-4 matrix
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
RenderingStyle
— Rendering style
"VolumeRendering"
(default) | "CinematicRendering"
| "LightScattering"
| "MaximumIntensityProjection"
| "MinimumIntensityProjection"
| "GradientOpacity"
| "Isosurface"
| "SlicePlanes"
Rendering style, specified as one of the values in the table.
Value | Description |
---|---|
"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
|
"Isosurface" | View an isosurface of the volume specified by the value in
|
"SlicePlanes" | View three orthogonal slice planes. |
CinematicNumIterations
— Number of iterations
positive integer scalar
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.
LightScatteringQuality
— Light scattering quality
"auto"
(default) | numeric scalar
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.
IsosurfaceValue
— Isosurface value
0.15
(default) | numeric scalar
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"
.
SlicePlaneValues
— Orthogonal or oblique slice planes
N-by-4 matrix
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
is six. The slice planes
are visible only when the SlicePlaneValues
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.
GradientOpacityValue
— Gradient opacity value
0.3
(default) | numeric scalar
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"
.
SpecularReflectance
— Specular reflectance
0.4
(default) | numeric scalar
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
OverlayData
— Overlay data
numeric array
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 OverlayDisplayRange
, OverlayRenderingStyle
, OverlayColormap
, and OverlayAlphamap
properties.
OverlayDisplayRange
— Overlay display range
[0, 255]
(default) | 2-element numeric vector
Overlay display range, specified as a 2-element numeric vector of the form
[low high]
that specifies the minimum and maximum of the display
range. If you specify this property directly, the OverlayDisplayRangeMode
property value automatically changes
to "manual"
. When the OverlayDisplayRangeMode
property value is "data-range"
or "type-range"
,
this property automatically updates to reflect the current display range.
OverlayDisplayRangeMode
— Overlay display range mode
"8-bit"
(default) | "type-range"
| "data-range"
| "manual"
Overlay display range mode, specified as one of the options in the table.
Value | Description |
---|---|
"8-bit" | Set the overlay display range to [0 255] . |
"type-range" | Set the overlay display range equal to the data type range for
OverlayData . For example, if
OverlayData is of data type double ,
the display range is [0 1] . |
"data-range" | Set the display range equal to the data range of
OverlayData . |
"manual" | Manually set a fixed display range using the OverlayDisplayRange property. Specifying the
OverlayDisplayRange property automatically sets the
OverlayDisplayRangeMode to
"manual" . |
OverlayColormap
— Overlay colormap
n-by-3 numeric matrix
Overlay colormap, specified as an n-by-3 numeric matrix with
values in the range [0, 1]. The maximum number of colors n is 256.
You can specify the colormap as a numeric matrix directly, or as the name of predefined
colormap such as turbo
or parula
. For a complete
list of colormaps, see Colormaps.
This property affects the visualization only when the OverlayData
property is nonempty. The default colormap
maximizes color differences between adjacent colors in the colormap, which helps
visually distinguish between different values in a discrete label image. When displaying
continuous overlay data as a heatmap, consider specifying a predefined colormap with
gradual color changes, such as turbo
or
parula
.
The OverlayDisplayRange
property determines how values of
OverlayData
map to the colormap. Values less than or equal to the
minimum of the OverlayDisplayRange
map to the first color in
OverlayColormap
, and all values greater than or equal to the
maximum of the OverlayDisplayRange
map to the last color in
OverlayColormap
.
OverlayAlpha
— Uniform transparency value for overlay
0.2
(default) | numeric scalar | []
Uniform transparency value for the overlay image, specified as a numeric scalar in
the range [0, 1] or an empty array. Specify a numeric scalar to apply a uniform
transparency to all nonzero pixels in OverlayData
. Zero-valued pixels display fully
transparent.
To specify a nonuniform transparency, or to apply a uniform transparency to all
pixels including zero-valued pixels, specify the OverlayAlphamap
property. If you specify
OverlayAlphamap
, then this property automatically changes to an
empty matrix, []
.
OverlayAlphamap
— Nonuniform transparency map for overlay
n-element column vector | "linear"
| "quadratic"
| "cubic"
Nonuniform transparency map for the overlay image, specified as one of the values in
the table. Specify this property to apply a nonuniform transparency to pixels in
OverlayData
. By default, OverlayAlphamap
is a 256-element column vector that reflects the current OverlayAlpha
value.
The OverlayDisplayRange
property determines how values of
OverlayData
map to the transparency range. Values less than or
equal to the minimum of the OverlayDisplayRange
map to the first
value of the transparency range, and all values greater than or equal to the maximum of
the OverlayDisplayRange
map to the last value of the transparency
range.
Value | Description |
---|---|
n-element column vector with values in the range [0, 1] | Values in OverlayData map linearly to the
transparency values in OverlayAlphamap . |
| Values in OverlayData map linearly to transparencies
in the range [0, 1]. |
| Values in OverlayData map quadratically to
transparencies in the range [0, 1]. Use this option to apply a more rapid
change in transparency between low and high values of
OverlayData compared to
"linear" . |
| Values in OverlayData map cubically to
transparencies in the range [0, 1]. Use this option to apply the most rapid
change in transparency between low and high values of
OverlayData . |
OverlayRenderingStyle
— Overlay rendering style
"LabelOverlay"
(default) | "VolumeOverlay"
| "GradientOverlay"
Overlay rendering style, specified as one of the values in the table.
Value | Description |
---|---|
"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. |
Version History
Introduced in R2022bR2024b: Specify volume display range and transparency map
Control the display range used to scale the volume by using the new
DisplayRange
andDisplayRangeMode
properties.Control the display range used to scale the volume overlay by using the new
OverlayDisplayRange
andOverlayDisplayRangeMode
properties.Specify a uniform transparency for all nonzero label values while hiding background labels by using the new
OverlayAlpha
property.For easier specification of transparency maps, the new options
"linear"
,"quadratic"
, and"cubic"
have been added for theAlphamap
andOverlayAlphamap
properties.
R2024b: New default colormap, OverlayThreshold
not recommended
To improve support for labeling workflows, the default
OverlayColormap
property value has changed fromturbo(256)
to a custom colormap that maximizes differences between adjacent colors. To apply the same colormap as in previous releases, specify theColormap
property asturbo(256)
.To apply a uniform transparency while hiding background labels, the new
OverlayAlpha
property is recommended over theOverlayThreshold
property. There are no plans to remove support for existing instances ofOverlayThreshold
.
R2023b: Cinematic rendering, volumetric light scattering, and specular reflectance
Specify the
RenderingStyle
property as"CinematicRendering"
to display a photorealistic volume using iterative postprocessing. Specify the number of postprocessing iterations using the newCinematicNumIterations
property.Specify the
RenderingStyle
property as"LightScattering"
to display the volume with volumetric light scattering, including light absorption, inscattering, and outscattering. Specify the balance between rendering quality and speed using the newLightScatteringQuality
property.Control the amount of light reflected by a volume using the new
SpecularReflectance
property. Increase the specular reflectance to make a volume appear shinier.
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)