AttributeError: ‘NoneType’ object has no attribute ‘AddObserver’
(In line: markupsFiducialNode.AddObserver(slicer.vtkMRMLMarkupsPlaneNode.PointModifiedEvent, printSegmentNames)
How can we solve this error ?
Assume that some of the segmentations are visible in the current segment, but are visible in different anterior/posterior positions. Can this script find those segments ? Ie., I need to do this in 3D coordinates, not just in one slice.
If you get an error that markupsFiducialNode is None then it means that there is no markups fiducial node in your scene, so you need to add one. Can you post a screenshot of your Slicer application window?
So the last thing : I need to check the segments in all slices, not just in one. It seems like this script is missing the segments which are not visible in the current slice.
Is it possible to loop over all slices so that segments of different slices are also covered ?
If you show the binary labelmap representation in the slice view then you should be able to get all segments.
You can also use vtkMRMLSegmentationsDisplayableManager3D’s Pick3D method, and then get GetPickedNodeID and GetPickedSegmentID to get the picked node and segment, but these only return the first hit.
I have many segments and I don’t think I can make all of them visible in just one slice… Any suggestions about that ?
I couldn’t find an example for using vtkMRMLSegmentationsDisplayableManager3D. I am trying :
sliceViewWidget = slicer.app.layoutManager().sliceWidget(sliceViewLabel)
segmentationsDisplayableManager = sliceViewWidget.sliceView().displayableManagerByClassName(‘vtkMRMLSegmentationsDisplayableManager3D’)
But segmentationsDisplayableManager is returned as None.
Individual segments don’t have to be visible in that slice view, just the segmentation overall. Again, it is important to set the visible representation to binary labelmap.
If you want to try 3D displayable manager then retrieve that from a 3D view.