I used the connection: self.inputSegmentationSelector.connect(“currentSegmentChanged(QString)”, self.onContourChange)
And now I want to calculate the center of mass of the selected contour. So I used the following code:
modelNode = slicer.mrmlScene.GetNodesByName((str(targetContour)))
pointCoordinates = slicer.util.arrayFromModelPoints(modelNode) # point coordinates of targetContour
but I’m having the error:
File “C:\Program Files\Slicer 4.10.0\bin\Python\slicer\util.py”, line 795, in arrayFromModelPoints
pointData = modelNode.GetPolyData().GetPoints().GetData()
AttributeError: ‘vtkCommonCorePython.vtkCollection’ object has no attribute ‘GetPolyData’