diff --git a/app/otbSingleTileGRMGraph.cxx b/app/otbSingleTileGRMGraph.cxx index 50b56335f67fca5f1631c5c7fe7ed45a5374602a..e714a1d2597cb0e1985bac5669c38ae0115ad8ec 100644 --- a/app/otbSingleTileGRMGraph.cxx +++ b/app/otbSingleTileGRMGraph.cxx @@ -110,6 +110,8 @@ private: AddParameter(ParameterType_Int, "tiling.user.sizex", "Tiles width"); AddParameter(ParameterType_Int, "tiling.user.sizey", "Tiles height"); AddParameter(ParameterType_Int, "tiling.user.nfirstiter", "Number of first iterations"); + AddParameter(ParameterType_Int, "tiling.user.margin", "Allows to manually set margin between tiles."); + MandatoryOff("tiling.user.margin"); AddChoice("tiling.none", "No tiling layout"); } @@ -167,7 +169,9 @@ private: } // Run the segmentation - controller->GetTilingLayout(); + unsigned int margin = 0; + if (HasValue("tiling.user.margin")) margin = GetParameterInt("tiling.user.margin"); + controller->GetTilingLayout(margin); if (HasValue("xtileidx")) { if (HasValue("ytileidx")) { diff --git a/include/lsgrmController.h b/include/lsgrmController.h index 5be9e20a9098fef4147767b0dc61dc40ad777afa..80a1e3fc8697ff67fe8b8402bbbaaa697c4322c4 100644 --- a/include/lsgrmController.h +++ b/include/lsgrmController.h @@ -40,7 +40,7 @@ public: void Modified(); void RunSegmentation(); - void GetTilingLayout(); + void GetTilingLayout(const unsigned int margin = 0); void ProcessSingleTile(unsigned int xidx, unsigned int yidx, const SegmentationParameterType& params); void JustMergeAndAchieveSegmentation(const unsigned int maxiter); diff --git a/include/lsgrmController.txx b/include/lsgrmController.txx index f4f92fc0c82b3a78d63f00c60e9767c51169bcfb..c79dc908aacff0a1684a098166e8413f801c8196 100644 --- a/include/lsgrmController.txx +++ b/include/lsgrmController.txx @@ -213,7 +213,7 @@ void Controller<TSegmenter>::RunSegmentation() * TODO: compute the correct number of iterations ! */ template<class TSegmenter> -void Controller<TSegmenter>::GetTilingLayout() +void Controller<TSegmenter>::GetTilingLayout(const unsigned int margin) { itkDebugMacro(<< "Entering GetTilingLayout()"); @@ -229,7 +229,8 @@ void Controller<TSegmenter>::GetTilingLayout() { m_NbTilesX = std::floor(m_InputImage->GetLargestPossibleRegion().GetSize()[0] / m_TileWidth); m_NbTilesY = std::floor(m_InputImage->GetLargestPossibleRegion().GetSize()[1] / m_TileHeight); - m_Margin = static_cast<unsigned int>(pow(2, m_NumberOfFirstIterations + 1) - 2); + if (!margin) m_Margin = static_cast<unsigned int>(pow(2, m_NumberOfFirstIterations + 1) - 2); + else m_Margin = margin; } std::cout <<