diff --git a/Code/BasicFilters/otbUnaryFunctorObjectListFilter.txx b/Code/BasicFilters/otbUnaryFunctorObjectListFilter.txx index 4c2b3950f1fbfdf1dfb0d9d5a6d95e35e40c7977..0aa90629668bf1393bce87aefa00c6433d6c645d 100644 --- a/Code/BasicFilters/otbUnaryFunctorObjectListFilter.txx +++ b/Code/BasicFilters/otbUnaryFunctorObjectListFilter.txx @@ -76,11 +76,14 @@ UnaryFunctorObjectListFilter<TInputList,TOutputList,TFunction> OutputListPointer outputPtr = this->GetOutput(); for (unsigned int i=0; i< this->m_ObjectListPerThread.size(); ++i) { + if(this->m_ObjectListPerThread[i].IsNotNull()) + { for (OutputListIterator it = this->m_ObjectListPerThread[i]->Begin(); it != this->m_ObjectListPerThread[i]->End(); ++it) - { + { outputPtr->PushBack(it.Get()); + } } } 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 36a7368a31d3e58e6be1e4e1440659e4dc3afac6..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,6 +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; + if(m_UseInverted) + { + m_EdgesPerThread[threadId][EdgePairType(vIt2.GetIndex(),vIt1.GetIndex())]=invert[value]; + } } } progress.CompletedPixel();