I’m trying to write a script that applies a color gradient to a markups curve.
All the changes are visible in the GUI, but the displayed curve does not change. To change the curve I have to manually click on something in the GUi (to update it?).
This is my code
# get color table
iron = slicer.util.getFirstNodeByName("Iron")
curveNode = slicer.mrmlScene.GetFirstNodeByName("MarkupsCurve_2")
dispNode = curveNode.GetDisplayNode()
dispNode.SetActiveScalarName("PedigreeIDs")
dispNode.SetAndObserveColorNodeID(iron.GetID())
dispNode.SetScalarVisibility(1)
This is how it looks after the code is executed (the Iron color table is not applied):
Then, if I e.g. click twice on the ‘Visibile:’ checkbox, the view gets updated (the Iron color table is applied):