brhoom
(ibr_ex@yahoo.com)
November 14, 2018, 4:55pm
1
Operating system: Ubuntu
Slicer version: 4.10
Expected behavior: Color changed
Actual behavior: does not
Hi,
I am trying to change the color and the text scale of a markup node. the text scale works but the color does not. Here is the code:
mNode = getNode('myMarkUpNode')
mDisplayNode=slicer.vtkMRMLMarkupsDisplayNode()
slicer.mrmlScene.AddNode(mDisplayNode)
mNode.SetAndObserveDisplayNodeID(mDisplayNode.GetID())
mDisplayNode.SetTextScale(1)
mDisplayNode.SetColor(0,1,0)
How can I fix this?
Thanks!
lassoan
(Andras Lasso)
November 14, 2018, 5:29pm
2
No need to create a new display node, just use the current one. By default, markups are selected, so you may want to change color of the selected markups, too.
mDisplayNode = getNode('myMarkUpNode').GetDisplayNode()
mDisplayNode.SetTextScale(1)
mDisplayNode.SetColor(0,1,0)
mDisplayNode.SetSelectedColor(0,1,0)
2 Likes
brhoom
(ibr_ex@yahoo.com)
November 14, 2018, 5:52pm
3
Thanks a lot for the quick reply and the valuable information. It seems SetColor does nothing. I only used SetSelectedColor and it works:
getNode('myMarkUpNode').GetDisplayNode()().SetSelectedColor(0,1,0)
lassoan
(Andras Lasso)
November 14, 2018, 5:54pm
4
SetColor
changes color of non-selected markups. Uncheck the checkbox next to the markup’s name in Markups module and you’ll then see how non-selected color is used.