diff --git a/include/lsgrmBaatzSegmenter.h b/include/lsgrmBaatzSegmenter.h index d8a937697cc3fb0e7e4edc1535d70b9b012cb5a7..97a6e5d6fe664dc5dc83cad83698911cfc280c48 100644 --- a/include/lsgrmBaatzSegmenter.h +++ b/include/lsgrmBaatzSegmenter.h @@ -26,7 +26,7 @@ public: }; } // end of namespace lsrm -#include "lsrmBaatzSegmenter.txx" +#include "lsgrmBaatzSegmenter.txx" #endif diff --git a/include/lsgrmController.h b/include/lsgrmController.h index dcff2518b4d65e7361c21803f4c3b15a01d884d8..4dfe9258c6f45c6f9d8e0ceb03a676ffe0a5ee39 100644 --- a/include/lsgrmController.h +++ b/include/lsgrmController.h @@ -29,7 +29,7 @@ public: using SegmenterType = TSegmenter; using ImageType = typename SegmenterType::ImageType; using LabelImageType = typename SegmenterType::LabelImageType; - using SegmentationParameterType = typename SegmenterType::ParameterType; + using SegmentationParameterType = typename SegmenterType::ParamType; /* Default constructor and destructor. */ Controller(); diff --git a/include/lsgrmController.txx b/include/lsgrmController.txx index 569e2e20dd2926036ad615a0e32094ddf7f0dbf4..d1ac3daba1287bdb8df24a97591acf457779b980 100644 --- a/include/lsgrmController.txx +++ b/include/lsgrmController.txx @@ -103,8 +103,15 @@ void Controller<TSegmenter>::RunSegmentation() m_InputImage->GetNumberOfComponentsPerPixel(), isFusion); - // Update the given number of iterations - numberOfIterationsRemaining -= numberOfIterationsForPartialSegmentations; + // Update the number of iterations remaining + if (numberOfIterationsRemaining > numberOfIterationsForPartialSegmentations) + { + numberOfIterationsRemaining -= numberOfIterationsForPartialSegmentations; + } + else + { + isFusion = false; + } #ifdef OTB_USE_MPI // Gathering useful variables @@ -134,7 +141,7 @@ void Controller<TSegmenter>::RunSegmentation() m_InputImage->GetNumberOfComponentsPerPixel(), numberOfIterationsRemaining); -// ShowTime(t); + // ShowTime(t); } else // accumulatedMemory > m_Memory diff --git a/include/lsgrmGraphOperations.h b/include/lsgrmGraphOperations.h index 19729d8f42d1823b24879d4ba96b9ac451a9b0e5..00b1b5771f7d13e4e0539e0f764b7bcd0a58ada6 100644 --- a/include/lsgrmGraphOperations.h +++ b/include/lsgrmGraphOperations.h @@ -33,7 +33,7 @@ typename TSegmenter::ImageType::Pointer ReadImageRegion( template<class TSegmenter> typename TSegmenter::LabelImageType::Pointer MergeAllGraphsAndAchieveSegmentation( - const typename TSegmenter::ParameterType& params, + const typename TSegmenter::ParamType& params, const float& threshold, std::vector<ProcessingTile>& tiles, const unsigned int nbTilesX, @@ -46,7 +46,7 @@ MergeAllGraphsAndAchieveSegmentation( template<class TSegmenter> long long unsigned int RunFirstPartialSegmentation( typename TSegmenter::ImageType * inputPtr, - const typename TSegmenter::ParameterType& params, + const typename TSegmenter::ParamType& params, const float& threshold, const unsigned int niter, const unsigned int niter2, @@ -59,7 +59,7 @@ long long unsigned int RunFirstPartialSegmentation( template<class TSegmenter> long long unsigned int RunPartialSegmentation( - const typename TSegmenter::ParameterType& params, + const typename TSegmenter::ParamType& params, const float& threshold, const unsigned int niter, std::vector<ProcessingTile>& tiles, diff --git a/include/lsgrmGraphOperations.txx b/include/lsgrmGraphOperations.txx index cf2b017bace24a5faaa4c21743a5c1e9e06e5836..b4ce481159ecefa717db1563eb11c729a026fa53 100644 --- a/include/lsgrmGraphOperations.txx +++ b/include/lsgrmGraphOperations.txx @@ -24,7 +24,7 @@ typename TSegmenter::ImageType::Pointer ReadImageRegion( template<class TSegmenter> typename TSegmenter::LabelImageType::Pointer MergeAllGraphsAndAchieveSegmentation( - const typename TSegmenter::ParameterType& params, + const typename TSegmenter::ParamType& params, const float& threshold, std::vector<ProcessingTile>& tiles, const unsigned int nbTilesX, @@ -106,7 +106,7 @@ MergeAllGraphsAndAchieveSegmentation( } template<class TSegmenter> -long long unsigned int RunPartialSegmentation(const typename TSegmenter::ParameterType& params, +long long unsigned int RunPartialSegmentation(const typename TSegmenter::ParamType& params, const float& threshold, const unsigned int niter, std::vector<ProcessingTile>& tiles, @@ -131,13 +131,12 @@ long long unsigned int RunPartialSegmentation(const typename TSegmenter::Paramet if (MyTurn(row*nbTilesX + col)) { // Get the current tile - ProcessingTile currentTile = tiles[row*nbTilesX + col]; - - TSegmenter segmenter; std::cout << "Processing tile " << row << ", " << col << std::endl; - std::cout << "\tLoad graph..." << std::endl; + ProcessingTile currentTile = tiles[row*nbTilesX + col]; // Load the graph + std::cout << "\tLoad graph..." << std::endl; + TSegmenter segmenter; ReadGraph<TSegmenter>(segmenter.m_Graph, currentTile.nodeFileName, currentTile.edgeFileName); // Add stability margin to the graph @@ -146,10 +145,8 @@ long long unsigned int RunPartialSegmentation(const typename TSegmenter::Paramet AddStabilityMargin<TSegmenter>(segmenter.m_Graph, tiles, row, col, nbTilesX, nbTilesY); - std::unordered_map<long unsigned int, - std::vector<typename TSegmenter::NodePointerType> > borderPixelMap; - std::cout << "\tBuild border pixel map..." << std::endl; + std::unordered_map<long unsigned int, std::vector<typename TSegmenter::NodePointerType> > borderPixelMap; BuildBorderPixelMap<TSegmenter>(segmenter.m_Graph, currentTile, row, col, nbTilesX, nbTilesY, borderPixelMap, imageWidth); @@ -217,7 +214,7 @@ long long unsigned int RunPartialSegmentation(const typename TSegmenter::Paramet typename TSegmenter::GraphType graph; ReadGraph<TSegmenter>(graph, currentTile.nodeFileName, currentTile.edgeFileName); - // Extract stability margin for all borders different from 0 imageWidth-1 et imageHeight - + // Extract stability margin for all borders different from 0 imageWidth-1 and imageHeight-1 // and write them to the stability margin { std::unordered_map<typename TSegmenter::NodePointerType, unsigned int> borderNodeMap; @@ -567,26 +564,26 @@ void AddStabilityMargin(typename TSegmenter::GraphType& graph, // Margin to retrieve at bottom right if(row < nbTilesY - 1 && col < nbTilesX - 1) { - InsertNodesFromTile<TSegmenter>(graph, tiles[ (row+1) * nbTilesX + (col+1)]); + InsertNodesFromTile<TSegmenter>(graph, tiles[(row+1) * nbTilesX + (col+1)]); } // Margin to retrieve at bottom left if(row < nbTilesY - 1 && col > 0) { - InsertNodesFromTile<TSegmenter>(graph, tiles[ (row+1) * nbTilesX + (col-1)]); + InsertNodesFromTile<TSegmenter>(graph, tiles[(row+1) * nbTilesX + (col-1)]); } // Margin to retrieve at top left if(row > 0 && col > 0) { - InsertNodesFromTile<TSegmenter>(graph, tiles[ (row-1) * nbTilesX + (col-1)]); + InsertNodesFromTile<TSegmenter>(graph, tiles[(row-1) * nbTilesX + (col-1)]); } } template<class TSegmenter> long long unsigned int RunFirstPartialSegmentation( typename TSegmenter::ImageType * inputPtr, - const typename TSegmenter::ParameterType& params, + const typename TSegmenter::ParamType& params, const float& threshold, const unsigned int niter, const unsigned int niter2, @@ -660,7 +657,7 @@ long long unsigned int RunFirstPartialSegmentation( std::cout << "\tWriting graph..." << std::endl; WriteGraph<TSegmenter>(segmenter.m_Graph, currentTile.nodeFileName, currentTile.edgeFileName); - // Extract stability margin for all borders different from 0 imageWidth-1 et imageHeight -1 + // Extract stability margin for all borders different from 0 imageWidth-1 and imageHeight -1 // and write them to the stability margin std::cout << "\tComputing stability margin..." << std::endl; {