Skip to content
Snippets Groups Projects
Commit e06cab66 authored by Julien Michel's avatar Julien Michel
Browse files

ENH: Adding an option to add or not inverted RCC8 edges

parent 7735ac39
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment