Tiff.computeStrip

Returns the index of the strip that contains a given image row.

Category: Data Import and Analysis > Data Import and Export

Syntax

stripNum = computeStrip(t, row)

Finds the strip holding image row row.

Description

The method acts on a Tiff object created with Tiff(filename, mode). Stripped TIFF files store the image as bands of consecutive rows, the height of each set by the RowsPerStrip tag. With 4 rows per strip, rows 1 to 4 are strip 1, rows 5 to 8 are strip 2, and so on.

Input arguments

t
Tiff object open on a stripped image.
row
Row number, counted from 1.

Output arguments

stripNum
Strip index, counted from 1, for use with readEncodedStrip.

Example

Strip of a row

tag.ImageLength = 8; tag.ImageWidth = 8;
tag.Photometric = Tiff.Photometric.MinIsBlack;
tag.BitsPerSample = 8; tag.SamplesPerPixel = 1; tag.RowsPerStrip = 4;
tag.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
I = uint8(magic(8) * 3);
w = Tiff('t.tif', 'w'); w.setTag(tag); w.write(I); w.close();
r = Tiff('t.tif', 'r');
[r.computeStrip(1) r.computeStrip(4) r.computeStrip(5)]
r.close();
Output
ans = 1×3

     1     1     2

See also

Tiff.readEncodedStrip Tiff.numberOfStrips Tiff.computeTile Tiff.getTag