labelvolshow

Display labeled volume

Description

Display labeled volumetric data, creating a labelvolshow object with properties that control the appearance of the display. You can embed the intensity volume with the labeled volume and display both volumes at once.

Creation

Description

example

labelvolshow(L) displays 3-D labeled volume L in a figure.

labelvolshow(L,V) displays 3-D labeled volume L and 3-D intensity volume V in a figure. L and V must be the same size.

labelvolshow(___,Name,Value) uses one or more name-value pairs to set Properties that control visualization of the volumes. Enclose each property name in quotes.

For example, labelvolshow(L,V,'BackgroundColor','w','VolumeThreshold',0.2) displays 3-D labeled volume L and grayscale volume V in a figure with a white background color. All pixels of V that have a value less than 0.2 are fully transparent.

h = labelvolshow(___) returns a labelvolshow object, h, with properties that can be used to control visualization of the volumes. Use input arguments from any of the previous syntaxes.

Input Arguments

expand all

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

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

Intensity volume, specified as a 3-D numeric array of the same size as the labeled volume, L.

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

Properties

expand all

Background color, specified as a MATLAB® ColorSpec. The intensities must be in the range [0, 1].

Location of the 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.

Vector defining upwards direction, specified as a 3-element vector of the form [x y z]. By default, labelvolshow 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.

Point used as the 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.

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

Volume is interactive, specified as true (1) or false (0). When true (default), you can zoom in and out on the labeled volume using the mouse scroll wheel, and rotate the volume by clicking and dragging. Rotation and zoom are performed about the value specified by CameraTarget. When this value is false, you cannot interact with the volume.

Label colors, specified as a numLabels-by-3 numeric array with values in the range [0, 1]. numLabels represents the number of labels in the labeled volume.

Label opacity, specified as a numLabels-by-1 numeric vector with values in the range [0, 1]. numLabels represents the number of labels in the labeled volume. LabelOpacity is not supported when embedding volumes together.

This property is read-only.

Label values, specified as a numLabels-by-1 numeric vector. numLabels represents the number of labels in the labeled volume.

Label visibility, specified as a numLabels-by-1 logical vector. numLabels represents the number of labels in the labeled volume.

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

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

Display intensity volume, specified as true (1) or false (0). When the value is true, the function displays both the labeled volume and the intensity volume. When the value is false, the function only displays the labeled volume. The default is true when the labelvolshow object contains both a labeled volume and an intensity volume. The default is false when the object contains only a labeled volume.

Volume opacity, specified as a number in the range [0, 1]. This value defines the opacity of volume data when both labeled and intensity volumes are embedded together. All of the embedded volume intensities above the VolumeThreshold value have the opacity of VolumeOpacity.

Threshold of volume intensities, specified as a normalized number in the range [0, 1]. All of the volume intensities below this threshold value have an opacity of 0.

Object Functions

setVolumeSet new labelvolshow object

Examples

collapse all

Read a grayscale image of a brain MRI. The image is stored in the workspace variable vol.

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

Read the corresponding labeled image into the workspace variable label.

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

Customize the display panel.

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

View the labeled volume and the intensity volume.

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

Hide the intensity volume. Only the labels appear.

h.ShowIntensityVolume = false;

Read a grayscale volume of a brain MRI. The image is stored in the workspace variable vol.

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

Read the corresponding labeled volume into the workspace variable label. The volume has three labels, excluding the background label 0.

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

Customize the display panel.

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

Display the labeled volume.

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

Make the first non-background label (the second label) fully transparent. Change the color of the second non-background label to red and the third non-background label to yellow.

h.LabelOpacity(2) = 0;
h.LabelColor(3,:) = [1 0 0];
h.LabelColor(4,:) = [1 1 0];

Introduced in R2019a