本文整理汇总了Python中EditUtil.EditUtil.getColorNode方法的典型用法代码示例。如果您正苦于以下问题:Python EditUtil.getColorNode方法的具体用法?Python EditUtil.getColorNode怎么用?Python EditUtil.getColorNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EditUtil.EditUtil
的用法示例。
在下文中一共展示了EditUtil.getColorNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: updateGUIFromMRML
# 需要导入模块: from EditUtil import EditUtil [as 别名]
# 或者: from EditUtil.EditUtil import getColorNode [as 别名]
def updateGUIFromMRML(self,caller,event):
if self.parameterNode.GetParameter(self.parameter) == '':
# parameter does not exist - probably initializing
return
label = int(self.parameterNode.GetParameter(self.parameter))
self.colorNode = EditUtil.getColorNode()
if self.colorNode:
self.frame.setDisabled(0)
self.labelName.setText( self.colorNode.GetColorName( label ) )
lut = self.colorNode.GetLookupTable()
rgb = lut.GetTableValue( label )
self.colorPatch.setStyleSheet(
"background-color: rgb(%s,%s,%s)" % (rgb[0]*255, rgb[1]*255, rgb[2]*255) )
self.colorSpin.setMaximum( self.colorNode.GetNumberOfColors()-1 )
else:
self.frame.setDisabled(1)
try:
self.colorSpin.setValue(label)
except ValueError:
# TODO: why does the python class still exist if the widget is destroyed?
# - this only happens when reloading the module. The owner of the
# instance is gone and the widgets are gone, but this instance still
# has observer on the parameter node - this indicates memory leaks
# that need to be fixed
self.cleanup()
return
示例2: showColorBox
# 需要导入模块: from EditUtil import EditUtil [as 别名]
# 或者: from EditUtil.EditUtil import getColorNode [as 别名]
def showColorBox(self):
self.colorNode = EditUtil.getColorNode()
if not self.colorBox:
self.colorBox = ColorBox.ColorBox(parameterNode=self.parameterNode, parameter=self.parameter, colorNode=self.colorNode)
self.colorBox.show(parameterNode=self.parameterNode, parameter=self.parameter, colorNode=self.colorNode)
示例3: updateGUIFromMRML
# 需要导入模块: from EditUtil import EditUtil [as 别名]
# 或者: from EditUtil.EditUtil import getColorNode [as 别名]
def updateGUIFromMRML(self,caller,event):
if self.parameterNode.GetParameter(self.parameter) == '':
# parameter does not exist - probably intializing
return
label = int(self.parameterNode.GetParameter(self.parameter))
self.colorNode = EditUtil.getColorNode()
if self.colorNode:
self.frame.setDisabled(0)
self.labelName.setText( self.colorNode.GetColorName( label ) )
lut = self.colorNode.GetLookupTable()
rgb = lut.GetTableValue( label )
self.colorPatch.setStyleSheet(
"background-color: rgb(%s,%s,%s)" % (rgb[0]*255, rgb[1]*255, rgb[2]*255) )
self.colorSpin.setMaximum( self.colorNode.GetNumberOfColors()-1 )
else:
self.frame.setDisabled(1)
try:
self.colorSpin.setValue(label)
# check to see if there's an associated terminology with this color node
if self.colorNode:
terminologyName = self.colorNode.GetAttribute("TerminologyName")
if terminologyName:
colorLogic = slicer.modules.colors.logic()
if colorLogic:
# enable the terminology widgets
self.hideTerminology(0)
region = colorLogic.GetAnatomicRegionCodeMeaning(label, terminologyName)
regionModifier = colorLogic.GetAnatomicRegionModifierCodeMeaning(label, terminologyName)
category = colorLogic.GetSegmentedPropertyCategoryCodeMeaning(label, terminologyName)
categoryType = colorLogic.GetSegmentedPropertyTypeCodeMeaning(label, terminologyName)
categoryModifier = colorLogic.GetSegmentedPropertyTypeModifierCodeMeaning(label, terminologyName)
self.terminologyRegion.setText(region)
self.terminologyRegionModifier.setText(regionModifier)
self.terminologyCategory.setText(category)
self.terminologyCategoryType.setText(categoryType)
self.terminologyCategoryModifier.setText(categoryModifier)
# if no region information, hide the region panel
if region is "" and regionModifier is "":
self.terminologyRegionFrame.setHidden(1)
else:
self.terminologyRegionFrame.setHidden(0)
else:
self.hideTerminology(1)
except ValueError:
# TODO: why does the python class still exist if the widget is destroyed?
# - this only happens when reloading the module. The owner of the
# instance is gone and the widgets are gone, but this instance still
# has observer on the parameter node - this indicates memory leaks
# that need to be fixed
self.cleanup()
return