Error: 'Can not read TIFF directory count'
bgilbert at cs.cmu.edu
Thu Jul 25 17:16:48 EDT 2013
On 07/25/2013 04:11 PM, Tim McIver wrote:
> I'm using OpenSlide in a csharp project via P/Invoke. It works fine for
> the most part but on a particular Aperio slide data file I get an error
> dialog box that states: 'Can not read TIFF directory count'. Note that
> this file /may/ be corrupt in some way. I attempted catch this error by
> wrapping the OpenSlide calls in a try/catch but this did not prevent the
> dialogs from opening.
> Can anyone give me any hints as to what might be the problem?
The dialog box is generated by libtiff's default error handler on
Windows. OpenSlide doesn't configure libtiff's error handling because
there's no API for attaching handlers to an individual TIFF handle; they
can only be overridden globally. Since OpenSlide is a library and is
not the application, the global state isn't ours to modify.
Are you using binaries from the OpenSlide website? libtiff has a
compile-time option to disable the dialog box; we should start using
that. This will cause libtiff to write error messages to stderr, just
as it does on Unix. I'll try to generate a new build with this change
in the next few days.
If you want to *completely* suppress the errors, you'll have to call
TIFFSetWarningHandler() and TIFFSetErrorHandler() yourself.
More information about the openslide-users