[Insight-developers] Two (big?) problems with itkTIFFImageIO.cxx

Brad King brad.king at kitware.com
Thu Jul 14 09:51:55 EDT 2005


Zachary Pincus wrote:
> Anyhow, I've tracked the problem down, and it's actually two problems  
> at the same time. The first and simplest is that ITK isn't dealing  
> properly when certain TIFF tags are missing (though the spec allows  
> them to be so). The second is that there's a method called  
> TIFFReaderInternal::CanRead() which should be used to check whether  the 
> TIFF can be properly read; instead it seems to be used to  determine 
> whether to read the TIFF as RGBA.
> 
> These two problems combine so that when a TIFF with a missing tag  (e.g. 
> in my case 'SamplesPerPixel') is encountered, the default value  for the 
> tag isn't used, so TIFFReaderInternal::CanRead() returns  false. At this 
> point, ITK really should just give an error; instead  it seems to 
> *forcibly* try to read the file as RGBA, which is of  course totally the 
> wrong way to detect if an image is in fact RGBA.

This patch looks fine to me.

> Someone else really ought to look into the latter issue of why images  
> for which TIFFReaderInternal::CanRead() returns false are still read  
> in, incorrectly, as RGBA images. I suspect this has to do with  calling 
> TIFFReadRGBAImage() with the parameter "stopOnError" set to  zero, which 
> from the man page, appears to disable the ability of this  function to 
> signal that an image is not an RGBA TIFF by returning  zero. Is there a 
> *reason* TIFFReadRGBAImage was called in this way?

Please submit this as a bug report:

http://www.itk.org

Thanks,
-Brad


More information about the Insight-developers mailing list