Hi,
I am trying to a custom loadable module in Python that has a QComboBox that shows the scalars similar to the one in the Models module. The item list and combo box work fine but the colors are not updated correctly on the model. I checked the correct ModelDisplayNode and saw that the ActiveScalarName, ScalarRangeFlag were all correct but the ScalarRange is always at (0, -1). The only way to fix this is to go to the Models module and click on that exact model node and then the color will be updated accordingly.
Here are the relevant pieces of code:
# ComboBox
bio_mech_selector = qt.QComboBox()
bio_mech_selector.activated.connect(self.on_select_scalar)
# Function
def on_select_scalar(self):
if self.timeline_slider.value>0:
self.model_display_node = slicer.mrmlScene.GetNodeByID("SomeNodeID")
self.model_display_node.SetActiveScalarName(self.bio_mech_selector.currentText)
I have several model nodes that can be selected using a slider and use a single model_display_node. My question is how can I make the Combo Box choice apply the colors correctly without the need to go to Models module and click on each of the model nodes?