本文整理汇总了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
示例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
示例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
示例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)
示例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
示例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()