getRegion

Read arbitrary region of big image

Description

example

data = getRegion(bigimg,level,regionStartWorld,regionEndWorld) reads the big image data in bigimg at the specified resolution level. The function returns all pixels whose center coordinate is within the bounds of the rectangular region specified by regionStartWorld and regionEndWorld.

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.

bshow = bigimageshow(bim);

Define a rectangular region by specifying the starting and ending coordinates in the horizontal and vertical direction relative to the finest resolution level.

xyStart = [2100,1800];
xyEnd = [2600,2300];

Get the region of the bigimage at each resolution level.

imL1 = getRegion(bim,1,xyStart,xyEnd);
imL2 = getRegion(bim,2,xyStart,xyEnd);
imL3 = getRegion(bim,3,xyStart,xyEnd);

Display the three regions in a montage.

montage({imL1,imL2,imL3},'Size',[1 3]);

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.

Top-left coordinates of the rectangular region to read, specified as a 1-by-2 numeric vector of the form [x y]. The location is specified in world coordinates, which are the pixel locations relative to the highest resolution level.

Bottom-right coordinates of the rectangular region to read, specified as a 1-by-2 numeric vector of the form [x y]. The location is specified in world coordinates, which are the pixel locations relative to the highest resolution level.

Output Arguments

collapse all

Pixel data, returned as a numeric array of the same data type as the big image, bigimg.ClassUnderlying.

See Also

| |

Introduced in R2019b