# Constraining flood fill to size brushsize

**URL:** <https://discourse.slicer.org/t/constraining-flood-fill-to-size-brushsize/9146>\
**Category:** Support\
**Created:** [November 14, 2019, 11:11am UTC](https://discourse.slicer.org/t/constraining-flood-fill-to-size-brushsize/9146 "2019-11-14T11:11:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/leon/32/1468_2.png) [@Leon](https://discourse.slicer.org/u/Leon)\
**Post date:** [November 14, 2019, 11:11am UTC](https://discourse.slicer.org/t/constraining-flood-fill-to-size-brushsize/9146/1 "2019-11-14T11:11:44Z")

</div>

Yesterday I came across this video ([https://www.youtube.com/watch?v=HdTKZKumw8o](https://www.youtube.com/watch?v=HdTKZKumw8o)) from the people of Itkgray ([https://web.stanford.edu/group/vista/cgi-bin/wiki/index.php/ItkGray](https://web.stanford.edu/group/vista/cgi-bin/wiki/index.php/ItkGray)). It’s a branch of ItkSnap.

Here you see them using the paintbrush with a ‘Floodfill’ setting for segmenting the white matter of the brain.

- Set the active drawing label to ‘white’ with the correct hemisphere.
- Use the **Paintbrush tool** to fill in most of the white matter and the ventricles.  
The axial view works well for this; using **Floodfill** with the **3D brush on** at a tolerance of ~5 and/or the **square** and **round brush.**
- It may help to start dorsally and work down, cleaning up the subcortical areas as you progress.

[![](https://web.stanford.edu/group/vista/wikiupload/thumb/d/dd/Segment_coarse1.png/250px-Segment_coarse1.png)](https://web.stanford.edu/group/vista/cgi-bin/wiki/index.php/File:Segment_coarse1.png)

[![](https://www.stanford.edu/dept/its/includes/mediawiki-1.16.5/skins/common/images/magnify-clip.png)](https://web.stanford.edu/group/vista/cgi-bin/wiki/index.php/File:Segment_coarse1.png)

I was wondering if this option is also available in Slicer? I haven’t found it (yet) and from what I noticed, it now only works on the entire 3D-image and you can’t contain it to only a brushsize or other volume.

Or is there maybe a workaround for this? My idea would be to do a coarse, completely filled segmentation with for instance the ‘Fill between slices’ option and then use the ‘Flood filling’, constrained to the coarse segmentation.

Any other suggestions?

---

<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:** [November 14, 2019, 2:01pm UTC](https://discourse.slicer.org/t/constraining-flood-fill-to-size-brushsize/9146/2 "2019-11-14T14:01:58Z")

</div>

> [@Leon](#):
>
> ‘Fill between slices’ option and then use the ‘Flood filling’, constrained to the coarse segmentation.

You are very lucky. @Sunderlandkyl have just added yesterday (rev 28613) a new effect “Local threshold” Segment Editor effect (via SegmentEditorExtraEffects extension) that does this. It computes an intensity range from a small region that you draw on the image, then you Ctrl-click at the position you want to fill around. You can choose between various fill strategies (flood fill, grow from seeds, watershed) and it works quite robustly in 3D.

---

<div class="post-metadata">

**Author:** ![Leon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/leon/32/1468_2.png) [@Leon](https://discourse.slicer.org/u/Leon)\
**Post date:** [November 14, 2019, 3:19pm UTC](https://discourse.slicer.org/t/constraining-flood-fill-to-size-brushsize/9146/3 "2019-11-14T15:19:43Z")

</div>

Great work! Lucky me!
