[Insight-developers] Regression in itk::ImageFileReader?

Zachary Pincus zpincus at stanford.edu
Mon Jul 11 23:20:44 EDT 2005


To recap: I recently updated my ITK CVS tree for the first time in a  
month or two. After that, I've noticed some trouble reading TIFF  
files that have tags that aren't recognized by libtiff (e.g. from  
Photoshop) -- these files are read completely incorrectly.

Today I tried compiling ITK against several different versions of  
libtiff to see if the problems I've had reading TIFF files with odd  
tags lay there, or elsewhere. I used 3.7.2 (the latest), 3.7.1, 3.5.7  
(ITK version), and 3.5.5 (the oldest I could find), and the error  
kept appearing.

Thus, it seems more likely that the problem is in the ITK code. Or  
that the problem is somehow totally isolated to me! Has anyone else  
noticed problems, or checked out my test case?

My next step will be to try this against the ITK 2.0.1 release to see  
if that fixes the problem; but I can't do this for a few days because  
I'm traveling and on dialup.

Does anyone who's worked on the image IO or TIFF image IO code lately  
have any idea how the previously rock-solid TIFF reading might have  
broken in the last few months?

Zach Pincus

Program in Biomedical Informatics and Department of Biochemistry
Stanford University School of Medicine

On Jul 11, 2005, at 12:04 AM, Zachary Pincus wrote:

> Hi folks,
>
> I've been using the image file reader class for a while to read  
> TIFF files with extraneous/odd headers (some put there by  
> photoshop, some by microscopes, etc.) for a while without incident.
>
> Last week, I updated my ITK CVS checkout, and noticed a problem. It  
> seems that the file reader now reads TIFF files with these headers  
> incorrectly.
>
> I wrote test code to read an image into different file types and  
> print out the (0,0) pixel. I then took a file I'd been having  
> trouble with and stripped the headers by opening it in ImageJ and  
> saving as a plain tiff. Here's the result on the 'noheaders.tif'  
> file (available here: http://www.stanford.edu/~zpincus/Images.zip ):
> ./itkTest /Users/zpincus/Desktop/noheaders.tif
> 74
> 74
> 74
> 74
>
> Note that 74 is the correct value.
>
> Here's the result on the file 'headers.tif':
> ./itkTest /Users/zpincus/Desktop/headers.tif
> [warning text]
> [warning text]
> [warning text]
> [warning text]
> 182
> 18870
> 18870
> 18870
>
> where [warning text] was:
> /Users/zpincus/Desktop/headers.tif: Warning, unknown field with tag  
> 317 (0x13d) ignored.
> /Users/zpincus/Desktop/headers.tif: Warning, unknown field with tag  
> 33628 (0x835c) ignored.
>
> Note that 182 is the lower 8 bits of 18870, and that the upper 8  
> bits of 18870 are, oddly enough, 73. (not 74!) Yet 182 is not the  
> next pixel in the buffer. Not much to go on, but it's something.
>
> Now, I've always gotten these warnings with TIFFs with odd headers,  
> but I've never had this create an error.
>
> Attached is my test code, the image which I noticed this problem  
> with, and a CMakeLists.txt file for convenience.
>
> Zach Pincus
>
> Program in Biomedical Informatics and Department of Biochemistry
> Stanford University School of Medicine
>
>
>
> <itkTest.cxx>
> <CMakeLists.txt>
>
>
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>



More information about the Insight-developers mailing list