(Not recommended) Get all data in one level of
Create a blocked 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 = blockedImage('tumor_091R.tif');
Display the entire blocked image at the finest resolution level, including a grid of the block boundaries.
bshow = bigimageshow(bim,'ResolutionLevel','fine', ... 'GridVisible','on','GridLevel',1);
Create a mask of the coarsest resolution level.
First create a single-resolution image of the coarsest resolution level. By default, the
gather function gets data from the coarsest resolution level.
imcoarse = gather(bim);
Convert the coarse image to grayscale.
graycoarse = rgb2gray(imcoarse);
Binarize the grayscale image. In the binarized image, the object of interest is black and the background is white.
bwcoarse = imbinarize(graycoarse);
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.
mask = imcomplement(bwcoarse);
Create a blocked image containing the mask.
Use the same spatial referencing as the original blocked image. Determine the coarsest resolution level and capture the spatial referencing information of the blocked image at the first two dimensions at that level.
coarsestLevel = bim.NumLevels; originalWorldStartCoarsest = bim.WorldStart(coarsestLevel,1:2); originalWorldEndCoarsest = bim.WorldEnd(coarsestLevel,1:2);
Create the blocked image for the mask.
bmask = blockedImage(mask,'WorldStart',originalWorldStartCoarsest, ... 'WorldEnd',originalWorldEndCoarsest);
Display the mask image.
Overlay the mask on the display of the original blocked image using the
showmask function. To highlight all blocks that contain at least one nonzero mask pixel, specify an inclusion threshold of
I— Single-resolution image
Single-resolution image, returned as a numeric array.
getFullLevelfunction is not recommended
Not recommended starting in R2021a
Although there are no plans to remove the
bigimage object and its
getFullLevel function at this time, switch to the
blockedImage object and the
gather function to take
advantage of the additional capabilities and flexibility.