[Insight-users] Issues with IO Examples

Agnes Masson-Sibut agnes.massonsibut at gmail.com
Mon Mar 22 12:46:39 EDT 2010


Hello everybody,

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 :

ImageIOBase::Pointer
ImageIOFactory::CreateImageIO(const char* path, FileModeType mode)
{

  RegisterBuiltInFactories();

  std::list<ImageIOBase::Pointer> possibleImageIO;
  std::list<LightObject::Pointer> allobjects =
    ObjectFactoryBase::CreateAllInstance("itkImageIOBase");
  for(std::list<LightObject::Pointer>::iterator i = allobjects.begin();
      i != allobjects.end(); ++i)
    {
    ImageIOBase* io = dynamic_cast<ImageIOBase*>(i->GetPointer());
    if(io)
      {
      possibleImageIO.push_back(io);
      }
    else
      {
      std::cerr << "Error ImageIO factory did not return an ImageIOBase: "
                << (*i)->GetNameOfClass()
                << std::endl;
      }
    }
  for(std::list<ImageIOBase::Pointer>::iterator k = possibleImageIO.begin();
      k != possibleImageIO.end(); ++k)
    {
    if( mode == ReadMode )
      {
      if((*k)->CanReadFile(path))
        {
        return *k;
        }
      }
    else if( mode == WriteMode )
      {
      if(/*(*k)->CanWriteFile(path)*/false)
        {
        return *k;
        }

      }
==>    } Here, the list can't be deleted because of a memory issue
  return 0;
}

It seems that the program isn't able to delete the list . Here is the call
list :

     ntdll.dll!7c91120e()
     ntdll.dll!7c97e139()
     ntdll.dll!7c97e576()
     ntdll.dll!7c9722e8()
     kernel32.dll!7c85f9a7()
    ImageReadWrite.exe!_CrtIsValidHeapPointer(const void *
pUserData=0x01790b58)  Ligne 1807    C
     ImageReadWrite.exe!_free_dbg_lk(void * pUserData=0x01790b58, int
nBlockUse=1)  Ligne 1132 + 0x9    C
     ImageReadWrite.exe!_free_dbg(void * pUserData=0x01790b58, int
nBlockUse=1)  Ligne 1070 + 0xd    C
     ImageReadWrite.exe!operator delete(void * pUserData=0x01790b58)  Ligne
54 + 0x10    C++

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++

ImageReadWrite.exe!std::list<itk::SmartPointer<itk::LightObject>,std::allocator<itk::SmartPointer<itk::LightObject>
> >::clear()  Ligne 622    C++

ImageReadWrite.exe!std::list<itk::SmartPointer<itk::LightObject>,std::allocator<itk::SmartPointer<itk::LightObject>
> >::_Tidy()  Ligne 931    C++

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++
     ImageReadWrite.exe!itk::ImageIOFactory::CreateImageIO(const char *
path=0x00382a44, itk::ImageIOFactory::FileModeType mode=ReadMode)  Ligne 75
+ 0x26    C++

ImageReadWrite.exe!itk::ImageFileReader<itk::Image<short,2>,itk::DefaultConvertPixelTraits<short>
>::GenerateOutputInformation()  Ligne 118 + 0x1d    C++
     ITKCommon.dll!itk::ProcessObject::UpdateOutputInformation()  Ligne 751
+ 0x10    C++
     ImageReadWrite.exe!itk::ImageBase<2>::UpdateOutputInformation()  Ligne
226 + 0x3e    C++
     ITKCommon.dll!itk::DataObject::Update()  Ligne 342 + 0xd    C++
     ITKCommon.dll!itk::ProcessObject::Update()  Ligne 615 + 0x1a    C++
     ImageReadWrite.exe!main(int argc=3, char * * argv=0x003939a0)  Ligne
164 + 0x1e    C++
     ImageReadWrite.exe!mainCRTStartup()  Ligne 259 + 0x19    C
     kernel32.dll!7c817077()
     ntdll.dll!7c925d47()

I tried 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 ?

Thanks a lot,


-- 
Agnès Masson-Sibut
Étudiante au doctorat
Lissi, Université Paris Est Créteil
Aesculap SAS, Dpt R&D Software
tél : 06-73-60-52-91
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100322/e82bc6eb/attachment.htm>


More information about the Insight-users mailing list