Commit c4ee96b1 authored by remicres's avatar remicres
Browse files

ENH: breaks the partial segmentations loop when max nb of iteration is reached

Showing with 14 additions and 10 deletions
+14 -10
...@@ -14,7 +14,6 @@ Controller<TSegmenter>::Controller() ...@@ -14,7 +14,6 @@ Controller<TSegmenter>::Controller()
m_TileWidth = 0; m_TileWidth = 0;
m_NbTilesX = 0; m_NbTilesX = 0;
m_NbTilesY = 0; m_NbTilesY = 0;
m_CleanTemporaryFiles = true;
m_Threshold = 75; m_Threshold = 75;
m_Memory = 0; m_Memory = 0;
} }
...@@ -103,18 +102,23 @@ void Controller<TSegmenter>::RunSegmentation() ...@@ -103,18 +102,23 @@ void Controller<TSegmenter>::RunSegmentation()
m_InputImage->GetNumberOfComponentsPerPixel(), m_InputImage->GetNumberOfComponentsPerPixel(),
isFusion); isFusion);
// Update the number of iterations remaining
if (numberOfIterationsRemaining > numberOfIterationsForPartialSegmentations)
{
numberOfIterationsRemaining -= numberOfIterationsForPartialSegmentations;
}
#ifdef OTB_USE_MPI #ifdef OTB_USE_MPI
// Gathering useful variables // Gathering useful variables
GatherUsefulVariables(accumulatedMemory, isFusion); GatherUsefulVariables(accumulatedMemory, isFusion);
#endif #endif
// Time monitoring // Time monitoring
ShowTime(t); ShowTime(t);
// Update the number of iterations remaining
if (numberOfIterationsRemaining > numberOfIterationsForPartialSegmentations)
{
numberOfIterationsRemaining -= numberOfIterationsForPartialSegmentations;
}
else
{
break;
}
} }
...@@ -315,7 +319,7 @@ void Controller<TSegmenter>::GetAutomaticConfiguration() ...@@ -315,7 +319,7 @@ void Controller<TSegmenter>::GetAutomaticConfiguration()
// Compactness // Compactness
float perimeter = tileWidth + tileHeight; float perimeter = tileWidth + tileHeight;
float surface = tileWidth * tileHeight; float surface = tileWidth * tileHeight;
float compactness = perimeter / surface * (float) vcl_max(tileWidth,tileHeight); // [1,+inf] float compactness = perimeter / surface * (float) std::max(tileWidth,tileHeight); // [1,+inf]
// Update minimum criterion // Update minimum criterion
float criterion = compactness / percentMemory; // ]0, +inf] float criterion = compactness / percentMemory; // ]0, +inf]
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
#endif #endif
/* /*
* This function returns TRUE if it's to the process #myrank to do the * This function returns TRUE if the process #myrank is assigned
* work on the yard #div in a pool of #nprocs threads * to the task #div in a pool of #nprocs processes
*/ */
bool MyTurn(int div = 0) bool MyTurn(int div = 0)
{ {
......
Supports Markdown
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