# Hidden crop when GROW from seeds tool is applied (Segment Editor Module)

**URL:** <https://discourse.slicer.org/t/hidden-crop-when-grow-from-seeds-tool-is-applied-segment-editor-module/17793>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [May 25, 2021, 3:26pm UTC](https://discourse.slicer.org/t/hidden-crop-when-grow-from-seeds-tool-is-applied-segment-editor-module/17793 "2021-05-25T15:26:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ond12](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ond12/32/8706_2.png) [@ond12](https://discourse.slicer.org/u/ond12)\
**Post date:** [May 25, 2021, 3:26pm UTC](https://discourse.slicer.org/t/hidden-crop-when-grow-from-seeds-tool-is-applied-segment-editor-module/17793/1 "2021-05-25T15:26:25Z")

</div>

Hello 3DSlicer forum ,

I have encountered a weird behavior with the tool “Grow From Seed” in the Segment Editor module :

Sometimes when I apply Grow from Seeds , after having painted inside a segment (choosing “inside segment” and “overwrite visible” as parameters), my previous segment (in which I have painted) isn’t fully completed.  
Like the "Grow from seed " tool only take into account a small region and not my entire segment mask. For information, the mask (i.e. the bone on which I apply my Grow from seeds), is the tibia completely colored initially.  
Also, normally by coloring my tibia completely on more images I won’t have this error, but I would like to know if it is possible to color automatically the whole mask.

Therefore the “Grow from seed” Result stop abrulty at a line.

 ![GFS_CROPED.PNG](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/e/eee317361bea27c8c7bafd7fa2a16c0df2ac5c58.jpeg)

Another same example but here we can clearly see the left bottom left and rigth boudaries of the blur grow from seed result.

 ![cropGFS](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/b/2b5627cb577e6448111c0089a98b8fc91a9ff3fa.png)

Do you know why ? Is there a solution for this problem ? ( If necessary I not afraid of scripting something )

---

<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:** [May 26, 2021, 4:23am UTC](https://discourse.slicer.org/t/hidden-crop-when-grow-from-seeds-tool-is-applied-segment-editor-module/17793/2 "2021-05-26T04:23:18Z")

</div>

Region growing is performed around the area designated by the seeds, expanded with about a 20% margin on all sides. All you need to do to expand the segmentation further in any direction is to paint a small additional seed close to the boundary.

---

<div class="post-metadata">

**Author:** ![ond12](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ond12/32/8706_2.png) [@ond12](https://discourse.slicer.org/u/ond12)\
**Post date:** [May 26, 2021, 7:00am UTC](https://discourse.slicer.org/t/hidden-crop-when-grow-from-seeds-tool-is-applied-segment-editor-module/17793/3 "2021-05-26T07:00:09Z")

</div>

hello Lassoan ,

Thanks for you help, so I need to do some manual paint for this tool to work.  
Is there a way to tweak the code or script something to automate this task ?

Remove the region limitation or increase the margin maybe ?

---

<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:** [May 26, 2021, 5:42pm UTC](https://discourse.slicer.org/t/hidden-crop-when-grow-from-seeds-tool-is-applied-segment-editor-module/17793/4 "2021-05-26T17:42:59Z")

</div>

Grow from seeds requires a at least one small seed region for each segment. For easy segmentation tasks you can generate these seeds fully automatically or use other tools (e.g., Thresholding and Islands / Split islands to segments). If you describe what you would like to achieve on what kind of images then we can give more specific advice.

---

<div class="post-metadata">

**Author:** ![ond12](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ond12/32/8706_2.png) [@ond12](https://discourse.slicer.org/u/ond12)\
**Post date:** [May 28, 2021, 7:57am UTC](https://discourse.slicer.org/t/hidden-crop-when-grow-from-seeds-tool-is-applied-segment-editor-module/17793/5 "2021-05-28T07:57:11Z")

</div>

Hello Lassoan,

Thank you for your time and your help. I think I misspoke indeed my goal is not really to do the segmentation of this image ( it was just an example to illustrate an issue in the grow from seed tool that I want to correct) .

I’m currently develloping a Python module extension that use the grow from seed tool.

I want to know how it’s possible to remove this Roi limitation in the GFS tool by code and set the work region for a whole segmentation mask ?

Is there a solution for this problem , Should I go c++ or still possible in python in which files ?

Best regards  
Thank you

---

<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:** [May 28, 2021, 7:48pm UTC](https://discourse.slicer.org/t/hidden-crop-when-grow-from-seeds-tool-is-applied-segment-editor-module/17793/6 "2021-05-28T19:48:20Z")

</div>

You can modify `extentGrowthRatio` to add a larger margin around the seeds. If you specify a very large value then it will always include the entire volume. For example, if you use the Segment editor module:

```python
gfs = slicer.modules.SegmentEditorWidget.editor.effectByName('Grow from seeds').self()
gfs.extentGrowthRatio = 10000

```

You may also try Local threshold effect, which takes care of the extent (it uses whatever large extent is needed), allows setting the threshold range in the same tool (you draw a small region to specify the threshold range, then you get the complete segmentation with a single Ctrl-click):

> [@New Segment Editor effect: Local threshold](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233):
>
> Local threshold, a new semi-automatic segmentation method, has been added to the Segment Editor. It is available in both the 4.11.0 and 4.10.2 releases through the SegmentEditorExtraEffects extension. This effect adds connected voxels to segments that are within a specified threshold, and attempts to prevent leaks into other structures through small connecting regions. The result is similar to that of the “Level trace” effect in that it delineates a region within a certain threshold value, howev…
