[Insight-users] object factory mechanism for ImageFileReader not working with mhd

Scott Pfeifer scottfivefour at gmail.com
Thu Oct 24 17:42:53 EDT 2013


I believe that I am probably not registering the IO type but when I run a
program that looks like this:

#include <itkImageFileReader.h>
#include <metaImage.h>
#include <iostream>
#include <itkMetaImageIO.h>

using namespace std;

int main()
{
    typedef short VoxelT;
    typedef itk::Image<VoxelT,4> VolumeT;
    typedef itk::ImageFileReader<VolumeT> ReaderT;

    try
    {
        ReaderT::Pointer reader;
        reader=ReaderT::New();
       
reader->SetFileName("/ControlledInstalls/SFT-5002-1.3.0/Imaging/RIH-20080905-1053/RIH-20080905-1053.mhd");
        reader->Update();
    }
    catch( itk::ExceptionObject & err )
        {
        std::cerr << "ExceptionObject caught !" << std::endl;
        std::cerr << err << std::endl;
    }
    catch( ... )
    {
        cout<<"caught the god dam thing"<<endl;
    }
}

&lt;b>I Get This*
File:
c:\controlledinstalls\itk-4.2.2.0\x86-64_windows-7_vc10\itk\itkImageFileReader.hxx
Line: 143
Description:  Could not create IO object for file
/ControlledInstalls/SFT-5002-1.3.0/Imaging/RIH-20080905-1053/RIH-20080905-1053.mhd
  Tried to create one of the following:
  You probably failed to set a file suffix, or
    set the suffix to an unsupported type.


*However* if I add reader->SetImageIO( itk::MetaImageIO::New() ); before
updating everything works fine.  
If anyone has seen this problem before or has an Idea of how I might get
everything working I would greatly appreciate it.  

If it helps at all what I am trying to read was created by itk 3.20.0 by
reading dicom slices.





--
View this message in context: http://itk-users.7.n7.nabble.com/object-factory-mechanism-for-ImageFileReader-not-working-with-mhd-tp32630.html
Sent from the ITK - Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list