This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

imresize3

Resize 3-D volumetric intensity image

Syntax

B = imresize3(V,scale)
B = imresize3(V,[numrows numcols numplanes])
B = imresize3(___,method)
B = imresize3(___,Name,Value)

Description

example

B = imresize3(V,scale) returns the volume B that is scale times the size of V. The input volume V must be a 3-D volumetric intensity image (called a volume). By default, imresize3 uses cubic interpolation.

B = imresize3(V,[numrows numcols numplanes]) returns the volume B that has the number of rows, columns, and planes specified by the three-element vector [numrows numcols numplanes].

B = imresize3(___,method) returns the volume B, where method specifies the interpolation method used.

B = imresize3(___,Name,Value) returns a resized volume where Name,Value pairs control aspects of the operation.

Examples

collapse all

Read MRI volume into the workspace.

s = load('mri');
mriVolumeOriginal = squeeze(s.D);
sizeO = size(mriVolumeOriginal);

Visualize the volume.

figure;
slice(double(mriVolumeOriginal),sizeO(2)/2,sizeO(1)/2,sizeO(3)/2);
shading interp, colormap gray;
title('Original');

Resize the volume, reducing the size all all dimensions by one-half. This example uses the default interpolation method and antialiasing.

mriVolumeResized = imresize3(mriVolumeOriginal, 0.5);
sizeR = size(mriVolumeResized);

Visualize the resized volume.

figure;
slice(double(mriVolumeResized),sizeR(2)/2,sizeR(1)/2,sizeR(3)/2);
shading interp, colormap gray;
title('Resized');

Input Arguments

collapse all

Volume to be resized, specified as a 3-D volumetric intensity image. V is numeric array with three dimensions.

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

Scale factor, specified as a numeric scalar. To make the resized volume smaller than the input volume, specify a scale value from 0 through 1.0. To make the resized volume bigger than the input volume, specify a scale value greater than 1.0.

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

Size of output image, specified as a three-element vector of real, positive, numeric values, in the form [rows columns planes]. If you specify one numeric value and the other two values as NaNs, imresize3 computes the other two elements automatically to preserve the aspect ratio.

Data Types: single | double

Interpolation method, specified as one of the values in the following table that identifies a general method or a named interpolation kernel.

MethodDescription

'nearest'

Nearest-neighbor interpolation

'linear'

Linear interpolation

'cubic'

Cubic interpolation

Note

Cubic interpolation can produce pixel values outside the original range.

Interpolation KernelDescription
'box'Box-shaped kernel
'triangle'Triangular kernel (equivalent to 'linear')
'lanczos2'Lanczos-2 kernel
'lanczos3'Lanczos-3 kernel

Data Types: char | string

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: mriVolumeResized = imresize3(mristack, 0.5,'Antialiasing',false);

Perform antialiasing when shrinking a volume, specified as the comma-separated pair consisting of 'Antialiasing' and the logical Boolean value true or false. The default value depends on the interpolation method. If the method is nearest-neighbor ('nearest'), the default is false. For all other interpolation methods, the default is true.

Data Types: logical

Interpolation method, specified as the comma-separated pair consisting of 'Method' and string scalar or character vector. For details, see method.

Data Types: char | string

Size of the output volume, specified as the comma-separated pair consisting of 'OutputSize' and a three-element numeric vector of positive values, of the form [rows cols planes]. For details, see [numrows numcols numplanes].

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

Resize scale factor, specified as a numeric scalar or three-element vector of positive values. If it is a scalar, the same scale factor is applied to each dimension. If it is a vector, it contains the scale factors for the row, column, and plane dimensions, respectively.

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

Output Arguments

collapse all

Resized volume, returned as a real, nonsparse numeric array, the same class as the input volume.

Introduced in R2017a