# Markup notification

**URL:** <https://discourse.slicer.org/t/markup-notification/7541>\
**Category:** Support\
**Created:** [July 11, 2019, 10:11pm UTC](https://discourse.slicer.org/t/markup-notification/7541 "2019-07-11T22:11:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gcsharp](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/gcsharp/32/863_2.png) [@gcsharp](https://discourse.slicer.org/u/gcsharp)\
**Post date:** [July 11, 2019, 10:11pm UTC](https://discourse.slicer.org/t/markup-notification/7541/1 "2019-07-11T22:11:18Z")

</div>

Hi, I am testing out the repository script “Get a notification if a markup point position is modified”. It is working (stuff being printed in python console) in Slicer 4.10.1, but I am getting no notifications in the version I just compiled early this week. Any idea what is going on?

Below is the script.

```
def onMarkupsNodeModified(markupsNode, unusedArg2=None, unusedArg3=None):
  sliceView = markupsNode.GetAttribute('Markups.MovingInSliceView')
  if not sliceView:
    print("Markup list was modified")
    return
  movingMarkupIndex = markupsNode.GetAttribute('Markups.MovingMarkupIndex')
  pos = [0,0,0]
  markupsNode.GetNthFiducialPosition(int(movingMarkupIndex), pos)  
  print("Markup {0} was moved in slice view {1} to {2}".format(movingMarkupIndex, sliceView, pos))

markupsNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsFiducialNode")
markupsNode.CreateDefaultDisplayNodes()
markupsNode.AddFiducial(0,0,0)
markupsNode.AddObserver(vtk.vtkCommand.ModifiedEvent, onMarkupsNodeModified)
```

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [July 11, 2019, 10:23pm UTC](https://discourse.slicer.org/t/markup-notification/7541/2 "2019-07-11T22:23:00Z")

</div>

I see that the wiki ScriptRepository might have some outdated examples as you are referring to.  
[https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get\_a\_notification\_if\_a\_markup\_point\_position\_is\_modified](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_a_notification_if_a_markup_point_position_is_modified)  
@lassoan Do you mind updating these examples for the nightly documentation wiki pages?

Markups has changed a good bit in the Slicer nightly. I would suggest reading the markups section of the migration guide which details some changes about markup events. [https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/MigrationGuide/Slicer#Markups](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/MigrationGuide/Slicer#Markups)

Another discussion about recent changes to Markups events can be found at:  
[Handle Markups events from an external module](https://discourse.slicer.org/t/handle-markups-events-from-an-external-module/6332)

---

<div class="post-metadata">

**Author:** ![gcsharp](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/gcsharp/32/863_2.png) [@gcsharp](https://discourse.slicer.org/u/gcsharp)\
**Post date:** [July 11, 2019, 10:29pm UTC](https://discourse.slicer.org/t/markup-notification/7541/3 "2019-07-11T22:29:14Z")

</div>

Very informative links. 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:** [July 12, 2019, 2:24pm UTC](https://discourse.slicer.org/t/markup-notification/7541/4 "2019-07-12T14:24:47Z")

</div>

I’ve updated the markups observation examples in the script repository according to the changed API.

---

<div class="post-metadata">

**Author:** ![timeanddoctor](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/timeanddoctor/32/5839_2.png) [@timeanddoctor](https://discourse.slicer.org/u/timeanddoctor)\
**Post date:** [December 15, 2019, 1:29pm UTC](https://discourse.slicer.org/t/markup-notification/7541/5 "2019-12-15T13:29:21Z")

</div>

There is still a problem for me that when I add the marksup in a transform, and this seems naver change unless ‘harden’ the transform.  
So, is there any method to find wheater a marksup was in a transform already?

---

<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:** [December 15, 2019, 2:10pm UTC](https://discourse.slicer.org/t/markup-notification/7541/6 "2019-12-15T14:10:02Z")

</div>

If you want to get notification about transform changes, you can observe vtkMRMLTransformableNode::TransformModifiedEvent.

For performance reasons, it is important to be able to observe point coordinates changes from node transform changes, but if we find that observing two events instead of only one puts unreasonable burden on developers then we can add a new “PointModifiedWorld” event.
