當前位置: 首頁>>代碼示例>>Python>>正文


Python vtk.vtkLookupTable方法代碼示例

本文整理匯總了Python中vtk.vtkLookupTable方法的典型用法代碼示例。如果您正苦於以下問題:Python vtk.vtkLookupTable方法的具體用法?Python vtk.vtkLookupTable怎麽用?Python vtk.vtkLookupTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vtk的用法示例。


在下文中一共展示了vtk.vtkLookupTable方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: create_mask_table

# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkLookupTable [as 別名]
def create_mask_table():
    m_mask_opacity = 1
    brain_lut = vtk.vtkLookupTable()
    brain_lut.SetRange(0, 4)
    brain_lut.SetRampToLinear()
    brain_lut.SetValueRange(0, 1)
    brain_lut.SetHueRange(0, 0)
    brain_lut.SetSaturationRange(0, 0)

    brain_lut.SetNumberOfTableValues(10)
    brain_lut.SetTableRange(0, 9)
    brain_lut.SetTableValue(0, 0, 0, 0, 0)
    brain_lut.SetTableValue(1, 1, 0, 0, m_mask_opacity)  # RED
    brain_lut.SetTableValue(2, 0, 1, 0, m_mask_opacity)  # GREEN
    brain_lut.SetTableValue(3, 1, 1, 0, m_mask_opacity)  # YELLOW
    brain_lut.SetTableValue(4, 0, 0, 1, m_mask_opacity)  # BLUE
    brain_lut.SetTableValue(5, 1, 0, 1, m_mask_opacity)  # MAGENTA
    brain_lut.SetTableValue(6, 0, 1, 1, m_mask_opacity)  # CYAN
    brain_lut.SetTableValue(7, 1, 0.5, 0.5, m_mask_opacity)  # RED_2
    brain_lut.SetTableValue(8, 0.5, 1, 0.5, m_mask_opacity)  # GREEN_2
    brain_lut.SetTableValue(9, 0.5, 0.5, 1, m_mask_opacity)  # BLUE_2
    brain_lut.Build()
    return brain_lut 
開發者ID:adamkwolf,項目名稱:3d-nii-visualizer,代碼行數:25,代碼來源:vtkUtils.py

示例2: MakeLUT

# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkLookupTable [as 別名]
def MakeLUT():
    """
    Make a lookup table using vtkColorSeries.
    :return: An indexed lookup table.
    """
    # Make the lookup table.
    colorSeries = vtk.vtkColorSeries()
    # Select a color scheme.
    # colorSeriesEnum = colorSeries.BREWER_DIVERGING_BROWN_BLUE_GREEN_9
    # colorSeriesEnum = colorSeries.BREWER_DIVERGING_SPECTRAL_10
    # colorSeriesEnum = colorSeries.BREWER_DIVERGING_SPECTRAL_3
    # colorSeriesEnum = colorSeries.BREWER_DIVERGING_PURPLE_ORANGE_9
    # colorSeriesEnum = colorSeries.BREWER_SEQUENTIAL_BLUE_PURPLE_9
    # colorSeriesEnum = colorSeries.BREWER_SEQUENTIAL_BLUE_GREEN_9
    colorSeriesEnum = colorSeries.BREWER_QUALITATIVE_SET3
    # colorSeriesEnum = colorSeries.CITRUS
    colorSeries.SetColorScheme(colorSeriesEnum)
    lut = vtk.vtkLookupTable()
    colorSeries.BuildLookupTable(lut)
    lut.SetNanColor(1, 0, 0, 1)
    return lut 
開發者ID:MaterialsDiscovery,項目名稱:PyChemia,代碼行數:23,代碼來源:test_code_vasp_01.py

示例3: ReverseLUT

# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkLookupTable [as 別名]
def ReverseLUT(lut):
    """
    Create a lookup table with the colors reversed.
    :param: lut - An indexed lookup table.
    :return: The reversed indexed lookup table.
    """
    lutr = vtk.vtkLookupTable()
    lutr.DeepCopy(lut)
    t = lut.GetNumberOfTableValues() - 1
    for i in reversed(range(t + 1)):
        rgba = [0, 0, 0]
        v = float(i)
        lut.GetColor(v, rgba)
        rgba.append(lut.GetOpacity(v))
        lutr.SetTableValue(t - i, rgba)
    t = lut.GetNumberOfAnnotatedValues() - 1
    for i in reversed(range(t + 1)):
        lutr.SetAnnotation(t - i, lut.GetAnnotation(i))
    return lutr 
開發者ID:MaterialsDiscovery,項目名稱:PyChemia,代碼行數:21,代碼來源:test_code_vasp_01.py

示例4: create_table

# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkLookupTable [as 別名]
def create_table():
    table = vtk.vtkLookupTable()
    table.SetRange(0.0, 1675.0)  # +1
    table.SetRampToLinear()
    table.SetValueRange(0, 1)
    table.SetHueRange(0, 0)
    table.SetSaturationRange(0, 0) 
開發者ID:adamkwolf,項目名稱:3d-nii-visualizer,代碼行數:9,代碼來源:vtkUtils.py

示例5: setup_brain

# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkLookupTable [as 別名]
def setup_brain(renderer, file):
    brain = NiiObject()
    brain.file = file
    brain.reader = read_volume(brain.file)
    brain.labels.append(NiiLabel(BRAIN_COLORS[0], BRAIN_OPACITY, BRAIN_SMOOTHNESS))
    brain.labels[0].extractor = create_brain_extractor(brain)
    brain.extent = brain.reader.GetDataExtent()

    scalar_range = brain.reader.GetOutput().GetScalarRange()
    bw_lut = vtk.vtkLookupTable()
    bw_lut.SetTableRange(scalar_range)
    bw_lut.SetSaturationRange(0, 0)
    bw_lut.SetHueRange(0, 0)
    bw_lut.SetValueRange(0, 2)
    bw_lut.Build()

    view_colors = vtk.vtkImageMapToColors()
    view_colors.SetInputConnection(brain.reader.GetOutputPort())
    view_colors.SetLookupTable(bw_lut)
    view_colors.Update()
    brain.image_mapper = view_colors
    brain.scalar_range = scalar_range

    add_surface_rendering(brain, 0, sum(scalar_range)/2)  # render index, default extractor value
    renderer.AddActor(brain.labels[0].actor)
    return brain 
開發者ID:adamkwolf,項目名稱:3d-nii-visualizer,代碼行數:28,代碼來源:vtkUtils.py

示例6: __init__

# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkLookupTable [as 別名]
def __init__(self):
        self.ren = vtk.vtkRenderer()
        self.renWin = vtk.vtkRenderWindow()
        self.renWin.AddRenderer(self.ren)
        self.iren = vtk.vtkRenderWindowInteractor()
        self.iren.SetRenderWindow(self.renWin)

        self.lut = vtk.vtkLookupTable()
        self.lut.SetHueRange(0.6, 0.6)
        self.lut.SetSaturationRange(.5, .5)
        self.lut.SetValueRange(0.2, 1.0)
        self.lut.SetNumberOfColors(256)
        self.lut.Build() 
開發者ID:cwant,項目名稱:tessagon,代碼行數:15,代碼來源:tessagon_vtk_demo.py


注:本文中的vtk.vtkLookupTable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。