フィルターのクリア

Unable to read tif files within loop - TIFF library error - 'TIFFFetchDirectory: Can not read TIFF directory count.'

24 ビュー (過去 30 日間)
Rosanne Hart
Rosanne Hart 2021 年 6 月 18 日
回答済み: Zuber Khan 2024 年 7 月 18 日 9:42
I am only relatively new to matlab.
A part of a code that I am trying to run continues to throw the following error:
TIFF library error - 'TIFFFetchDirectory: Can not read TIFF directory count.'
This is the part of the code where the error is coming from:
for k=1:17
name1 = L{k}(j).name;
I{k}=imread(fullfile(imageDirectory{k},name1));
end
j is defined within an earlier part of the code as 1:2400 and valid within this code.
imageDirectory{k} is a set of subfolders (18 in total) that contain 2400 images within each folder. Once this part of the code is ran, I{k} is then used for further processing.
I am attempting to run this through a linux-based HPC which is potentially where I am getting into trouble. Any advice would be great as I cannot seem to find a solution anywhere to this particular error. When running locally, it runs fine.
The complete error is:

回答 (1 件)

Zuber Khan
Zuber Khan 2024 年 7 月 18 日 9:42
Hi,
It may be the case that the .TIFF file is corrupted.
"imread" uses the third party libTiff 4.0.0 library under the hood. The error could be generated from this library when trying to open the file. One symptom of this can be seen by running "imfinfo" on the file, and seeing if the following error (or similar) is output:
>> i=imfinfo(<filename>)
Warning: Unable to read the number of directory entries in the image file directory at byte offset position
2193940808.
One possible corruption is as follows: the file could be larger than 2GB, but be incorrectly classified as a 32-bit Tiff file instead of as a Big Tiff. Every Tiff file has a header section called Tiff Image File Header. This header contains three fields of information. One of these three field is the version. For regular Tiff file the value is always 2A in HEX. But for BigTiff, the value is 2B. It could be the case that, for a BigTiff File, the version shown is 2A instead of 2B. If this is the case, you can try manually changing the 2A to a 2B and seeing if the .TIFF file opens.
Also, try opening the .TIFF file with other third party software. If it cannot be opened, it is probably corrupted.
Hope it helps!
Regards,
Zuber

カテゴリ

Help Center および File ExchangeAdding custom doc についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by