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<ImageIOBase::Pointer> 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<LightObject::Pointer> 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("itkImageIOBase");</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<LightObject::Pointer>::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<ImageIOBase*>(i->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 << "Error ImageIO factory did not return an ImageIOBase: "</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)->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);"> << 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<ImageIOBase::Pointer>::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)->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)->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);">==></span> }</span> <span style="color: rgb(255, 0, 0);">Here, the list can'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'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<std::_List_nod<itk::SmartPointer<itk::LightObject>,std::allocator<itk::SmartPointer<itk::LightObject> > >::_Node>::deallocate(std::_List_nod<itk::SmartPointer<itk::LightObject>,std::allocator<itk::SmartPointer<itk::LightObject> > >::_Node * _Ptr=0x01790b58, unsigned int __formal=1) Ligne 132 + 0x9 C++<br>
ImageReadWrite.exe!std::list<itk::SmartPointer<itk::LightObject>,std::allocator<itk::SmartPointer<itk::LightObject> > >::clear() Ligne 622 C++<br> ImageReadWrite.exe!std::list<itk::SmartPointer<itk::LightObject>,std::allocator<itk::SmartPointer<itk::LightObject> > >::_Tidy() Ligne 931 C++<br>
ImageReadWrite.exe!std::list<itk::SmartPointer<itk::LightObject>,std::allocator<itk::SmartPointer<itk::LightObject> > >::~list<itk::SmartPointer<itk::LightObject>,std::allocator<itk::SmartPointer<itk::LightObject> > >() 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<itk::Image<short,2>,itk::DefaultConvertPixelTraits<short> >::GenerateOutputInformation() Ligne 118 + 0x1d C++<br>
ITKCommon.dll!itk::ProcessObject::UpdateOutputInformation() Ligne 751 + 0x10 C++<br> ImageReadWrite.exe!itk::ImageBase<2>::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&D Software<br>tél : 06-73-60-52-91<br>