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

Zachary Pincus zpincus at stanford.edu
Mon Jul 11 03:04:55 EDT 2005


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: itkTest.cxx
Type: application/octet-stream
Size: 1172 bytes
Desc: not available
Url : http://www.itk.org/mailman/private/insight-developers/attachments/20050711/209203d0/itkTest.obj
-------------- next part --------------
# This project is designed to be built outside the Insight source tree.
SET(PROJ "itkTest")
PROJECT(${PROJ})

SET(ITK_DIR "/Developer/Local/ITK-bin")
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
  INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
  MESSAGE(FATAL_ERROR
          "Cannot build without ITK.  Please set ITK_DIR.")
ENDIF(ITK_FOUND)


ADD_EXECUTABLE(${PROJ} ${PROJ}.cxx)

TARGET_LINK_LIBRARIES(${PROJ} ITKCommon ITKIO)
-------------- next part --------------





More information about the Insight-developers mailing list