Tiff.computeTile
Returns the index of the tile that contains a given image position.
Category: Data Import and Analysis > Data Import and Export
Syntax
tileNum = computeTile(t, [row col])
Finds the tile holding the pixel at row, col.
Description
The method acts on a Tiff object created with Tiff(filename, mode). Tiled TIFF files split the image into a grid of fixed-size rectangles, whose size is given by the TileWidth and TileLength tags. Tiles are numbered row by row. This image fits inside one tile, so every position falls in tile 1.
Input arguments
tTiffobject open on a tiled image.[row col]- Pixel coordinates, counted from 1.
Output arguments
tileNum- Tile index, counted from 1, for use with
readEncodedTile.
Example
Tile of a pixel
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.isTiled()
r.computeTile([2 3])
r.close();
Output
ans = logical
1
ans = 1
See also
Tiff.readEncodedTile Tiff.numberOfTiles Tiff.isTiled Tiff.computeStrip