[Insight-users] Reading Tif images

Miller, James V (Research) millerjv at crd.ge.com
Tue, 27 Apr 2004 13:16:59 -0400


The exception seems to be coming from the "writer".  What filename did
you give the writer?  The extension on the filename specified on the writer
is what is used to determine the particular ImageIO object to use.  It
looks like the IO mechanism did not recognize the extension you specified
on the filename to the writer.

Jim

-----Original Message-----
From: Michael Hawrylycz [mailto:MikeH at alleninstitute.org]
Sent: Tuesday, April 27, 2004 12:45 PM
To: Luis Ibanez
Cc: insight-users at itk.org
Subject: RE: [Insight-users] Reading Tif images


 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! 
ExceptionObject caught !

itk::ExceptionObject (00E7F9A4)
Location: "Unknown" 
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] 
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 = 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
> 




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