# Add "Create new segment" or "Clone segment" feature to Segment Editor

**URL:** <https://discourse.slicer.org/t/add-create-new-segment-or-clone-segment-feature-to-segment-editor/14947>\
**Category:** Support\
**Created:** [December 8, 2020, 7:53pm UTC](https://discourse.slicer.org/t/add-create-new-segment-or-clone-segment-feature-to-segment-editor/14947 "2020-12-08T19:53:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [December 8, 2020, 7:53pm UTC](https://discourse.slicer.org/t/add-create-new-segment-or-clone-segment-feature-to-segment-editor/14947/1 "2020-12-08T19:53:15Z")

</div>

Would it be possible to modify the Segment Editor effects such that:

1. Output of a segmentation can be set as a new segment as oppose to changing the existing one. For example a setting of “Modify other segments” can be “Create a new segment”.
2. If this is not possible or feasible, can there be a right click behavior such that a clone of a segment can be created directly from the Segment Editor (as oppose to click add and then use copy from logical operations).

I think these two would make life easier for user who wants to compare how certain effects modify their data (e.g., smoothing, margin operations etc).

---

<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:** [December 8, 2020, 8:12pm UTC](https://discourse.slicer.org/t/add-create-new-segment-or-clone-segment-feature-to-segment-editor/14947/2 "2020-12-08T20:12:59Z")

</div>

> [@muratmaga](#):
>
> I think these two would make life easier for user who wants to compare how certain effects modify their data (e.g., smoothing, margin operations etc).

You can already inspect the difference with/without the last operation, without any extra steps of manually adding/removing copies of segments, by using undo/redo.

There is also a right-click menu option (in Data module) to clone a segmentation.

> [@muratmaga](#):
>
> Output of a segmentation can be set as a new segment as oppose to changing the existing one. For example a setting of “Modify other segments” can be “Create a new segment”.

An editing operation could affect many segments, so I don’t think there is general way of creating a new segment. You would need to create a completely new segmentation (which you can already do).

> [@muratmaga](#):
>
> If this is not possible or feasible, can there be a right click behavior such that a clone of a segment can be created directly from the Segment Editor (as oppose to click add and then use copy from logical operations).

Adding a “Clone segment” option would not be hard, but probably this would not work well in general, because it would force the user to switch to “Allow overlap” mode. This would interfere with the segmentation editing. Instead, for comparison, it is better to create independent segmentations, by cloning the segmentation node (right-click in Data module).

With the new way of setting view content by drag-and-drop from Data module to viewers, it is now much easier to set up node comparison in side-by-side views.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [December 8, 2020, 8:52pm UTC](https://discourse.slicer.org/t/add-create-new-segment-or-clone-segment-feature-to-segment-editor/14947/3 "2020-12-08T20:52:16Z")

</div>

> [@lassoan](#):
>
> You can already inspect the difference with/without the last operation, without any extra steps of manually adding/removing copies of segments, by using undo/redo.

But I can’t see pre/post at the same time that’s the issue using undo/redo.

> [@lassoan](#):
>
> Instead, for comparison, it is better to create independent segmentations, by cloning the segmentation node (right-click in Data module).

True, but it is harder to manipulate the visibility of individual segmentations, then it is to manipulate segments. It also requires actively switching to different segmentations in Segment Editor when you trying to experiment with different filters.

> [@lassoan](#):
>
> With the new way of setting view content by drag-and-drop from Data module to viewers, it is now much easier to set up node comparison in side-by-side views.

I remember your demo of this, but it is not in the latest stable. Is it in the preview?

---

<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:** [December 8, 2020, 9:18pm UTC](https://discourse.slicer.org/t/add-create-new-segment-or-clone-segment-feature-to-segment-editor/14947/4 "2020-12-08T21:18:59Z")

</div>

> [@muratmaga](#):
>
> But I can’t see pre/post at the same time that’s the issue using undo/redo.

Undo/redo is very fast and they are available using keyboard shortcuts (z/y). Since only one version is shown at a time, you can see the difference much more clearly than on two overlapping segments.

> [@muratmaga](#):
>
> it is harder to manipulate the visibility of individual segmentations, then it is to manipulate segments

Manipulating visibility is not enough. You need to change the color or showing thick outline only. Otherwise you would not see the difference clearly. So, you need to go to Segmentations or Data module the same way as you would do for cloning the entire segmentation.

> [@muratmaga](#):
>
> I remember your demo of this, but it is not in the latest stable. Is it in the preview?

Yes, it is in the latest preview - see [documentation](https://slicer.readthedocs.io/en/latest/user_guide/user_interface.html#selecting-displayed-data).  
[New feature post](https://discourse.slicer.org/tag/feature) will go out tomorrow (I’ve pushed two small fixes today).

* * *

I agree that it takes extra effort to go to Data module, clone the segmentation, change its display properties; and when done with the comparison then go back to Data module and delete it. So, if this comes up often and undo/redo is not sufficient then you can implement it in a Segment Editor effect. It would be similar to the preview feature in “Grow from seeds” effect and be distributed in an extension similarly to the [Autoscroll effect](https://github.com/lassoan/SlicerAutoscroll).
