Commit d1d34cb0 authored by remicres's avatar remicres

ADD: Function dedicated to availaible memory in controller

parent 77ed5ba2
......@@ -89,6 +89,7 @@ private:
void GetAutomaticConfiguration();
void ComputeMaximumStabilityMargin(unsigned int width, unsigned int height, unsigned int &iter, unsigned int &margin);
void CheckMemorySize();
unsigned int GetNodeMemory();
long unsigned int GetMaximumNumberOfNodesInMemory();
......
......@@ -39,6 +39,8 @@ void Controller<TSegmenter>::RunSegmentation()
{
itkDebugMacro(<< "Entering RunSegmentation()");
CheckMemorySize();
if (m_TilingMode == LSGRM_TILING_AUTO || m_TilingMode == LSGRM_TILING_USER)
{
if(m_TilingMode == LSGRM_TILING_AUTO)
......@@ -252,23 +254,25 @@ unsigned int Controller<TSegmenter>::GetNodeMemory()
return memory;
}
/*
* Compute the maximum number of nodes which can fit in the system memory
*/
template<class TSegmenter>
long unsigned int Controller<TSegmenter>::GetMaximumNumberOfNodesInMemory()
void Controller<TSegmenter>::CheckMemorySize()
{
itkDebugMacro(<< "Computing maximum number of nodes in memory");
if (m_Memory == 0)
{
m_Memory = getMemorySize();
assert(m_Memory > 0);
}
m_Memory /= 2; // For safety and can prevent out of memory troubles
}
/*
* Compute the maximum number of nodes which can fit in the memory
*/
template<class TSegmenter>
long unsigned int Controller<TSegmenter>::GetMaximumNumberOfNodesInMemory()
{
itkDebugMacro(<< "Computing maximum number of nodes in memory");
return std::ceil(((float) m_Memory) / ((float) GetNodeMemory()));
}
template<class TSegmenter>
......
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