# Methods to Make 3D Segment Editor Faster

**URL:** https://discourse.slicer.org/t/methods-to-make-3d-segment-editor-faster/5734
**Category:** Support
**Tags:** segmentation
**Created:** [February 11, 2019, 10:38pm UTC](https://discourse.slicer.org/t/methods-to-make-3d-segment-editor-faster/5734 "2019-02-11T22:38:35Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![triple\_axel](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@triple\_axel](https://discourse.slicer.org/u/triple_axel)
#### Post date: [February 11, 2019, 10:38pm UTC](https://discourse.slicer.org/t/methods-to-make-3d-segment-editor-faster/5734/1 "2019-02-11T22:38:35Z")

</div>

Hi,

Currently, the 3D segment editor tool is running very slowly on my laptop whenever I try to segment a 3D volume.

I was wondering if there were any methods to make this process faster?

Thanks

---

<div class="post-metadata">

### Author: ![gleman](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@gleman](https://discourse.slicer.org/u/gleman)
#### Post date: [February 11, 2019, 11:01pm UTC](https://discourse.slicer.org/t/methods-to-make-3d-segment-editor-faster/5734/2 "2019-02-11T23:01:19Z")

</div>

I just had the same issue and noticed that the GPU memory size in the Volume Rendering / Advanced widget had been reset to 128MB. Setting it back to 6GB (which my video card supports) got it back to it’s old snappy self. YMMV.

I’ve added the following in the startup code of my scripts:

```
volumeRenderingGPUNode = slicer.util.getNodesByClass('vtkMRMLGPURayCastVolumeRenderingDisplayNode')[0]
volumeRenderingGPUNode.SetGPUMemorySize(6144)
```

---

<div class="post-metadata">

### Author: ![triple\_axel](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@triple\_axel](https://discourse.slicer.org/u/triple_axel)
#### Post date: [February 12, 2019, 4:08pm UTC](https://discourse.slicer.org/t/methods-to-make-3d-segment-editor-faster/5734/3 "2019-02-12T16:08:49Z")

</div>

Hi, I set mine back to 4GP as that is what my video card supports, and it does in fact run faster then before, but not as fast as I need it to be. Do you have any other tips/tricks to make segmentation in 3D views faster? (Through scripts)

---

<div class="post-metadata">

### Author: ![triple\_axel](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@triple\_axel](https://discourse.slicer.org/u/triple_axel)
#### Post date: [February 13, 2019, 10:06pm UTC](https://discourse.slicer.org/t/methods-to-make-3d-segment-editor-faster/5734/4 "2019-02-13T22:06:23Z")

</div>

I managed to make it a bit faster by increasing the scaling for volume rendering through scripts (using Crop Volume).  
However, it still does not run fast enough.  
Would one issue perhaps creating a 3D Closed Surface rather then a Binary LabelMap? What is the difference between the two? If I were to instead create a binary labelmap to edit from could I use the same script I’ve been using to activate/run the Segment Editor?  
Would anyone have any example scripts for conversion to Binary Label Map?

Thanks

---

<div class="post-metadata">

### Author: ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)
#### Post date: [February 13, 2019, 10:23pm UTC](https://discourse.slicer.org/t/methods-to-make-3d-segment-editor-faster/5734/5 "2019-02-13T22:23:32Z")

</div>

The reason it’s slow is probably because you have Show 3D turned on, and whenever your segmentation changes it updates the 3D surface. You don’t need the surface for segmentation, it is only a visual aid. The underlying representation that you edit in Segment Editor is actually a binary labelmap, and conversion is done automatically. Please refer to this page:  
[https://www.slicer.org/wiki/Documentation/Nightly/Modules/Segmentations](https://www.slicer.org/wiki/Documentation/Nightly/Modules/Segmentations)

It would be possible to not convert to surface but do volume rendering without any conversion, but it has not been added yet. In the meantime you can turn off 3D and only show it when necessary.

---

<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: [February 13, 2019, 10:37pm UTC](https://discourse.slicer.org/t/methods-to-make-3d-segment-editor-faster/5734/6 "2019-02-13T22:37:58Z")

</div>

You can get very fast 3D updates if you disable surface smoothing (see checkbox in drop-down menu of `Show 3D` button).

---

<div class="post-metadata">

### Author: ![triple\_axel](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@triple\_axel](https://discourse.slicer.org/u/triple_axel)
#### Post date: [February 14, 2019, 3:43pm UTC](https://discourse.slicer.org/t/methods-to-make-3d-segment-editor-faster/5734/7 "2019-02-14T15:43:35Z")

</div>

Thank you so much for all the help and quick replies!

---

<div class="post-metadata">

### Author: ![triple\_axel](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@triple\_axel](https://discourse.slicer.org/u/triple_axel)
#### Post date: [February 14, 2019, 5:01pm UTC](https://discourse.slicer.org/t/methods-to-make-3d-segment-editor-faster/5734/8 "2019-02-14T17:01:45Z")

</div>

Sorry I have one more quick question about this.  
I know how to disable surface smoothening by setting “smoothing factor” to 0 using the segmentation node:  
seg.GetSegmentation().SetConversionParameter(‘Smoothing factor’,‘0.0’)  
before activating the segment editor widget.

However, how do I enable the surface smoothening display again once I turn off any segment editor affects, or when I do:  
segmentEditorWidget.setActiveEffectByName(“None”)  
When I do seg.GetSegmentation().SetConversionParameter(‘Smoothing factor’,‘0.5’) nothing happens and it still stays unsmoothened.

Also, I was wondering how to set the diameter of the brush in segment editor to a specific size (ie 10%) through scripts?

---

<div class="post-metadata">

### Author: ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)
#### Post date: [February 14, 2019, 8:18pm UTC](https://discourse.slicer.org/t/methods-to-make-3d-segment-editor-faster/5734/9 "2019-02-14T20:18:48Z")

</div>

I guess you just need to request conversion again using the new conversion parameter:

```
seg.GetSegmentation().CreateRepresentation('Closed surface', True) # Last parameter forces conversion even if it exists
seg.Modified() # Update display
```

---

<div class="post-metadata">

### Author: ![triple\_axel](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@triple\_axel](https://discourse.slicer.org/u/triple_axel)
#### Post date: [February 15, 2019, 2:43pm UTC](https://discourse.slicer.org/t/methods-to-make-3d-segment-editor-faster/5734/10 "2019-02-15T14:43:53Z")

</div>

That did the trick, thanks a bunch.
