当前位置: 首页>>代码示例>>Python>>正文


Python EditUtil.getColorNode方法代码示例

本文整理汇总了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
开发者ID:BRAINSia,项目名称:Slicer,代码行数:31,代码来源:EditColor.py

示例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)
开发者ID:BRAINSia,项目名称:Slicer,代码行数:9,代码来源:EditColor.py

示例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
开发者ID:LucasGandel,项目名称:Slicer,代码行数:56,代码来源:EditColor.py


注:本文中的EditUtil.EditUtil.getColorNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。