[Insight-developers] ImageFileReader and IO factory

Joshua Cates cates at sci . utah . edu
Wed, 6 Aug 2003 15:58:02 -0600 (MDT)


Hi Luis,

Ok.  I'll check this in in the morning.

I looked at the ImageFileWriter and the logic it uses is somewhat 
different.  I think it is ok, but I'll test it out.

Josh.

______________________________
 Josh Cates			
 Scientific Computing and Imaging Institute
 University of Utah
 Email: cates at sci . utah . edu
 Phone: (801) 587-7697
 URL:   http://www . sci . utah . edu/~cates


On Wed, 6 Aug 2003, Luis Ibanez wrote:

> 
> Hi Josh,
> 
> The change looks good,
> 
> Just please add an initialization to false for
> the m_UserSpecifiedImageIO flag in the constructor.
> 
> We probably need a similar modification in
> the ImageFileWriter.
> 
> 
> 
>    Luis
> 
> 
> -------------------
> Joshua Cates wrote:
> > Hi all,
> > 
> > I have noticed that ImageFileReader will only create an ImageIO object 
> > once.  This means that if your pipeline reads a "foo.mha" image and then 
> > later you want to reuse the filter to read a "foo.png" image, it fails 
> > and throws an exception.
> > 
> > The following modification to ImageFileReader<TOutputImage, ConvertPixelTraits>
> > ::GenerateOutputInformation(void) fixes the problem:
> > 
> > change
> > 
> >   if ( m_ImageIO.IsNull() ) //try creating via factory
> >     {	
> >     m_UserSpecifiedImageIO = false;
> >     m_ImageIO = ImageIOFactory::CreateImageIO( m_FileName.c_str(), 
> >       ImageIOFactory::ReadMode );
> >     }
> > 
> > to
> > 
> >  if ( m_UserSpecifiedImageIO == false ) //try creating via factory
> >     {
> >     m_ImageIO = ImageIOFactory::CreateImageIO( m_FileName.c_str(), 
> > ImageIOFactory::ReadMode );
> >     }
> >   
> > 
> > Anyone see any potential problems or have any objections to my making 
> > this change?
> > 
> > Josh.
> > ______________________________
> >  Josh Cates			
> >  Scientific Computing and Imaging Institute
> >  University of Utah
> >  Email: cates at sci . utah . edu
> >  Phone: (801) 587-7697
> >  URL:   http://www . sci . utah . edu/~cates
> > 
> > 
> > _______________________________________________
> > Insight-developers mailing list
> > Insight-developers at itk . org
> > http://www . itk . org/mailman/listinfo/insight-developers
> > 
> 
> 
> 
>