Single point placement for vtkMRMLMarkupsLineNode?


I am wondering if it is possible to place one fiducial point at a time when using MarkupsLineNode. I would like the user to place one point, without having to place the second point to complete the line.

I’d like the line to be displayed following placement of the second fiducial. I am using the MarkupsLineNode to plot a planned trajectory.

I have tried applying the following to each fiducial point but it doesn’t seem to work:

self.Point = slicer.qSlicerMarkupsPlaceWidget()
self.Point.placeMultipleMarkups = slicer.qSlicerMarkupsPlaceWidget.ForcePlaceSingleMarkup


You can hide the line until you want to show it by calling SetLineThickness(0.0) on the markup’s display node.

One markup is a line, so forcing a single placement will deactivate place mode after the two line points are placed. To disable place mode after one point is placed, you can call self.Poin.placeModeEnabled = False.

Alternatively, you can use markup fiducial points to get user input (they can be placed one by one and they are not connected by a line) and when you have the two points, create a markup line using these point positions.