How to display a line with interaction handles by python?

How to display a line (vtkMRMLMarkupsLineNode) with interaction handles by python?

@lassoan@Juicy@jamesobutler @jcfr @pieper

like that:

  1. First get the reference to vtkMRMLMarkupsLineNode (see get-mrml-node-from-the-scene)
  2. Get the DisplayNode for that Line Node. (similar to change-markup-fiducial-display-properties)
  3. The interactive handles can be set from the DisplayNode. SetHandlesInteractive.

Great! Thanks!


Is it possible to further control the position of the “origin” and “rotation” or “translate” of the handle?

Yes. They are all methods in the Markups Display Node class.

1 Like


I want the “Origin” of this Handle to be at the end of the line segment instead of the midpoint, how to do it?


That’s not something that I believe is possible at the moment.


You can position a line shaped actor (e.g., that you generated using SlicerIGT extension’s Create Models module) using a transform. You can update the transform from a markups plane node by a few lines of Python code. This technique is used in the Bone Reconstruction Planner extension.

Hello, I am trying to find a way to grab 2 planes (generated from markups module) and lock (?) combine them together so when I transform them in position, they move in harmony.

How can I do this programmatically? assuming I have displayNodes of both planes.
Thanks in advance!

Also would there be a way to adjust the size of the interactive handles programmatically?
Thank you & sorry for many questions

没太看懂你的问题, 不过可以看看这个👇或许对你有帮助

I don’t understand your question very well, but you can take a look at this👇 maybe it will help you…
How to rotate OrthogonalSlicesDeg in slices?, getPlaneIntersectionPoint

Thank you, but I do not think it is similar to my problem.
My problem is:

  • I have 2 plane nodes. I want the relationship between the 2 planes to be fixed. If I move 1 of them, I want the other to move by the same amount, if I rotate 1 of them, I want the other to rotate by the same amount

There appears to be a way to do it on the user interface under “Markups module” then “Interactive handles.” How can I do this programmatically?