[Insight-users] Reading Tif images

Luis Ibanez luis.ibanez at kitware.com
Mon, 26 Apr 2004 21:49:24 -0400


Hi Michael,

The ImageFileReader is capable of reading TIFF images.

Did you tried adding a try/catch block around the Update()
call of the reader ?


The code should be simply


    typedef itk::Image< PixelType, Dimension > ImageType;
    typedef itk::ImageFileReader< ImageType  > ReaderType;

    ReaderType::Poiner  reader = ReaderType::New();

    reader->SetFileName("myImage.tif");

    try
      {
      reader->Update();
      }
    catch( itk::ExceptionObject & excp )
      {
      std::cerr << excp << std::endl;
      }



If something fails on the reading process, the reader will
throw an exception. When that happens, it is illuminating
to print out the exception. Its description is usually
a good indication of the source of the problem.


Please let us know what you find,


     Thanks


       Luis


--------------------------
Michael Hawrylycz wrote:

>  
>  Hi,
> 
>  I am trying to read in a tif image using itkImageFileReader, but my
> sense is that these methods
> don't recognize that format.  Is there another way of doing this?
> 
> Thanks,
> 
> Mike
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>