[Insight-users] Segmentation Faults with ITK

Luis Ibanez luis.ibanez at kitware.com
Sun Jan 9 20:25:22 EST 2005


Hi Karsten,

The best application for managing Deformable Models in ITK is
the one in


         InsightApplications/
                     DeformableModelSimplexMesh


The use of Simplex Meshes simplifies memory management during
the evolution of the surface.


Please take a look at this application and let us know if you
find any difficulty.



    Regards,



       Luis



------------------------
Karsten Grasemann wrote:

> Hello everybody,
> 
> I have a big problem with itk. I try to build an application that can do some
> segmentation an generates a model out of a DICOM or RAW-Image.
> So I implement the example from the "ItkSoftwareGuide, Chapter 9.4.3
> Deformable Model and Gibbs Prior" in a seperate method. Another method will
> build my binary-image as described in Chapter 9.1.1 "Connected Threshold".
> Everything is wrapped in a Qt-GUI framework.
> 
> So far so good. In the compilation process I get some warnings :
> "...
> /usr/local/include/InsightToolkit/Algorithms/itkCurvatureFlowFunction.txx: In
>    member function `typename itk::FiniteDifferenceFunction<TImage>::PixelType
>    itk::CurvatureFlowFunction<TImage>::ComputeUpdate(typename
>    itk::FiniteDifferenceFunction<TImageType>::NeighborhoodType&, void*,
>    typename itk::FiniteDifferenceFunction<TImageType>::FloatOffsetType&) [with
>    TImage = itk::Image<short unsigned int, 3>]':
> /usr/local/include/InsightToolkit/Common/itkPointLocator.txx:161:
> instantiated from here
> /usr/local/include/InsightToolkit/Algorithms/itkCurvatureFlowFunction.txx:104:
> Warnung: initialization
>     to `short unsigned int' from `double'
> /usr/local/include/InsightToolkit/Algorithms/itkCurvatureFlowFunction.txx:104:
> Warnung: argument
>     to `short unsigned int' from `double'
> /usr/local/include/InsightToolkit/Common/itkPointLocator.txx:161:
> instantiated from here
> /usr/local/include/InsightToolkit/Algorithms/itkCurvatureFlowFunction.txx:109:
> Warnung: assignment
>     to `short unsigned int' from `double'
> /usr/local/include/InsightToolkit/Algorithms/itkCurvatureFlowFunction.txx:109:
> Warnung: argument
>     to `short unsigned int' from `double'
> /usr/local/include/InsightToolkit/Common/itkPointLocator.txx:161:
> instantiated from here
> /usr/local/include/InsightToolkit/Algorithms/itkCurvatureFlowFunction.txx:119:
> Warnung: assignment
>     to `short unsigned int' from `double'
> /usr/local/include/InsightToolkit/Algorithms/itkCurvatureFlowFunction.txx:119:
> Warnung: argument
>     to `short unsigned int' from `double'
> /usr/local/include/InsightToolkit/Algorithms/itkCurvatureFlowFunction.txx:137:
> Warnung: initialization
>     to `short unsigned int' from `double'
> /usr/local/include/InsightToolkit/Algorithms/itkCurvatureFlowFunction.txx:137:
> Warnung: argument
>     to `short unsigned int' from `double'
> /usr/local/include/InsightToolkit/Common/itkPointLocator.txx:161:
> instantiated from here
> /usr/local/include/InsightToolkit/Algorithms/itkCurvatureFlowFunction.txx:143:
> Warnung: assignment
>     to `short unsigned int' from `double'
> /usr/local/include/InsightToolkit/Algorithms/itkCurvatureFlowFunction.txx:143:
> Warnung: argument
>     to `short unsigned int' from `double'
> ... "
> 
> ... nothing serious so far. But when I run the application, my program bails
> out with a segmentation fault in the calculation of the Deformable Mesh
> Filter.
> So I started a new Gdb-session and got the following Debug Infos:
> 
> "...
> Using host libthread_db library "/lib/tls/libthread_db.so.1".
> (gdb) set args
> (gdb) run
> [Thread debugging using libthread_db enabled]
> [New Thread 1086799200 (LWP 10627)]
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 1086799200 (LWP 10627)]
> itk::VectorContainer<unsigned long, itk::CellInterface<double,
> itk::CellTraitsInfo<3, float, float, unsigned long, unsigned long, unsigned
> long, itk::Point<float, 3u>, itk::VectorContainer<unsigned long,
> itk::Point<float, 3u> >, std::set<unsigned long, std::less<unsigned long>,
> std::allocator<unsigned long> > > >*>::Begin (this=0x0) at stl_iterator.h:593
> (gdb)
> 
> ..."
> 
> an assembler dump does the following
> 
> "...
> 
> Dump of assembler code for function
> _ZN3itk15VectorContainerImPNS_13CellInterfaceIdNS_14CellTraitsInfoILi3EffmmmNS_5PointIfLj3EEENS0_ImS4_EESt3setImSt4lessImESaImEEEEEEE5BeginEv:
>     0x080f8570 <itk::VectorContainer<unsigned long, itk::CellInterface<double,
> itk::CellTraitsInfo<3, float, float, unsigned long, unsigned long, unsigned
> long, itk::Point<float, 3u>, itk::VectorContainer<unsigned long,
> itk::Point<float, 3u> >, std::set<unsigned long, std::less<unsigned long>,
> std::allocator<unsigned long> > > >*>::Begin()+0>:   push   %ebp
>     0x080f8571 <itk::VectorContainer<unsigned long, itk::CellInterface<double,
> itk::CellTraitsInfo<3, float, float, unsigned long, unsigned long, unsigned
> long, itk::Point<float, 3u>, itk::VectorContainer<unsigned long,
> itk::Point<float, 3u> >, std::set<unsigned long, std::less<unsigned long>,
> std::allocator<unsigned long> > > >*>::Begin()+1>:   mov    %esp,%ebp
>     0x080f8573 <itk::VectorContainer<unsigned long, itk::CellInterface<double,
> itk::CellTraitsInfo<3, float, float, unsigned long, unsigned long, unsigned
> long, itk::Point<float, 3u>, itk::VectorContainer<unsigned long,
> itk::Point<float, 3u> >, std::set<unsigned long, std::less<unsigned long>,
> std::allocator<unsigned long> > > >*>::Begin()+3>:   mov    0xc(%ebp),%edx
>     0x080f8576 <itk::VectorContainer<unsigned long, itk::CellInterface<double,
> itk::CellTraitsInfo<3, float, float, unsigned long, unsigned long, unsigned
> long, itk::Point<float, 3u>, itk::VectorContainer<unsigned long,
> itk::Point<float, 3u> >, std::set<unsigned long, std::less<unsigned long>,
> std::allocator<unsigned long> > > >*>::Begin()+6>:   mov    0x8(%ebp),%eax
> 
> -- Here comes the Point of bailout -->    0x080f8579
> <itk::VectorContainer<unsigned long, itk::CellInterface<double,
> itk::CellTraitsInfo<3, float, float, unsigned long, unsigned long, unsigned
> long, itk::Point<float, 3u>, itk::VectorContainer<unsigned long,
> itk::Point<float, 3u> >, std::set<unsigned long, std::less<unsigned long>,
> std::allocator<unsigned long> > > >*>::Begin()+9>:   mov    0x30(%edx),%edx
>     0x080f857c <itk::VectorContainer<unsigned long, itk::CellInterface<double,
> itk::CellTraitsInfo<3, float, float, unsigned long, unsigned long, unsigned
> long, itk::Point<float, 3u>, itk::VectorContainer<unsigned long,
> itk::Point<float, 3u> >, std::set<unsigned long, std::less<unsigned long>,
> std::allocator<unsigned long> > > >*>::Begin()+12>:  movl   $0x0,(%eax)
>     0x080f8582 <itk::VectorContainer<unsigned long, itk::CellInterface<double,
> itk::CellTraitsInfo<3, float, float, unsigned long, unsigned long, unsigned
> long, itk::Point<float, 3u>, itk::VectorContainer<unsigned long,
> itk::Point<float, 3u> >, std::set<unsigned long, std::less<unsigned long>,
> std::allocator<unsigned long> > > >*>::Begin()+18>:  mov    %edx,0x4(%eax)
>     0x080f8585 <itk::VectorContainer<unsigned long, itk::CellInterface<double,
> itk::CellTraitsInfo<3, float, float, unsigned long, unsigned long, unsigned
> long, itk::Point<float, 3u>, itk::VectorContainer<unsigned long,
> itk::Point<float, 3u> >, std::set<unsigned long, std::less<unsigned long>,
> std::allocator<unsigned long> > > >*>::Begin()+21>:  pop    %ebp
>     0x080f8586 <itk::VectorContainer<unsigned long, itk::CellInterface<double,
> itk::CellTraitsInfo<3, float, float, unsigned long, unsigned long, unsigned
> long, itk::Point<float, 3u>, itk::VectorContainer<unsigned long,
> itk::Point<float, 3u> >, std::set<unsigned long, std::less<unsigned long>,
> std::allocator<unsigned long> > > >*>::Begin()+22>:  ret    $0x4
> End of assembler dump.
> ..."
> 
> it seems to come out of the stdlib
> 
> "
> template<typename _Iterator, typename _Container>
>  574     class __normal_iterator
>  575       : public iterator<typename
> iterator_traits<_Iterator>::iterator_category,
>  576                         typename iterator_traits<_Iterator>::value_type,
>  577                         typename
> iterator_traits<_Iterator>::difference_type,
>  578                         typename iterator_traits<_Iterator>::pointer,
>  579                         typename iterator_traits<_Iterator>::reference>
>  580     {
>  581     protected:
>  582       _Iterator _M_current;
>  583
>  584     public:
>  585       typedef typename iterator_traits<_Iterator>::difference_type
>  586
> difference_type;
>  587       typedef typename iterator_traits<_Iterator>::reference   reference;
>  588       typedef typename iterator_traits<_Iterator>::pointer     pointer;
>  589
>  590       __normal_iterator() : _M_current(_Iterator()) { }
>  591
>  592       explicit
> --- Bailout here --->
>  593       __normal_iterator(const _Iterator& __i) : _M_current(__i) { }
>  594
>  595       // Allow iterator to const_iterator conversion
>  596       template<typename _Iter>
>  597       inline __normal_iterator(const __normal_iterator<_Iter,
> _Container>& __i)
>  598         : _M_current(__i.base()) { }
>  599
> 
> "
> 
> So, has anybody an idea of a workaround ? Even the examples in the
> InsightApplications will bail out with a segmentation fault. I haven't
> debugged them yet ...
> 
> Some system and version infos:
> AMD 2200+, 512Meg, SuSE-Linux-i586 2.6.5, GCC 3.3.3-41, CMake 2.0.5,
> InsightToolkit 1.8.0, InsightApplications 1.8.0, VTK 4.2, QT 3.3.1-36.16, DDD
> 3.3.8
> 
> Thanx for the help
> 
> Karsten Grasemann
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 






More information about the Insight-users mailing list