Tiff.numberOfStrips

Returns the number of strips in the current image.

Category: Data Import and Analysis > Data Import and Export

Syntax

n = numberOfStrips(t)

Counts the strips of a stripped image.

Description

The method acts on a Tiff object created with Tiff(filename, mode). Use it to bound a loop that reads a large image strip by strip with readEncodedStrip, so only one band is in memory at a time. The call is an error for a tiled image.

Input arguments

t
Tiff object opened for reading.

Output arguments

n
Number of strips, equal to ceil(ImageLength / RowsPerStrip) for chunky data.

Example

Strips of an 8-row image

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.numberOfStrips()
r.getTag('RowsPerStrip')
r.close();
Output
ans = 2
ans = 4

See also

Tiff.readEncodedStrip Tiff.computeStrip Tiff.isTiled Tiff.numberOfTiles