[Insight-developers] Lesion Sizing Toolkit logic error
Bill Lorensen
bill.lorensen at gmail.com
Thu Jun 23 15:22:35 EDT 2011
Folks,
I recently reported a run-time error in
itkRegionCompetitionImageFilterTest1
8: /usr/lib/gcc/i686-redhat-linux/4.4.5/../../../../include/c++/4.4.5/debug/safe_iterator.h:175:
8: error: attempt to dereference a past-the-end iterator.
8:
8: Objects involved in the operation:
8: iterator "this" @ 0x0xbfece8a0 {
8: type = N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPKmNSt6__norm6vectorImSaImEEEEENSt7__debug6vectorImS7_EEEE
(constant iterator);
8: state = past-the-end;
8: references sequence with type `NSt7__debug6vectorImSaImEEE' @ 0x0xbfece8a0
I tracked it down to flawed logic in
RegionCompetitionImageFilter::VisitAllSeedsAndTransitionTheirState()
the call to:
this->PasteNewSeedValuesToOutputImage();
is inside the
for( unsigned int lb = 0; lb < this->m_NumberOfLabels; lb++ )
Since PasteNewSeedValuesToOutputImage() has a loop
for( unsigned int lb = 0; lb < this->m_NumberOfLabels; lb++ )
the size of this->m_SeedsNewValues[lb] can be zero and does not match
this->m_SeedArray1[lb].size()
to verify this add a print to the loop in PasteNewSeedValuesToOutputImage()
std::cout << "For label: " << lb
<< " SeedArray1.size(): " << this->m_SeedArray1[lb].size()
<< " SeedsNewValues[lb].size(): " <<
this->m_SeedsNewValues[lb].size()
I was not sure how to fix it.
Bill
More information about the Insight-developers
mailing list