From e06cab66d18b0909c104af5206fa4d7409b3a2d9 Mon Sep 17 00:00:00 2001 From: Julien Michel <julien.michel@orfeo-toolbox.org> Date: Fri, 30 Jan 2009 16:31:28 +0100 Subject: [PATCH] ENH: Adding an option to add or not inverted RCC8 edges --- Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.h | 8 +++++++- Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.txx | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.h b/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.h index 8483cfac69..90098ebbe9 100644 --- a/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.h +++ b/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.h @@ -83,7 +83,9 @@ public: /** Toogle optimisation flag */ itkBooleanMacro(Optimisation); itkSetMacro(Optimisation,bool); - + itkBooleanMacro(UseInverted); + itkSetMacro(UseInverted,bool); + void SetSegmentationRanges(SegmentationRangesType ranges) { m_SegmentationRanges = ranges; @@ -161,6 +163,10 @@ private: /** This array stores the indices corresponding to each segmentation */ SegmentationRangesType m_SegmentationRanges; + + /** If set to true, the filter will also add the invert relationship + * between v2 and v1 */ + bool m_UseInverted; }; } // End namespace otb diff --git a/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.txx b/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.txx index 7fa8be1e57..0a26dd42aa 100644 --- a/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.txx +++ b/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.txx @@ -32,6 +32,7 @@ PolygonListToRCC8GraphFilter<TPolygonList, TOutputGraph> { this->SetNumberOfRequiredInputs(1); m_Optimisation=false; + m_UseInverted=false; } /** * Destructor. @@ -341,7 +342,10 @@ PolygonListToRCC8GraphFilter<TPolygonList, TOutputGraph> // Add the edge to the graph. otbMsgDevMacro(<<"Adding edge: "<<vIt1.GetIndex()<<" -> "<<vIt2.GetIndex()<<": "<<value); m_EdgesPerThread[threadId][EdgePairType(vIt1.GetIndex(),vIt2.GetIndex())]=value; - m_EdgesPerThread[threadId][EdgePairType(vIt2.GetIndex(),vIt1.GetIndex())]=invert[value]; + if(m_UseInverted) + { + m_EdgesPerThread[threadId][EdgePairType(vIt2.GetIndex(),vIt1.GetIndex())]=invert[value]; + } } } progress.CompletedPixel(); -- GitLab