Main Content

getBlock

Read specific block of blocked image

    Description

    example

    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(___) returns additional block information in the scalar structure blockinfo.

    Examples

    collapse all

    Create a blocked image and display it.

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

    Figure contains an axes. The axes contains an object of type bigimageshow.

    Display the value of the SizeInBlocks property.

    disp(bim.SizeInBlocks)
         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.

    imshow(block)   

    Figure contains an axes. The axes contains an object of type image.

    Input Arguments

    collapse all

    Blocked image, specified as a blockedImage object.

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

    Example: [3, 2, 1]

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

    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.

    FieldDescription
    StartSubscripts of the first element in blockdata
    EndSubscripts of the last element in blockdata
    LevelImage level
    Introduced in R2021a