Creating a line between already made mark up points

I’m trying to draw lines exactly where I placed some markup points

is there a way to define a line or plane according to already placed mark-up points?

thanks

You can copy-paste markup control points from a markups fiducial list to a markups line in Markups module. Select the markups fiducial list, in Control points section select the two control points, hit Ctrl-C to copy them to the clipboard, select the markups line, and hit Ctrl-V to past the control points into the line).

1 Like

Dear Andras!

Is it possible to make automatic? I mean I have two markup points and get a line between these two points, without Ctrl-C and Ctrl-V?

Thanks a lot,
Imre

Thats like three clicks; one to create the empty line markups object, one to copy and one to paste.

Is it too complicated? You can probably do it by scripting it.

Yes, this is easily scriptable. Here is an example function you could paste in the python interactor

def connectPoints(markupsNode1, markupsNode2):
    '''Simple function which connects the first control
    point of markupsNode1 to the first control point of 
    markupsNode2 with a line'''
    pt1 = markupsNode1.GetNthControlPointPositionWorld(0)
    pt2 = markupsNode2.GetNthControlPointPositionWorld(0)
    newCurveNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLMarkupsCurveNode')
    newCurveNode.AddControlPoint(*pt1)
    newCurveNode.AddControlPoint(*pt2)
    return newCurveNode

Then you could use it like this:

connectingLineNode = connectPoints(getNode('myFirstPoint'), getNode('mySecondPoint'))

where you would need to replace ‘myFirstPoint’ and ‘mySecondPoint’ with the names of the markups which contain the two points you want to connect.

1 Like

Dear Mike Bindschadler!

Thank you so much it works!

With best regards,
Imre

1 Like