read
(Removed) Read data from bigimageDatastore
The read function of the bigimageDatastore object
has been removed (since R2026a). Use the read function
associated with the blockedImageDatastore object instead. For more information, see Version History.
Description
Examples
Create a bigimage from the sample image "tumor_091R.tif".
bim = bigimage("tumor_091R.tif");Create a bigimageDatastore object at resolution level 1. Specify
a nondefault block size. Set the datastore to read four blocks at a time.
bimds = bigimageDatastore(bim,2,"BlockSize",[512 512],"ReadSize",4)
bimds =
bigimageDatastore with properties:
ReadSize: 4
BorderSize: [0 0]
PadMethod: 0
Images: [1x1 bigimage]
Levels: 2
BlockSize: [512 512]
BlockOffsets: [512 512]
IncompleteBlocks: 'same'
BlockLocationSet: [1x1 blockLocationSet]Read one batch of data from the datastore. Notice that the third block is a partial edge block and has a smaller size than interior blocks
blocks = read(bimds);
blocks=4×1 cell array
{512x512x3 uint8}
{512x512x3 uint8}
{512x316x3 uint8}
{512x512x3 uint8}Input Arguments
Big image datastore, specified as a bigimageDatastore object.
The datastore contains one or more big images,
Images, each withChannelsnumber of channels.The datastore reads blocks from each big image at specified resolution levels,
Levels.The datastore specifies the number of blocks to read in each batch,
ReadSize.The datastore specifies the m-by-n pixel size of blocks to read,
BlockSize.
Output Arguments
Output data, returned as a cell array with ReadSize elements.
Each cell contains an
m-by-n-by-Channels numeric
array.
Information about output data, returned as a struct containing these fields.
| Field Name | Description |
|---|---|
Level | Resolution level of the data, specified as a
1-by-ReadSize vector of positive integers. |
ImageNumber | Index of the big image providing the data, specified as a
1-by-ReadSize vector of positive integers. |
BlockStartWorld | (x,y) coordinates of the center of
the top-left pixel of the data, excluding padding, specified as a
ReadSize-by-2 numeric vector. Values are in
world-coordinates. |
BlockEndWorld | (x,y) coordinates of the center of
the bottom-right pixel of the data, excluding padding, specified as a
ReadSize-by-2 numeric vector. Values are in
world-coordinates. |
DataStartWorld | (x,y) coordinates of the center of
the top-left pixel of the data, including padding, specified as a
ReadSize-by-2 numeric vector. Values are in
world-coordinates. |
DataEndWorld | (x,y) coordinates of the center of
the bottom-right pixel of the data, including padding, specified as a
ReadSize-by-2 numeric vector. Values are in
world-coordinates. |
Version History
Introduced in R2019bThe read function has been removed. Use the read function
of the blockedImageDatastore object instead.
To update your code, first create a blockedImage
object to read your image data. Then, follow these steps to create a
blockedImageDatastore object and read a block of data:
If you want to read data at a resolution level other than
1, then create a block location set using theselectBlockLocationsfunction. Specify the level using theLevelname-value argument.Create a
blockedImageDatastore, specifying theblockedImageobject. If you want to read data at a resolution level other than1, then specify the block location set using theBlockLocationSetname-value argument.In the call to the
readfunction, replace the input argument with theblockedImageDatastoreobject.
If you return block metadata using the info argument, then some
fields of the metadata structure differ.
| Discouraged Usage | Recommended Replacement |
|---|---|
This example reads a block from a bigIm = bigimage("tumor_091R.tif");
bigDS = bigimageDatastore(bigIm);
[block,info] = read(bigDS); | Here is equivalent code that reads a block from a
blockedIm = blockedImage("tumor_091R.tif");
blockedDS = blockedImageDatastore(blockedIm);
[block,info] = read(blockedDS); |
This example reads a block at resolution level
bigIm = bigimage("tumor_091R.tif");
level = 2;
bigDS = bigimageDatastore(bigIm,level);
[block,info] = read(bigDS); | Here is equivalent code using a blockedIm = blockedImage("tumor_091R.tif");
level = 2;
bls = selectBlockLocations(blockedIm,Levels=level);
blockedDS = blockedImageDatastore(blockedIm,BlockLocationSet=bls);
[block,info] = read(blockedDS); |
The read function issues a warning that it will be removed
in a future release.
The bigimageDatastore object and this function will be removed in a
future release.
Starting in R2021a, the bigimageDatastore object and its object
functions, which operate on data from bigimage objects, are no longer
recommended. Instead, use the blockedImageDatastore object and its object functions, which operate on data
from blockedImage
objects. The blockedImage object offers several advantages including
extension to N-D processing, a simpler interface, and custom support for reading and writing
nonstandard image formats.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)