Main Content


Read specific block of blocked image

Since R2021a



blockdata = getBlock(bim,blocksub) returns blockdata, the block specified by the subscripts in blocksub.

blockdata = getBlock(bim,blocksub,'Level',L) gets the specified block from the L'th level of the multiresolution blockedImage, bim. By default, L is 1.

[blockdata,blockinfo] = getBlock(___) also returns block metadata in blockinfo.


collapse all

Create a blocked image and display it.

bim = blockedImage('tumor_091R.tif');
    'GridVisible','on', 'GridLevel', 1,...
    'GridLineWidth', 2, 'GridColor','k','GridAlpha',0.3);

Display the value of the SizeInBlocks property.

     5     6     1
     2     2     1
     1     1     1

Specify the block you want to read.

block = getBlock(bim, [3, 2, 1]);

Display the block.


Input Arguments

collapse all

Blocked image, specified as a blockedImage object.

Block subscript vector, specified as a 1-by-N integer-valued vector. Valid elements range from 1 to the corresponding element in the SizeInBlocks property.

Example: [3, 2, 1]

Output Arguments

collapse all

Block of pixels from blocked image, returned as a numeric array. Partial blocks around the edges can be smaller than the BlockSize property.

Metadata of block of pixels, returned as a scalar struct. The blockinfo struct contains these fields.

StartSubscripts of the first element in blockdata
EndSubscripts of the last element in blockdata
LevelImage level

Version History

Introduced in R2021a