Commit 260146a4 authored by remicres's avatar remicres

FIX: ParamType from grm used instead of the ParameterType from the old lsrm

parent 2ed36bce
......@@ -26,7 +26,7 @@ public:
};
} // end of namespace lsrm
#include "lsrmBaatzSegmenter.txx"
#include "lsgrmBaatzSegmenter.txx"
#endif
......
......@@ -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();
......
......@@ -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
......
......@@ -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,
......
......@@ -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;
{
......
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