# SegmentEditor Islands effect keeps the islands in the original segment

**URL:** <https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [August 14, 2019, 8:49pm UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037 "2019-08-14T20:49:26Z")\
**Posts on this page:** 17\
**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:** [August 14, 2019, 8:49pm UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/1 "2019-08-14T20:49:26Z")

</div>

I am trying to do use the islands effect to separate individual bones. While, it finishes correctly, it still retains the new created islands/segments in the original segment. I thought the behavior was to move them to the newly created segments. See screen captures. This is with r28340 on windows 10.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/a/0a924d815060f76d48f7ba9ab8ccb4c4196ced5c.jpeg)  
After i turned off the segments that are right hindlimbs and forelimbs, they are still visible in segment\_1 (green large chunk)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/6/36fea00d1e34b0d7f95d168c9e2d07aee90ce801.jpeg)

I don’t recall the functionality being like this. If this change was intentional, I find this behavior tedious. It requires me doing additional logical operations to remove them from the original segment.

I am not sure if it is relevant, but there is this error in the log file

> [WARNING][Qt] 14.08.2019 13:29:35 (unknown:0) - ctkSliderWidget::setSingleStep() 0 is out of bounds. 0 100 1
> 
> [INFO][Python] 14.08.2019 13:35:34 [Python] (C:\Slicer 4.11.0-2019-08-09\lib\Slicer-4.11\qt-scripted-modules\SegmentEditorEffects\SegmentEditorIslandsEffect.py:187) - 18 islands created (78 ignored)
> 
> [INFO][Stream] 14.08.2019 13:35:34 (unknown:0) - 18 islands created (78 ignored)
> 
> [CRITICAL][Qt] 14.08.2019 13:35:58 (unknown:0) - void \_\_cdecl qSlicerSegmentEditorAbstractEffect::modifySelectedSegmentByLabelmap(class vtkOrientedImageData \*,enum qSlicerSegmentEditorAbstractEffect::ModificationMode,const int ) : Invalid segment selection

---

<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:** [August 15, 2019, 3:16am UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/2 "2019-08-15T03:16:38Z")

</div>

You can choose the behavior using Masking / Modify other segments option. “Overwrite all” replaces content in the original segments, “Allow overlap” preserves the original segments.

---

<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:** [August 15, 2019, 4:27am UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/3 "2019-08-15T04:27:18Z")

</div>

@lassoan  
Unfortunately it happens with ‘overwrite all option’ (i.e., it doesn’t overwrite the initial segment)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/f/cf1d3f3305a9c61a4aacbcf996f247b3f2cd6cee.png)  
There is this error in the log file:

> Loaded volume from file: C:/Users/Murat/Downloads/IntensityWindowingImageFilter Output.nrrd. Dimensions: 869x998x1295. Number of components: 1. Pixel type: unsigned char.
> 
> “Volume” Reader has successfully read the file “C:/Users/Murat/Downloads/IntensityWindowingImageFilter Output.nrrd” “[1.00s]”
> 
> Switch to module: “SegmentEditor”
> 
> ctkSliderWidget::setSingleStep() 0 is out of bounds. 0 100 1
> 
> 28 islands created (14632 ignored)
> 
> 28 islands created (14632 ignored)
> 
> void \_\_cdecl qSlicerSegmentEditorAbstractEffect::modifySelectedSegmentByLabelmap(class vtkOrientedImageData \*,enum qSlicerSegmentEditorAbstractEffect::ModificationMode,const int ) : Invalid segment selection

---

<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:** [August 15, 2019, 5:08pm UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/4 "2019-08-15T17:08:33Z")

</div>

I think the behavior haven’t changed in the last few years:

- “Split islands to segments” option does not modify the original segment (you can delete the original segment if you no longer need it)
- “Add selected island” does overwrite the original segment if “overwrite all” is chosen

Do you find these behaviors not optimal for your workflow? Do you find any difference compared to Slicer-4.10?

---

<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:** [August 15, 2019, 5:37pm UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/5 "2019-08-15T17:37:58Z")

</div>

@lassoan  
Thanks, I have to give it a more careful try with the preview version. Dataset is on my home computer.

The issue is, after the island effect segmentation is not fully done. I still have to operate on Segment\_1 (e.g., isolate pelvis, the skull, left forelimb, vertebral column etc), yet Segment\_1 is unmodified. It is ok for it to remain unmodified, but at the end of the operation I would like to have a segment that I can carry on the remaining segmentation tasks without having to do additional logical operations. If I delete the segment\_1, I don’t have anything else to carry those operations.

For example, if I want to segment the thorax, I would like to use the fact that both forelimbs and scapula are already segmented.

I haven’t been using the segment editor as much as the old editor personally, so may be am missing something here. What I described was the behavior in the old island effect.

---

<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:** [August 15, 2019, 6:17pm UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/6 "2019-08-15T18:17:13Z")

</div>

Island effect has many modes. Do you have problem with the behavior of “Split islands to segments”?

---

<div class="post-metadata">

**Author:** ![hjhedgar](https://avatars.discourse-cdn.com/v4/letter/h/839c29/32.png) [@hjhedgar](https://discourse.slicer.org/u/hjhedgar)\
**Post date:** [August 29, 2019, 3:27am UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/7 "2019-08-29T03:27:24Z")

</div>

We are having the same problem with islands module, split island to segments option with the “overwrite all” selected. See screenshot. This is different than the behavior in stable version, which actually “splits” the segment into new segments. This behavior requires an additional operation to “subtract” the newly created island (or islands) from the original.  
See screenshot.

 ![55%20PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/1/a1c3099fa02ce1875e783814600db180f4e3e828.jpeg)

---

<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:** [August 30, 2019, 1:58pm UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/8 "2019-08-30T13:58:46Z")

</div>

@lassoan do you have a chance to replicate the issue with the split islands behavior?

---

<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:** [August 30, 2019, 2:24pm UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/9 "2019-08-30T14:24:12Z")

</div>

I did not try it again since my first answer.

"Split islands to segments” option does not modify the original segment. Do you find that the behavior is different in latest stable vs latest preview version?

You can delete the original segment if you no longer need it by a single click. Is the problem that you need to do this extra click?

---

<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:** [August 30, 2019, 5:51pm UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/10 "2019-08-30T17:51:02Z")

</div>

Hi Andras,

If you look at the image on the @hjhedgar post above, if you delete the segment\_1 (green), which is the original, you will no longer have any segment that contains the hand on the left side as a single structure. This was not the behavior in the stable version.

Currently the solution we found is to subtract every other segment from the original, and that gets tedious as the number your islands increase.

I think keeping the original segment is a good idea, except the result of split islands to segment should output two additional segments, a left foot only, a right foot only, and then the original.

What we have instead is the original (untouched segment) and only the right hand. That’s our issue with the current behavior.

---

<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:** [August 30, 2019, 7:37pm UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/11 "2019-08-30T19:37:52Z")

</div>

This sounds like a bug, will test again. What masking settings do you use?

---

<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:** [August 30, 2019, 8:36pm UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/12 "2019-08-30T20:36:36Z")

</div>

Same as the screen capture, (editable everywhere, overwrite all segments)

---

<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:** [September 1, 2019, 2:17am UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/13 "2019-09-01T02:17:09Z")

</div>

I could reproduce and [fixed the issue](https://github.com/Slicer/Slicer/commit/f5c1095ce34ac6f835617ab79e8a48fb4ef685ea). The problem was that due to some recent changes, current node selection was lost when the new segments were added. Thanks @muratmaga and @hjhedgar for reporting the issue and providing all the details.

@Sunderlandkyl You’ve recently investigated and fixed a similar problem of losing current segment selection. Could you have a look at this, too - why current selected segment ID is cleared when running `slicer.vtkSlicerSegmentationsModuleLogic.ImportLabelmapToSegmentationNode`? Thank you!

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [September 3, 2019, 2:37pm UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/14 "2019-09-03T14:37:11Z")

</div>

[This pull request](https://github.com/Slicer/Slicer/pull/1204) should fix the segment selection issue for most cases.

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [June 8, 2021, 3:59am UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/15 "2021-06-08T03:59:53Z")

</div>

Hi Andras,  
split island to segments is not working for my case.

I am doing it to split one labelmap. It ignores 113 islands 0 created.  
0 islands created (113 ignored).

Also I noticed the one segment in the segment editor it diappears although the label is still there but its empty now.

Regards,  
Saima Safdar

---

<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:** [June 8, 2021, 5:35am UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/16 "2021-06-08T05:35:44Z")

</div>

Split islands has a minimum island size option. If your individual islands are less than this value (which has a default of 1000 voxels), they will be removed. Try reducing this number and see if the islands are retained.

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [June 8, 2021, 5:41am UTC](https://discourse.slicer.org/t/segmenteditor-islands-effect-keeps-the-islands-in-the-original-segment/8037/17 "2021-06-08T05:41:17Z")

</div>

Yes I get it now. Thanks alot
