# Feedbacks / Updating segment editor node after each paint/erase effect

**URL:** <https://discourse.slicer.org/t/feedbacks-updating-segment-editor-node-after-each-paint-erase-effect/19187>\
**Category:** Support\
**Created:** [August 13, 2021, 2:07pm UTC](https://discourse.slicer.org/t/feedbacks-updating-segment-editor-node-after-each-paint-erase-effect/19187 "2021-08-13T14:07:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raj\_Kumar\_Ranabhat](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/raj_kumar_ranabhat/32/9857_2.png) [@Raj\_Kumar\_Ranabhat](https://discourse.slicer.org/u/Raj_Kumar_Ranabhat)\
**Post date:** [August 13, 2021, 2:07pm UTC](https://discourse.slicer.org/t/feedbacks-updating-segment-editor-node-after-each-paint-erase-effect/19187/1 "2021-08-13T14:07:26Z")

</div>

Hi andras, @lassoan

Are there any way to check programmatically using python whether erase/paint has been done?

In our project, we are using erase effect to erase the portion of the segmentation node.  
First, we set volume, segmentation, and segment for segment editor widget, and when our resection tool is on then we set to erase effect.

We want update/feedback in each bite of segmentation. But this is not happening.  
a small portion of code is given below.

def turnONOrOFF(self, seg):  
if self.turnToolSelector.currentText == ‘On’:  
if self.resectToolTypeSelector.currentText == ‘Sphere Brush’:  
seg.GetSegmentation().SetConversionParameter(‘Smoothing factor’, ‘0.0’)  
self.segmentEditorWidget.setActiveEffectByName(“Erase”)  
effect = self.segmentEditorWidget.activeEffect()  
effect.setCommonParameter(“EditIn3DViews”, “1”)  
effect.setCommonParameter(“BrushSphere”, “1”)  
effect.setCommonParameter(“BrushAbsoluteDiameter”, 60)  
print(self.segmentEditorNode)  
else:  
self.segmentEditorWidget.setActiveEffectByName(“Scissors”)  
effect = self.segmentEditorWidget.activeEffect()  
effect.setParameter(‘Shape’, ‘Rectangle’)  
else:  
self.segmentEditorWidget.setActiveEffectByName(“None”)  
seg1 = slicer.mrmlScene.GetNodesByName(“Spine”).GetItemAsObject(0)  
seg2 = slicer.mrmlScene.GetNodesByName(‘All Segments’).GetItemAsObject(0)  
seg1.GetSegmentation().CreateRepresentation(‘Closed surface’, True)  
seg2.GetSegmentation().CreateRepresentation(‘Closed surface’, True)  
seg1.Modified()  
seg2.Modified()

I have printed segmentEditorNode to see the attributes. I would like to see these attributes in every bite during erase effect.

What are possible options ?

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:** [August 13, 2021, 7:54pm UTC](https://discourse.slicer.org/t/feedbacks-updating-segment-editor-node-after-each-paint-erase-effect/19187/2 "2021-08-13T19:54:59Z")

</div>

You can add an observer to various modified events of the segmentation node. It notifies you not just about paint/erase but about all editing operations.

---

<div class="post-metadata">

**Author:** ![Raj\_Kumar\_Ranabhat](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/raj_kumar_ranabhat/32/9857_2.png) [@Raj\_Kumar\_Ranabhat](https://discourse.slicer.org/u/Raj_Kumar_Ranabhat)\
**Post date:** [August 17, 2021, 2:02am UTC](https://discourse.slicer.org/t/feedbacks-updating-segment-editor-node-after-each-paint-erase-effect/19187/3 "2021-08-17T02:02:11Z")

</div>

Thank you @lassoan . It is really helpful.
