I managed to connect the colors widget via slicer.modules.colors.widgetRepresentation.
Now I want to use the color node from the ColorTableComboBox, but I can’t access it.
Basically, my code would be:
self.visualization_button.enabled = True
displayNode = self.uncertainty_selector.currentNode().GetScalarVolumeDisplayNode()
colormap = self.colormap_selector.ColorTableComboBox.getNode()
displayNode.SetAndObserveColorNodeID(colormap)
However, python can’t find this combobox. How can I access the colorNode?
Thanks in advance!
Operating system: Windows 10
Slicer version: 4.10.0
Would you like to change the currently selected color node in the Colors module? Or you would like to add a color table or a color node selector into your own module GUI?
I want to apply the currenty selected color node in the Colors Module to a displayNode via displayNode.SetAndBoserveColorNodeID(ColorNode), but I can’t access the selected colorNode.
EDIT:
In the source code of qSlicerColorsModuleWidget.cxx, there is a pointer d that is used to access the ColorTableComboBox from SlicerColorsModuleWidgetPrivate, like in Line 370, for example: d->ColorTableComboBox->currentNode(). I want that exact node.
I did it!
I used the slicer.qMRMLColorPickerWidget() to select a premade color node and accessed it via .currentColorNode().GetID() to set it as the ColorNode for my DisplayNode. Thank you!