# Is there an option to duplicate a segment?

**URL:** <https://discourse.slicer.org/t/is-there-an-option-to-duplicate-a-segment/18074>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [June 11, 2021, 9:18am UTC](https://discourse.slicer.org/t/is-there-an-option-to-duplicate-a-segment/18074 "2021-06-11T09:18:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giovanni\_Cunha](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/giovanni_cunha/32/6942_2.png) [@Giovanni\_Cunha](https://discourse.slicer.org/u/Giovanni_Cunha)\
**Post date:** [June 11, 2021, 9:18am UTC](https://discourse.slicer.org/t/is-there-an-option-to-duplicate-a-segment/18074/1 "2021-06-11T09:18:37Z")

</div>

I would like to know how to duplicate a segmentation on Slicer. Is there some option to do it?

best

---

<div class="post-metadata">

**Author:** ![simonoxen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/simonoxen/32/66398_2.png) [@simonoxen](https://discourse.slicer.org/u/simonoxen)\
**Post date:** [June 11, 2021, 10:17am UTC](https://discourse.slicer.org/t/is-there-an-option-to-duplicate-a-segment/18074/2 "2021-06-11T10:17:03Z")

</div>

Hi, I guess you can do the following:

To duplicate a **segment** you can Add a new segment and use the Copy operation under the Logical operations Effect.

To duplicate a **segmentation** you can clone the node by right clicking → Clone in the Data module

---

<div class="post-metadata">

**Author:** ![OpenSource\_Contri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/opensource_contri/32/11189_2.png) [@OpenSource\_Contri](https://discourse.slicer.org/u/OpenSource_Contri)\
**Post date:** [June 11, 2021, 4:00pm UTC](https://discourse.slicer.org/t/is-there-an-option-to-duplicate-a-segment/18074/3 "2021-06-11T16:00:37Z")

</div>

@simonoxen  
Could you please tell where to find “clone” segment file to explore its functionalities (i.e. .cxx or .py file)?

---

<div class="post-metadata">

**Author:** ![simonoxen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/simonoxen/32/66398_2.png) [@simonoxen](https://discourse.slicer.org/u/simonoxen)\
**Post date:** [June 11, 2021, 4:17pm UTC](https://discourse.slicer.org/t/is-there-an-option-to-duplicate-a-segment/18074/4 "2021-06-11T16:17:44Z")

</div>

> To duplicate a **segment** you can Add a new segment and use the Copy operation under the Logical operations Effect.

[https://github.com/Slicer/Slicer/blob/4483cc0e6f288b0816b6329f1829d9ef8c5aa81a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorLogicalEffect.py](https://github.com/Slicer/Slicer/blob/4483cc0e6f288b0816b6329f1829d9ef8c5aa81a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorLogicalEffect.py)

> To duplicate a **segmentation** you can clone the node by right clicking → Clone in the Data module

[https://github.com/Slicer/Slicer/blob/0094e9a35bd266cc8b0e677858dabce797c9928f/Modules/Loadable/SubjectHierarchy/Logic/vtkSlicerSubjectHierarchyModuleLogic.cxx](https://github.com/Slicer/Slicer/blob/0094e9a35bd266cc8b0e677858dabce797c9928f/Modules/Loadable/SubjectHierarchy/Logic/vtkSlicerSubjectHierarchyModuleLogic.cxx)

---

<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:** [June 11, 2021, 7:32pm UTC](https://discourse.slicer.org/t/is-there-an-option-to-duplicate-a-segment/18074/5 "2021-06-11T19:32:18Z")

</div>

This question has just been asked and answered here, too:

> [@Clone Segment Button](https://discourse.slicer.org/t/clone-segment-button/18081/2):
>
> I’ve added an example for this in the script repitository: [https://slicer.readthedocs.io/en/latest/developer\_guide/script\_repository.html#clone-a-segment](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#clone-a-segment)

---

<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:** [June 12, 2021, 11:59am UTC](https://discourse.slicer.org/t/is-there-an-option-to-duplicate-a-segment/18074/6 "2021-06-12T11:59:01Z")

</div>

A post was split to a new topic: [How to disable the clone button?](https://discourse.slicer.org/t/how-to-disable-the-clone-button/18090)

---

<div class="post-metadata">

**Author:** ![Giovanni\_Cunha](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/giovanni_cunha/32/6942_2.png) [@Giovanni\_Cunha](https://discourse.slicer.org/u/Giovanni_Cunha)\
**Post date:** [June 17, 2021, 7:45am UTC](https://discourse.slicer.org/t/is-there-an-option-to-duplicate-a-segment/18074/7 "2021-06-17T07:45:52Z")

</div>

Thank you everyone for the explanations!

---

<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:** [June 17, 2021, 1:19pm UTC](https://discourse.slicer.org/t/is-there-an-option-to-duplicate-a-segment/18074/8 "2021-06-17T13:19:27Z")

</div>

I’ve submitted a pull request that makes “Clone” action clone the segment if the user right-clicks on a segment (and not clone the entire segmentation):

> <https://github.com/Slicer/Slicer/pull/5700>
>
> Previously, "Clone" action duplicated the entire segmentation node, even when ri…ght-clicked on a segment.
> This commit changes the behavior so that if the user right-clicks on a Segment and chooses Clone then only that selected segment will be cloned.

It will be probably merged within 1-2 days and appear in Slicer Preview Release the next day.
