本文整理汇总了Python中volumina.view3d.volumeRendering.RenderingManager.removeObject方法的典型用法代码示例。如果您正苦于以下问题:Python RenderingManager.removeObject方法的具体用法?Python RenderingManager.removeObject怎么用?Python RenderingManager.removeObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类volumina.view3d.volumeRendering.RenderingManager
的用法示例。
在下文中一共展示了RenderingManager.removeObject方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PixelClassificationGui
# 需要导入模块: from volumina.view3d.volumeRendering import RenderingManager [as 别名]
# 或者: from volumina.view3d.volumeRendering.RenderingManager import removeObject [as 别名]
#.........这里部分代码省略.........
self._viewerControlUi.viewerControls.setupConnections(model)
def _initShortcuts(self):
mgr = ShortcutManager()
ActionInfo = ShortcutManager.ActionInfo
shortcutGroupName = "Predictions"
mgr.register( "p", ActionInfo( shortcutGroupName,
"Toggle Prediction",
"Toggle Prediction Layer Visibility",
self._viewerControlUi.checkShowPredictions.click,
self._viewerControlUi.checkShowPredictions,
self._viewerControlUi.checkShowPredictions ) )
mgr.register( "s", ActionInfo( shortcutGroupName,
"Toggle Segmentaton",
"Toggle Segmentaton Layer Visibility",
self._viewerControlUi.checkShowSegmentation.click,
self._viewerControlUi.checkShowSegmentation,
self._viewerControlUi.checkShowSegmentation ) )
mgr.register( "l", ActionInfo( shortcutGroupName,
"Live Prediction",
"Toggle Live Prediction Mode",
self.labelingDrawerUi.liveUpdateButton.toggle,
self.labelingDrawerUi.liveUpdateButton,
self.labelingDrawerUi.liveUpdateButton ) )
def _setup_contexts(self, layer):
def callback(pos, clayer=layer):
name = clayer.name
if name in self._renderedLayers:
label = self._renderedLayers.pop(name)
self._renderMgr.removeObject(label)
self._update_rendering()
else:
label = self._renderMgr.addObject()
self._renderedLayers[clayer.name] = label
self._update_rendering()
if self.render:
layer.contexts.append( QAction('Toggle 3D rendering', None, triggered=callback) )
def setupLayers(self):
"""
Called by our base class when one of our data slots has changed.
This function creates a layer for each slot we want displayed in the volume editor.
"""
# Base class provides the label layer.
layers = super(PixelClassificationGui, self).setupLayers()
ActionInfo = ShortcutManager.ActionInfo
if ilastik_config.getboolean('ilastik', 'debug'):
# Add the label projection layer.
labelProjectionSlot = self.topLevelOperatorView.opLabelPipeline.opLabelArray.Projection2D
if labelProjectionSlot.ready():
projectionSrc = LazyflowSource(labelProjectionSlot)
try:
# This colortable requires matplotlib
from volumina.colortables import jet
projectionLayer = ColortableLayer( projectionSrc,
colorTable=[QColor(0,0,0,128).rgba()]+jet(N=255),
normalize=(0.0, 1.0) )
except (ImportError, RuntimeError):
示例2: Counting3dGui
# 需要导入模块: from volumina.view3d.volumeRendering import RenderingManager [as 别名]
# 或者: from volumina.view3d.volumeRendering.RenderingManager import removeObject [as 别名]
#.........这里部分代码省略.........
self._viewerControlUi.checkShowSegmentation.clicked.connect( self.handleShowSegmentationClicked )
# The editor's layerstack is in charge of which layer movement buttons are enabled
model = self.editor.layerStack
self._viewerControlUi.viewerControls.setupConnections(model)
def _initShortcuts(self):
mgr = ShortcutManager()
shortcutGroupName = "Predictions"
togglePredictions = QShortcut( QKeySequence("p"), self, member=self._viewerControlUi.checkShowPredictions.click )
mgr.register( shortcutGroupName,
"Toggle Prediction Layer Visibility",
togglePredictions,
self._viewerControlUi.checkShowPredictions )
toggleSegmentation = QShortcut( QKeySequence("s"), self, member=self._viewerControlUi.checkShowSegmentation.click )
mgr.register( shortcutGroupName,
"Toggle Segmentaton Layer Visibility",
toggleSegmentation,
self._viewerControlUi.checkShowSegmentation )
toggleLivePredict = QShortcut( QKeySequence("l"), self, member=self.labelingDrawerUi.liveUpdateButton.toggle )
mgr.register( shortcutGroupName,
"Toggle Live Prediction Mode",
toggleLivePredict,
self.labelingDrawerUi.liveUpdateButton )
def _setup_contexts(self, layer):
def callback(pos, clayer=layer):
name = clayer.name
if name in self._renderedLayers:
label = self._renderedLayers.pop(name)
self._renderMgr.removeObject(label)
self._update_rendering()
else:
label = self._renderMgr.addObject()
self._renderedLayers[clayer.name] = label
self._update_rendering()
if self.render:
layer.contexts.append(('Toggle 3D rendering', callback))
@traceLogged(traceLogger)
def setupLayers(self):
"""
Called by our base class when one of our data slots has changed.
This function creates a layer for each slot we want displayed in the volume editor.
"""
# Base class provides the label layer.
layers = super(Counting3dGui, self).setupLayers()
# Add each of the predictions
labels = self.labelListData
slots = {'density' : self.op.Density}
for name, slot in slots.items():
if slot.ready():
from volumina import colortables
layer = ColortableLayer(LazyflowSource(slot), colorTable = colortables.jet(), normalize = 'auto')
layer.name = name
layers.append(layer)
示例3: CarvingGui
# 需要导入模块: from volumina.view3d.volumeRendering import RenderingManager [as 别名]
# 或者: from volumina.view3d.volumeRendering.RenderingManager import removeObject [as 别名]
#.........这里部分代码省略.........
if confirmed == QMessageBox.Yes:
for name in namelist:
self.topLevelOperatorView.deleteObject(name)
return True
return False
def labelingContextMenu(self,names,op,position5d):
menu = QMenu(self)
menu.setObjectName("carving_context_menu")
posItem = menu.addAction("position %d %d %d" % (position5d[1], position5d[2], position5d[3]))
posItem.setEnabled(False)
menu.addSeparator()
for name in names:
submenu = QMenu(name,menu)
# Load
loadAction = submenu.addAction("Load %s" % name)
loadAction.triggered.connect( partial(op.loadObject, name) )
# Delete
def onDelAction(_name):
self.confirmAndDelete([_name])
if self.render and self._renderMgr.ready:
self._update_rendering()
delAction = submenu.addAction("Delete %s" % name)
delAction.triggered.connect( partial(onDelAction, name) )
if self.render:
if name in self._shownObjects3D:
# Remove
def onRemove3D(_name):
label = self._shownObjects3D.pop(_name)
self._renderMgr.removeObject(label)
self._update_rendering()
removeAction = submenu.addAction("Remove %s from 3D view" % name)
removeAction.triggered.connect( partial(onRemove3D, name) )
else:
# Show
def onShow3D(_name):
label = self._renderMgr.addObject()
self._shownObjects3D[_name] = label
self._update_rendering()
showAction = submenu.addAction("Show 3D %s" % name)
showAction.triggered.connect( partial(onShow3D, name ) )
# Export mesh
if _have_vtk:
exportAction = submenu.addAction("Export mesh for %s" % name)
exportAction.triggered.connect( partial(self._onContextMenuExportMesh, name) )
menu.addMenu(submenu)
if names:
menu.addSeparator()
menu.addSeparator()
if self.render:
showSeg3DAction = menu.addAction( "Show Editing Segmentation in 3D" )
showSeg3DAction.setCheckable(True)
showSeg3DAction.setChecked( self._showSegmentationIn3D )
showSeg3DAction.triggered.connect( self._toggleSegmentation3D )
if op.dataIsStorable():
menu.addAction("Save object").triggered.connect( self.onSaveButton )
menu.addAction("Browse objects").triggered.connect( self.onShowObjectNames )
示例4: CarvingGui
# 需要导入模块: from volumina.view3d.volumeRendering import RenderingManager [as 别名]
# 或者: from volumina.view3d.volumeRendering.RenderingManager import removeObject [as 别名]
#.........这里部分代码省略.........
self._update_rendering()
#self.labelingDrawerUi.randomizeColors.clicked.connect(onRandomizeColors)
def handleEditorRightClick(self, position5d, globalWindowCoordinate):
names = self.topLevelOperatorView.opCarving.doneObjectNamesForPosition(position5d[1:4])
op = self.topLevelOperatorView.opCarving
menu = QMenu(self)
menu.addAction("position %d %d %d" % (position5d[1], position5d[2], position5d[3]))
for name in names:
menu.addAction("edit %s" % name)
menu.addAction("delete %s" % name)
if self.render:
if name in self._shownObjects3D:
menu.addAction("remove %s from 3D view" % name)
else:
menu.addAction("show 3D %s" % name)
act = menu.exec_(globalWindowCoordinate)
for name in names:
if act is not None and act.text() == "edit %s" %name:
op.loadObject(name)
elif act is not None and act.text() =="delete %s" % name:
op.deleteObject(name)
if self.render and self._renderMgr.ready:
self._update_rendering()
elif act is not None and act.text() == "show 3D %s" % name:
label = self._renderMgr.addObject()
self._shownObjects3D[name] = label
self._update_rendering()
elif act is not None and act.text() == "remove %s from 3D view" % name:
label = self._shownObjects3D.pop(name)
self._renderMgr.removeObject(label)
self._update_rendering()
def _update_rendering(self):
if not self.render:
return
op = self.topLevelOperatorView.opCarving
if not self._renderMgr.ready:
self._renderMgr.setup(op.MST.value.raw.shape)
# remove nonexistent objects
self._shownObjects3D = dict((k, v) for k, v in self._shownObjects3D.iteritems()
if k in op.MST.value.object_lut.keys())
lut = numpy.zeros(len(op.MST.value.objects.lut), dtype=numpy.int32)
for name, label in self._shownObjects3D.iteritems():
objectSupervoxels = op.MST.value.object_lut[name]
lut[objectSupervoxels] = label
self._renderMgr.volume = lut[op.MST.value.regionVol]
self._update_colors()
self._renderMgr.update()
def _update_colors(self):
op = self.topLevelOperatorView.opCarving
ctable = self._doneSegmentationLayer.colorTable
for name, label in self._shownObjects3D.iteritems():
color = QColor(ctable[op.MST.value.object_names[name]])
color = (color.red() / 255.0, color.green() / 255.0, color.blue() / 255.0)
self._renderMgr.setColor(label, color)
示例5: CarvingGui
# 需要导入模块: from volumina.view3d.volumeRendering import RenderingManager [as 别名]
# 或者: from volumina.view3d.volumeRendering.RenderingManager import removeObject [as 别名]
#.........这里部分代码省略.........
if confirmed == QMessageBox.Yes:
for name in namelist:
self.topLevelOperatorView.deleteObject(name)
return True
return False
def labelingContextMenu(self,names,op,position5d):
menu = QMenu(self)
menu.setObjectName("carving_context_menu")
posItem = menu.addAction("position %d %d %d" % (position5d[1], position5d[2], position5d[3]))
posItem.setEnabled(False)
menu.addSeparator()
for name in names:
submenu = QMenu(name,menu)
# Load
loadAction = submenu.addAction("Load %s" % name)
loadAction.triggered.connect( partial(op.loadObject, name) )
# Delete
def onDelAction(_name):
self.confirmAndDelete([_name])
if self.render and self._renderMgr.ready:
self._update_rendering()
delAction = submenu.addAction("Delete %s" % name)
delAction.triggered.connect( partial(onDelAction, name) )
if self.render:
if name in self._shownObjects3D:
# Remove
def onRemove3D(_name):
label = self._shownObjects3D.pop(_name)
self._renderMgr.removeObject(label)
self._update_rendering()
removeAction = submenu.addAction("Remove %s from 3D view" % name)
removeAction.triggered.connect( partial(onRemove3D, name) )
else:
# Show
def onShow3D(_name):
label = self._renderMgr.addObject()
self._shownObjects3D[_name] = label
self._update_rendering()
showAction = submenu.addAction("Show 3D %s" % name)
showAction.triggered.connect( partial(onShow3D, name ) )
menu.addMenu(submenu)
if names:
menu.addSeparator()
menu.addSeparator()
if self.render:
showSeg3DAction = menu.addAction( "Show Editing Segmentation in 3D" )
showSeg3DAction.setCheckable(True)
showSeg3DAction.setChecked( self._showSegmentationIn3D )
showSeg3DAction.triggered.connect( self._toggleSegmentation3D )
if op.dataIsStorable():
menu.addAction("Save object").triggered.connect( self.onSaveButton )
menu.addAction("Browse objects").triggered.connect( self.onShowObjectNames )
menu.addAction("Segment").triggered.connect( self.onSegmentButton )
menu.addAction("Clear").triggered.connect( self.topLevelOperatorView.clearCurrentLabeling )
return menu
def handleEditorRightClick(self, position5d, globalWindowCoordinate):
示例6: PixelClassificationGui
# 需要导入模块: from volumina.view3d.volumeRendering import RenderingManager [as 别名]
# 或者: from volumina.view3d.volumeRendering.RenderingManager import removeObject [as 别名]
#.........这里部分代码省略.........
self._viewerControlUi.viewerControls.setupConnections(model)
def _initShortcuts(self):
mgr = ShortcutManager()
ActionInfo = ShortcutManager.ActionInfo
shortcutGroupName = "Predictions"
mgr.register( "p", ActionInfo( shortcutGroupName,
"Toggle Prediction",
"Toggle Prediction Layer Visibility",
self._viewerControlUi.checkShowPredictions.click,
self._viewerControlUi.checkShowPredictions,
self._viewerControlUi.checkShowPredictions ) )
mgr.register( "s", ActionInfo( shortcutGroupName,
"Toggle Segmentaton",
"Toggle Segmentaton Layer Visibility",
self._viewerControlUi.checkShowSegmentation.click,
self._viewerControlUi.checkShowSegmentation,
self._viewerControlUi.checkShowSegmentation ) )
mgr.register( "l", ActionInfo( shortcutGroupName,
"Live Prediction",
"Toggle Live Prediction Mode",
self.labelingDrawerUi.liveUpdateButton.toggle,
self.labelingDrawerUi.liveUpdateButton,
self.labelingDrawerUi.liveUpdateButton ) )
def _setup_contexts(self, layer):
def callback(pos, clayer=layer):
name = clayer.name
if name in self._renderedLayers:
label = self._renderedLayers.pop(name)
self._renderMgr.removeObject(label)
self._update_rendering()
else:
label = self._renderMgr.addObject()
self._renderedLayers[clayer.name] = label
self._update_rendering()
if self.render:
layer.contexts.append(('Toggle 3D rendering', callback))
def setupLayers(self):
"""
Called by our base class when one of our data slots has changed.
This function creates a layer for each slot we want displayed in the volume editor.
"""
# Base class provides the label layer.
layers = super(PixelClassificationGui, self).setupLayers()
ActionInfo = ShortcutManager.ActionInfo
# Add the uncertainty estimate layer
uncertaintySlot = self.topLevelOperatorView.UncertaintyEstimate
if uncertaintySlot.ready():
uncertaintySrc = LazyflowSource(uncertaintySlot)
uncertaintyLayer = AlphaModulatedLayer( uncertaintySrc,
tintColor=QColor( Qt.cyan ),
range=(0.0, 1.0),
normalize=(0.0, 1.0) )
uncertaintyLayer.name = "Uncertainty"
uncertaintyLayer.visible = False
uncertaintyLayer.opacity = 1.0
uncertaintyLayer.shortcutRegistration = ( "u", ActionInfo( "Prediction Layers",
"Uncertainty",
示例7: PixelClassificationGui
# 需要导入模块: from volumina.view3d.volumeRendering import RenderingManager [as 别名]
# 或者: from volumina.view3d.volumeRendering.RenderingManager import removeObject [as 别名]
#.........这里部分代码省略.........
self._viewerControlUi.checkShowSegmentation.clicked.connect( self.handleShowSegmentationClicked )
# The editor's layerstack is in charge of which layer movement buttons are enabled
model = self.editor.layerStack
self._viewerControlUi.viewerControls.setupConnections(model)
def _initShortcuts(self):
mgr = ShortcutManager()
shortcutGroupName = "Predictions"
togglePredictions = QShortcut( QKeySequence("p"), self, member=self._viewerControlUi.checkShowPredictions.click )
mgr.register( shortcutGroupName,
"Toggle Prediction Layer Visibility",
togglePredictions,
self._viewerControlUi.checkShowPredictions )
toggleSegmentation = QShortcut( QKeySequence("s"), self, member=self._viewerControlUi.checkShowSegmentation.click )
mgr.register( shortcutGroupName,
"Toggle Segmentaton Layer Visibility",
toggleSegmentation,
self._viewerControlUi.checkShowSegmentation )
toggleLivePredict = QShortcut( QKeySequence("l"), self, member=self.labelingDrawerUi.liveUpdateButton.toggle )
mgr.register( shortcutGroupName,
"Toggle Live Prediction Mode",
toggleLivePredict,
self.labelingDrawerUi.liveUpdateButton )
def _setup_contexts(self, layer):
def callback(pos, clayer=layer):
name = clayer.name
if name in self._renderedLayers:
label = self._renderedLayers.pop(name)
self._renderMgr.removeObject(label)
self._update_rendering()
else:
label = self._renderMgr.addObject()
self._renderedLayers[clayer.name] = label
self._update_rendering()
if self.render:
layer.contexts.append(('Toggle 3D rendering', callback))
def setupLayers(self):
"""
Called by our base class when one of our data slots has changed.
This function creates a layer for each slot we want displayed in the volume editor.
"""
# Base class provides the label layer.
layers = super(PixelClassificationGui, self).setupLayers()
# Add the uncertainty estimate layer
uncertaintySlot = self.topLevelOperatorView.UncertaintyEstimate
if uncertaintySlot.ready():
uncertaintySrc = LazyflowSource(uncertaintySlot)
uncertaintyLayer = AlphaModulatedLayer( uncertaintySrc,
tintColor=QColor( Qt.cyan ),
range=(0.0, 1.0),
normalize=(0.0, 1.0) )
uncertaintyLayer.name = "Uncertainty"
uncertaintyLayer.visible = False
uncertaintyLayer.opacity = 1.0
uncertaintyLayer.shortcutRegistration = (
"Prediction Layers",
"Show/Hide Uncertainty",
QShortcut( QKeySequence("u"), self.viewerControlWidget(), uncertaintyLayer.toggleVisible ),
示例8: CarvingGui
# 需要导入模块: from volumina.view3d.volumeRendering import RenderingManager [as 别名]
# 或者: from volumina.view3d.volumeRendering.RenderingManager import removeObject [as 别名]
#.........这里部分代码省略.........
if confirmed == QMessageBox.Yes:
for name in namelist:
self.topLevelOperatorView.deleteObject(name)
return True
return False
def labelingContextMenu(self,names,op,position5d):
menu = QMenu(self)
menu.setObjectName("carving_context_menu")
posItem = menu.addAction("position %d %d %d" % (position5d[1], position5d[2], position5d[3]))
posItem.setEnabled(False)
menu.addSeparator()
for name in names:
submenu = QMenu(name,menu)
# Load
loadAction = submenu.addAction("Load %s" % name)
loadAction.triggered.connect( partial(op.loadObject, name) )
# Delete
def onDelAction(_name):
self.confirmAndDelete([_name])
if self.render and self._renderMgr.ready:
self._update_rendering()
delAction = submenu.addAction("Delete %s" % name)
delAction.triggered.connect( partial(onDelAction, name) )
if self.render:
if name in self._shownObjects3D:
# Remove
def onRemove3D(_name):
label = self._shownObjects3D.pop(_name)
self._renderMgr.removeObject(label)
self._update_rendering()
removeAction = submenu.addAction("Remove %s from 3D view" % name)
removeAction.triggered.connect( partial(onRemove3D, name) )
else:
# Show
def onShow3D(_name):
label = self._renderMgr.addObject()
self._shownObjects3D[_name] = label
self._update_rendering()
showAction = submenu.addAction("Show 3D %s" % name)
showAction.triggered.connect( partial(onShow3D, name ) )
menu.addMenu(submenu)
if names:
menu.addSeparator()
menu.addSeparator()
showSeg3DAction = menu.addAction( "Show Editing Segmentation in 3D" )
showSeg3DAction.setCheckable(True)
showSeg3DAction.setChecked( self._showSegmentationIn3D )
showSeg3DAction.triggered.connect( self._toggleSegmentation3D )
if op.dataIsStorable():
menu.addAction("Save objects").triggered.connect( self.onSegmentButton )
menu.addAction("Browse objects").triggered.connect( self.topLevelOperatorView.clearCurrentLabeling )
menu.addAction("Segment").triggered.connect( self.onShowObjectNames )
menu.addAction("Clear").triggered.connect( self.onSaveAsButton )
return menu
def handleEditorRightClick(self, position5d, globalWindowCoordinate):
names = self.topLevelOperatorView.doneObjectNamesForPosition(position5d[1:4])
示例9: GraphCutsGui
# 需要导入模块: from volumina.view3d.volumeRendering import RenderingManager [as 别名]
# 或者: from volumina.view3d.volumeRendering.RenderingManager import removeObject [as 别名]
#.........这里部分代码省略.........
self._viewerControlUi.checkShowSegmentation.clicked.connect( self.handleShowSegmentationClicked )
# The editor's layerstack is in charge of which layer movement buttons are enabled
model = self.editor.layerStack
self._viewerControlUi.viewerControls.setupConnections(model)
def _initShortcuts(self):
mgr = ShortcutManager()
shortcutGroupName = "Predictions"
togglePredictions = QShortcut( QKeySequence("p"), self, member=self._viewerControlUi.checkShowPredictions.click )
mgr.register( shortcutGroupName,
"Toggle Prediction Layer Visibility",
togglePredictions,
self._viewerControlUi.checkShowPredictions )
toggleSegmentation = QShortcut( QKeySequence("s"), self, member=self._viewerControlUi.checkShowSegmentation.click )
mgr.register( shortcutGroupName,
"Toggle Segmentaton Layer Visibility",
toggleSegmentation,
self._viewerControlUi.checkShowSegmentation )
toggleLivePredict = QShortcut( QKeySequence("l"), self, member=self.labelingDrawerUi.liveUpdateButton.toggle )
mgr.register( shortcutGroupName,
"Toggle Live Prediction Mode",
toggleLivePredict,
self.labelingDrawerUi.liveUpdateButton )
def _setup_contexts(self, layer):
def callback(pos, clayer=layer):
name = clayer.name
if name in self._renderedLayers:
label = self._renderedLayers.pop(name)
self._renderMgr.removeObject(label)
self._update_rendering()
else:
label = self._renderMgr.addObject()
self._renderedLayers[clayer.name] = label
self._update_rendering()
if self.render:
layer.contexts.append(('Toggle 3D rendering', callback))
def handleThresholdGuiValuesChanged(self, minVal, maxVal):
with Tracer(traceLogger):
self.topLevelOperatorView.MinValue.setValue(minVal)
self.topLevelOperatorView.MaxValue.setValue(maxVal)
def getAppletDrawerUi(self):
return self._drawer
def setupLayers(self):
"""
Called by our base class when one of our data slots has changed.
This function creates a layer for each slot we want displayed in the volume editor.
"""
# Base class provides the label layer.
layers = super(GraphCutsGui, self).setupLayers()
labels = self.labelListData
# Add each of the segmentations
for channel, segmentationSlot in enumerate(self.topLevelOperatorView.SegmentationChannels):
if segmentationSlot.ready() and channel < len(labels):
ref_label = labels[channel]
segsrc = LazyflowSource(segmentationSlot)
segLayer = AlphaModulatedLayer( segsrc,