Make specified IFD the current IFD
setDirectory(t,dirNum)
example
setDirectory(t,dirNum) sets the image file directory (IFD) specified by dirNum as the current IFD. Tiff object functions operate on the current IFD.
t
dirNum
Tiff
collapse all
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.
example.tif
t = Tiff('example.tif','r'); currentDirectory(t)
ans = 1
Change the current IFD to 2 and get the value of the ImageDescription tag.
2
ImageDescription
setDirectory(t,2); getTag(t,'ImageDescription')
ans = 'First image converted to grayscale.'
Change the current IFD to 3 and get the value of the ImageDescription tag.
3
setDirectory(t,3); getTag(t,'ImageDescription')
ans = 'Credit: Jeff Mather and Alex Taylor.'
Close the Tiff object.
close(t);
Tiff object representing a TIFF file. Use the Tiff function to create the object.
Directory index number, specified as a one-based positive integer.
Example: 2
Data Types: double
double
This function corresponds to the TIFFSetDirectory function in the LibTIFF C API. To use this function, you must be familiar with the TIFF specification and technical notes. View this documentation at LibTIFF - TIFF Library and Utilities.
TIFFSetDirectory
LibTIFF - TIFF Library and Utilities
currentDirectory | nextDirectory
currentDirectory
nextDirectory
You have a modified version of this example. Do you want to open this example with your edits?