Overwrite existing segments when copying a new segment

Hello,

I have a vtkSegmentation with vtkSegments. When I use the method CopySegmentFromSegmentation(segmentation, segmentId), the corresponding vtkSegment is copied and overlaps the existing vtkSegments in the original vtkSegmentation.

Is there a way to overwrite the existing vtkSegments when copying a new vtkSegment, instead of overlapping?

Renzo

1 Like

Copying is different operation than painting. It will not affect any existing segments. If you want to make all segments overwrite the segments before them in the segment list, you can flatten the segmentation into a single layer. If you want to keep overlapping segments and just make some segments overwrite others then you can use the “Logical operators” effect.

1 Like

Thank you, Andras. I decided to copy the vtkSegment and then subtract it from all other already existing vtkSegments.

1 Like