• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python vtk.vtkLookupTable函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中vtk.vtkLookupTable函数的典型用法代码示例。如果您正苦于以下问题:Python vtkLookupTable函数的具体用法?Python vtkLookupTable怎么用?Python vtkLookupTable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了vtkLookupTable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self):
        
        self.interactor = None
        self.image_original = None
        self.image_threshold = None
        self.render = None
    
        self.lut = vtk.vtkLookupTable()
        self.lut_original = vtk.vtkLookupTable()
        self.image_color = vtk.vtkImageMapToColors()
        self.blend = blend = vtk.vtkImageBlend()
        self.map = map = vtk.vtkImageMapper()
        
        self.actor = actor = vtk.vtkImageActor()
        self.actor2 = actor2 = vtk.vtkImageActor()
        self.actor3 = actor3 = vtk.vtkImageActor()
        
        self.image_color_o = vtk.vtkImageMapToColors()
        
        self.operation_type = 0
        self.w = None
   
        self.slice = 0
        self.clicked = 0
        self.orientation = AXIAL

        self.w = (200, 1200)
开发者ID:151706061,项目名称:invesalius3,代码行数:27,代码来源:editor.py


示例2: get_lookup_table

    def get_lookup_table(self, display_mode):
        """
        Sets up and returns the lookup table depending upon the display mode
        """
        lut = vtkLookupTable()
        ref_lut = vtkLookupTable()
        num_colours = 256
        lut.SetNumberOfColors(num_colours)
        ref_lut.SetNumberOfColors(num_colours)

        if (display_mode == 'load'):
            lut.SetTableRange(0.0, 1.75)
            ref_lut.SetTableRange(0.0, 1.75)
        else:
            lut.SetTableRange(0.0, 1.0)
            ref_lut.SetTableRange(0.0, 1.0)

        lut.Build()
        ref_lut.Build()

        # invert the colours: we want red to be at the high end
        for j in range(num_colours):
            lut.SetTableValue(j, ref_lut.GetTableValue(num_colours-1-j))

        return lut
开发者ID:paultcochrane,项目名称:pbsclusterviz,代码行数:25,代码来源:node_grid_display.py


示例3: initArea

    def initArea(self):
        '''
        Sets up the VTK simulation area
        :return:None
        '''

        self.actors_dict = {}

        self.actorCollection=vtk.vtkActorCollection()
        self.borderActor    = vtk.vtkActor()
        self.borderActorHex = vtk.vtkActor()
        self.clusterBorderActor    = vtk.vtkActor()
        self.clusterBorderActorHex = vtk.vtkActor()
        self.cellGlyphsActor  = vtk.vtkActor()
        self.FPPLinksActor  = vtk.vtkActor()  # used for both white and colored links
        self.outlineActor = vtk.vtkActor()
        # self.axesActor = vtk.vtkCubeAxesActor2D()
        self.axesActor = vtk.vtkCubeAxesActor()


        self.outlineDim=[0,0,0]
        
        self.cellsActor     = vtk.vtkActor()
        self.cellsActor.GetProperty().SetInterpolationToFlat() # ensures that pixels are drawn exactly not with interpolations/antialiasing
        
        self.hexCellsActor     = vtk.vtkActor()
        self.hexCellsActor.GetProperty().SetInterpolationToFlat() # ensures that pixels are drawn exactly not with interpolations/antialiasing
        
        self.conActor       = vtk.vtkActor()
        self.conActor.GetProperty().SetInterpolationToFlat()

        self.hexConActor       = vtk.vtkActor()
        self.hexConActor.GetProperty().SetInterpolationToFlat()
        
        self.contourActor   = vtk.vtkActor()      

        self.glyphsActor=vtk.vtkActor()
        #self.linksActor=vtk.vtkActor()

        # # Concentration lookup table
        
        self.clut = vtk.vtkLookupTable()
        self.clut.SetHueRange(0.67, 0.0)
        self.clut.SetSaturationRange(1.0,1.0)
        self.clut.SetValueRange(1.0,1.0)
        self.clut.SetAlphaRange(1.0,1.0)
        self.clut.SetNumberOfColors(1024)
        self.clut.Build()

        # Contour lookup table
        # Do I need lookup table? May be just one color?
        self.ctlut = vtk.vtkLookupTable()
        self.ctlut.SetHueRange(0.6, 0.6)
        self.ctlut.SetSaturationRange(0,1.0)
        self.ctlut.SetValueRange(1.0,1.0)
        self.ctlut.SetAlphaRange(1.0,1.0)
        self.ctlut.SetNumberOfColors(1024)
        self.ctlut.Build()
开发者ID:CompuCell3D,项目名称:CompuCell3D,代码行数:58,代码来源:MVCDrawView2D.py


示例4: __init__

    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._volume_input = None

        self._opacity_tf = vtk.vtkPiecewiseFunction()
        self._colour_tf = vtk.vtkColorTransferFunction()
        self._lut = vtk.vtkLookupTable()

        # list of tuples, where each tuple (scalar_value, (r,g,b,a))
        self._config.transfer_function = [
                (0, (0,0,0), 0),
                (255, (255,255,255), 1)
                ]

        self._view_frame = None
        self._create_view_frame()
        self._bind_events()

        self.view()

        # all modules should toggle this once they have shown their
        # stuff.
        self.view_initialised = True

        self.config_to_logic()
        self.logic_to_config()
        self.config_to_view()
开发者ID:fvpolpeta,项目名称:devide,代码行数:28,代码来源:TransferFunctionEditor.py


示例5: _makeLut

 def _makeLut(self):
     """
     Creates vtkLookupTable for mapping the volumes
     """
     random.seed(0)
     lut = vtk.vtkLookupTable()
     cm  = self._gidToColorMap   # Just simple alias
     
     # Number of colors in LUT is equal to the largest GID +1
     lut.SetNumberOfColors(max(cm.keys())+1)
     
     # Then, allocate the table with the colors. Iterate over all color
     # slots and assign proper color
     for i in range(lut.GetNumberOfColors()):
         # If given index is defined in indexer:
         # assign its color to the lookup table
         # otherwise set it to black
         if i in cm:
             if cm[i][0] == cm[i][1] == cm[i][2] == 119:
                 c = map(lambda x: float(random.randint(0, 255))/255., [0,0,0])
                 lut.SetTableValue(i, c[0], c[1], c[2], 1)
             else:
                 c = cm[i]
                 c = map(lambda x: float(x)/255., c)
                 lut.SetTableValue(i, c[0], c[1], c[2], 1)
         else:
             lut.SetTableValue(i, 0., 0., 0., 0.)
     
     # Build the LUT and return it
     lut.SetRange(0, max(cm.keys()))
     lut.Build()
     
     return lut
开发者ID:pmajka,项目名称:3dbar-extensions,代码行数:33,代码来源:volume_merger.py


示例6: initArea

    def initArea(self):
        # Zoom items
        self.zitems = []
        
        self.cellTypeActors={}
        self.outlineActor = vtk.vtkActor()
        self.outlineDim=[0,0,0]
        
        self.invisibleCellTypes={}
        self.typesInvisibleStr=""
        self.set3DInvisibleTypes()
        
        axesActor = vtk.vtkActor()
        axisTextActor = vtk.vtkFollower()
        
        self.clut = vtk.vtkLookupTable()
        self.clut.SetHueRange(0.67, 0.0)
        self.clut.SetSaturationRange(1.0,1.0)
        self.clut.SetValueRange(1.0,1.0)
        self.clut.SetAlphaRange(1.0,1.0)
        self.clut.SetNumberOfColors(1024)
        self.clut.Build()

        ## Set up the mapper and actor (3D) for concentration field.
        # self.conMapper = vtk.vtkPolyDataMapper()
        self.conActor = vtk.vtkActor()

        self.glyphsActor=vtk.vtkActor()
        # self.glyphsMapper=vtk.vtkPolyDataMapper()
        
        self.cellGlyphsActor  = vtk.vtkActor()
        self.FPPLinksActor  = vtk.vtkActor()

        # Weird attributes
        self.typeActors             = {} # vtkActor
开发者ID:AngeloTorelli,项目名称:CompuCell3D,代码行数:35,代码来源:MVCDrawView3D.py


示例7: __MakeLUT

 def __MakeLUT(self):
     '''
     Make a lookup table using vtkColorSeries.
     :return: An indexed lookup table.
     '''
     # Make the lookup table.
     pal = "../util/color_circle_Ajj.pal"
     tableSize = 255
     colorFunc = vtk.vtkColorTransferFunction()
     scalars = self.histo()[1]
     with open(pal) as f:
         lines = f.readlines()
         # lines.reverse()
         for i, line in enumerate(lines):
             l = line.strip()
             r, g, b = self.__hex2rgb(l[1:])
             # print scalars[i], r, g, b
             colorFunc.AddRGBPoint(scalars[i], r, g, b)
     lut = vtk.vtkLookupTable()
     lut.SetNumberOfTableValues(tableSize)
     lut.Build()
     for i in range(0, tableSize):
         rgb = list(colorFunc.GetColor(float(i)/tableSize))+[1]
         lut.SetTableValue(i, rgb)
     return lut
开发者ID:CreativeCodingLab,项目名称:DarkSkyVis,代码行数:25,代码来源:vtkDarkSkyFlow.py


示例8: write

    def write(self, file_name):
        writer = vtk.vtkPLYWriter()
        writer.SetFileName(file_name)
        writer.SetInputData(self.vtk_poly_data)
        if self.is_color_mode_height:
            # set lookup tbale for depth values to colors
            lut = vtk.vtkLookupTable()
            lut.SetTableRange(self.height_min, self.height_max)
            lut.Build()
            # in order to be convertable to pcd, use lut to generate colors.
            # THIS IS A DIRTY HACK BUT NEEDED SINCE PCL IS STUPID
            # writer.SetLookupTable(lut) only works for meshlab
            cur_color_data = vtk.vtkUnsignedCharArray()
            cur_color_data.SetNumberOfComponents(3)
            for id in self.color_ids:
                val = self.color_data.GetValue(id)
                col = [0., 0., 0.]
                lut.GetColor(val, col)
                col = [int(c * 255) for c in col]
                cur_color_data.InsertNextTuple3(col[0], col[1], col[2])

            self.color_data = cur_color_data
            self.color_data.SetName("Colors")
            self.vtk_poly_data.GetPointData().SetActiveScalars('Colors')
            self.vtk_poly_data.GetPointData().SetScalars(self.color_data)

        writer.SetArrayName("Colors")
        writer.Write()
开发者ID:Leeyangg,项目名称:limo,代码行数:28,代码来源:vtk_pointcloud.py


示例9: __init__

    def __init__(self, filename, max_num_of_vertices=-1, edge_color_filename=None):
        super(VTKVisualizer, self).__init__()
        self.vertex_id_idx_map = {}
        self.next_vertex_id = 0
        self.edge_counter = 0
        self.lookup_table = vtk.vtkLookupTable()
        self.lookup_table.SetNumberOfColors(int(1e8))
        self.edge_color_tuples = {}
        self.edge_color_filename = edge_color_filename
        self.label_vertex_id_map = {}
        self.starting_vertex = None
        self.starting_vertex_index = -1
        self.filename = filename
        self.max_num_of_vertices = max_num_of_vertices
        self.g = vtk.vtkMutableDirectedGraph()

        self.vertex_ids = vtk.vtkIntArray()
        self.vertex_ids.SetNumberOfComponents(1)
        self.vertex_ids.SetName(VERTEX_ID)

        self.labels = vtk.vtkStringArray()
        self.labels.SetNumberOfComponents(1)
        self.labels.SetName(LABELS)

        self.glyph_scales = vtk.vtkFloatArray()
        self.glyph_scales.SetNumberOfComponents(1)
        self.glyph_scales.SetName(SCALES)

        self.edge_weights = vtk.vtkDoubleArray()
        self.edge_weights.SetNumberOfComponents(1)
        self.edge_weights.SetName(WEIGHTS)

        self.edge_colors = vtk.vtkIntArray()
        self.edge_colors.SetNumberOfComponents(1)
        self.edge_colors.SetName(EDGE_COLORS)
开发者ID:AlexLeSang,项目名称:NetGraph,代码行数:35,代码来源:vtkVisualizeGraph.py


示例10: setParams

    def setParams(self):
        # # You can use either Build() method (256 color by default) or
        # # SetNumberOfTableValues() to allocate much more colors!
        # self.celltypeLUT = vtk.vtkLookupTable()
        # # You need to explicitly call Build() when constructing the LUT by hand
        # self.celltypeLUT.Build()
        #
        # self.populate_cell_type_lookup_table()

        # self.populateLookupTable()

        # self.dim = [100, 100, 1] # Default values

        # for FPP links (and offset also for cell glyphs)
        self.eps = 1.e-4  # not sure how small this should be (checking to see if cell volume -> 0)
        self.stubSize = 3.0  # dangling line stub size for lines that wraparound periodic BCs
        #        self.offset = 1.0    # account for fact that COM of cell is offset from visualized lattice
        #        self.offset = 0.0    # account for fact that COM of cell is offset from visualized lattice

        # scaling factors to map square lattice to hex lattice (rf. CC3D Manual)
        self.xScaleHex = 1.0
        self.yScaleHex = 0.866
        self.zScaleHex = 0.816

        self.lutBlueRed = vtk.vtkLookupTable()
        self.lutBlueRed.SetHueRange(0.667, 0.0)
        self.lutBlueRed.Build()
开发者ID:CompuCell3D,项目名称:CompuCell3D,代码行数:27,代码来源:MVCDrawModelBase.py


示例11: MakeLUT

def MakeLUT(tableSize):
    '''
    Make a lookup table from a set of named colors.
    :param: tableSize - The table size
    :return: The lookup table.
    '''
    nc = vtk.vtkNamedColors()

    lut = vtk.vtkLookupTable()
    lut.SetNumberOfTableValues(tableSize)
    lut.Build()

    # Fill in a few known colors, the rest will be generated if needed
    lut.SetTableValue(0,nc.GetColor4d("Black"))
    lut.SetTableValue(1,nc.GetColor4d("Banana"))
    lut.SetTableValue(2,nc.GetColor4d("Tomato"))
    lut.SetTableValue(3,nc.GetColor4d("Wheat"))
    lut.SetTableValue(4,nc.GetColor4d("Lavender"))
    lut.SetTableValue(5,nc.GetColor4d("Flesh"))
    lut.SetTableValue(6,nc.GetColor4d("Raspberry"))
    lut.SetTableValue(7,nc.GetColor4d("Salmon"))
    lut.SetTableValue(8,nc.GetColor4d("Mint"))
    lut.SetTableValue(9,nc.GetColor4d("Peacock"))

    return lut
开发者ID:lorensen,项目名称:VTKWikiExamples,代码行数:25,代码来源:AssignCellColorsFromLUT.py


示例12: jet

 def jet(self, m=256):
     # blue, cyan, green, yellow, red, black
     lut = vtk.vtkLookupTable()
     lut.SetNumberOfColors(m)
     lut.SetHueRange(0.667,0.0)
     lut.Build()
     return lut
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:7,代码来源:PlotVTK.py


示例13: do_colour_mask

    def do_colour_mask(self, imagedata):
        scalar_range = int(imagedata.GetScalarRange()[1])
        r, g, b = self.current_mask.colour

        # map scalar values into colors
        lut_mask = vtk.vtkLookupTable()
        lut_mask.SetNumberOfColors(256)
        lut_mask.SetHueRange(const.THRESHOLD_HUE_RANGE)
        lut_mask.SetSaturationRange(1, 1)
        lut_mask.SetValueRange(0, 255)
        lut_mask.SetRange(0, 255)
        lut_mask.SetNumberOfTableValues(256)
        lut_mask.SetTableValue(0, 0, 0, 0, 0.0)
        lut_mask.SetTableValue(1, 0, 0, 0, 0.0)
        lut_mask.SetTableValue(254, r, g, b, 1.0)
        lut_mask.SetTableValue(255, r, g, b, 1.0)
        lut_mask.SetRampToLinear()
        lut_mask.Build()
        # self.lut_mask = lut_mask

        # map the input image through a lookup table
        img_colours_mask = vtk.vtkImageMapToColors()
        img_colours_mask.SetLookupTable(lut_mask)
        img_colours_mask.SetOutputFormatToRGBA()
        img_colours_mask.SetInput(imagedata)
        img_colours_mask.Update()
        # self.img_colours_mask = img_colours_mask

        return img_colours_mask.GetOutput()
开发者ID:ruppert,项目名称:invesalius3,代码行数:29,代码来源:slice_.py


示例14: addArrayFromIdList

 def addArrayFromIdList(self, connectedIdList, inputModelNode, arrayName):
     if not inputModelNode:
         return
     inputModelNodePolydata = inputModelNode.GetPolyData()
     pointData = inputModelNodePolydata.GetPointData()
     numberofIds = connectedIdList.GetNumberOfIds()
     hasArrayInt = pointData.HasArray(arrayName)
     if hasArrayInt == 1:  # ROI Array found
         pointData.RemoveArray(arrayName)
     arrayToAdd = vtk.vtkDoubleArray()
     arrayToAdd.SetName(arrayName)
     for i in range(0, inputModelNodePolydata.GetNumberOfPoints()):
         arrayToAdd.InsertNextValue(0.0)
     for i in range(0, numberofIds):
         arrayToAdd.SetValue(connectedIdList.GetId(i), 1.0)
     lut = vtk.vtkLookupTable()
     tableSize = 2
     lut.SetNumberOfTableValues(tableSize)
     lut.Build()
     ID = inputModelNode.GetDisplayNodeID()
     slicer.app.mrmlScene().GetNodeByID(ID)
     displayNode = slicer.app.mrmlScene().GetNodeByID(ID)
     rgb = displayNode.GetColor()
     lut.SetTableValue(0, rgb[0], rgb[1], rgb[2], 1)
     lut.SetTableValue(1, 1.0, 0.0, 0.0, 1)
     arrayToAdd.SetLookupTable(lut)
     pointData.AddArray(arrayToAdd)
     inputModelNodePolydata.Modified()
     return True
开发者ID:DCBIA-OrthoLab,项目名称:ShapeQuantifierExtension,代码行数:29,代码来源:ShapeQuantifierCore.py


示例15: setParams

 def setParams(self):
     # You can use either Build() method (256 color by default) or
     # SetNumberOfTableValues() to allocate much more colors!
     self.lut = vtk.vtkLookupTable()
     # You need to explicitly call Build() when constructing the LUT by hand     
     self.lut.Build()
     self.populateLookupTable()
开发者ID:AngeloTorelli,项目名称:CompuCell3D,代码行数:7,代码来源:MVCDrawViewBase.py


示例16: _set_colour

    def _set_colour(self, imagedata, colour):
        scalar_range = int(imagedata.GetScalarRange()[1])
        r, g, b = colour

        # map scalar values into colors
        lut_mask = vtk.vtkLookupTable()
        lut_mask.SetNumberOfColors(256)
        lut_mask.SetHueRange(const.THRESHOLD_HUE_RANGE)
        lut_mask.SetSaturationRange(1, 1)
        lut_mask.SetValueRange(0, 255)
        lut_mask.SetRange(0, 255)
        lut_mask.SetNumberOfTableValues(256)
        lut_mask.SetTableValue(0, 0, 0, 0, 0.0)
        lut_mask.SetTableValue(1, 1-r, 1-g, 1-b, 0.50)
        lut_mask.SetRampToLinear()
        lut_mask.Build()

        # map the input image through a lookup table
        img_colours_mask = vtk.vtkImageMapToColors()
        img_colours_mask.SetLookupTable(lut_mask)
        img_colours_mask.SetOutputFormatToRGBA()
        img_colours_mask.SetInput(imagedata)
        img_colours_mask.Update()

        return img_colours_mask.GetOutput()
开发者ID:dragonlet,项目名称:invesalius3,代码行数:25,代码来源:cursor_actors.py


示例17: writeAllImageSlices

def writeAllImageSlices(imgfn,pathfn,ext,output_dir):
    reader = vtk.vtkMetaImageReader()
    reader.SetFileName(imgfn)
    reader.Update()
    img = reader.GetOutput()

    parsed_path = parsePathFile(pathfn)
    slices = getAllImageSlices(img,parsed_path,ext)

    writer = vtk.vtkJPEGWriter()

    table = vtk.vtkLookupTable()
    scalar_range = img.GetScalarRange()
    table.SetRange(scalar_range[0], scalar_range[1]) # image intensity range
    table.SetValueRange(0.0, 1.0) # from black to white
    table.SetSaturationRange(0.0, 0.0) # no color saturation
    table.SetRampToLinear()
    table.Build()

    # Map the image through the lookup table
    color = vtk.vtkImageMapToColors()
    color.SetLookupTable(table)

    mkdir(output_dir)
    for i in range(len(slices)):
        color.SetInputData(slices[i])
        writer.SetInputConnection(color.GetOutputPort())
        writer.SetFileName(output_dir+'{}.jpg'.format(i))
        writer.Update()
        writer.Write()
开发者ID:gmaher,项目名称:tcl_code,代码行数:30,代码来源:utility.py


示例18: polyShowColorScalars

def polyShowColorScalars(ren, obj):

    #@c Show scalar values on poly in renderer in color
    #@a ren: renderer
    #@a obj: object name

    if isinstance(obj,list):
        tag = "%s_%s" % (ren[0],obj[0])
    elif isinstance(obj,str):
        tag = "%s_%s" % (ren[0],obj)
    else:
        raise ValueError("Argument type unsupported.")
    lookupColor = [None]*2
    lookupColor[0] = "p_blueToRedLUT_"+tag
    lookupColor[1] = vtk.vtkLookupTable()
    lookupColor[1].SetHueRange(0.6667 ,0.0)
    lookupColor[1].SetSaturationRange(1.,1.)
    lookupColor[1].SetValueRange(1.,1.)
    lookupColor[1].SetAlphaRange(1.,1.)
    lookupColor[1].SetNumberOfColors(16384)
    lookupColor[1].Build()
    
    act = polyGetActor(ren,obj)
    act[1].GetMapper().SetLookupTable(lookupColor[1])
    act[1].GetMapper().ScalarVisibilityOn()
    
    Range = act[1].GetMapper().GetInput().GetPointData().GetScalars().GetRange()
    act[1].GetMapper().SetScalarRange(Range[0],Range[1])
    vis.render(ren)
    
    setattr(vis,act[0],act)
    setattr(vis,lookupColor[0],lookupColor)
    return 
开发者ID:osmsc,项目名称:SimVascular,代码行数:33,代码来源:poly.py


示例19: __init__

    def __init__(self,data_reader):
        self.lut=vtk.vtkLookupTable()
        self.lut.SetNumberOfColors(256)

        self.lut.SetTableRange(data_reader.get_scalar_range())
        self.lut.SetHueRange(0,1)
        self.lut.SetRange(data_reader.get_scalar_range())
        self.lut.SetRange(data_reader.get_scalar_range())
        self.lut.Build()

        self.arrow=vtk.vtkArrowSource()
        self.arrow.SetTipResolution(6)
        self.arrow.SetTipRadius(0.1)
        self.arrow.SetTipLength(0.35)
        self.arrow.SetShaftResolution(6)
        self.arrow.SetShaftRadius(0.03)
        
        self.glyph=vtk.vtkGlyph3D()

        self.glyph.SetInput(data_reader.get_data_set())
        self.glyph.SetSource(self.arrow.GetOutput())
        self.glyph.SetVectorModeToUseVector()
        self.glyph.SetColorModeToColorByScalar()
        self.glyph.SetScaleModeToScaleByVector()
        self.glyph.OrientOn()
        self.glyph.SetScaleFactor(0.002)
		
        mapper=vtk.vtkPolyDataMapper()
        mapper.SetInput(self.glyph.GetOutput())
        mapper.SetLookupTable(self.lut)
        mapper.ScalarVisibilityOn()
        mapper.SetScalarRange(data_reader.get_scalar_range())
        self.actor=vtk.vtkActor()
        self.actor.SetMapper(mapper)	
开发者ID:bitcoinsoftware,项目名称:3D-Scientific-Visualization,代码行数:34,代码来源:Vector_Field.py


示例20: SetLookupTable

 def SetLookupTable(self, lut):
     if not lut:
         return
     vtkViewImage.SetLookupTable(self, lut)
     v_min = self.Level - 0.5*self.Window
     v_max = self.Level + 0.5+self.Window
     
     #==========================================================================
     #   In the case of a shift/scale, one must set the lut range to values
     # without this shift/scale, because the object can be shared by different
     # views.
     #==========================================================================
     lut.SetRange( (v_min-0.5*self.Shift)/self.Scale,
                   (v_max-1.5*self.Shift)/self.Scale)
     
     #==========================================================================
     #     Due to the same problem as above (shift/scale), one must copy the lut
     # so that it does not change values of the shared object.
     #==========================================================================
     realLut = vtk.vtkLookupTable.SafeDownCast(lut)
     if not realLut:
         raise RuntimeError, "Error: Cannot cast vtkScalarsToColors to vtkLookupTable."
     newLut = vtk.vtkLookupTable()
     newLut.DeepCopy(realLut)
     newLut.SetRange(v_min, v_max)
     self.WindowLevel.SetLookupTable(newLut)
     del newLut
开发者ID:jackyko1991,项目名称:vtkpythonext,代码行数:27,代码来源:vtkViewImage2D.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python vtk.vtkMarchingCubes函数代码示例发布时间:2022-05-26
下一篇:
Python vtk.vtkLineSource函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap