Commit 3c558d44 authored by Gaetano Raffaele's avatar Gaetano Raffaele
Browse files

FIX: switched node id type to std::size_t for 64 bit Windows portability

parent f6fad8b1
...@@ -94,7 +94,7 @@ private: ...@@ -94,7 +94,7 @@ private:
void ComputeMaximumStabilityMargin(unsigned int width, unsigned int height, unsigned int &iter, unsigned int &margin); void ComputeMaximumStabilityMargin(unsigned int width, unsigned int height, unsigned int &iter, unsigned int &margin);
void CheckMemorySize(); void CheckMemorySize();
unsigned int GetNodeMemory(); unsigned int GetNodeMemory();
long unsigned int GetMaximumNumberOfNodesInMemory(); std::size_t GetMaximumNumberOfNodesInMemory();
/* Parameters given by the user */ /* Parameters given by the user */
std::string m_TemporaryFilesPrefix; // Path used to store intermediate files during the process. std::string m_TemporaryFilesPrefix; // Path used to store intermediate files during the process.
......
...@@ -266,7 +266,7 @@ void Controller<TSegmenter>::CheckMemorySize() ...@@ -266,7 +266,7 @@ void Controller<TSegmenter>::CheckMemorySize()
* Compute the maximum number of nodes which can fit in the memory * Compute the maximum number of nodes which can fit in the memory
*/ */
template<class TSegmenter> template<class TSegmenter>
long unsigned int Controller<TSegmenter>::GetMaximumNumberOfNodesInMemory() std::size_t Controller<TSegmenter>::GetMaximumNumberOfNodesInMemory()
{ {
itkDebugMacro(<< "Computing maximum number of nodes in memory"); itkDebugMacro(<< "Computing maximum number of nodes in memory");
......
...@@ -78,13 +78,13 @@ void RemoveUselessNodes(ProcessingTile& tile, ...@@ -78,13 +78,13 @@ void RemoveUselessNodes(ProcessingTile& tile,
template<class TSegmenter> template<class TSegmenter>
void UpdateNeighborsOfNoneDuplicatedNodes(std::unordered_map<long unsigned int, void UpdateNeighborsOfNoneDuplicatedNodes(std::unordered_map<std::size_t,
std::vector<typename TSegmenter::NodePointerType> >& borderPixelMap, std::vector<typename TSegmenter::NodePointerType> >& borderPixelMap,
const unsigned int imageWidth, const unsigned int imageWidth,
const unsigned int imageHeight); const unsigned int imageHeight);
template<class TSegmenter> template<class TSegmenter>
void RemoveDuplicatedNodes(std::unordered_map<long unsigned int, void RemoveDuplicatedNodes(std::unordered_map<std::size_t,
std::vector<typename TSegmenter::NodePointerType> >& borderPixelMap, std::vector<typename TSegmenter::NodePointerType> >& borderPixelMap,
typename TSegmenter::GraphType& graph, typename TSegmenter::GraphType& graph,
const unsigned int imageWidth); const unsigned int imageWidth);
...@@ -96,7 +96,7 @@ void BuildBorderPixelMap(typename TSegmenter::GraphType& graph, ...@@ -96,7 +96,7 @@ void BuildBorderPixelMap(typename TSegmenter::GraphType& graph,
const unsigned int colTile, const unsigned int colTile,
const unsigned int nbTilesX, const unsigned int nbTilesX,
const unsigned int nbTilesY, const unsigned int nbTilesY,
std::unordered_map<long unsigned int, std::unordered_map<std::size_t,
std::vector<typename TSegmenter::NodePointerType> >& borderPixelMap, std::vector<typename TSegmenter::NodePointerType> >& borderPixelMap,
const unsigned int imageWidth); const unsigned int imageWidth);
......
...@@ -63,7 +63,7 @@ MergeAllGraphsAndAchieveSegmentation( ...@@ -63,7 +63,7 @@ MergeAllGraphsAndAchieveSegmentation(
{ {
std::cout << "Cleaning nodes of tile " << (row*nbTilesX + col) << " / " << (nbTilesX*nbTilesY) << std::endl; std::cout << "Cleaning nodes of tile " << (row*nbTilesX + col) << " / " << (nbTilesX*nbTilesY) << std::endl;
std::unordered_map<long unsigned int, std::unordered_map<std::size_t,
std::vector<typename TSegmenter::NodePointerType> > borderPixelMap; std::vector<typename TSegmenter::NodePointerType> > borderPixelMap;
std::cout << "\tBuildBorderPixelMap..." << std::endl; std::cout << "\tBuildBorderPixelMap..." << std::endl;
...@@ -160,7 +160,7 @@ long long unsigned int RunPartialSegmentation(const typename TSegmenter::ParamTy ...@@ -160,7 +160,7 @@ long long unsigned int RunPartialSegmentation(const typename TSegmenter::ParamTy
row, col, nbTilesX, nbTilesY); row, col, nbTilesX, nbTilesY);
std::cout << "\tBuild border pixel map..." << std::endl; std::cout << "\tBuild border pixel map..." << std::endl;
std::unordered_map<long unsigned int, std::vector<typename TSegmenter::NodePointerType> > borderPixelMap; std::unordered_map<std::size_t, std::vector<typename TSegmenter::NodePointerType> > borderPixelMap;
BuildBorderPixelMap<TSegmenter>(segmenter.m_Graph, currentTile, row, col, BuildBorderPixelMap<TSegmenter>(segmenter.m_Graph, currentTile, row, col,
nbTilesX, nbTilesY, borderPixelMap, imageWidth); nbTilesX, nbTilesY, borderPixelMap, imageWidth);
...@@ -328,7 +328,7 @@ void RemoveUselessNodes(ProcessingTile& tile, ...@@ -328,7 +328,7 @@ void RemoveUselessNodes(ProcessingTile& tile,
} }
template<class TSegmenter> template<class TSegmenter>
void UpdateNeighborsOfNoneDuplicatedNodes(std::unordered_map<long unsigned int, void UpdateNeighborsOfNoneDuplicatedNodes(std::unordered_map<std::size_t,
std::vector<typename TSegmenter::NodePointerType> >& borderPixelMap, std::vector<typename TSegmenter::NodePointerType> >& borderPixelMap,
const unsigned int imageWidth, const unsigned int imageWidth,
const unsigned int imageHeight) const unsigned int imageHeight)
...@@ -338,7 +338,7 @@ void UpdateNeighborsOfNoneDuplicatedNodes(std::unordered_map<long unsigned int, ...@@ -338,7 +338,7 @@ void UpdateNeighborsOfNoneDuplicatedNodes(std::unordered_map<long unsigned int,
for(auto& pn : borderPixelMap) for(auto& pn : borderPixelMap)
{ {
long int neighborhood[4]; NeighIDType neighborhood[4];
grm::FOURNeighborhood(neighborhood, pn.first, imageWidth, imageHeight); grm::FOURNeighborhood(neighborhood, pn.first, imageWidth, imageHeight);
for(short j = 0; j < 4; ++j) for(short j = 0; j < 4; ++j)
...@@ -366,7 +366,7 @@ void UpdateNeighborsOfNoneDuplicatedNodes(std::unordered_map<long unsigned int, ...@@ -366,7 +366,7 @@ void UpdateNeighborsOfNoneDuplicatedNodes(std::unordered_map<long unsigned int,
{ {
if(borderPixelMap.find(pix) != borderPixelMap.end()) if(borderPixelMap.find(pix) != borderPixelMap.end())
{ {
long int pixNeighborhood[4]; NeighIDType pixNeighborhood[4];
grm::FOURNeighborhood(pixNeighborhood, pix, imageWidth, imageHeight); grm::FOURNeighborhood(pixNeighborhood, pix, imageWidth, imageHeight);
for(short k = 0; k < 4; k++) for(short k = 0; k < 4; k++)
...@@ -393,7 +393,7 @@ void UpdateNeighborsOfNoneDuplicatedNodes(std::unordered_map<long unsigned int, ...@@ -393,7 +393,7 @@ void UpdateNeighborsOfNoneDuplicatedNodes(std::unordered_map<long unsigned int,
} }
template<class TSegmenter> template<class TSegmenter>
void RemoveDuplicatedNodes(std::unordered_map<long unsigned int, void RemoveDuplicatedNodes(std::unordered_map<std::size_t,
std::vector<typename TSegmenter::NodePointerType> >& borderPixelMap, std::vector<typename TSegmenter::NodePointerType> >& borderPixelMap,
typename TSegmenter::GraphType& graph, typename TSegmenter::GraphType& graph,
const unsigned int imageWidth) const unsigned int imageWidth)
...@@ -464,7 +464,7 @@ void BuildBorderPixelMap(typename TSegmenter::GraphType& graph, ...@@ -464,7 +464,7 @@ void BuildBorderPixelMap(typename TSegmenter::GraphType& graph,
const unsigned int colTile, const unsigned int colTile,
const unsigned int nbTilesX, const unsigned int nbTilesX,
const unsigned int nbTilesY, const unsigned int nbTilesY,
std::unordered_map<long unsigned int, std::unordered_map<std::size_t,
std::vector<typename TSegmenter::NodePointerType> >& borderPixelMap, std::vector<typename TSegmenter::NodePointerType> >& borderPixelMap,
const unsigned int imageWidth) const unsigned int imageWidth)
{ {
......
...@@ -106,7 +106,7 @@ public: ...@@ -106,7 +106,7 @@ public:
void ReadGraph(FILE * nodeStream, FILE * edgeStream) void ReadGraph(FILE * nodeStream, FILE * edgeStream)
{ {
std::unordered_map<long unsigned int, NodePointerType> nodeMap; std::unordered_map<std::size_t, NodePointerType> nodeMap;
// Read the size of the graph // Read the size of the graph
{ {
...@@ -151,7 +151,7 @@ public: ...@@ -151,7 +151,7 @@ public:
for(auto& node: this->m_Graph.m_Nodes) for(auto& node: this->m_Graph.m_Nodes)
{ {
long unsigned int nodeId; std::size_t nodeId;
fread(&(nodeId), sizeof(nodeId), 1, edgeStream); fread(&(nodeId), sizeof(nodeId), 1, edgeStream);
assert(nodeId == node->m_Id); assert(nodeId == node->m_Id);
...@@ -160,7 +160,7 @@ public: ...@@ -160,7 +160,7 @@ public:
node->m_Edges.reserve(edgeSize); node->m_Edges.reserve(edgeSize);
for(unsigned int b = 0; b < edgeSize; b++) for(unsigned int b = 0; b < edgeSize; b++)
{ {
long unsigned int targetId; std::size_t targetId;
unsigned int boundary; unsigned int boundary;
fread(&(targetId), sizeof(targetId), 1, edgeStream); fread(&(targetId), sizeof(targetId), 1, edgeStream);
fread(&(boundary), sizeof(boundary), 1, edgeStream); fread(&(boundary), sizeof(boundary), 1, edgeStream);
......
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