mau_igna_06
(Mauro I. Dominguez)
21
I don’t know if this is exactly what you need but here is code I used to make the user draw a line:
lineNode = slicer.mrmlScene.CreateNodeByClass("vtkMRMLMarkupsLineNode")
lineNode.SetName("temp")
slicer.mrmlScene.AddNode(lineNode)
slicer.modules.markups.logic().AddNewDisplayNodeForMarkupsNode(lineNode)
lineNode.SetName(slicer.mrmlScene.GetUniqueNameByString("line"))
#setup placement
slicer.modules.markups.logic().SetActiveListID(lineNode)
interactionNode = slicer.mrmlScene.GetNodeByID("vtkMRMLInteractionNodeSingleton")
interactionNode.SwitchToSinglePlaceMode()
1 Like
spycolyf
(Doug Porter)
22
Hey @mau_igna_06, I owe you big time! This is perfect! Wow! Made my day!
spycolyf
(Doug Porter)
23
How does one delete the lines using Python?
mikebind
(Mike Bindschadler)
24
slicer.mrmlScene.RemoveNode(lineNode)
to remove
spycolyf
(Doug Porter)
25
Is there a Slicer Python Scripting reference manual that I can use so that I can stop bugging you guys about every little command? Thanks!
smrolfe
(Sara Rolfe)
26
The Python script repository is a good place to start.