# Faster way to draw Segmentation?

**URL:** https://discourse.slicer.org/t/faster-way-to-draw-segmentation/627
**Category:** Development
**Created:** [July 5, 2017, 1:41pm UTC](https://discourse.slicer.org/t/faster-way-to-draw-segmentation/627 "2017-07-05T13:41:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jks1995](https://avatars.discourse-cdn.com/v4/letter/j/90db22/32.png) [@jks1995](https://discourse.slicer.org/u/jks1995)
#### Post date: [July 5, 2017, 1:41pm UTC](https://discourse.slicer.org/t/faster-way-to-draw-segmentation/627/1 "2017-07-05T13:41:23Z")

</div>

Hello,

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))
slicer.modules.segmentations.logic().ImportLabelmapToSegmentationNode(label_map, segment)
segmentation = self.view_seg.GetSegmentation()
segment = segmentation.GetSegment(segmentation.GetNthSegmentID(0))
`

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [July 5, 2017, 7:51pm UTC](https://discourse.slicer.org/t/faster-way-to-draw-segmentation/627/2 "2017-07-05T19:51:02Z")

</div>

What is taking too long time? Interactive editing or the code snippet that you included?

You can make interactive editing faster by deleting the closed surface representation disable smoothing (click Update button in the representation list, closed surface representation row, set smoothing to 0).
