Dear community,
First of all, thank you always for helping!
I had been trying to modify the onPrincipalAxes() of the SegmentGeometry module to fit my use.
def troubleGetName(selectedSeg):
sourceNode = slicer.mrmlScene.GetNodeByID("vtkMRMLSegmentationNode1")
sourceSeg = sourceNode.GetSegmentation()
volumeNode = slicer.mrmlScene.GetNodeByID('vtkMRMLScalarVolumeNode1')
volumeName = volumeNode.GetName()
segmentId = sourceSeg.GetSegmentIdBySegmentName(selectedSeg)
segmentationNode = sourceSeg.GetSegment(selectedSeg)
displayNode = sourceNode.GetDisplayNode()
displayNode.SetAllSegmentsVisibility(True)
segmentationNode.SetAndObserveTransformNodeID(None)
#my segment name is "Grain"
troubleGetName("Grain")
And I soon came across a situation where below error happens.
Traceback (most recent call last):
File “”, line 1, in
File “”, line 10, in troubleGetName
AttributeError: ‘NoneType’ object has no attribute ‘SetAndObserveTransformNodeID’
I looked up the SetAndObserveTransformNodeID on the vtkMRMLTransformableNode Class Reference and saw that SetAndObserveTransformNodeID is supposed to be after a vtkMRMLTransformableNode.
bool vtkMRMLTransformableNode::SetAndObserveTransformNodeID ( const char * transformNodeID )
The captured image and other people’s cases seems to be telling me that segment node can be used as the vtkMRMLTransformableNode. So I cannot figure out what went wrong.
Can anyone please tell me what I am doing wrong?
By the way, I just have to mention how much I love this module!
Easy to use and so convenient!!
Thank you in advance!!
*** I posted wrong error message at first, so I fixed it!! Sorry about that!!