Main Content

computeTile

Index number of tile containing specified coordinates

Description

tileNumber = computeTile(t,coord) returns the index of the tile containing the pixel specified in coord. The computeTile function clamps out-of-range coordinate values to the bounds of the image.

example

tileNumber = computeTile(t,coord,plane) returns the index of the tile containing the pixel from the specified plane.

Examples

collapse all

Create a Tiff object for a file and get the number of rows and columns in the image.

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

Get the index of the tile containing the last pixel of the image.

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

Close the Tiff object.

close(t);

Input Arguments

collapse all

Tiff object representing a TIFF file. Use the Tiff function to create the object.

Pixel coordinates, specified as an integer array in the form [row, col]. The integers row and col are one-based positive scalar indices.

Example: [100,50]

Data Types: double

Plane number, specified as a positive integer. The value of plane must be one-based.

Use the plane parameter only if the data is organized in separate planes. Data is organized in separate planes when the value of the PlanarConfiguration tag is Tiff.PlanarConfiguration.Separate.

Example: 1

Data Types: double

Algorithms

collapse all

References

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

Version History

Introduced in R2009b