[Insight-users] Analyze Image Reader Error

Luis Ibanez luis.ibanez@kitware.com
Fri, 07 Feb 2003 23:47:02 -0500


Hi Raluca,

The Analyze reader is not being registered by
default in the ImageIOFactory at this point.

This means that you have to explicitly create
the AnalyzeImageIO object and connect it to the
ImageFileReader.

The runtime error you get is probably due to the
IO factory trying to find an ImageIO capable of
reading your image file and... failing to find one.
Normally this should result in an exception being
thrown.

Please try code like the following:


typedef itk::AnalyzeImageIO   ImageIOType;
ImageIOType::Pointer  imageIO = ImageIOType::New();

typedef itk::ImageFileReader< ImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();

reader->SetImageIO( imageIO );
reader->SetFileName( filename );

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



Let us know if you find any problems


   Thanks


      Luis


-----------------------------------
Raluca wrote:
> Hi everyone
> 
> I'm trying to read an Analyze format image and I keep getting an Access
> Violation error. I've tested the file with itkAnalyzeImageIO::CanReadFile
> method and it seems OK. I use itkImageFileReader which should detect the
> ImageIO type as for the other image formats.
> I've downloaded the files: itkAnalyzeImageIO.cxx/.h,
> itkAnalyzeImageIOFactory.cxx/.h and dbh.h and updated itkImageFileReader and
> itkImageIOFactory with the support for Analyze format.
> Can anyone tell me if there is anything else that I should update or if
> there is any particular procedure to follow for reading this format?
> Is there an example anywhere?
> 
> Thanks
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>