// Add the raw data last (on the bottom)
inputDataSlot = self.topLevelOperatorView.InputImages
if inputDataSlot.ready():
inputLayer = self.createStandardLayerFromSlot( inputDataSlot )inputLayer.name = "Input Data"inputLayer.visible = True
inputLayer.opacity = 1.0
// the flag window_leveling is used to determine if the contrast
// of the layer is adjustable
if isinstance( inputLayer, GrayscaleLayer ):
inputLayer.window_leveling = True
else:
inputLayer.window_leveling = False
def toggleTopToBottom():
index = self.layerstack.layerIndex( inputLayer )
self.layerstack.selectRow( index )
if index == 0:
self.layerstack.moveSelectedToBottom()
else:
self.layerstack.moveSelectedToTop()
inputLayer.shortcutRegistration = ( "i", ActionInfo( "Prediction Layers",
"Bring Input To Top/Bottom",
"Bring Input To Top/Bottom",
toggleTopToBottom,
self.viewerControlWidget(),
inputLayer ) )
layers.append(inputLayer)
// The thresholding button can only be used if the data is displayed as grayscale.
if inputLayer.window_leveling:
self.labelingDrawerUi.thresToolButton.show()