# Module to flip through connected components

**URL:** <https://discourse.slicer.org/t/module-to-flip-through-connected-components/34871>\
**Category:** Support\
**Created:** [March 13, 2024, 5:02pm UTC](https://discourse.slicer.org/t/module-to-flip-through-connected-components/34871 "2024-03-13T17:02:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkraaijveld](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rkraaijveld](https://discourse.slicer.org/u/rkraaijveld)\
**Post date:** [March 13, 2024, 5:02pm UTC](https://discourse.slicer.org/t/module-to-flip-through-connected-components/34871/1 "2024-03-13T17:02:16Z")

</div>

Hi!

I want to make a module where I first input a mask and get the connected components (with Islands for example). I then somehow want to flip through the islands using Previous/Next buttons and give each connected component a score/label.

I was wondering if anyone has some advice on the flipping-through-connected-components part? I see that SegmentationReview has code for scoring, which I could use, but I am unsure how to do the first part.

Thanks!

---

<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:** [March 17, 2024, 3:01am UTC](https://discourse.slicer.org/t/module-to-flip-through-connected-components/34871/2 "2024-03-17T03:01:19Z")

</div>

You can split islands to segments in Segment Editor’s Islands effects, and then write a few-line Python script that adjusts the visibility of segments.
