%% Determine Index of Strip
% Determine the index of the strip containing a specific row from the second image in a TIFF file.
% Create a Tiff object for the file example.tif, and then set the image file directory to directory number 2.

t = Tiff('example.tif','r');
setDirectory(t,2)

% Get the length of the strips in the image, and then get the index of the strip containing the middle row.

stripLength = getTag(t,'RowsPerStrip')
numRows = getTag(t,'ImageLength');
stripNumber = computeStrip(t,numRows/2)

% Close the Tiff object.

close(t);

% Copyright 2012 The MathWorks, Inc.