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

Matt McCormick matt.mccormick at kitware.com
Thu Oct 24 22:59:55 EDT 2013


Hi Scott,

Is CMake used to configure your project?  If not, please try that.

Thanks,
Matt

On Thu, Oct 24, 2013 at 5:42 PM, Scott Pfeifer <scottfivefour at gmail.com> wrote:
> 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.
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/community


More information about the Insight-users mailing list