[Insight-users] Reading Tif images

Michael Hawrylycz MikeH at alleninstitute.org
Tue, 27 Apr 2004 09:45:00 -0700


 Hi Luis,

I tried exactly as you are indicating on Visual Studio 6.  I get the
following exception

Input File Name imagetest.tif
We are here!=20
ExceptionObject caught !

itk::ExceptionObject (00E7F9A4)
Location: "Unknown"=20
File: D:\Source\Insight-1.4\Code\IO\itkImageFileWriter.txx
Line: 143
Description: itk::ERROR: ImageFileWriter(00231440): No ImageIO set, or
none could be created.

Which makes me think that maybe I'm not finding all of ITK?  I have left
most of the ITK source on the CD
and using Cmake to do the local builds on C Drive...Any problem with
that?

Thanks,

Mike


Mike Hawrylycz, Ph.D.
Director, Informatics
Allen Institute of Brain Science
mikeh at alleninstitute.org
(206) 548-7011

-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com]=20
Sent: Monday, April 26, 2004 6:49 PM
To: Michael Hawrylycz
Cc: insight-users at itk.org
Subject: Re: [Insight-users] Reading Tif images


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 =3D 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:

> =20
>  Hi,
>=20
>  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?
>=20
> Thanks,
>=20
> Mike
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>=20