getFullLevel

Get all data in one level of big image

Description

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

example

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

Examples

collapse all

Load a bigimage. This examples uses a modified version of image "tumor_091.tif" from the CAMELYON16 data set. The original image is a training image of a lymph node containing tumor tissue. The original image has eight resolution levels, and the finest level has resolution 53760-by-61440. The modified image has only three coarse resolution levels. The spatial referencing of the modified image 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);

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:

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

  2. Convert the image to grayscale.

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

  4. 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 big image.

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

Display the mask.

figure
bigimageshow(bmask);

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);

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.

Introduced in R2019b