[vtkusers] a possible fix for vtkTIFFReader?

Flanagin, Maik C MVN Contractor Maik.C.Flanagin at MVN02.USACE.ARMY.MIL
Tue Sep 9 16:31:54 EDT 2003


Hi guys!

Since I started working with VTK, I've always had problems reading TIFFs.
Though true-color TIFFs would display just fine, rendering colormapped TIFFs
would always result in a blank canvas of nothingness. 

After mucking around in the code for the vtkTIFFReader, I found that I
wasn't getting null pixel values; The class read the data good enough,
however the resulting values weren't in the correct range (0-255).

I changed the following lines of code in vtkTIFFReader::EvaluateImageAt().

case vtkTIFFReader::PALETTE_RGB:
      this->GetColor(*source, &red, &green, &blue);     
      *(image)   = static_cast<unsigned char>(red >> 8);
      *(image+1) = static_cast<unsigned char>(green >> 8);
      *(image+2) = static_cast<unsigned char>(blue >> 8);

and, to my jaw-dropping astonishment, the pixels values fell in the correct
range and my 8-bit TIFF image displayed correctly!

So, what exactly is going on here? Are the images I work with buggered up,
or has this always been a problem with the vtkTIFFReader?

Any comments? 
--
Maik Flanagin
Contractor
ACS 
U.S. Army Corps of Engineers - New Orleans District

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030909/ac94b311/attachment.htm>


More information about the vtkusers mailing list