Main Content

Cuboid

Spatial extents of 3-D cuboidal region

Description

ACuboidobject stores the spatial extents of a 3-D volumetric image.

Creation

You can create aCuboidobject in several ways.

  • centerCropWindow3d— Create aCuboidof a specified size whose position is centered on an image.

  • randomCropWindow3d— Create aCuboidof a specified size whose position is selected randomly from inside an image.

  • Running the command

    c = images.spatialref.Cuboid(XLimits,YLimits,ZLimits);
    creates aCuboidobject and sets theXLimits,YLimits, andZLimitsproperties.

Properties

expand all

Minimum and maximum limits of the cropping window along thex-axis, specified as a 2-element numeric vector of the form[min max], wheremaxis greater thanmin.

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

Minimum and maximum limits of the cropping window along they-axis, specified as a 2-element numeric vector of the form[min max], wheremaxis greater thanmin.

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

Minimum and maximum limits of the cropping window along thez-axis, specified as a 2-element numeric vector of the form[min max], wheremaxis greater thanmin.

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

Examples

collapse all

Load a 3-D MRI image. Use thesqueezefunction to remove any singleton dimensions.

loadmri; D = squeeze(D);

Display the image.

fullViewPnl = uipanel(figure,'Title','Original Volume'); volshow(D,'Parent',fullViewPnl);

Specify the target size of the cropping window.

targetSize = [64 64 10];

创建一个center cropping window that crops the specified image from its center.

win = centerCropWindow3d(size(D),targetSize);

Crop the image using the center cropping window.

Dcrop = imcrop3(D,win);

Display the cropped image in a display panel.

fullViewPnl = uipanel(figure,'Title','Cropped Volume'); volshow(Dcrop,'Parent',fullViewPnl);

Load a 3-D MRI image. Use thesqueezefunction to remove any singleton dimensions.

S = load('mri.mat','D'); volumeData = squeeze(S.D);

Display the image.

fullViewPnl = uipanel(figure,'Title','Original Volume'); volshow(volumeData,'Parent',fullViewPnl);

创建一个Cuboidobject and specify the cropping window size in all three dimensions.

c = images.spatialref.Cuboid([30,90],[30,90],[1,20]);

Crop the image based on theCuboiddimensions.

croppedVolume = imcrop3(volumeData,c);

Display the cropped image.

fullViewPnl = uipanel(figure,'Title','Cropped Volume'); volshow(croppedVolume,'Parent',fullViewPnl);

版本历史

Introduced in R2019b