<div dir="ltr">Thank you very much, Bill! I think this is the problem. I looked at the Diff of itkObjectFactoryBase.cxx, and the changes are exactly what I thought should be changed in order to load the dynamic libraries on reader instantiation. I think the if statement<div>
<br></div><div>if ( !ObjectFactoryBasePrivate::m_RegisteredFactories )</div><div><br></div><div>is never true, so Initialize() and therefore LoadDynamicFactories() is never called. </div><div><br></div><div>So I guess I have to get our admin to update to the newest ITK version.</div>
<div><br></div><div>Thanks again and have a nice weekend</div><div>-Silvio</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-05-09 14:37 GMT-06:00 Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">There were other changes in that October 2012 patch. See here:<br>
<a href="http://review.source.kitware.com/#/c/8102/" target="_blank">http://review.source.kitware.com/#/c/8102/</a><br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Fri, May 9, 2014 at 4:35 PM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>> wrote:<br>
> If this test does not work on your version, you may need to upgrade to<br>
> a newer ITK.<br>
><br>
><br>
> On Fri, May 9, 2014 at 4:32 PM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>> wrote:<br>
>> I'm using the git HEAD, but ReHash was removed in October 2012. I've<br>
>> attached the latest version.<br>
>><br>
>><br>
>> On Fri, May 9, 2014 at 4:27 PM, Silvio Bauer <<a href="mailto:mail@silviobauer.de">mail@silviobauer.de</a>> wrote:<br>
>>> Which ITK version are you running? My itkIOPluginTest.cxx looks like this<br>
>>> (with ITK 4.2.1):<br>
>>><br>
>>> /*=========================================================================<br>
>>>  *<br>
>>>  *  Copyright Insight Software Consortium<br>
>>>  *<br>
>>>  *  Licensed under the Apache License, Version 2.0 (the "License");<br>
>>>  *  you may not use this file except in compliance with the License.<br>
>>>  *  You may obtain a copy of the License at<br>
>>>  *<br>
>>>  *         <a href="http://www.apache.org/licenses/LICENSE-2.0.txt" target="_blank">http://www.apache.org/licenses/LICENSE-2.0.txt</a><br>
>>>  *<br>
>>>  *  Unless required by applicable law or agreed to in writing, software<br>
>>>  *  distributed under the License is distributed on an "AS IS" BASIS,<br>
>>>  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br>
>>>  *  See the License for the specific language governing permissions and<br>
>>>  *  limitations under the License.<br>
>>>  *<br>
>>><br>
>>> *=========================================================================*/<br>
>>><br>
>>> #include "itkImageFileReader.h"<br>
>>> #include "itkImageFileWriter.h"<br>
>>><br>
>>> int itkIOPluginTest(int argc, char *argv[])<br>
>>> {<br>
>>>   if (argc < 4)<br>
>>>     {<br>
>>>     std::cout << "Usage: " << argv[0] << " FactoryPath FileName Output" <<<br>
>>> std::endl;<br>
>>>     return EXIT_FAILURE;<br>
>>>     }<br>
>>><br>
>>>   std::string myenv = std::string("ITK_AUTOLOAD_PATH=") +<br>
>>> std::string(argv[1]) + std::string("/");<br>
>>> #ifdef CMAKE_INTDIR<br>
>>>   myenv += std::string(CMAKE_INTDIR);<br>
>>> #endif<br>
>>>   std::cout << myenv << std::endl;<br>
>>>   putenv (const_cast<char *>(myenv.c_str()));<br>
>>>   itk::ObjectFactoryBase::ReHash(); // <--- there it is<br>
>>><br>
>>>   // List all registered factories<br>
>>>   std::list<itk::ObjectFactoryBase *> factories =<br>
>>>     itk::ObjectFactoryBase::GetRegisteredFactories();<br>
>>><br>
>>>   std::cout << "----- Registered factories -----" << std::endl;<br>
>>>   if (factories.size() > 0)<br>
>>>     {<br>
>>>     for ( std::list<itk::ObjectFactoryBase*>::iterator<br>
>>>             f = factories.begin();<br>
>>>           f != factories.end(); ++f )<br>
>>>       {<br>
>>>       std::cout << "  Factory version: "<br>
>>>                 << (*f)->GetITKSourceVersion() << std::endl<br>
>>>                 << "  Factory description: "<br>
>>>                 << (*f)->GetDescription() << std::endl;<br>
>>><br>
>>>       std::list<std::string> overrides = (*f)->GetClassOverrideNames();<br>
>>>       std::list<std::string> names = (*f)->GetClassOverrideWithNames();<br>
>>>       std::list<std::string> descriptions =<br>
>>> (*f)->GetClassOverrideDescriptions();<br>
>>>       std::list<bool> enableflags = (*f)->GetEnableFlags();<br>
>>>       std::list<std::string>::const_iterator n = names.begin();<br>
>>>       std::list<std::string>::const_iterator d = descriptions.begin();<br>
>>>       std::list<bool>::const_iterator e = enableflags.begin();<br>
>>>       for ( std::list<std::string>::const_iterator o = overrides.begin();<br>
>>>             o != overrides.end(); ++o, ++n, ++d, e++ )<br>
>>>         {<br>
>>>         std::cout << "    Override " << *o<br>
>>>                   << " with " << *n << std::endl<br>
>>>                   << "      described as \"" << *d << "\"" << std::endl<br>
>>>                   << "      enabled " << *e << std::endl;<br>
>>>         }<br>
>>>       }<br>
>>>     std::cout << "----- -----" << std::endl;<br>
>>>     }<br>
>>>   else<br>
>>>     {<br>
>>>     std::cout << "Failed to load any factories" << std::endl;<br>
>>>     return EXIT_FAILURE;<br>
>>>     }<br>
>>><br>
>>>   typedef itk::Image<unsigned char,2> ImageNDType;<br>
>>>   typedef itk::ImageFileReader<ImageNDType> ReaderType;<br>
>>>   typedef itk::ImageFileWriter<ImageNDType> WriterType;<br>
>>>   ReaderType::Pointer reader = ReaderType::New();<br>
>>>   WriterType::Pointer writer = WriterType::New();<br>
>>><br>
>>>   int status = EXIT_SUCCESS;<br>
>>>   try<br>
>>>     {<br>
>>>     reader->SetFileName(argv[2]);<br>
>>><br>
>>>     writer->SetFileName(argv[3]);<br>
>>>     writer->SetInput(reader->GetOutput());<br>
>>>     writer->Update();<br>
>>>     reader->GetOutput()->Print(std::cout);<br>
>>>   }<br>
>>>   catch (itk::ExceptionObject &ex)<br>
>>>     {<br>
>>>     std::cout << "------------------ Caught unexpected exception!" <<<br>
>>> std::endl;<br>
>>>     std::cout << ex;<br>
>>>     status = EXIT_FAILURE;<br>
>>>     }<br>
>>><br>
>>>   try<br>
>>>     {<br>
>>>     reader->SetFileName("foo");<br>
>>>     reader->Update();<br>
>>>     }<br>
>>>   catch (itk::ExceptionObject &ex)<br>
>>>     {<br>
>>>     std::cout << "------------------ Caught expected exception!" <<<br>
>>> std::endl;<br>
>>>     std::cout << ex;<br>
>>>     status = EXIT_SUCCESS;<br>
>>>     }<br>
>>><br>
>>>   return status;<br>
>>> }<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> 2014-05-09 14:20 GMT-06:00 Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>>:<br>
>>><br>
>>>> Really, my copy does not have ReHash<br>
>>>><br>
>>>> On Fri, May 9, 2014 at 3:29 PM, Silvio Bauer <<a href="mailto:mail@silviobauer.de">mail@silviobauer.de</a>> wrote:<br>
>>>> > If you look at the source code itkIOPluginTest.cxx, it is actually<br>
>>>> > calling<br>
>>>> > ReHash() right at the beginning.<br>
>>>> ><br>
>>>> ><br>
>>>> > 2014-05-09 13:06 GMT-06:00 Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>>:<br>
>>>> ><br>
>>>> >> Try running this test:<br>
>>>> >><br>
>>>> >> ITK/Modules/IO/ImageBase/test/itkIOPluginTest<br>
>>>> >><br>
>>>> >> it works wihtout a rehash...<br>
>>>> >><br>
>>>> >> On Fri, May 9, 2014 at 3:02 PM, Silvio Bauer <<a href="mailto:silvio.bauer01@gmail.com">silvio.bauer01@gmail.com</a>><br>
>>>> >> wrote:<br>
>>>> >> > Hi,<br>
>>>> >> ><br>
>>>> >> > I'm working on an IO plugin for ITK to read and write in-house image<br>
>>>> >> > file<br>
>>>> >> > formats. I did everything as described in the wiki here.<br>
>>>> >> ><br>
>>>> >> > I did everything by the book, put the dynamic library in the<br>
>>>> >> > ITK_AUTOLOAD_PATH and set the ITK_AUTOLOAD_PATH environment variable.<br>
>>>> >> ><br>
>>>> >> > The library builds successfully, but when I try to read a file with<br>
>>>> >> > the<br>
>>>> >> > in-house format (with ImageReadExportVTK from the examples), I get<br>
>>>> >> > this<br>
>>>> >> > error message:<br>
>>>> >> ><br>
>>>> >> > ExceptionObject: Command not found.<br>
>>>> >> ><br>
>>>> >> > itk::ImageFileReaderException (0x7feab10f4eb8)<br>
>>>> >> > Location: "virtual void itk::ImageFileReader<itk::Image<unsigned<br>
>>>> >> > char,<br>
>>>> >> > 3>,<br>
>>>> >> > itk::DefaultConvertPixelTraits<unsigned char><br>
>>>> >> > >::GenerateOutputInformation()<br>
>>>> >> > [TOutputImage = itk::Image<unsigned char, 3>, ConvertPixelTraits =<br>
>>>> >> > itk::DefaultConvertPixelTraits<unsigned char>]"<br>
>>>> >> > File: /people/seidel/ITK<br>
>>>> >> ><br>
>>>> >> ><br>
>>>> >> > src/InsightToolkit-4.2.1/Modules/IO/ImageBase/include/itkImageFileReader.hxx<br>
>>>> >> > Line: 143<br>
>>>> >> > Description:  Could not create IO object for file little.lat<br>
>>>> >> ><br>
>>>> >> > Tried to create one of the following:<br>
>>>> >> ><br>
>>>> >> > JPEGImageIO<br>
>>>> >> > GDCMImageIO<br>
>>>> >> > BMPImageIO<br>
>>>> >> > LSMImageIO<br>
>>>> >> > PNGImageIO<br>
>>>> >> > TIFFImageIO<br>
>>>> >> > VTKImageIO<br>
>>>> >> > StimulateImageIO<br>
>>>> >> > BioRadImageIO<br>
>>>> >> > MetaImageIO<br>
>>>> >> > NiftiImageIO<br>
>>>> >> > NrrdImageIO<br>
>>>> >> > GiplImageIO<br>
>>>> >> > HDF5ImageIO<br>
>>>> >> > You probably failed to set a file suffix, or<br>
>>>> >> > set the suffix to an unsupported type<br>
>>>> >> ><br>
>>>> >> > However, if I put<br>
>>>> >> ><br>
>>>> >> > itk::ObjectFactoryBase::ReHash();<br>
>>>> >> ><br>
>>>> >> > before the reader is instantiated, everything works fine. But after<br>
>>>> >> > that, no<br>
>>>> >> > default factories are loaded. As I understand the plugin mechanism<br>
>>>> >> > correctly, calling ReHash() shouldn't be necessary.<br>
>>>> >> ><br>
>>>> >> > Can anybody point me in the right direction?<br>
>>>> >> ><br>
>>>> >> > I'm on Mac OS 10.8.5 with ITK 4.2.1.<br>
>>>> >> ><br>
>>>> >> > Thanks in advance.<br>
>>>> >> ><br>
>>>> >> > -Silvio<br>
>>>> >> ><br>
>>>> >> ><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>
>>>> >><br>
>>>> >><br>
>>>> >> --<br>
>>>> >> Unpaid intern in BillsBasement at noware dot com<br>
>>>> ><br>
>>>> ><br>
>>>><br>
>>>><br>
>>>><br>
>>>> --<br>
>>>> Unpaid intern in BillsBasement at noware dot com<br>
>>><br>
>>><br>
>><br>
>><br>
>><br>
>> --<br>
>> Unpaid intern in BillsBasement at noware dot com<br>
><br>
><br>
><br>
> --<br>
> Unpaid intern in BillsBasement at noware dot com<br>
<br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<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>
</div></div></blockquote></div><br></div>