[Insight-developers] ImageFileWriter bug?

Blezek, Daniel J (Research) blezek@crd.ge.com
Wed, 30 Oct 2002 13:04:21 -0500


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