Main Content

setVolume

(To be removed) Set new volume in volshow object

setVolume will be removed in a future release. Set the Data property of a Volume object instead. For more information, see Version History.

Description

setVolume(hVol,V) updates the volshow object hVol with a new volume V. setVolume preserves the current viewpoint and other visualization settings remain unchanged.

example

Examples

collapse all

Load a volume.

load mri
V = squeeze(D);

Display the volume in a volshow object using the images.compatibility.volshow.R2022a.volshow function. Specify a nondefault colormap and background color.

vol = images.compatibility.volshow.R2022a.volshow(V, ...
    "Colormap",hot(256),"BackgroundColor","magenta");

MRI volume displayed with hot colormap in a figure window with a magenta background

Load a new volume, then display that volume in the existing volshow object. Note that setVolume preserves the colormap and the background color.

load spiralVol
setVolume(vol,spiralVol)

Spiral volume displayed with hot colormap in a figure window with a magenta background

Input Arguments

collapse all

Volume visualization, specified as a volshow object. You can create a volshow object using the images.compatibility.volshow.R2022a.volshow function.

Volumetric data, specified as a 3-D grayscale volume.

Version History

Introduced in R2019a

collapse all

R2022b: setVolume will be removed

setVolume and the images.compatibility.volshow.R2022a.volshow function will be removed in a future release. Instead, create a Volume object using the volshow function and then set the Data property using dot notation.

Discouraged UsageRecommended Replacement

This example uses the setVolume function to change the displayed volume data.

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

Here is equivalent code, creating a Volume object then changing the displayed data by setting the Data property.

load mri
V = squeeze(D);
vol = volshow(V);
load spiralVol
vol.Data = spiralVol;