Tiff.nextDirectory

Moves to the next image directory in the file.

Category: Data Import and Analysis > Data Import and Export

Syntax

nextDirectory(t)

Makes the following directory current.

Description

The method acts on a Tiff object created with Tiff(filename, mode). Calling it on the last directory is an error, so guard it with lastDirectory. After the move, read returns the next image.

Input arguments

t
Tiff object.

Example

Step to the second image

tag.ImageLength = 2; tag.ImageWidth = 2;
tag.Photometric = Tiff.Photometric.MinIsBlack;
tag.BitsPerSample = 8; tag.SamplesPerPixel = 1; tag.RowsPerStrip = 2;
tag.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
w = Tiff('m.tif', 'w');
w.setTag(tag); w.write(uint8([1 2; 3 4])); w.writeDirectory();
w.setTag(tag); w.write(uint8([5 6; 7 8])); w.close();
r = Tiff('m.tif', 'r');
r.read()
r.nextDirectory();
r.read()
r.close();
Output
ans = 2×2 uint8 matrix

   1   2
   3   4
ans = 2×2 uint8 matrix

   5   6
   7   8

See also

Tiff.lastDirectory Tiff.setDirectory Tiff.currentDirectory Tiff.read