%% Navigate Through Multiple Images in TIFF File
% Navigate the image file directories (IFDs) in a TIFF file and get tag or image data from the different IFDs.
% Create a Tiff object for the file example.tif  which contains three IFDs and display the directory index number for the current IFD in the file.

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

% Change the current IFD to 2 and  get the value of the ImageDescription tag.

setDirectory(t,2);
getTag(t,'ImageDescription')

% Change the current IFD to 3 and  get the value of the ImageDescription tag.

setDirectory(t,3);
getTag(t,'ImageDescription')

% Close the Tiff object.

close(t);

% Copyright 2012 The MathWorks, Inc.