computeTile

Class: Tiff

Index number of tile containing specified coordinates

Syntax

tileNumber = computeTile(tiffobj,[row col])
tileNumber = computeTile(tiffobj,[row col],plane)

Description

tileNumber = computeTile(tiffobj,[row col]) returns the index number of the tile containing the pixel specified by the one-based indices, row and col.

tileNumber = computeTile(tiffobj,[row col],plane) returns the index number of the tile containing the pixel specified by the indices in the specified plane, if the value of the PlanarConfiguration tag is Tiff.PlanarConfiguration.Separate. The row, column, and plane coordinate values are one-based.

computeTile clamps out-of-range coordinate values to the bounds of the image.

Examples

expand all

Open a Tiff object and get the dimensions of the image to calculate coordinates.

t = Tiff('example.tif','r');
numRows = getTag(t,'ImageLength');
numCols = getTag(t,'ImageWidth');

Get the ID number of the tile containing the coordinates.

tileNum = computeTile(t,[numRows numCols])
tileNum =

   110

Close the Tiff object.

close(t)

Related Examples

References

This method corresponds to the TIFFComputeTile function in the LibTIFF C API. To use this method, you must be familiar with the TIFF specification and technical notes. View this documentation at LibTiff - TIFF Library and Utilities.

Was this topic helpful?