Main Content

getFullLevel

(To be removed) Get all data in one level of bigimage object

The getFullLevel function of the bigimage object will be removed in a future release. Use the gather function associated with the blockedImage object instead. For more information, see Version History.

Description

I = getFullLevel(bigimg) reads the big image data in bigimg at the coarsest resolution level and returns the single-resolution image I.

I = getFullLevel(bigimg,level) reads the big image data in bigimg at the specified resolution level and returns the single-resolution image I.

example

Examples

collapse all

Create a big image from the sample image "tumor_091R.tif". This sample image is a training image of a lymph node containing tumor tissue from the CAMELYON16 data set. The image has been modified to have three coarse resolution levels, and has been adjusted to enforce a consistent aspect ratio and to register features at each level.

bim = bigimage("tumor_091R.tif");

Display the entire bigimage at the finest resolution level. Display a grid of the block boundaries.

bshow = bigimageshow(bim,'GridVisible','on','GridLevel',1);

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

Determine the coarsest resolution level and the spatial referencing of the bigimage at that level.

clevel = bim.CoarsestResolutionLevel;
clevelLims = bim.SpatialReferencing(clevel);

Create a mask of the coarsest resolution level by following these steps:

  • Get a single-resolution image of the coarsest resolution level.

  • Convert the image to grayscale.

  • Binarize the image. In the binarized image, the object of interest is black and the background is white.

  • Take the complement of the binarized image. The resulting mask follows the convention in which the object of interest is white and the background is black.

imcoarse = getFullLevel(bim,clevel);
graycoarse = rgb2gray(imcoarse);
bwcoarse = imbinarize(graycoarse);
mask = imcomplement(bwcoarse);

Create a bigimage containing the mask. Use the same spatial referencing as the original bigimage.

bmask = bigimage(mask,'SpatialReferencing',clevelLims);

Display the mask.

figure
bigimageshow(bmask);

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

Overlay the mask on the original bigimage. To highlight all blocks that contain at least one nonzero mask pixel, specify an inclusion threshold of 0.

showmask(bshow,bmask,'InclusionThreshold',0);

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

Input Arguments

collapse all

Big image, specified as a bigimage object.

Resolution level, specified as a positive integer that is less than or equal to the number of resolution levels of bigimg. The default level is the coarsest resolution level, bigimg.CoarsestResolutionLevel.

Output Arguments

collapse all

Single-resolution image, returned as a numeric array.

Tips

  • Check the LevelSizes property of the input big image bigimg to confirm that the size of image data at the specified level is small enough to fit in memory.

Version History

Introduced in R2019b

expand all

R2024b: Warns

The getFullLevel function issues a warning that it will be removed in a future release.