Tiff.numberOfTiles
Returns the number of tiles in the current image.
Category: Data Import and Analysis > Data Import and Export
Syntax
n = numberOfTiles(t)
Counts the tiles of a tiled image.
Description
The method acts on a Tiff object created with Tiff(filename, mode). The grid has ceil(ImageWidth / TileWidth) columns and ceil(ImageLength / TileLength) rows, and edge tiles are padded to full size. The call is an error for a stripped image.
Input arguments
tTiffobject opened for reading.
Output arguments
n- Number of tiles in the grid that covers the image.
Example
Tile count
tag.ImageLength = 4; tag.ImageWidth = 4;
tag.Photometric = Tiff.Photometric.MinIsBlack;
tag.BitsPerSample = 8; tag.SamplesPerPixel = 1;
tag.TileLength = 16; tag.TileWidth = 16;
tag.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
w = Tiff('u.tif', 'w'); w.setTag(tag); w.write(uint8(magic(4))); w.close();
r = Tiff('u.tif', 'r');
r.numberOfTiles()
[r.getTag('TileWidth') r.getTag('TileLength')]
r.close();
Output
ans = 1
ans = 1×2
16 16
See also
Tiff.readEncodedTile Tiff.computeTile Tiff.isTiled Tiff.numberOfStrips