[Insight-users] Fwd: ImportImageFilter segfault

Dan Mueller dan.muel at gmail.com
Wed Jun 30 08:42:35 EDT 2010


Please keep this discussion on the list.

---------- Forwarded message ----------
From: Miklos Espak <espakm at gmail.com>
Date: 30 June 2010 14:27
Subject: Re: [Insight-users] ImportImageFilter segfault
To: Dan Mueller <dan.muel at gmail.com>

Hi Dan,

you're right, that's the problem, just I don't know how to get around it.

Your code compiles and runs, but still does not what is intended.

Valgrind says that getFirstPixel tries to read from a deallocated memory.

==16187== Invalid read of size 1
==16187==    at 0x415CC5:
itk::DefaultPixelAccessorFunctor<itk::Image<unsigned char, 3u>
>::Get(unsigned char const&) const (in
/home/espakm/workspace-torino/kmaps-ktrans/build/test/importfiltertest)
==16187==    by 0x414C2B: itk::ImageConstIterator<itk::Image<unsigned
char, 3u> >::Get() const (in
/home/espakm/workspace-torino/kmaps-ktrans/build/test/importfiltertest)
==16187==    by 0x413E02:
ImportFilterTest::getFirstPixel(itk::SmartPointer<itk::Image<unsigned
char, 3u> >) (in
/home/espakm/workspace-torino/kmaps-ktrans/build/test/importfiltertest)
==16187==    by 0x4141CD: ImportFilterTest::test_import() (in
/home/espakm/workspace-torino/kmaps-ktrans/build/test/importfiltertest)


I have attached the source again with your suggestion.
To make things easier, I added a main function and removed the cppunit
dependency.

Cheers,
Miklos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ImportFilterTest2.cpp
Type: application/octet-stream
Size: 4653 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100630/feded2e7/attachment.obj>


More information about the Insight-users mailing list