Commit f1892f1d authored by remicres's avatar remicres

ENH: fallback to tiling=none when layout size is 1

parent e0f8c814
......@@ -35,6 +35,8 @@ public:
Controller();
~Controller();
void Modified();
void RunSegmentation();
void SetSpecificParameters(const SegmentationParameterType& params);
......@@ -42,9 +44,9 @@ public:
void SetInternalMemoryAvailable(long long unsigned int v); // expecting a value in Mbytes.
/* Accessors */
void SetTilingModeNone(){m_TilingMode = LSGRM_TILING_NONE;};
void SetTilingModeUser(){m_TilingMode = LSGRM_TILING_USER;};
void SetTilingModeAuto(){m_TilingMode = LSGRM_TILING_AUTO;};
void SetTilingModeNone(){m_TilingMode = LSGRM_TILING_NONE; Modified();};
void SetTilingModeUser(){m_TilingMode = LSGRM_TILING_USER; Modified();};
void SetTilingModeAuto(){m_TilingMode = LSGRM_TILING_AUTO; Modified();};
typename LabelImageType::Pointer GetLabeledClusteredOutput();
std::vector<std::string> GetTemporaryFilesList();
......
......@@ -23,6 +23,13 @@ Controller<TSegmenter>::~Controller()
{
}
template<class TSegmenter>
void Controller<TSegmenter>::Modified()
{
Superclass::Modified();
m_Tiles.clear();
}
template<class TSegmenter>
void Controller<TSegmenter>::RunSegmentation()
{
......@@ -53,7 +60,12 @@ void Controller<TSegmenter>::RunSegmentation()
m_NbTilesX, m_NbTilesY, m_TemporaryFilesPrefix);
// If there is only one tile, then fallback to LSGRM_TILING_NONE case
m_TilingMode = LSGRM_TILING_NONE;
if (m_Tiles.size() == 1)
{
std::cout << "Only one tile is needed. Fallback to tiling=none." << std::endl;
SetTilingModeNone();
}
}
if (m_TilingMode == LSGRM_TILING_AUTO || m_TilingMode == LSGRM_TILING_USER)
......@@ -163,6 +175,9 @@ void Controller<TSegmenter>::RunSegmentation()
}
else if (m_TilingMode == LSGRM_TILING_NONE)// tiling_mode is none
{
// Update input image
m_InputImage->Update();
// Use classic grm
TSegmenter segmenter;
segmenter.SetParam(m_SpecificParameters);
......@@ -171,6 +186,9 @@ void Controller<TSegmenter>::RunSegmentation()
segmenter.SetNumberOfIterations(m_NumberOfIterations);
segmenter.SetInput(m_InputImage);
segmenter.Update();
// Get label image
m_LabelImage = segmenter.GetLabeledClusteredOutput();
}
else
{
......@@ -181,6 +199,7 @@ void Controller<TSegmenter>::RunSegmentation()
/*
* Compute the memory occupied by one node
* TODO: compute the exact value
*/
template<class TSegmenter>
unsigned int Controller<TSegmenter>::GetNodeMemory()
......@@ -228,8 +247,7 @@ long unsigned int Controller<TSegmenter>::GetMaximumNumberOfNodesInMemory()
}
template<class TSegmenter>
void
Controller<TSegmenter>::ComputeMaximumStabilityMargin(unsigned int width,
void Controller<TSegmenter>::ComputeMaximumStabilityMargin(unsigned int width,
unsigned int height, unsigned int &niter, unsigned int &margin)
{
itkDebugMacro(<< "Computing maximum stability margin");
......
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