Main Content

getRegion

(To be removed) Read arbitrary region of bigimage object

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

Description

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

example

Examples

collapse all

Create a bigimage using 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);

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

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. The finest resolution level is on the left and the coarsest resolution level is on the right.

montage({imL1,imL2,imL3},'Size',[1 3], ...
    'BorderSize',5,'BackgroundColor','w');

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

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.

Version History

Introduced in R2019b

expand all

R2024b: Warns

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