本文整理汇总了Python中volumina.api.AlphaModulatedLayer.set_normalize方法的典型用法代码示例。如果您正苦于以下问题:Python AlphaModulatedLayer.set_normalize方法的具体用法?Python AlphaModulatedLayer.set_normalize怎么用?Python AlphaModulatedLayer.set_normalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类volumina.api.AlphaModulatedLayer
的用法示例。
在下文中一共展示了AlphaModulatedLayer.set_normalize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupLayers
# 需要导入模块: from volumina.api import AlphaModulatedLayer [as 别名]
# 或者: from volumina.api.AlphaModulatedLayer import set_normalize [as 别名]
def setupLayers(self):
layers = []
opLane = self.topLevelOperatorView
# This code depends on a specific order for the export slots.
# If those change, update this function!
selection_names = opLane.SelectionNames.value
assert selection_names[0:4] == ['Probabilities', 'Simple Segmentation', 'Uncertainty', 'Features'] # see comment above
selection = selection_names[ opLane.InputSelection.value ]
if selection == 'Probabilities':
exportedLayers = self._initPredictionLayers(opLane.ImageOnDisk)
for layer in exportedLayers:
layer.visible = True
layer.name = layer.name + "- Exported"
layers += exportedLayers
previewLayers = self._initPredictionLayers(opLane.ImageToExport)
for layer in previewLayers:
layer.visible = False
layer.name = layer.name + "- Preview"
layers += previewLayers
elif selection == "Simple Segmentation":
exportedLayer = self._initSegmentationlayer(opLane.ImageOnDisk)
if exportedLayer:
exportedLayer.visible = True
exportedLayer.name = exportedLayer.name + " - Exported"
layers.append( exportedLayer )
previewLayer = self._initSegmentationlayer(opLane.ImageToExport)
if previewLayer:
previewLayer.visible = False
previewLayer.name = previewLayer.name + " - Preview"
layers.append( previewLayer )
elif selection == "Uncertainty":
if opLane.ImageToExport.ready():
previewUncertaintySource = LazyflowSource(opLane.ImageToExport)
previewLayer = AlphaModulatedLayer( previewUncertaintySource,
tintColor=QColor(0,255,255), # cyan
range=(0.0, 1.0),
normalize=(0.0,1.0) )
previewLayer.opacity = 0.5
previewLayer.visible = False
previewLayer.name = "Uncertainty - Preview"
layers.append(previewLayer)
if opLane.ImageOnDisk.ready():
exportedUncertaintySource = LazyflowSource(opLane.ImageOnDisk)
exportedLayer = AlphaModulatedLayer( exportedUncertaintySource,
tintColor=QColor(0,255,255), # cyan
range=(0.0, 1.0),
normalize=(0.0,1.0) )
exportedLayer.opacity = 0.5
exportedLayer.visible = True
exportedLayer.name = "Uncertainty - Exported"
layers.append(exportedLayer)
else: # Features and all other layers.
if selection != "Features":
warnings.warn("Not sure how to display '{}' result. Showing with default layer settings."
.format(selection))
if opLane.ImageToExport.ready():
previewLayer = self.createStandardLayerFromSlot( opLane.ImageToExport )
previewLayer.visible = False
previewLayer.name = "{} - Preview".format( selection )
previewLayer.set_normalize( 0, None )
layers.append(previewLayer)
if opLane.ImageOnDisk.ready():
exportedLayer = self.createStandardLayerFromSlot( opLane.ImageOnDisk )
exportedLayer.visible = True
exportedLayer.name = "{} - Exported".format( selection )
exportedLayer.set_normalize( 0, None )
layers.append(exportedLayer)
# If available, also show the raw data layer
rawSlot = opLane.FormattedRawData
if rawSlot.ready():
rawLayer = self.createStandardLayerFromSlot( rawSlot )
rawLayer.name = "Raw Data"
rawLayer.visible = True
rawLayer.opacity = 1.0
layers.append( rawLayer )
return layers