2018.12.12 22:21 "[Tiff] Fwd: TIFFSetDirectory and TIFFCurrentDirectory issues in libtif 4.0.10", by Bardas Georgios

2018.12.12 22:57 "Re: [Tiff] Fwd: TIFFSetDirectory and TIFFCurrentDirectory issues in libtif 4.0.10", by Kemp Watson

Hi George:

If this is pathology with whole slide images, drop me a line, I might be able to save you a lot of time you could put on other aspects of your project, or also check out the OpenSlide project or BioFormats.

If by “so big” you mean more than 4GB or 65K pixels on a side, you will be looking at BigTIFF, not TIFF.

Else, yes, you can go back and read a previous directory, but I don’t believe you can go back to write it (add to I mean, you can start again with TIFFRewriteDirectory()) – anyway, you still probably have access to your source data, just don’t close those files/blobs until the decimated tiles are written – that way, you’ll have at most ¼ of your image in memory at any time, even with a naïve approach, and you won’t need to re-read anything at all.

Also, I might make mention that almost everyone does reduced-resolution images totally incorrectly according to the spec – they should be in SubIFDs, not IFDs, to be properly compliant with the intent of the TIFF specification regarding alternate renditions of the same data.

Kemp Watson

From: Tiff <tiff-bounces@lists.osgeo.org> on behalf of Bardas Georgios <geobar2010@gmail.com>

Hello gentlemen,

I have been working in Libtiff for one or two weeks now, and i am stuck into some mysterious problem. I am using libtiff 4.0.10 in Visual Studio 2017 and just trying to do the following task: I am willing to fill the first page (directory) with some data (black tiles (256x256) for example) and then i need to read that information and write it on the next page decimated by two. In fact all i am trying to make is a tiled pyramid tiff image which the level 0 is so big i can parse it only through tiles. My question is: Is it possible to write one directory and then return back and read from it to write that data on the next directory?

Currenlty i am using TIFFSetDirectory to try and get back to the previous one, but unfortunately it fails (TIFFSetDirectory(tiff,0) returns 0) after i have saved the previous' directory's data with TIFFWriteDirectory.

On the other hand, when i use TIFFCurrentDirectory on the first directory i write, strangely i get "65536" instead of 0 (probably -1 in uint), why? And when i write this folder it goes to folder 0, then 1 etc. To sum up TIFFCurrentDirectory seems to return n-1, where n is the current directory's number.

Can anyone help me?
Thanks a lot,
George.