From 9f8abd776a51e9c55ff6bc5db54c574b495f408c Mon Sep 17 00:00:00 2001 From: remicres <remi.cresson@teledetection.fr> Date: Thu, 11 Aug 2016 13:14:00 +0000 Subject: [PATCH] ADD: implementation of the baatzSegmenter node memory computation --- include/lsrmBaatzSegmenter.h | 1 + include/lsrmBaatzSegmenter.txx | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/lsrmBaatzSegmenter.h b/include/lsrmBaatzSegmenter.h index cc5a951..53dbf7e 100644 --- a/include/lsrmBaatzSegmenter.h +++ b/include/lsrmBaatzSegmenter.h @@ -94,6 +94,7 @@ namespace lsrm float ComputeMergingCost(NodePointerType n1, NodePointerType n2); void UpdateSpecificAttributes(NodePointerType n1, NodePointerType n2); void InitFromImage(); + unsigned int GetNodeMemory(unsigned int nEdges); }; } // end of namespace lsrm diff --git a/include/lsrmBaatzSegmenter.txx b/include/lsrmBaatzSegmenter.txx index abc0273..362c64b 100644 --- a/include/lsrmBaatzSegmenter.txx +++ b/include/lsrmBaatzSegmenter.txx @@ -129,6 +129,21 @@ namespace lsrm this->m_Complete = !prev_merged; } } + + template<class TImage> + unsigned int + BaatzSegmenter<TImage>::GetNodeMemory(unsigned int nEdges) + { + + unsigned int nBands = this->m_InputImage->GetNumberOfComponentsPerPixel(); + + long long unsigned int memory = 0; + memory += sizeof(NodePointerType); // size of the node pointer + memory += sizeof(NodeType); // size of the node + memory += 4 * nBands * sizeof(float); // size of the 4 attributes, multiplied by the nb. of bands + memory += nEdges * sizeof(EdgeType); // size of the edges + return memory; + } } // end of namespace lsrm #endif -- GitLab