# Changes to the Markups Module

**URL:** <https://discourse.slicer.org/t/changes-to-the-markups-module/19871>\
**Category:** Development\
**Created:** [September 26, 2021, 4:20pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871 "2021-09-26T16:20:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![smrolfe](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/smrolfe/32/3659_2.png) [@smrolfe](https://discourse.slicer.org/u/smrolfe)\
**Post date:** [September 26, 2021, 4:20pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/1 "2021-09-26T16:20:08Z")

</div>

Several updates to the Markups module and the addition of a Markups toolbar were added in commit: [ENH: Improve control point state management and add markups toolbar · Slicer/Slicer@09d12ae · GitHub](https://github.com/Slicer/Slicer/commit/09d12ae6f7598fe8490b691d17a35dcca5bd344a) and are available in the latest preview version.

The [motivation for these changes](https://discourse.slicer.org/t/proposed-changes-to-markups-to-support-unplaced-points/12714) was to add support for unplaced or missing control points. These states make it possible to create landmark templates for efficient placing of pre-named points, which is a common feature in other landmarking software. The position status can now be accessed and changed in the control points table of the Markups menu. Additionally, the number of control points in any markup node can now be locked, preventing the addition of new points and the deletion of named points.

While making these updates, we found that the current system of adding new points via the mouse mode menu made it difficult to tell which markup was being edited. To resolve this, a Markups toolbar was added to display/select the active markup node and provide access to several node properties without opening the Markups module.

In the Markups toolbar, the “Create new node and initiate placement” and the “Continue placement” functions have been explicitly separated, to prevent confusion about whether a new node would be created on entering placement mode. The “Place” button in the mouse mode toolbar is now replaced with a button that toggles the Markups toolbar (where new nodes can be created), when there are no active nodes that can accept more points in the scene.

Placement of annotation nodes is not included in the Markups toolbar. Previously, the placement of markups or annotation type nodes was not well distinguished, which was especially problematic as the Annotation nodes are a legacy type that are planned to be phased out. Creation of Annotation type nodes has been moved to the Annotation module to avoid confusion and so they will only be placed intentionally. A shortcut to the Annotation module has been added to the Markups toolbar to prompt the user and reduce the number of clicks needed to place a node.

The issues and fixes related to these changes are being tracked [here](https://github.com/Slicer/Slicer/issues/5889), so please update with any feedback.

I made a short video demonstrating the new functionality of the [Markups module and toolbar](https://youtu.be/ddd1U61eVlo) and related changes to creating legacy [Annotations](https://youtu.be/dDYxDFehS3k).

Many thanks to @lassoan, @muratmaga, @jamesobutler, @ezgimercan and others who helped and advised on these updates.

---

<div class="post-metadata">

**Author:** ![smrolfe](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/smrolfe/32/3659_2.png) [@smrolfe](https://discourse.slicer.org/u/smrolfe)\
**Post date:** [September 27, 2021, 7:57pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/2 "2021-09-27T19:57:13Z")

</div>

I’ve added a tutorial showing how the new options to create unplaced control points and lock the number of points in a node can be used to make [templates for landmarking](https://youtu.be/m-z9vNRIhxg).

---

<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:** [September 29, 2021, 3:25am UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/3 "2021-09-29T03:25:15Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/e/eefba976ea8613faf8b76fee2c157203494313fb.png)

I have had trouble easily understanding the position status options in the markups control points context menu.

- “Set position missing for highlighted fiducial(s)” → It is actually functioning as a toggle that Sets or Unsets the position missing. I see it toggling between different states in the last column of the table. Can it instead only do the action stated? “Unset position” for instance does not act as a toggle for unsetting/restoring position. It only unsets.

- Upon quick reading “Unset position…” and “Set position…” based on their sentence structure they initially appear to be the opposites of each other however they are not. The latter is “Set position missing” which is an unrelated “Set” action. What do you think about the following rewording and reordering:

The above order also matches the order when cycling through the position status states in the last column of the table. Restore/complete → unset → edit → skip

“Unset” also sounds a bit technical compared to maybe “Clear”. Maybe Clear/Restore just seems like more natural pairs than Unset/Restore?

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [September 29, 2021, 4:22am UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/4 "2021-09-29T04:22:59Z")

</div>

> [@jamesobutler](#):
>
> - Restore position of highlighted fiducial(s)
> - Unset position of highlighted fiducial(s) ← or “Clear position…”
> - Edit position of highlighted fiducial(s)
> - Skip position of highlighted fiducial(s) ← Formerly “Set position missing…”

These look good to me.

---

<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:** [September 29, 2021, 2:24pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/5 "2021-09-29T14:24:52Z")

</div>

Thank you @jamesobutler, I like your naming suggestions, too. The recommended order is better, too, but I think we should start with the Edit action (Edit, Skip, Restore, Clear), because Edit and Skip are the most commonly needed right-click menu actions (Restore is rarely needed and Clear is available by a single click on the state icon).

---

<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:** [September 29, 2021, 4:52pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/6 "2021-09-29T16:52:35Z")

</div>

Sure, I’m fine with it starting with edit as the top entry. So you agree with “Clear” instead of “Unset”? If so, I think that will be good to make it a bit less technical sounding.

---

<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:** [September 29, 2021, 6:22pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/7 "2021-09-29T18:22:17Z")

</div>

I agree that “Clear position” sounds better than “Unset position”. Since the “clear” word is not used in markups for anything else, it should not be a problem to have a slight mismatch between the source code and GUI; and a bit less obvious match between set/unset operation names.

---

<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:** [September 29, 2021, 10:02pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/8 "2021-09-29T22:02:28Z")

</div>

PR issued for this naming and reordering

> <https://github.com/Slicer/Slicer/pull/5919>
>
> Originally from discussion starting at https://discourse.slicer.org/t/changes-to…-the-markups-module/19871/3?u=jamesobutler
> 
> "Clear" is chosen over "Unset" since it is less technical. Action order is based on the cycle order when click in the position status column of the markups control point table.
> 
> | Current | This PR |
> |----------|---------|
> | !\[image\](https://user-images.githubusercontent.com/15837524/135353453-fecd3318-5cf7-40e8-a6e8-c34011e5dec3.png)| !\[image\](https://user-images.githubusercontent.com/15837524/135353330-bf9ee5cd-2885-494b-96a0-3936350a31b0.png)|
> |!\[image\](https://user-images.githubusercontent.com/15837524/135351384-e9c090ea-6880-4e68-a7c7-d7951b08aa5a.png)|!\[image\](https://user-images.githubusercontent.com/15837524/135353255-f23b08b8-8708-4186-a9b1-b19ba1ab57c5.png)|
> 
> Also including minor commit \`STYLE: Use control point terminology in context menu\` which should been included in 1669e8c94d54d6763e381e837ae90113ed31deb7 as it relates to consistently using the "control point" terminology rather than "point" or some other incorrect uses such as "fiducial" or "markup".
> 
> | Current | This PR |
> |----------|---------|
> |!\[image\](https://user-images.githubusercontent.com/15837524/135354587-5d57f5d4-4a88-41e2-9ab9-3569d19c785c.png)|!\[image\](https://user-images.githubusercontent.com/15837524/135354613-928c0f8a-65ca-4d5b-a3fa-29fecb3c2193.png)|

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [October 2, 2021, 5:01pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/9 "2021-10-02T17:01:12Z")

</div>

The ‘Persistent’ option is no longer available.

![Screenshot_20211002_185334](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/5/c51bfe15066c1f4869ec742d4de957b8f0d95d77.png)

Or I may have missed in the ‘Markups properties’ module.

This was very convenient when placing multiple fiducial points. Now we have to click on the fiducial icon in the toolbar every time.

Is it a deprecated function? If yes, is it definitively removed ? Or is it restorable for fiducial placement ?

Thank you.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 2, 2021, 5:06pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/10 "2021-10-02T17:06:42Z")

</div>

It is there. It is now called “place multiple points” as persistence wasn’t a very clear term.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/e/1eac8ef5bab0660e824d81b077e712719abd760f.png)

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [October 2, 2021, 5:15pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/11 "2021-10-02T17:15:16Z")

</div>

Ah, and there’s much more in the complete toolbar. Mine was truncated to the right.  
 ![Screenshot_20211002_191222](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/9/99ffe47c09f4cc5f160471abf4dad5609bd910e6.png)

When the markups toolbar is positioned in a second row, it shows up completely.

Thanks for the quick reply.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 2, 2021, 8:38pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/12 "2021-10-02T20:38:17Z")

</div>

Yes, I think the length of the toolbar is one of @jamesobutler’s concerns.

---

<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:** [October 3, 2021, 3:01am UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/13 "2021-10-03T03:01:32Z")

</div>

> [@chir.set](#):
>
> Ah, and there’s much more in the complete toolbar. Mine was truncated to the right.

In dark mode it is hard to see the toolbar expansion button. This button indicates that only a part of the toolbar is visible and when the button is clicked then the hidden part is displayed. We should adjust the color theme to make the button clearly visible.

The toolbar could be made somewhat smaller (at the cost of requiring more clicks to access functions on it), but the idea is that users would move it to a second toolbar row. I think we initialize the Sequence toolbar to be in the second row and probably we should do the same for this toolbar, too.

---

<div class="post-metadata">

**Author:** ![ezgimercan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ezgimercan/32/4584_2.png) [@ezgimercan](https://discourse.slicer.org/u/ezgimercan)\
**Post date:** [October 11, 2021, 10:26pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/14 "2021-10-11T22:26:20Z")

</div>

Thanks Sara and the team! This one feature I’ve been waiting for a very long time…

I’ve been using the updated module for a while now. I’ve integrated it into our workflow and it changed my landmarking experience a lot. I am mostly using it to mark a list of anatomical points on lots of skull CTs. I’ve created a “template” markups file with empty points and fill that out for every sample. It is much more efficient compared to my old method (of keeping a PDF file open for the order of points and naming them using Python scripts before saving).

I haven’t used it for other markup node types (curves, angles etc) yet but I am looking forward to. We have a couple projects starting that will use curves to mark regions, so this tool will definitely come handy.

One other thing, I am having trouble finding the function call for adding “undefined” points to a node through Python. And for some reason, my Slicer instance crashes when I try to autocomplete [fiducial node].logic.Add … methods. I’ve just started using preview version (just for this update) so I need to investigate if it’s because of these updates or something else.

There is room for improvement in terms of GUI but I am super happy with the functionality (also kinda suck at picking function/button names and designing icons).

---

<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:** [October 11, 2021, 10:44pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/15 "2021-10-11T22:44:20Z")

</div>

As a workaround, you can add points at an arbitrary location and then unset their location.

```auto
F = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLFiducialNode')
tempLocation = vtk.vtkVector3d(0,0,0)
newControlPointIndex = F.AddControlPointWorld(tempLocation, 'my-landmark-label')
F.UnsetNthControlPointPosition( newControlPointIndex )

```

to add a single control point with an unset location, or  
`F.UnsetAllControlPoints()`  
if you want to add several and then unset them all.

---

<div class="post-metadata">

**Author:** ![ezgimercan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ezgimercan/32/4584_2.png) [@ezgimercan](https://discourse.slicer.org/u/ezgimercan)\
**Post date:** [October 11, 2021, 10:46pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/16 "2021-10-11T22:46:56Z")

</div>

Unset!  
I was searching under SetNthControlPoint… group. Thanks, Mike!

---

<div class="post-metadata">

**Author:** ![smrolfe](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/smrolfe/32/3659_2.png) [@smrolfe](https://discourse.slicer.org/u/smrolfe)\
**Post date:** [October 11, 2021, 10:47pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/17 "2021-10-11T22:47:20Z")

</div>

Thanks for your feedback @ezgimercan. Could you send a few lines of code to replicate the Slicer crash?

---

<div class="post-metadata">

**Author:** ![ezgimercan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ezgimercan/32/4584_2.png) [@ezgimercan](https://discourse.slicer.org/u/ezgimercan)\
**Post date:** [October 11, 2021, 10:51pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/18 "2021-10-11T22:51:22Z")

</div>

a = loadMarkups(\<your markup file .mrk.json\>)  
a.logic.Add

then click tab and select a function. When I hit enter, it freezes and crashes.

This is the last line of log file:  
[DEBUG][Qt] 11.10.2021 15:45:21 [] (unknown:0) - Python console user input: a=loadMarkups("/home/emerc1/XXX.mrk.json")

Version 2021-10-10, Linux, + SlicerMorph

---

<div class="post-metadata">

**Author:** ![smrolfe](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/smrolfe/32/3659_2.png) [@smrolfe](https://discourse.slicer.org/u/smrolfe)\
**Post date:** [October 11, 2021, 10:55pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/19 "2021-10-11T22:55:06Z")

</div>

Thanks @ezgimercan! It’s not replicating on my Mac, but I’ll give it a try on Linux.

---

<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:** [October 11, 2021, 11:07pm UTC](https://discourse.slicer.org/t/changes-to-the-markups-module/19871/20 "2021-10-11T23:07:31Z")

</div>

I’m not sure if it is related, but I ran into something like this crash a while back [Reproducible Slicer crash on attempted tab completion, on Nightly 2020-01-08](https://discourse.slicer.org/t/reproducible-slicer-crash-on-attempted-tab-completion-on-nightly-2020-01-08/10146) . Unfortunately, it wasn’t really sorted out at the time, and it went away in a more recent preview release, so I don’t think it was pursued any further.

[Next page](https://discourse.slicer.org/t/changes-to-the-markups-module/19871.md?page=2)
