Operating system: Mac
Slicer version:4.11
Expected behavior: The centerline model from GUI of slicer has a different number of points compared with the centerline model I get from the python script
Actual behavior:
This is the code I use in python to get a centerline model:
import ExtractCenterline
def centerlineExtractcenterline(nameSeg:str, nameRegion:str, nameFids:str):
ec = ExtractCenterline.ExtractCenterlineLogic()
n = getNode(nameSeg)
s = n.GetSegmentation()
ss = s.GetSegment(s.GetSegmentIdBySegmentName(nameRegion)).GetRepresentation('Closed surface')
fids = getNode(nameFids)
centerlinePolyData,voronoiDiagramPolyData = ec.extractCenterline(ss, fids)
return centerlinePolyData, voronoiDiagramPolyData
centerlinePolyData, voronoiDiagramPolyData = centerlineExtractcenterline('seg_nerve', 'R_optic_nerve', 'F1')
model = slicer.vtkMRMLModelNode()
model.SetAndObservePolyData(centerlinePolyData)
modelDisplay = slicer.vtkMRMLModelDisplayNode()
modelDisplay.SetColor(1, 1, 0)
modelDisplay.BackfaceCullingOff()
modelDisplay.SetOpacity(0.8)
modelDisplay.SetPointSize(3)
modelDisplay.SetSliceIntersectionVisibility(True)
modelDisplay.SetVisibility(True)
slicer.mrmlScene.AddNode(modelDisplay)
model.SetAndObserveDisplayNodeID(modelDisplay.GetID())
modelDisplay.SetInputPolyDataConnection(model.GetPolyDataConnection())
slicer.mrmlScene.AddNode(model)
Thank you so much!
Ge Tang