Main Content

setVolume

(To be removed) Set new volume in labelvolshow object

setVolume will be removed in a future release. Use volshow instead. For more information, see Compatibility Considerations.

Description

example

setVolume(hLabelVol,L) updates the labelvolshow object hLabelVol with a new labeled volume L. setVolume preserves the current viewpoint and other visualization settings remain unchanged, but the label properties are set to their respective defaults.

setVolume(hLabelVol,L,V) updates the labelvolshow object hLabelVol with a new labeled volume L and a new intensity volume V.

Examples

collapse all

Load an intensity volume and an associated labeled volume into the workspace.

load(fullfile(toolboxdir('images'),'imdata','BrainMRILabeled','images','vol_001.mat'));
load(fullfile(toolboxdir('images'),'imdata','BrainMRILabeled','labels','label_001.mat'));

Customize the display panel.

ViewPnl = uipanel(figure,'Title','Labeled Volume');

Display the labeled volume along with an intensity volume.

hVol = labelvolshow(label,vol,'Parent',ViewPnl);

Change the background color to magenta and decrease the opacity of the intensity volume.

hVol.VolumeOpacity = 0.2;
hVol.BackgroundColor = 'magenta';

Load another intensity volume and an associated labeled volume into the workspace.

im = load(fullfile(toolboxdir('images'),'imdata','BrainMRILabeled','images','vol_002.mat'));
data = load(fullfile(toolboxdir('images'),'imdata','BrainMRILabeled','labels','label_002.mat'));

newIntensityVol = im.vol;
newLabelVol = data.label;

Change the volume in the labelvolshow object hVol. Note how labelvolshow preserves the rendering settings of the background color and intensity volume transparency.

setVolume(hVol,newLabelVol,newIntensityVol)

Input Arguments

collapse all

Labeled volume object, specified as a labelvolshow object.

Labeled volumetric data, specified as a 3-D labeled volume.

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

Version History

Introduced in R2019a

collapse all

R2022b: setVolume will be removed

setVolume and the labelvolshow object will be removed in a future release. Instead, create a Volume object using the volshow function. Change the labels and intensity data by setting the OverlayData and Data properties of the Volume object, respectively.

Discouraged UsageRecommended Replacement

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

vol = labelvolshow(labels,volume);
setVolume(vol,newLabels,newVolume);

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

vol = volshow(volume,OverlayData=labels);
vol.Data = newVolume;
vol.OverlayData = newLabels;