[Insight-developers] file reader behavior
Bill Hoffman
bill . hoffman at kitware . com
Tue, 06 Aug 2002 12:36:03 -0400
Both should work, could you elaborate on the meaning of crashes?
At 12:24 PM 8/6/2002 -0400, Damion Shelton wrote:
>Quick question about image IO:
>
>Until recently, the following code fragment worked fine.
>
> m_ImageReader = ImageFileReaderType::New();
> itk::MetaImageIOFactory::RegisterOneFactory();
> m_ImageReader->SetFileName( m_InputImageFilename );
> m_InputImage = m_ImageReader->GetOutput();
> m_InputImage->SetRequestedRegionToLargestPossibleRegion();
> m_ImageReader->Update();
>
>Now, this crashes, but rewriting it in a slightly different way works.
>
> m_ImageReader = ImageFileReaderType::New();
> itk::MetaImageIO::Pointer metaIO;
> metaIO = itk::MetaImageIO::New();
> m_ImageReader->SetImageIO(metaIO);
> m_ImageReader->SetFileName(m_InputImageFilename);
> m_ImageReader->Update();
> m_InputImage = m_ImageReader->GetOutput();
> m_InputImage->SetRequestedRegionToLargestPossibleRegion();
>
>Any ideas what's going on? The original code was very similar to MetaImageIOTest while the new version is closer to most of the other image tests (PNG, for instance). Which of the two styles (factory vs. SetImageIO) is "correct"?
>
>Thanks,
>-Damion-
>_______________________________________________
>Insight-developers mailing list
>Insight-developers@public.kitware.com
>http://public.kitware.com/mailman/listinfo/insight-developers