I am trying to draw a segmentation in the slicer scene based on user clicks, but I find that the process of rendering the segment takes too long. I am using the code below to turn my label map into a segmentation, but I find that it runs quite slowly. Does anyone have an idea how I can speed this process up or different methods I could use to accomplish the same goal?
segmentation = segment.GetSegmentation() while segmentation.GetNumberOfSegments() > 0: segmentation.RemoveSegment(segmentation.GetNthSegment(0))
segmentation = self.view_seg.GetSegmentation()
segment = segmentation.GetSegment(segmentation.GetNthSegmentID(0))