How do I properly connect the qMRMLSegmentEditorWidget so that it properly updates?

I am expanding an automated segmentation Tool that I have created to be a bit more user friendly for people to not go between a ton of menus in slicer.

I have a UI created that has the qMRMLSegmentEditorWidget added, and linked to the mrmlSceneChanged(vtkMRMLScene*) signal.

for my input/output volume nodes and a nodule seed placement nodes, I can update these using setCurrentNode(). When doing this with the segmentation node, I get an error saing that the setCurrentNode() doesnt exist.

Looking at the the documentation of qMRMLSegmentEditorWidget, the closest thing I can find is setCurrentSegmentID, but even setting that doesnt work properly, and the widget segmentation selection/volume nodes are still greyed out.

image

any help would be appreciated

setCurrentSegmentID sets the currently selected segment (not the segmentation node). All segment editor parameters are stored in the segment editor node and you can modify them via methods in that node. There are several examples in the script repository.

These examples are sligtly different than what I was wanting. I already have my segmentations transferred from volumes to the scene to be ready for editing using some of the code from those examples.

My issue is that I want to add the segmentation editor widget to allow for ease of editing, but those menus, and that widget in general do not update when a reference volume or segmentation are available.

I have double checked that the scene is properly connected in QT for updates, which is why I am stuck as to why the widget is greyed out, when I used the same methods as connecting my other widgets which work.

after trying implementing the linking in Slicer/SegmentEditor.py at main · Slicer/Slicer · GitHub I was able to get a version of the widget that works and updates with user inputs.

Although I still do not get why the widget is non responsive in my scripted module when I directly link it to the MRML scene in QT

If you set the MRML scene and then the segment editor parameter node into the widget then the GUI becomes editable.