# Automatic segmentation of low intensity-difference layers

**URL:** <https://discourse.slicer.org/t/automatic-segmentation-of-low-intensity-difference-layers/31941>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [September 28, 2023, 2:36am UTC](https://discourse.slicer.org/t/automatic-segmentation-of-low-intensity-difference-layers/31941 "2023-09-28T02:36:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Windy](https://avatars.discourse-cdn.com/v4/letter/w/91b2a8/32.png) [@Windy](https://discourse.slicer.org/u/Windy)\
**Post date:** [September 28, 2023, 2:36am UTC](https://discourse.slicer.org/t/automatic-segmentation-of-low-intensity-difference-layers/31941/1 "2023-09-28T02:36:52Z")

</div>

Hi,

I have an image dataset where the color intensity difference of classes in an image is pretty much similar (example given below, contains 4 layers of muscle, hence 4 classes). I tried many semiautomatic algorithms like grow from seed, flood fill, watershed, etc., but none of them worked well for me. So what I do now is fill in between slices, but I have to do this at least every 20 slices to get a fairly good segmentation. My datasets are large, but if they are downsampled, lots of helpful details are lost. I also have at least 30 datasets like that. So repeating the fill-in between slices is tedious. If you have any advice or suggestions, I would be really grateful.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/0/608827d5f8cbb7480e4991ed1a3848d3ef2de2fa.jpeg)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/0/00255ca44d4b51aa6882d7f359e4734b2669f072.jpeg)

---

<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 28, 2023, 2:39am UTC](https://discourse.slicer.org/t/automatic-segmentation-of-low-intensity-difference-layers/31941/2 "2023-09-28T02:39:10Z")

</div>

Can you show a few segmented slices so that we can see what structures you need to separate?

---

<div class="post-metadata">

**Author:** ![Windy](https://avatars.discourse-cdn.com/v4/letter/w/91b2a8/32.png) [@Windy](https://discourse.slicer.org/u/Windy)\
**Post date:** [September 28, 2023, 3:31am UTC](https://discourse.slicer.org/t/automatic-segmentation-of-low-intensity-difference-layers/31941/3 "2023-09-28T03:31:29Z")

</div>

Updated the question with segmentation

---

<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:** [September 28, 2023, 3:49pm UTC](https://discourse.slicer.org/t/automatic-segmentation-of-low-intensity-difference-layers/31941/4 "2023-09-28T15:49:16Z")

</div>

until @lassoan provides more complete answer here are my thoughts

So grow from the seed should work well for yellow and blue boundary, as well as brown structure, if you apply an intensity masking along with it.

yellow green boundary is a lot more challenging, because I can’t see a feature that separates them in the lower right corner.

When you say grow from the seeds didnt work, how extensive seeding have you done? For example have you tried growth from the seed after you painted every 20 slice (like you are doing for fill between the slices).

Nowadays, deep learning can be solution for this type of challenging segmentations, but you do need some segmented data to start training a model.

---

<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 28, 2023, 4:03pm UTC](https://discourse.slicer.org/t/automatic-segmentation-of-low-intensity-difference-layers/31941/5 "2023-09-28T16:03:30Z")

</div>

I agree, “Grow from seeds” should work, the only question is how much work it takes to provide sufficient seeds. If you need to paint a lot then “Fill between slices” may be more efficient.

You can make the segmentation workflow much faster by first segmenting all the muscles and recolor parts of that segment (using Masking settings / Editable area).

I agree that nowadays you would train a neural network to automate this. However, if you only have 30 images than that may be just enough to train the network. You can try setting up MONAILabel extension or an nn-Unet training and maybe you would get usable results after 10-20 segmentation cases, so you could save some time and get some experience with AI segmentation.

---

<div class="post-metadata">

**Author:** ![Windy](https://avatars.discourse-cdn.com/v4/letter/w/91b2a8/32.png) [@Windy](https://discourse.slicer.org/u/Windy)\
**Post date:** [September 29, 2023, 1:17am UTC](https://discourse.slicer.org/t/automatic-segmentation-of-low-intensity-difference-layers/31941/6 "2023-09-29T01:17:02Z")

</div>

Thank you @muratmaga and @lassoan. I will try the MONAILabel extension as well
