please check above code everything works fine except last line .
Traceback:
‘MRMLCorePython.vtkMRMLScalarVolumeNode’ object has no attribute ‘GetPolyData’
do i need any additional code, so that i can get polydata from my node or from these segmentation process.
getNode expects a node name or node ID. Passing a segment ID (an internal ID within a segmentation node) will not work. Follow the example that I referenced above more closely. It should be something like this:
yeah, i did the same thing and then i tried to getNode like this
modelNode = getNode(addedSegmentID)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Program Files\Slicer 4.9.0-2018-05-07\bin\Python\slicer\util.py", line 631, in getNode
raise MRMLNodeNotFoundException("could not find nodes in the scene by name or id '%s'" % (pattern if (type(pattern) == str) else ""))
MRMLNodeNotFoundException: could not find nodes in the scene by name or id 'bone'
and this error comes up , in data still i cant find out the mode hierarchy;only my volume node under that segmentation and a single segment…
This should return an error and it does, so everything works as expected. If you need a vtkPolyData of a segment, then please see my post above that shows how surfaceMesh variable is set.