Commit b10ece1b authored by remicres's avatar remicres

FIX: compute remaining number of iterations

parent ce05ae95
......@@ -96,9 +96,6 @@ void Controller<TSegmenter>::RunSegmentation()
m_TileHeight,
isFusion);
// Update the given number of iterations
numberOfIterationsRemaining -= m_NumberOfFirstIterations;
#ifdef OTB_USE_MPI
// Gathering useful variables
GatherUsefulVariables(accumulatedMemory, isFusion);
......@@ -107,20 +104,9 @@ void Controller<TSegmenter>::RunSegmentation()
// Time monitoring
ShowTime(t);
std::cout << "accumulatedMemory=" << accumulatedMemory << std::endl;
while(accumulatedMemory > m_Memory && isFusion)
{
if (numberOfIterationsRemaining < numberOfIterationsForPartialSegmentations)
{
numberOfIterationsForPartialSegmentations = numberOfIterationsRemaining;
numberOfIterationsRemaining = 0;
}
else
{
numberOfIterationsRemaining -= numberOfIterationsForPartialSegmentations;
}
isFusion = false;
accumulatedMemory = RunPartialSegmentation<TSegmenter>(
m_SpecificParameters,
......@@ -134,6 +120,9 @@ void Controller<TSegmenter>::RunSegmentation()
m_InputImage->GetNumberOfComponentsPerPixel(),
isFusion);
std::cout << "accumulatedMemory=" << accumulatedMemory << std::endl;
#ifdef OTB_USE_MPI
// Gathering useful variables
GatherUsefulVariables(accumulatedMemory, isFusion);
......@@ -142,8 +131,15 @@ void Controller<TSegmenter>::RunSegmentation()
// Time monitoring
ShowTime(t);
if (numberOfIterationsRemaining == 0)
// Update number of remaining iterations
if (numberOfIterationsRemaining < numberOfIterationsForPartialSegmentations)
{
break;
}
else
{
numberOfIterationsRemaining -= numberOfIterationsForPartialSegmentations;
}
}
#ifdef OTB_USE_MPI
......@@ -196,7 +192,7 @@ void Controller<TSegmenter>::RunSegmentation()
TSegmenter segmenter;
segmenter.SetParam(m_SpecificParameters);
segmenter.SetThreshold(m_Threshold);
segmenter.SetDoFastSegmentation(true);
segmenter.SetDoFastSegmentation(false);
segmenter.SetNumberOfIterations(m_NumberOfIterations);
segmenter.SetInput(m_InputImage);
segmenter.Update();
......
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