<div dir="ltr">As it turns out, I needed to add <div><br></div><div>#define ITK_IO_FACTORY_REGISTER_MANAGER</div><div>and place the file itkImageIOFactoryRegisterManager.h somewhere in the include path. </div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Oct 25, 2013 at 1:08 PM, Matt McCormick <span dir="ltr"><<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Scott,<br>
<br>
There should be file called<br>
<br>
itkImageIOFactoryRegisterManager.h<br>
<br>
found in the build tree of your project. When linked into your<br>
executable, this does the factory registration.<br>
<br>
Thanks,<br>
Matt<br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, Oct 25, 2013 at 1:09 PM, Scott Pfeifer <<a href="mailto:scottfivefour@gmail.com">scottfivefour@gmail.com</a>> wrote:<br>
> Hi Matt,<br>
> I compiled using CMake, changing the tests and examples to be turned off and<br>
> I have the same issue using both windows and mac. When are the different IO<br>
> types registered with the factory? Does that happen when the libraries are<br>
> compiles or is that done at run time?<br>
><br>
> Thanks,<br>
> Scott<br>
><br>
><br>
> On Thu, Oct 24, 2013 at 8:59 PM, Matt McCormick <<a href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>><br>
> wrote:<br>
>><br>
>> Hi Scott,<br>
>><br>
>> Is CMake used to configure your project? If not, please try that.<br>
>><br>
>> Thanks,<br>
>> Matt<br>
>><br>
>> On Thu, Oct 24, 2013 at 5:42 PM, Scott Pfeifer <<a href="mailto:scottfivefour@gmail.com">scottfivefour@gmail.com</a>><br>
>> wrote:<br>
>> > I believe that I am probably not registering the IO type but when I run<br>
>> > a<br>
>> > program that looks like this:<br>
>> ><br>
>> > #include <itkImageFileReader.h><br>
>> > #include <metaImage.h><br>
>> > #include <iostream><br>
>> > #include <itkMetaImageIO.h><br>
>> ><br>
>> > using namespace std;<br>
>> ><br>
>> > int main()<br>
>> > {<br>
>> > typedef short VoxelT;<br>
>> > typedef itk::Image<VoxelT,4> VolumeT;<br>
>> > typedef itk::ImageFileReader<VolumeT> ReaderT;<br>
>> ><br>
>> > try<br>
>> > {<br>
>> > ReaderT::Pointer reader;<br>
>> > reader=ReaderT::New();<br>
>> ><br>
>> ><br>
>> > reader->SetFileName("/ControlledInstalls/SFT-5002-1.3.0/Imaging/RIH-20080905-1053/RIH-20080905-1053.mhd");<br>
>> > reader->Update();<br>
>> > }<br>
>> > catch( itk::ExceptionObject & err )<br>
>> > {<br>
>> > std::cerr << "ExceptionObject caught !" << std::endl;<br>
>> > std::cerr << err << std::endl;<br>
>> > }<br>
>> > catch( ... )<br>
>> > {<br>
>> > cout<<"caught the god dam thing"<<endl;<br>
>> > }<br>
>> > }<br>
>> ><br>
>> > &lt;b>I Get This*<br>
>> > File:<br>
>> ><br>
>> > c:\controlledinstalls\itk-4.2.2.0\x86-64_windows-7_vc10\itk\itkImageFileReader.hxx<br>
>> > Line: 143<br>
>> > Description: Could not create IO object for file<br>
>> ><br>
>> > /ControlledInstalls/SFT-5002-1.3.0/Imaging/RIH-20080905-1053/RIH-20080905-1053.mhd<br>
>> > Tried to create one of the following:<br>
>> > You probably failed to set a file suffix, or<br>
>> > set the suffix to an unsupported type.<br>
>> ><br>
>> ><br>
>> > *However* if I add reader->SetImageIO( itk::MetaImageIO::New() ); before<br>
>> > updating everything works fine.<br>
>> > If anyone has seen this problem before or has an Idea of how I might get<br>
>> > everything working I would greatly appreciate it.<br>
>> ><br>
>> > If it helps at all what I am trying to read was created by itk 3.20.0 by<br>
>> > reading dicom slices.<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > --<br>
>> > View this message in context:<br>
>> > <a href="http://itk-users.7.n7.nabble.com/object-factory-mechanism-for-ImageFileReader-not-working-with-mhd-tp32630.html" target="_blank">http://itk-users.7.n7.nabble.com/object-factory-mechanism-for-ImageFileReader-not-working-with-mhd-tp32630.html</a><br>
>> > Sent from the ITK - Users mailing list archive at Nabble.com.<br>
>> > _____________________________________<br>
>> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> ><br>
>> > Visit other Kitware open-source projects at<br>
>> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> ><br>
>> > Kitware offers ITK Training Courses, for more information visit:<br>
>> > <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
>> ><br>
>> > Please keep messages on-topic and check the ITK FAQ at:<br>
>> > <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>> ><br>
>> > Follow this link to subscribe/unsubscribe:<br>
>> > <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
>> > _______________________________________________<br>
>> > Community mailing list<br>
>> > <a href="mailto:Community@itk.org">Community@itk.org</a><br>
>> > <a href="http://public.kitware.com/cgi-bin/mailman/listinfo/community" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/community</a><br>
><br>
><br>
</div></div></blockquote></div><br></div>