本文整理汇总了Python中volumina.layer.ColortableLayer.window_leveling方法的典型用法代码示例。如果您正苦于以下问题:Python ColortableLayer.window_leveling方法的具体用法?Python ColortableLayer.window_leveling怎么用?Python ColortableLayer.window_leveling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类volumina.layer.ColortableLayer
的用法示例。
在下文中一共展示了ColortableLayer.window_leveling方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupLayers
# 需要导入模块: from volumina.layer import ColortableLayer [as 别名]
# 或者: from volumina.layer.ColortableLayer import window_leveling [as 别名]
#.........这里部分代码省略.........
colortable.append(QColor(r,g,b).rgba())
layer = ColortableLayer(LazyflowSource(seg), colortable, direct=True)
layer.name = "Segmentation"
layer.setToolTip("This layer displays the <i>current</i> segmentation. Simply add foreground and background " \
"labels, then press <i>Segment</i>.")
layer.visible = True
layer.opacity = 0.3
layers.append(layer)
#done
done = self.topLevelOperatorView.DoneObjects
if done.ready():
colortable = [QColor(0,0,0,0).rgba(), QColor(0,0,255).rgba()]
#have to use lazyflow because it provides dirty signals
layer = ColortableLayer(LazyflowSource(done), colortable, direct=True)
layer.name = "Completed segments (unicolor)"
layer.setToolTip("In order to keep track of which objects you have already completed, this layer " \
"shows <b>all completed object</b> in one color (<b>blue</b>). " \
"The reason for only one color is that for finding out which " \
"objects to label next, the identity of already completed objects is unimportant " \
"and destracting.")
layer.visible = False
layer.opacity = 0.5
layers.append(layer)
#done seg
doneSeg = self.topLevelOperatorView.DoneSegmentation
if doneSeg.ready():
layer = ColortableLayer(LazyflowSource(doneSeg), self._doneSegmentationColortable, direct=True)
layer.name = "Completed segments (one color per object)"
layer.setToolTip("<html>In order to keep track of which objects you have already completed, this layer " \
"shows <b>all completed object</b>, each with a random color.</html>")
layer.visible = False
layer.opacity = 0.5
self._doneSegmentationLayer = layer
layers.append(layer)
#supervoxel
sv = self.topLevelOperatorView.Supervoxels
if sv.ready():
colortable = []
for i in range(256):
r,g,b = numpy.random.randint(0,255), numpy.random.randint(0,255), numpy.random.randint(0,255)
colortable.append(QColor(r,g,b).rgba())
layer = ColortableLayer(LazyflowSource(sv), colortable, direct=True)
layer.name = "Supervoxels"
layer.setToolTip("<html>This layer shows the partitioning of the input image into <b>supervoxels</b>. The carving " \
"algorithm uses these tiny puzzle-piceces to piece together the segmentation of an " \
"object. Sometimes, supervoxels are too large and straddle two distinct objects " \
"(undersegmentation). In this case, it will be impossible to achieve the desired " \
"segmentation. This layer helps you to understand these cases.</html>")
layer.visible = False
layer.opacity = 1.0
layers.append(layer)
# Visual overlay (just for easier labeling)
overlaySlot = self.topLevelOperatorView.OverlayData
if overlaySlot.ready():
overlay5D = self.topLevelOperatorView.OverlayData.value
layer = GrayscaleLayer(ArraySource(overlay5D), direct=True)
layer.visible = True
layer.name = 'Overlay'
layer.opacity = 1.0
# if the flag window_leveling is set the contrast
# of the layer is adjustable
layer.window_leveling = True
self.labelingDrawerUi.thresToolButton.show()
layers.append(layer)
del layer
inputSlot = self.topLevelOperatorView.InputData
if inputSlot.ready():
layer = GrayscaleLayer( LazyflowSource(inputSlot), direct=True )
layer.name = "Input Data"
layer.setToolTip("<html>The data originally loaded into ilastik (unprocessed).</html>")
#layer.visible = not rawSlot.ready()
layer.visible = True
layer.opacity = 1.0
# Window leveling is already active on the Overlay,
# but if no overlay was provided, then activate window_leveling on the raw data instead.
if not overlaySlot.ready():
# if the flag window_leveling is set the contrast
# of the layer is adjustable
layer.window_leveling = True
self.labelingDrawerUi.thresToolButton.show()
layers.append(layer)
del layer
filteredSlot = self.topLevelOperatorView.FilteredInputData
if filteredSlot.ready():
layer = GrayscaleLayer( LazyflowSource(filteredSlot) )
layer.name = "Filtered Input"
layer.visible = False
layer.opacity = 1.0
layers.append(layer)
return layers