[Insight-users] WatershedImageFilter Crashed.

=?GB2312?B?/Yj9iA==?= anjingdelonglong at gmail.com
Thu Dec 6 02:50:47 EST 2012


I found the reason!!!

(*segment_ptr).second.edge_list.front().label

When the filter can not detect any block, the member edge_list is empty.
But without any check of list, going on invoke the .front(). Thus the
program crashed.

It can be a BUG !?


2012/12/5 ýˆýˆ <anjingdelonglong at gmail.com>

> Dear All.
>
> I'm using Watershed filter on my work about segmentation. But it often
> crashed and i can not find the reason. Please Help~
>
> Error message is : "list iterator not dereferencable"
>
> Try my best to explain the problem.
>
> This is the part of my program
>
> .....
> //A SigmoidImageFilter executed.
>
> typedef  itk::WatershedImageFilter< InternalImageType >
> WatershedFilterType; // InternalImageType--> image<float, 2>;
> WatershedFilterType::Pointer watershedFilter = WatershedFilterType::New();
> watershedFilter->SetInput( sigmoidFilter->GetOutput() );
> watershedFilter->SetThreshold( _threshold );
> watershedFilter->SetLevel( _level );  //both threshold and  level is
> between 0~1
> watershedFilter->Update();
>
> When going to this
> step: SegmentTreeGenerator<TScalarType>::CompileMergeList(SegmentTableTypePointer
> segments,
> SegmentTreeTypePointer mergeList)
> {
>    //.....
>
>    for (segment_ptr = segments->Begin(); segment_ptr != segments->End();
>        ++segment_ptr)
>     {
>     labelFROM = (*segment_ptr).first;
>
>     labelTO
>       =
> m_MergedSegmentsTable->RecursiveLookup((*segment_ptr).second.edge_list.front().label);
>
>    //.....
> }
>
> then I found that the segment_ptr -> hash_table only have one element.
> Thus the list crashed.
> the variable segment is copy of the input which is defined "  typename
> SegmentTableType::Pointer input = this->GetInputSegmentTable(); " in
> the SegmentTreeGenerator::GenerateData() part.
>
> I'm not clear about the internal implement of this function. Therefore i
> can't find the reason why it crashed.
> Please HELP!
> THANKS.
>
>
> --
> Nothing but a MADAO£¡
>
>


-- 
Nothing but a MADAO£¡
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121206/4ed965a4/attachment.htm>


More information about the Insight-users mailing list