# How can I access the source code for expanding margin method?

**URL:** <https://discourse.slicer.org/t/how-can-i-access-the-source-code-for-expanding-margin-method/31646>\
**Category:** Support\
**Created:** [September 11, 2023, 5:43pm UTC](https://discourse.slicer.org/t/how-can-i-access-the-source-code-for-expanding-margin-method/31646 "2023-09-11T17:43:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![erhushenshou](https://avatars.discourse-cdn.com/v4/letter/e/7993a0/32.png) [@erhushenshou](https://discourse.slicer.org/u/erhushenshou)\
**Post date:** [September 11, 2023, 5:43pm UTC](https://discourse.slicer.org/t/how-can-i-access-the-source-code-for-expanding-margin-method/31646/1 "2023-09-11T17:43:20Z")

</div>

I am now trying to read source code to learn but I have no idea to find the exact file or location for the method I am interested in at this moment. Can anyone help?

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [September 12, 2023, 2:58am UTC](https://discourse.slicer.org/t/how-can-i-access-the-source-code-for-expanding-margin-method/31646/2 "2023-09-12T02:58:17Z")

</div>

Here you go: [https://github.com/Slicer/Slicer/blob/0e332ecdadff2034071260e8ffb5dd38e8f1ab42/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorMarginEffect.py#L13](https://github.com/Slicer/Slicer/blob/0e332ecdadff2034071260e8ffb5dd38e8f1ab42/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorMarginEffect.py#L13)

I searched “margin” on the Slicer github repository and looked through the first few code results. I knew I was looking for a Segment Editor Effect, which helped.

There is also this example in the script repository which uses a VTK filter directly (though note that the margin is specified as a kernel size is in voxels rather than millimeters in that case).[Script repository — 3D Slicer documentation](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#process-segment-using-a-vtk-filter)
