Commit 35e2001d authored by Andreas Schwarzkopf's avatar Andreas Schwarzkopf

[FIX #371] Fixed bug when the Surface detection module by Lari crashed

Regarding the module "Surface detection by Lari" crashes appeared sometimes.
The reason was that the object containing the status bar thing (point classifier
class) was deleted before the progress was set to be finished.

Remaining bug:
The following bug could not be fixed short-time because it does not appear if
the module is compiled using the debug flag.
Shortly said sometimes the search instance even can not find a point using
coordinates of itself. Weird. I put setting the ID in the end of
WLariBruteforceClustering::addExtentCluster manually at least not to get stuck.
But still some groups result a bad result. No errors appear when compiling (cmake)
using the debug flag. Has to be fixed sometime later.
parent 9d57f602
......@@ -232,6 +232,7 @@ void WMSurfaceDetectionByLari::moduleMain()
WLariOutliner* outliner = new WLariOutliner( classifier );
classifier->assignProgressCombiner( m_progress );
classifier->setProgressSettings( 0, 10, "Initializing " );
classifier->setNumberPointsK( m_numberPointsK->get() );
classifier->setMaxPointDistanceR( m_maxPointDistanceR->get() );
classifier->setCpuThreadCount( m_cpuThreadCount->get() );
......@@ -266,12 +267,6 @@ void WMSurfaceDetectionByLari::moduleMain()
m_outputParameterDomain->updateData( outliner->outlineParameterDomain() );
cout << "Outlining done" << endl;
delete classifier;
delete inputPoints;
delete clustering;
delete outliner;
delete boundaryDetector;
m_nbPoints->set( count );
m_infoPointsPerSecond->set( m_infoRenderTimeSeconds->get() == 0.0 ?m_nbPoints->get()
:m_nbPoints->get() / m_infoRenderTimeSeconds->get() );
......@@ -281,9 +276,15 @@ void WMSurfaceDetectionByLari::moduleMain()
m_yMax->set( boundingBox->getRootNode()->getYMax() );
m_zMin->set( boundingBox->getRootNode()->getValueMin() );
m_zMax->set( boundingBox->getRootNode()->getValueMax() );
delete boundingBox;
m_infoRenderTimeSeconds->set( timer.elapsed() / 60.0 );
classifier->finishProgress();
delete classifier;
delete inputPoints;
delete clustering;
delete outliner;
delete boundaryDetector;
delete boundingBox;
}
m_reloadData->set( WPVBaseTypes::PV_TRIGGER_READY, true );
m_reloadData->get( true );
......
......@@ -108,14 +108,14 @@ void WLariBruteforceClustering::initExtentSizes( vector<WKdPointND*>* pointsToPr
void WLariBruteforceClustering::initExtentSizesAtThread( vector<WKdPointND*>* pointsToProcess, size_t threadIndex )
{
WParameterSpaceSearcher parameterSearcher;
parameterSearcher.setExaminedKdTree( m_parameterDomain );
parameterSearcher.setSegmentationSettings( m_segmentationMaxAngleDegrees, m_segmentationMaxPlaneDistance );
for( size_t index = threadIndex; index < pointsToProcess->size(); index += m_cpuThreadCount )
{
WParameterDomainKdPoint* refreshable = static_cast<WParameterDomainKdPoint*>( pointsToProcess->at( index ) );
if( refreshable->isTaggedToRefresh() )
{
WParameterSpaceSearcher parameterSearcher;
parameterSearcher.setExaminedKdTree( m_parameterDomain );
parameterSearcher.setSegmentationSettings( m_segmentationMaxAngleDegrees, m_segmentationMaxPlaneDistance );
parameterSearcher.setSearchedPeakCenter( refreshable->getCoordinate() );
size_t count = parameterSearcher.getNearestNeighborCount();
......@@ -140,6 +140,9 @@ void WLariBruteforceClustering::addExtentCluster( WParameterDomainKdPoint* peakC
&WLariBruteforceClustering::addExtentClusterAtThread, this, extentPoints, clusterID, thread );
for( size_t thread = 0; thread < threads; thread++ )
m_cpuThreads[thread]->join();
peakCenterPoint->getSpatialPoint()->setClusterID( clusterID );
peakCenterPoint->setIsAddedToPlane( true );
}
void WLariBruteforceClustering::addExtentClusterAtThread( vector<WParameterDomainKdPoint*>* extentPoints, size_t clusterID, size_t threadIndex )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment