Hello everybody,<br><br>I am a new user of the Insight Toolkit, and I have issues to simply read and write an image. When I try to execute the exemple ImageReadWrite, I get an error inside the CreateImageIO function from itkImageIOFactory file :<br>
<br><div style="margin-left: 40px;"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">ImageIOBase::Pointer</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">ImageIOFactory::CreateImageIO(const char* path, FileModeType mode)</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">{</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">  RegisterBuiltInFactories();</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">  std::list&lt;ImageIOBase::Pointer&gt; possibleImageIO;</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">  std::list&lt;LightObject::Pointer&gt; allobjects =</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">    ObjectFactoryBase::CreateAllInstance(&quot;itkImageIOBase&quot;);</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">  for(std::list&lt;LightObject::Pointer&gt;::iterator i = allobjects.begin();</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">      i != allobjects.end(); ++i)</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">    {</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">    ImageIOBase* io = dynamic_cast&lt;ImageIOBase*&gt;(i-&gt;GetPointer());</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">    if(io)</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">      {</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">      possibleImageIO.push_back(io);</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">      }</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">    else</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">      {</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">      std::cerr &lt;&lt; &quot;Error ImageIO factory did not return an ImageIOBase: &quot;</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">                &lt;&lt; (*i)-&gt;GetNameOfClass()</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">                &lt;&lt; std::endl;</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">      }</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">    }</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">  for(std::list&lt;ImageIOBase::Pointer&gt;::iterator k = possibleImageIO.begin();</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">      k != possibleImageIO.end(); ++k)</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">    {</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">    if( mode == ReadMode )</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">      {</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">      if((*k)-&gt;CanReadFile(path))</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">        {</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">        return *k;</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">        }</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">      }</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">    else if( mode == WriteMode )</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">      {</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">      if(/*(*k)-&gt;CanWriteFile(path)*/false)</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">        {</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">        return *k;</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">        }</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">      }</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"></div><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="color: rgb(255, 0, 0);">==&gt;</span>    }</span> <span style="color: rgb(255, 0, 0);">Here, the list can&#39;t be deleted because of a memory issue</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);">
<div style="margin-left: 40px;"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">  return 0;</span><br style="font-family: courier new,monospace; color: rgb(51, 102, 255);"><span style="font-family: courier new,monospace; color: rgb(51, 102, 255);">}</span><br clear="all">
</div><br>It seems that the program isn&#39;t able to delete the list . Here is the call list :<br><br><div style="color: rgb(51, 102, 255);">     ntdll.dll!7c91120e()     <br>     ntdll.dll!7c97e139()     <br>     ntdll.dll!7c97e576()     <br>
     ntdll.dll!7c9722e8()     <br>     kernel32.dll!7c85f9a7()     <br>    ImageReadWrite.exe!_CrtIsValidHeapPointer(const void * pUserData=0x01790b58)  Ligne 1807    C<br>     ImageReadWrite.exe!_free_dbg_lk(void * pUserData=0x01790b58, int nBlockUse=1)  Ligne 1132 + 0x9    C<br>
     ImageReadWrite.exe!_free_dbg(void * pUserData=0x01790b58, int nBlockUse=1)  Ligne 1070 + 0xd    C<br>     ImageReadWrite.exe!operator delete(void * pUserData=0x01790b58)  Ligne 54 + 0x10    C++<br>     ImageReadWrite.exe!std::allocator&lt;std::_List_nod&lt;itk::SmartPointer&lt;itk::LightObject&gt;,std::allocator&lt;itk::SmartPointer&lt;itk::LightObject&gt; &gt; &gt;::_Node&gt;::deallocate(std::_List_nod&lt;itk::SmartPointer&lt;itk::LightObject&gt;,std::allocator&lt;itk::SmartPointer&lt;itk::LightObject&gt; &gt; &gt;::_Node * _Ptr=0x01790b58, unsigned int __formal=1)  Ligne 132 + 0x9    C++<br>
     ImageReadWrite.exe!std::list&lt;itk::SmartPointer&lt;itk::LightObject&gt;,std::allocator&lt;itk::SmartPointer&lt;itk::LightObject&gt; &gt; &gt;::clear()  Ligne 622    C++<br>     ImageReadWrite.exe!std::list&lt;itk::SmartPointer&lt;itk::LightObject&gt;,std::allocator&lt;itk::SmartPointer&lt;itk::LightObject&gt; &gt; &gt;::_Tidy()  Ligne 931    C++<br>
     ImageReadWrite.exe!std::list&lt;itk::SmartPointer&lt;itk::LightObject&gt;,std::allocator&lt;itk::SmartPointer&lt;itk::LightObject&gt; &gt; &gt;::~list&lt;itk::SmartPointer&lt;itk::LightObject&gt;,std::allocator&lt;itk::SmartPointer&lt;itk::LightObject&gt; &gt; &gt;()  Ligne 366 C++<br>
     ImageReadWrite.exe!itk::ImageIOFactory::CreateImageIO(const char * path=0x00382a44, itk::ImageIOFactory::FileModeType mode=ReadMode)  Ligne 75 + 0x26    C++<br>     ImageReadWrite.exe!itk::ImageFileReader&lt;itk::Image&lt;short,2&gt;,itk::DefaultConvertPixelTraits&lt;short&gt; &gt;::GenerateOutputInformation()  Ligne 118 + 0x1d    C++<br>
     ITKCommon.dll!itk::ProcessObject::UpdateOutputInformation()  Ligne 751 + 0x10    C++<br>     ImageReadWrite.exe!itk::ImageBase&lt;2&gt;::UpdateOutputInformation()  Ligne 226 + 0x3e    C++<br>     ITKCommon.dll!itk::DataObject::Update()  Ligne 342 + 0xd    C++<br>
     ITKCommon.dll!itk::ProcessObject::Update()  Ligne 615 + 0x1a    C++<br>     ImageReadWrite.exe!main(int argc=3, char * * argv=0x003939a0)  Ligne 164 + 0x1e    C++<br>     ImageReadWrite.exe!mainCRTStartup()  Ligne 259 + 0x19    C<br>
     kernel32.dll!7c817077()     <br>     ntdll.dll!7c925d47()<br><br><font style="font-family: arial,helvetica,sans-serif; color: rgb(0, 0, 0);" color="#000000">I tried</font><span style="color: rgb(0, 0, 0); font-family: arial,helvetica,sans-serif;"> with different image types, but the result is the same. Is the bug known ? Is there something I can do to help the thing working out ?  <br>
<br>Thanks a lot,<br>  </span><br></div><br>-- <br>Agnès Masson-Sibut<br>Étudiante au doctorat<br>Lissi, Université Paris Est Créteil<br>Aesculap SAS, Dpt R&amp;D Software<br>tél : 06-73-60-52-91<br>