本文整理汇总了Python中EditUtil.EditUtil.getBackgroundVolume方法的典型用法代码示例。如果您正苦于以下问题:Python EditUtil.getBackgroundVolume方法的具体用法?Python EditUtil.getBackgroundVolume怎么用?Python EditUtil.getBackgroundVolume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EditUtil.EditUtil
的用法示例。
在下文中一共展示了EditUtil.getBackgroundVolume方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getBackgroundScalarRange
# 需要导入模块: from EditUtil import EditUtil [as 别名]
# 或者: from EditUtil.EditUtil import getBackgroundVolume [as 别名]
def getBackgroundScalarRange(self):
success = False
lo = -1
hi = -1
backgroundVolume = EditUtil.getBackgroundVolume()
if backgroundVolume:
backgroundImage = backgroundVolume.GetImageData()
if backgroundImage:
lo, hi = backgroundImage.GetScalarRange()
success = True
return success, lo, hi
示例2: _onEffectChanged
# 需要导入模块: from EditUtil import EditUtil [as 别名]
# 或者: from EditUtil.EditUtil import getBackgroundVolume [as 别名]
def _onEffectChanged(self, effectName):
if self.currentEffect == effectName:
return
#
# If there is no background volume or label map, do nothing
#
if not EditUtil.getBackgroundVolume():
return
if not EditUtil.getLabelVolume():
return
self.currentEffect = effectName
EditUtil.restoreLabel()
# Update action if possible - if not, we aren't ready to select the effect
if effectName not in self.actions:
return
self.actions[effectName].checked = True
#
# an effect was selected, so build an options GUI
# - check to see if it is an extension effect,
# if not, try to create it, else ignore it
# For extensions, look for 'effect'Options and 'effect'Tool
# in the editorExtensions map and use those to create the
# effect
#
if self.currentOption:
# clean up any existing effect
self.currentOption.__del__()
self.currentOption = None
for tool in self.currentTools:
tool.sliceWidget.unsetCursor()
tool.cleanup()
self.currentTools = []
# look at builtins and extensions
# - TODO: other effect styles are deprecated
effectClass = None
if effectName in slicer.modules.editorExtensions.keys():
effectClass = slicer.modules.editorExtensions[effectName]()
elif effectName in self.editorBuiltins.keys():
effectClass = self.editorBuiltins[effectName]()
if effectClass:
# for effects, create an options gui and an
# instance for every slice view
self.currentOption = effectClass.options(self.optionsFrame)
self.currentOption.setMRMLDefaults()
self.currentOption.undoRedo = self.undoRedo
self.currentOption.defaultEffect = self.defaultEffect
self.currentOption.create()
self.currentOption.updateGUI()
layoutManager = slicer.app.layoutManager()
sliceNodeCount = slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLSliceNode')
for nodeIndex in xrange(sliceNodeCount):
# find the widget for each node in scene
sliceNode = slicer.mrmlScene.GetNthNodeByClass(nodeIndex, 'vtkMRMLSliceNode')
sliceWidget = layoutManager.sliceWidget(sliceNode.GetLayoutName())
if sliceWidget:
tool = effectClass.tool(sliceWidget)
tool.undoRedo = self.undoRedo
self.currentTools.append(tool)
self.currentOption.tools = self.currentTools
else:
# fallback to internal classes
try:
options = eval("%sOptions" % effectName)
self.currentOption = options(self.optionsFrame)
except NameError, AttributeError:
# No options for this effect, skip it
pass