Commit 35e0a468 authored by remicres's avatar remicres
Browse files

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() ...@@ -30,6 +30,10 @@ void Controller<TSegmenter>::Modified()
m_Tiles.clear(); m_Tiles.clear();
} }
/*
* Run the segmentation
* TODO: compute the correct number of iterations !
*/
template<class TSegmenter> template<class TSegmenter>
void Controller<TSegmenter>::RunSegmentation() void Controller<TSegmenter>::RunSegmentation()
{ {
...@@ -71,7 +75,7 @@ void Controller<TSegmenter>::RunSegmentation() ...@@ -71,7 +75,7 @@ void Controller<TSegmenter>::RunSegmentation()
if (m_TilingMode == LSGRM_TILING_AUTO || m_TilingMode == LSGRM_TILING_USER) 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; unsigned int numberOfIterationsRemaining = m_NumberOfIterations;
// Boolean indicating if there are remaining fusions // Boolean indicating if there are remaining fusions
...@@ -107,6 +111,16 @@ void Controller<TSegmenter>::RunSegmentation() ...@@ -107,6 +111,16 @@ void Controller<TSegmenter>::RunSegmentation()
while(accumulatedMemory > m_Memory && isFusion) while(accumulatedMemory > m_Memory && isFusion)
{ {
if (numberOfIterationsRemaining < numberOfIterationsForPartialSegmentations)
{
numberOfIterationsForPartialSegmentations = numberOfIterationsRemaining;
numberOfIterationsRemaining = 0;
}
else
{
numberOfIterationsRemaining -= numberOfIterationsForPartialSegmentations;
}
isFusion = false; isFusion = false;
accumulatedMemory = RunPartialSegmentation<TSegmenter>( accumulatedMemory = RunPartialSegmentation<TSegmenter>(
m_SpecificParameters, m_SpecificParameters,
...@@ -128,11 +142,8 @@ void Controller<TSegmenter>::RunSegmentation() ...@@ -128,11 +142,8 @@ void Controller<TSegmenter>::RunSegmentation()
// Time monitoring // Time monitoring
ShowTime(t); ShowTime(t);
// Update the number of iterations remaining if (numberOfIterationsRemaining == 0)
if (numberOfIterationsRemaining > numberOfIterationsForPartialSegmentations) break;
{
numberOfIterationsRemaining -= numberOfIterationsForPartialSegmentations;
}
} }
#ifdef OTB_USE_MPI #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