# How to add segment editor erase tool logic which is in C++ to a dummy python tool?

**URL:** <https://discourse.slicer.org/t/how-to-add-segment-editor-erase-tool-logic-which-is-in-c-to-a-dummy-python-tool/16781>\
**Category:** Development\
**Tags:** python\
**Created:** [March 26, 2021, 6:19pm UTC](https://discourse.slicer.org/t/how-to-add-segment-editor-erase-tool-logic-which-is-in-c-to-a-dummy-python-tool/16781 "2021-03-26T18:19:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![akshay\_pillai](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/akshay_pillai/32/8301_2.png) [@akshay\_pillai](https://discourse.slicer.org/u/akshay_pillai)\
**Post date:** [March 26, 2021, 6:19pm UTC](https://discourse.slicer.org/t/how-to-add-segment-editor-erase-tool-logic-which-is-in-c-to-a-dummy-python-tool/16781/1 "2021-03-26T18:19:24Z")

</div>

So I was able to create a copy of the smoothing tool in segment editor and name it as “x” (using info from:[How can I create a copy of the segment editor erase effect and rename it?](https://discourse.slicer.org/t/how-can-i-create-a-copy-of-the-segment-editor-erase-effect-and-rename-it/16499)), but how can I add C++ functionality of erase into this tool in python? Any help is appreciated. 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:** [April 14, 2021, 5:54am UTC](https://discourse.slicer.org/t/how-to-add-segment-editor-erase-tool-logic-which-is-in-c-to-a-dummy-python-tool/16781/2 "2021-04-14T05:54:36Z")

</div>

All you need to do is to modify `paintApply` to call `modifySelectedSegmentByLabelmap` with the `maskImage` (similarlt as it is done in C++ in `qSlicerSegmentEditorPaintEffect::paintApply`).
