How to select segment

I have two segment “skin1” and “skin2”. And when I apply threshold with CLI, I donot know how to select the second one. I don’t know how to set parameters for skin2
360%E6%88%AA%E5%9B%BE-406308453

# Thresholding
segmentEditorWidget.setActiveEffectByName("Threshold")
effect = segmentEditorWidget.activeEffect()
effect.setParameter("MinimumThreshold","54")  
effect.setParameter("MaximumThreshold","78")
effect.self().onApply()

This should do the trick

OK, Csaba Pinter, thank you very much.
Another problem, can I define the color of a segment
addedSegmentID = segmentationNode.GetSegmentation().AddEmptySegment("skin11",*red*)

To change the primary color of the segment (that is also saved to disk etc.)

s=getNode('vtkMRMLSegmentationNode1')
se=s.GetSegmentation()
seg=se.GetSegment('Segment_1')
seg.SetColor(1,0,0)

To change the override color (only for display)

d=s.GetDisplayNode()
d.SetSegmentOverrideColor('Segment_1', 0,1,0)
1 Like

Thank you very much.