Main Content

images.compatibility.volshow.R2022a.volshow

(To be removed) Display volume using volshow object

Since R2022b

images.compatibility.volshow.R2022a.volshow will be removed in a future release. Use the viewer3d and volshow functions instead. For more information, see Compatibility Considerations.

Description

A volshow object created by the images.compatibility.volshow.R2022a.volshow function displays a volume and enables you to modify the appearance of the display.

Creation

Description

example

images.compatibility.volshow.R2022a.volshow(V) displays 3-D grayscale volume V in a figure. You can rotate and zoom in and out on the display interactively using the mouse.

images.compatibility.volshow.R2022a.volshow(V,config) displays the 3-D grayscale volume V. config is a struct exported from the Volume Viewer app. The config struct controls visualization of the volume, containing values for volshow object properties.

images.compatibility.volshow.R2022a.volshow(V,Name,Value) displays the volume, using one or more name-value arguments to set properties that control the visualization of the volume. For a list of name-value arguments, see Properties.

Example: images.compatibility.volshow.R2022a.volshow(V,BackgroundColor="w") displays 3-D grayscale volume V in a figure with a white background color.

vs = images.compatibility.volshow.R2022a.volshow(___) returns a volshow object with properties that can be used to control visualization of the volume.

Input Arguments

expand all

3-D grayscale volume, specified as a numeric array.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | logical

Rendering information exported by Volume Viewer, specified as a struct.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | logical

Properties

expand all

Transparency map for the volume content, specified as a 256-by-1 numeric array, with values in the range [0, 1]. The default transparency map is the vector linspace(0,1,256)'.

Background color, specified as an RGB triplet, a color name, or a short color name.

You can specify any color using an RGB triplet. An RGB triplet is a 3-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range [0, 1].

You can specify some common colors by name as a string scalar or character vector. This table lists the named color options and the equivalent RGB triplets.

Color NameShort NameRGB TripletAppearance
"red""r"[1 0 0]

A rectangle colored pure red

"green""g"[0 1 0]

A rectangle colored pure green

"blue""b"[0 0 1]

A rectangle colored pure blue

"cyan" "c"[0 1 1]

A rectangle colored pure cyan

"magenta""m"[1 0 1]

A rectangle colored pure magenta

"yellow""y"[1 1 0]

A rectangle colored pure yellow

"black""k"[0 0 0]

A rectangle colored black

"white""w"[1 1 1]

A rectangle colored white

Here are the RGB triplets for the default colors that MATLAB® uses in many types of plots.

RGB TripletAppearance
[0 0.4470 0.7410]

A rectangle colored medium blue

[0.8500 0.3250 0.0980]

A rectangle colored reddish-orange

[0.9290 0.6940 0.1250]

A rectangle colored dark yellow

[0.4940 0.1840 0.5560]

A rectangle colored dark purple

[0.4660 0.6740 0.1880]

A rectangle colored light green

[0.3010 0.7450 0.9330]

A rectangle colored light blue

[0.6350 0.0780 0.1840]

A rectangle colored dark red

Example: "BackgroundColor","r"

Example: "BackgroundColor","green"

Example: "BackgroundColor",[0 0.4470 0.7410]

Location of camera, or the viewpoint, specified as a 3-element vector of the form [x y z]. This vector defines the axes coordinates of the camera location, which is the point from which you view the axes. The camera is oriented along the view axis, which is a straight line that connects the camera position and the camera target. Changing the CameraPosition property changes the point from which you view the volume. For an illustration, see Camera Graphics Terminology. Interactively rotating the volume modifies the value of this property.

Point used as camera target, specified as a 3-element vector of the form [x y z]. The camera is oriented along the view axis, which is a straight line that connects the camera position and the camera target. For an illustration, see Camera Graphics Terminology.

Vector defining upwards direction, specified as a 3-element direction vector of the form [x y z]. By default, volshow defines the z-axis as the up direction ([0 0 1]). For an illustration, see Camera Graphics Terminology. Interactively rotating the volume modifies the value of this property.

Field of view, specified as a scalar angle in the range [0, 180). The larger the angle, the larger the field of view. Also, as the angle increases, objects appear smaller in the scene. For an illustration, see Camera Graphics Terminology.

Colormap of the volume content, specified as a 256-by-3 numeric array with values in the range [0, 1].

Interactivity of the volume, specified as true or false. When true, you can zoom using the mouse scroll wheel, and rotate by clicking and dragging on the volume. Rotation and zoom are performed about the value specified by the CameraTarget property. When false, you cannot interact with the volume.

Isosurface color, specified as an RGB triplet, a color name, or a short color name. This property specifies the volume color when the Renderer property is set to "Isosurface".

You can specify any color using an RGB triplet. An RGB triplet is a 3-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range [0, 1].

You can specify some common colors by name as a string scalar or character vector. This table lists the named color options and the equivalent RGB triplets.

Color NameShort NameRGB TripletAppearance
"red""r"[1 0 0]

A rectangle colored pure red

"green""g"[0 1 0]

A rectangle colored pure green

"blue""b"[0 0 1]

A rectangle colored pure blue

"cyan" "c"[0 1 1]

A rectangle colored pure cyan

"magenta""m"[1 0 1]

A rectangle colored pure magenta

"yellow""y"[1 1 0]

A rectangle colored pure yellow

"black""k"[0 0 0]

A rectangle colored black

"white""w"[1 1 1]

A rectangle colored white

Here are the RGB triplets for the default colors that MATLAB uses in many types of plots.

RGB TripletAppearance
[0 0.4470 0.7410]

A rectangle colored medium blue

[0.8500 0.3250 0.0980]

A rectangle colored reddish-orange

[0.9290 0.6940 0.1250]

A rectangle colored dark yellow

[0.4940 0.1840 0.5560]

A rectangle colored dark purple

[0.4660 0.6740 0.1880]

A rectangle colored light green

[0.3010 0.7450 0.9330]

A rectangle colored light blue

[0.6350 0.0780 0.1840]

A rectangle colored dark red

Example: "IsosurfaceColor","r"

Example: "IsosurfaceColor","green"

Example: "IsosurfaceColor",[0 0.4470 0.7410]

Value that defines the volume surface drawn when the Renderer property is set to "Isosurface", specified as a nonnegative number in the range [0, 1].

Include light source in rendering, specified as a logical scalar.

Parent of the volshow object, specified as a uipanel object or figure object. If you do not specify a parent, then the parent of the volshow object is gcf.

Rendering style, specified as one of the values in this table. When the volume is logical, the default rendering style is "Isosurface", otherwise the default rendering style is "VolumeRendering".

ValueDescription
"VolumeRendering"View the volume based on the specified color and transparency for each voxel.
"MaximumIntensityProjection"View the voxel with the highest intensity value for each ray projected through the data.
"Isosurface"View an isosurface of the volume specified by the value in Isovalue.

Scale factors used to rescale volume, specified as a 1-by-3 positive numeric array. The values in the array correspond to the scale factor applied in the x, y, and z direction.

Object Functions

setVolume(To be removed) Set new volume in volshow object

Examples

collapse all

Load and view a volume.

load spiralVol;
images.compatibility.volshow.R2022a.volshow(spiralVol);

Gray spiraling coil against blue background.

Tips

  • The images.compatibility.volshow.R2022a.volshow function creates a uipanel object in the specified parent figure. Panels are containers that group UI components together. volshow displays volumetric data in the uipanel. In contrast, imshow displays images in an Axes. If you call imshow to display an image in a figure in which volshow has displayed a volume, then imshow does not overwrite the volume displayed by volshow. The Axes created by imshow displays behind the uipanel.

Version History

Introduced in R2022b

collapse all

R2022b: images.compatibility.volshow.R2022a.volshow will be removed

images.compatibility.volshow.R2022a.volshow will be removed in a future release. Use the viewer3d and volshow functions instead. The viewer3d function creates a Viewer3D object that you can use to modify the scene, such as the camera, background colors, and lighting. The volshow object creates a Volume object that you can use to modify the appearance of the volumetric data, such as the rendering style, colormap, and transparency map.

Some of the properties of the volshow object have a different name with the Viewer3D and Volume objects. For more information, see Viewer3D Properties and Volume Properties.

Discouraged UsageRecommended Replacement

This example uses the images.compatibility.volshow.R2022a.volshow function to display volume data.

load mri
V = squeeze(D);
vol = images.compatibility.volshow.R2022a.volshow(V);

Here is equivalent code, creating a Volume object using the volshow function.

load mri
V = squeeze(D);
vol = volshow(V);

This example displays a volume on a blue background using an isosurface rendering style.

vol = images.compatibility.volshow.R2022a.volshow(V, ...
    BackgroundColor="b",Renderer="Isosurface");

Change the background color and the rendering style by setting properties of the object.

vol.BackgroundColor = "g";
vol.Renderer = "VolumeRendering");

Here is equivalent code, setting the background color using a Viewer3D object and the rendering style using a Volume object.

viewer = viewer3d(BackgroundColor="b");
vol = volshow(V,Parent=viewer,RenderingStyle="Isosurface");

Change the background color by setting properties of the Viewer3D object and change the rendering style by setting properties of the Volume object.

viewer.BackgroundColor = "g";
vol.RenderingStyle = "VolumeRendering");