[Insight-users] 16-bit TIFF reading

Lorensen, William E (Research) lorensen at crd.ge.com
Wed May 26 14:02:17 EDT 2004


Luis,
Nick is visiting today. It turns out that Julien fixed the 16 bit tiff
problem on January 31, just after the 1.4 release (which is the release Nick
was using).

In summary, he can read his images with the current cvs checkout.

Bill

-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
Sent: Tuesday, May 18, 2004 11:11 AM
To: Nick Arini
Cc: insight-users at itk.org
Subject: Re: [Insight-users] 16-bit TIFF reading



Hi Nick,

Thanks for your detailed report.

Your code looks fine.

The TIFF reader in ITK is based on the libtiff
that is distributed in: Insight/Utilities/tiff.

Both 8 bits/pixel and 16 bits/pixel are supported.

What you describe sounds like a bug in the pixel
conversion... Could you please send us one of the
TIFF image that is producing this effect for you ?


That will help us to figure out if this is a real
bug and eventually how to fix it.


Thanks


     Luis


PS
If possible, please send a small image   :-)


-----------------
Nick Arini wrote:

> 
> Dear ITK users,
> 
> I am having trouble trying to read single channel grayscale 16-bit TIFF 
> images using the itk::ImageFileReader.
> 
> The tiffinfo output for my test image looks like this:
> 
> <begin tifinfo>
> 
> TIFF Directory at offset 0x8
>  Subfile Type: (0 = 0x0)
>  Image Width: 1392 Image Length: 1040
>  Resolution: 61728, 61728 pixels/cm
>  Bits/Sample: 16
>  Compression Scheme: None
>  Photometric Interpretation: min-is-black
>  Samples/Pixel: 1
>  Max Sample Value: 4095
>  Planar Configuration: single image plane
> 
> <end tiffinfo>
> 
> I am using ITK in a manner similar to the following code fragment:
> 
> <begin code>
> 
> #include "itkImage.h"
> #include "itkImageFileReader.h"
> 
> int main( int argc, char * argv[] )
> {
> 
>  if( argc < 3 )
>    {
>    std::cerr << "Usage: " << argv[0] << " inputImageFile ";
>    std::cerr << " outputImageFile" << std::endl;  
>    return 1;
>    }
>  
>  typedef  unsigned short PixelType;
> 
>  typedef itk::Image< PixelType,  2 >   ImageType;
> 
>  typedef itk::ImageFileReader< ImageType >  ReaderType;
> 
>  ReaderType::Pointer reader = ReaderType::New();
> 
>  reader->SetFileName( argv[1] );
> 
>  ImageType::Pointer image = reader->GetOutput();
> 
>  reader->Update();
> 
>  return 0;
> }
> 
> <end code>
> 
> The problem that I seem to have is that although I can read the file 
> with the correct dimensions the actual pixel values are not the ones I 
> am expecting.
> 
> I have successfully read this image into other packages, including 
> Matlab and know what I should be getting. The effect I am seeing is 
> similar to binning although the new (wrong?) values after reading are 
> not restricted to the 8-bit range(0-255).
> 
> Has anyone else had problems with reading 16-bit TIFF images? Is the ITK 
> IO TIFF machinery based on libtiff and does this support 16-bit TIFFs.
> 
> I am using ITK version 1.6.0 and observe exactly the same effect on 
> Linux (GCC) and WinXP(MSVC++7.1).
>  
> Thanks in advance for any help or advice.
> 
> Best regards,
> 
> Nick Arini



_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list