# Possible regression in events triggered by plane and ROI markups

**URL:** <https://discourse.slicer.org/t/possible-regression-in-events-triggered-by-plane-and-roi-markups/40474>\
**Category:** Development\
**Tags:** bug, markups\
**Created:** [December 2, 2024, 11:34am UTC](https://discourse.slicer.org/t/possible-regression-in-events-triggered-by-plane-and-roi-markups/40474 "2024-12-02T11:34:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rfenioux](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rfenioux/32/70007_2.png) [@rfenioux](https://discourse.slicer.org/u/rfenioux)\
**Post date:** [December 2, 2024, 11:34am UTC](https://discourse.slicer.org/t/possible-regression-in-events-triggered-by-plane-and-roi-markups/40474/1 "2024-12-02T11:34:18Z")

</div>

Hi all,

I am encountering an inconsistent behavior regarding the handling of events for plane and ROI markups in the latest preview version of Slicer, comparing to the stable release (slicer 5.6.2)

It seems that in the cases detailed below, some events are missing.

Here is the detailed behaviour :

**Reproduction:**  
OS = Windows 11  
Slicer version = 5.7.0 (revision 33134, built 2024-12-01) compared to slicer 5.6.2 (both installed from binaries)

1. Create the markups (plane or ROI) using the markups module
2. use the following snippet to get the node and connect the observers

```auto
# retrieve the node using its name (default is P for plane, R for ROI)
node = getNode("P")
# connect callbacks 
node.AddObserver(slicer.vtkMRMLMarkupsROINode.PointStartInteractionEvent, lambda *_: print("start"))
node.AddObserver(slicer.vtkMRMLMarkupsROINode.PointModifiedEvent, lambda *_: print("modified"))
node.AddObserver(slicer.vtkMRMLMarkupsROINode.PointEndInteractionEvent, lambda *_: print("end"))

```

1. observe the console logs while click and dragging either the center point, or the corner (or side) handles

**Results:**  
Here are the events triggered depending on the use cases

| Use case | Slicer 5.6.2 | Slicer 5.7.2 2024-12-01 |
| --- | --- | --- |
| Dragging center of ROI | startInteraction, modified, endInteraction | modified |
| Dragging corner of ROI | startInteraction, modified, endInteraction | modified |
| Draging center of plane markup | startInteraction, modified, endInteraction | startInteraction, modifiedEvents, endInteraction |
| Dragging corner of plane markup | StartInteraction, endInteraction\* | No event |

\*The first time a corner of the plane is moved in 5.6.2, a single `modifiedEvent` is triggered between the `start` and `end` events

To me it seems like a regression, unless I have missed an API change regarding the events of these markups. I didn’t notice any change in other markups (fiducial, line, angle…) but I haven’t tried all of them.

I would be grateful if you have any insight on what could be causing these changes.

---

<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 2, 2024, 4:03pm UTC](https://discourse.slicer.org/t/possible-regression-in-events-triggered-by-plane-and-roi-markups/40474/2 "2024-12-02T16:03:03Z")

</div>

Control point modifications still invoke PointStartInterActionEvent, PointModifiedEvent, PointEndInteractionEvent events. However, plane and ROI position and sizes are not defined by control points but mostly by the new vtkMRMLInteractionWidget, which does not emit start/end interaction events. It may be still possible to add these events to the interaction widget before we release Slicer-5.8. To make sure we try to include this, please add an issue at [https://issues.slicer.org](https://issues.slicer.org).

Can you write about your use case? How do you use these interaction events?

---

<div class="post-metadata">

**Author:** ![rfenioux](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rfenioux/32/70007_2.png) [@rfenioux](https://discourse.slicer.org/u/rfenioux)\
**Post date:** [December 2, 2024, 4:45pm UTC](https://discourse.slicer.org/t/possible-regression-in-events-triggered-by-plane-and-roi-markups/40474/3 "2024-12-02T16:45:21Z")

</div>

Thank you for the clarification.

[Here is the link](https://github.com/Slicer/Slicer/issues/8074) to the corresponding issue I created.

We often use markups as handles for controlling 3D assets and rely on those events to update their properties.

---

<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 2, 2024, 5:02pm UTC](https://discourse.slicer.org/t/possible-regression-in-events-triggered-by-plane-and-roi-markups/40474/4 "2024-12-02T17:02:32Z")

</div>

You can control 3D assets using node modified events. It is only necessary to know about interaction (when the user depresses and releases the mouse button) in very rare, special cases, such as you cannot de real-time updates continuouslt. What is your special use case?

Are you aware that transforms have now widgets in 2D and 3D (so you don’t need to use ROIs or planes for positioning, rotating, and scaling them)?

---

<div class="post-metadata">

**Author:** ![rfenioux](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rfenioux/32/70007_2.png) [@rfenioux](https://discourse.slicer.org/u/rfenioux)\
**Post date:** [December 3, 2024, 1:19pm UTC](https://discourse.slicer.org/t/possible-regression-in-events-triggered-by-plane-and-roi-markups/40474/5 "2024-12-03T13:19:45Z")

</div>

Start- and End- interaction events are used for undo / redo logic.

Real time updates also pose a problem when performance is an issue (e.g when the event is triggering a processing pipeline on the data). Sometimes it makes more sense to let the user do the positioning and re-run the pipeline only once on mouse release than to do it real time with too much lag.

I understand that there are options around it, but none of them are painless. And from a developer perspective, I think it would be valuable to keep the API consistent for all markups types. Having some markups not trigger the same events as others adds a bit of complexity, since it is not immediately obvious why they would have a different behavior. So I think it could be worth adding these events back.

---

<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 11, 2024, 2:31pm UTC](https://discourse.slicer.org/t/possible-regression-in-events-triggered-by-plane-and-roi-markups/40474/6 "2024-12-11T14:31:14Z")

</div>

We will try to get this done before releasing Slicer-5.8 within a few weeks.
