[Insight-developers] ImageFileWriter bug?

Blezek, Daniel J (Research) blezek@crd.ge.com
Thu, 31 Oct 2002 11:47:53 -0500


I made these changes, and discovered that the RawImageIO factory will a file with any name, i.e. it
always returns true to CanWriteFile(filename).  So the simple code change that I outlined below
doesn't work correctly, it always writes Raw images (due to the order in which things are checked).
So something to be tackled another time.

-dan

--
Daniel Blezek, Ph.D.
blezek@crd.ge.com
Visualization and Computer Vision Lab, Imaging Technologies
GE Global Research Center


> -----Original Message-----
> From: Blezek, Daniel J (Research) 
> Sent: Wednesday, October 30, 2002 1:04 PM
> To: 'insight-developers@public.kitware.com'
> Subject: [Insight-developers] ImageFileWriter bug?
> 
> 
> Hi all,
> 
>   ImageFileWriter uses this code:
> 
>     m_ImageIO = ImageIOFactory::CreateImageIO(m_FileName.c_str());
> 
> However, ImageIOFactory uses this test to determine if the 
> IOFactory is usable:
> 
>   for(std::list<ImageIOBase::Pointer>::iterator k = 
> possibleImageIO.begin();
>       k != possibleImageIO.end(); ++k)
>     { 
>     if((*k)->CanReadFile(path))
>       {
>       return *k;
>       }
>     }
> 
> And generally, all the tests fail, as they try to open a 
> non-existant file.  Now you can do this:
> 
>     itk::PNGImageIO::Pointer io;
>     io = itk::PNGImageIO::New();
>   
>     itk::ImageFileWriter<OutputImageType>::Pointer writer;
>     writer = itk::ImageFileWriter<OutputImageType>::New();
> -->    writer->SetImageIO( io );
> 
> While using SetImageIO is OK, why can't the ImageFileWriter 
> class determine which Factory to use by
> calling CanWriteFile?
> 
> Ideas?
> -dan
> 
> --
> Daniel Blezek, Ph.D.
> blezek@crd.ge.com
> Visualization and Computer Vision Lab, Imaging Technologies
> GE Global Research Center
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>