diff --git a/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.h b/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.h index 8483cfac69e05cea559322f2c197809527a0f0bc..90098ebbe9ea9018cd27d5fe41f800352d76ec6a 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 7fa8be1e57915439a3447720c8f9f59549d273df..0a26dd42aa78afdcab000bf7b40bc1570f677936 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();