[Insight-users] Problem for reading vtk images

Luis Ibanez luis.ibanez at kitware.com
Wed Oct 31 09:05:13 EDT 2007



Hi Alex,


   Why are you using the ImageIO classes directly ?


     You *should not* need to access them at all.


You can read image by simply using the ImageFileReader:



   typedef itk::ImageFileReader< ImageType >   ReaderType;

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

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

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




The ImageFileReader will deal with the ImageIOFactories for you.



Please give us more details about what you are doing,


    Thanks



       Luis



----------------------
Alexandre Abadie wrote:
> Hi itk users,
> 
> I am currently using the itkImageIOFactory class for reading the data 
> formats supported by itk. This works very well with versions 3.0 and 3.2 
> but I recently made an update to 3.4 and now I can't read vtk data. I 
> tested with NIFTI and Mha data and it always works.
> Here is how I am proceeding :
> itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO ( 
> entree, itk::ImageIOFactory::ReadMode );
> This return a null pointer when I am trying to load a vtk data with itk 
> 3.4.
> 
> Any suggestion ?
> 
> Thanks in advance.
> 
> Alex
> _______________________________________________
> 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