Commit 35e0a468 authored by remicres's avatar remicres

TODO: there is a bug: parameters are not the same when mode=tiled vs none...

TODO: there is a bug: parameters are not the same when mode=tiled vs none (same result whatever tiling layout, but different result than monotile)
parent a7fce875
......@@ -30,6 +30,10 @@ void Controller<TSegmenter>::Modified()
m_Tiles.clear();
}
/*
* Run the segmentation
* TODO: compute the correct number of iterations !
*/
template<class TSegmenter>
void Controller<TSegmenter>::RunSegmentation()
{
......@@ -71,7 +75,7 @@ void Controller<TSegmenter>::RunSegmentation()
if (m_TilingMode == LSGRM_TILING_AUTO || m_TilingMode == LSGRM_TILING_USER)
{
const unsigned int numberOfIterationsForPartialSegmentations = 3; // TODO: find a smart value
unsigned int numberOfIterationsForPartialSegmentations = 3; // TODO: find a smart value
unsigned int numberOfIterationsRemaining = m_NumberOfIterations;
// Boolean indicating if there are remaining fusions
......@@ -107,6 +111,16 @@ void Controller<TSegmenter>::RunSegmentation()
while(accumulatedMemory > m_Memory && isFusion)
{
if (numberOfIterationsRemaining < numberOfIterationsForPartialSegmentations)
{
numberOfIterationsForPartialSegmentations = numberOfIterationsRemaining;
numberOfIterationsRemaining = 0;
}
else
{
numberOfIterationsRemaining -= numberOfIterationsForPartialSegmentations;
}
isFusion = false;
accumulatedMemory = RunPartialSegmentation<TSegmenter>(
m_SpecificParameters,
......@@ -128,11 +142,8 @@ void Controller<TSegmenter>::RunSegmentation()
// Time monitoring
ShowTime(t);
// Update the number of iterations remaining
if (numberOfIterationsRemaining > numberOfIterationsForPartialSegmentations)
{
numberOfIterationsRemaining -= numberOfIterationsForPartialSegmentations;
}
if (numberOfIterationsRemaining == 0)
break;
}
#ifdef OTB_USE_MPI
......
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