I found the reason!!! <div><br></div><div><span style="font-family:arial,sans-serif;font-size:14px">(*segment_ptr)</span><span style="font-family:arial,sans-serif;font-size:14px">.second.edge_list.front().</span><span style="font-family:arial,sans-serif;font-size:14px">label</span><br>
</div><div><span style="font-family:arial,sans-serif;font-size:14px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:14px">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.</span></div>
<div><span style="font-family:arial,sans-serif;font-size:14px"><br></span></div><div><font face="arial, sans-serif"><span style="font-size:14px">It can be a BUG !?</span></font></div><div class="gmail_extra"><br><br><div class="gmail_quote">
2012/12/5 ýˆýˆ <span dir="ltr"><<a href="mailto:anjingdelonglong@gmail.com" target="_blank">anjingdelonglong@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear All.<div><br></div><div>I'm using Watershed filter on my work about segmentation. But it often crashed and i can not find the reason. Please Help~</div><div><br></div><div>Error message is : "list iterator not dereferencable"</div>
<div><br></div><div>Try my best to explain the problem.</div><div><br></div><div>This is the part of my program</div><div><br></div><div>.....</div><div>//A SigmoidImageFilter executed.</div><div><br></div><div><div>typedef itk::WatershedImageFilter< InternalImageType > WatershedFilterType; // InternalImageType--> image<float, 2>;</div>
<div>WatershedFilterType::Pointer watershedFilter = WatershedFilterType::New();</div><div>watershedFilter->SetInput( sigmoidFilter->GetOutput() );</div><div>watershedFilter->SetThreshold( _threshold );</div><div>
watershedFilter->SetLevel( _level ); //both threshold and level is between 0~1</div><div>watershedFilter->Update();</div></div><div><br clear="all"><div>When going to this step: SegmentTreeGenerator<TScalarType>::CompileMergeList(SegmentTableTypePointer segments, </div>
<div>SegmentTreeTypePointer mergeList)</div><div>{</div><div> //.....</div><div> </div><div> for (segment_ptr = segments->Begin(); segment_ptr != segments->End();</div><div> ++segment_ptr)</div><div> {</div>
<div> labelFROM = (*segment_ptr).first;</div><div> </div><div> labelTO</div><div> = m_MergedSegmentsTable->RecursiveLookup((*segment_ptr).second.edge_list.front().label);</div><div><br></div><div> //.....</div>
<div>}</div><div><br></div><div>then I found that the segment_ptr -> hash_table only have one element. Thus the list crashed.</div><div>the variable segment is copy of the input which is defined " typename SegmentTableType::Pointer input = this->GetInputSegmentTable(); " in the SegmentTreeGenerator::GenerateData() part.</div>
<div><br></div><div>I'm not clear about the internal implement of this function. Therefore i can't find the reason why it crashed.</div><div>Please HELP!</div><div>THANKS.</div><span class="HOEnZb"><font color="#888888"><div>
<br></div><div><br></div>-- <br>
Nothing but a MADAO£¡<br><br>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Nothing but a MADAO£¡<br><br>
</div>