[Community] [Insight-users] object factory mechanism for ImageFileReader not working with mhd
Scott Pfeifer
scottfivefour at gmail.com
Mon Oct 28 13:32:38 EDT 2013
As it turns out, I needed to add
#define ITK_IO_FACTORY_REGISTER_MANAGER
and place the file itkImageIOFactoryRegisterManager.h somewhere in the
include path.
On Fri, Oct 25, 2013 at 1:08 PM, Matt McCormick
<matt.mccormick at kitware.com>wrote:
> Hi Scott,
>
> There should be file called
>
> itkImageIOFactoryRegisterManager.h
>
> found in the build tree of your project. When linked into your
> executable, this does the factory registration.
>
> Thanks,
> Matt
>
> On Fri, Oct 25, 2013 at 1:09 PM, Scott Pfeifer <scottfivefour at gmail.com>
> wrote:
> > Hi Matt,
> > I compiled using CMake, changing the tests and examples to be turned off
> and
> > I have the same issue using both windows and mac. When are the
> different IO
> > types registered with the factory? Does that happen when the libraries
> are
> > compiles or is that done at run time?
> >
> > Thanks,
> > Scott
> >
> >
> > On Thu, Oct 24, 2013 at 8:59 PM, Matt McCormick <
> matt.mccormick at kitware.com>
> > wrote:
> >>
> >> 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;
> >> > }
> >> > }
> >> >
> >> > <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
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20131028/f622701c/attachment.html>
-------------- next part --------------
_____________________________________
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
More information about the Community
mailing list