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


Python vtk.vtkRenderer方法代码示例

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


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

示例1: vis_segments

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkRenderer [as 别名]
def vis_segments(ind=1):
    renderer = vtk.vtkRenderer()
    seg_folder = os.path.join(params['base_dir'], "output/pcd_seg/" + str(ind).zfill(params["file_name_digits"])) + "/"
    seg_list = os.listdir(seg_folder)
    for seg in seg_list:
        if seg.split(".")[-1] == "txt":
            color_tup = (np.random.randint(1, 255, 3)).tolist()
            points_ls = list()
            jdcs_collection = cPickle.load(open(os.path.abspath(seg_folder + seg), 'rb'))
            if len(jdcs_collection) > 0:  # filter
                for jdc in jdcs_collection:
                    points_ls.extend(jdc)
            # print points_ls
            actor = vis_pcd_color_arr(np.array(points_ls), color_tup)
            renderer.AddActor(actor)
    vis_with_renderer(renderer) 
开发者ID:mfxox,项目名称:ILCC,代码行数:18,代码来源:utility.py

示例2: vis_segments_only_chessboard_color

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkRenderer [as 别名]
def vis_segments_only_chessboard_color(ind=1):
    renderer = vtk.vtkRenderer()
    seg_folder = os.path.join(params['base_dir'], "output/pcd_seg/" + str(ind).zfill(params["file_name_digits"])) + "/"
    seg_list = os.listdir(seg_folder)
    chessboard_file_name = \
        cPickle.load(open(os.path.join(params['base_dir'], "output/pcd_seg/") + str(ind).zfill(
            params["file_name_digits"]) + "_pcd_result.pkl", "r"))[
            -1].split("/")[-1]
    for seg in seg_list:
        if seg.split(".")[-1] == "txt":
            if seg == chessboard_file_name:
                color_tup = np.array([0, 255, 0])
            else:
                color_tup = np.array([0, 0, 0])

            points_ls = list()
            jdcs_collection = cPickle.load(open(os.path.abspath(seg_folder + seg), 'rb'))
            if len(jdcs_collection) > 0:  # filter
                for jdc in jdcs_collection:
                    points_ls.extend(jdc)
            # print points_ls
            actor = vis_pcd_color_arr(np.array(points_ls), color_tup)
            renderer.AddActor(actor)
    vis_with_renderer(renderer) 
开发者ID:mfxox,项目名称:ILCC,代码行数:26,代码来源:utility.py

示例3: __init__

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkRenderer [as 别名]
def __init__(self):
        self.renderer = vtk.vtkRenderer()
        self.renderer.SetBackground(0.5, 0.5, 0.5)
        self.renderer.ResetCamera()

        axes_actor = vtk.vtkAxesActor()
        axes_actor.AxisLabelsOff()
        self.renderer.AddActor(axes_actor)

        self.window = vtk.vtkRenderWindow()
        self.window.AddRenderer(self.renderer)

        self.interactor = vtk.vtkRenderWindowInteractor()
        self.interactor.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())
        self.interactor.SetRenderWindow(self.window)

        self.camera = vtk.vtkCamera()
        self.camera.SetViewUp(0.0, -1.0, 0.0)
        self.camera.SetPosition(0.0, 0.0, -5)
        self.camera.SetFocalPoint(0.0, 0.0, 0.0)
        # self.camera.SetClippingRange(0.0, 100000)

        self.renderer.SetActiveCamera(self.camera) 
开发者ID:tobiasfshr,项目名称:MOTSFusion,代码行数:25,代码来源:vtkVisualization.py

示例4: viewer

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkRenderer [as 别名]
def viewer(pointclouds):
        assert all([isinstance(p, VtkPointCloud) for p in pointclouds])

        # Renderer
        renderer = vtk.vtkRenderer()
        renderer.SetBackground(1.0, 1.0, 1.0)

        for p in pointclouds:
            renderer.AddActor(p.vtkActor)
        renderer.ResetCamera()

        # Render Window
        renderWindow = vtk.vtkRenderWindow()
        renderWindow.AddRenderer(renderer)

        # Interactor
        renderWindowInteractor = vtk.vtkRenderWindowInteractor()
        renderWindowInteractor.SetRenderWindow(renderWindow)

        # Begin Interaction
        renderWindow.Render()
        renderWindow.SetWindowName("XYZ Data Viewer")

        renderWindowInteractor.Start() 
开发者ID:moberweger,项目名称:deep-prior-pp,代码行数:26,代码来源:vtkpointcloud.py

示例5: make_render_window

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkRenderer [as 别名]
def make_render_window():

    #cone actor
    cone = vtk.vtkConeSource()
    coneMapper = vtk.vtkPolyDataMapper()
    coneMapper.SetInputConnection(cone.GetOutputPort())
    coneActor = vtk.vtkActor()
    coneActor.SetMapper(coneMapper)

    #text actor following camera
    text = vtk.vtkVectorText()
    text.SetText("Origin")
    textMapper = vtk.vtkPolyDataMapper()
    textMapper.SetInputConnection(text.GetOutputPort())
    textActor = vtk.vtkFollower()
    textActor.SetMapper(textMapper)

    ren = vtk.vtkRenderer()
    ren.AddActor(coneActor)
    ren.AddActor(textActor)
    textActor.SetCamera(ren.GetActiveCamera())

    renWin = vtk.vtkRenderWindow()
    renWin.AddRenderer(ren)
    return renWin 
开发者ID:holoviz,项目名称:panel,代码行数:27,代码来源:test_vtk.py

示例6: create_ren_list

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkRenderer [as 别名]
def create_ren_list(self):
        """
        Create a list of the 4 renderers we use. One general view and 3 cartersian projections
        Returns:
            list: list of renderers
        """

        # viewport dimensions setup
        xmins = [0, 0.6, 0.6, 0.6]
        xmaxs = [0.6, 1, 1, 1]
        ymins = [0, 0, 0.33, 0.66]
        ymaxs = [1, 0.33, 0.66, 1]

        # create list of renderers, set vieport values
        ren_list = []
        for i in range(self.n_ren):
            # append each renderer to list of renderers
            ren_list.append(vtk.vtkRenderer())
            # add each renderer to window
            self.renwin.AddRenderer(ren_list[-1])
            # set viewport for each renderer
            ren_list[-1].SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i])

        return ren_list 
开发者ID:cgre-aachen,项目名称:gempy,代码行数:26,代码来源:visualization_3d.py

示例7: vis_csv_pcd

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkRenderer [as 别名]
def vis_csv_pcd(ind=1, color_style="monochrome"):
    pcd_arr = np.genfromtxt(
        os.path.join(params['base_dir'], "pcd/" + str(ind).zfill(params["file_name_digits"])) + ".csv", delimiter=",",
        skip_header=1)
    # actor = vis_3D_points(pcd_arr, color_style="intens")
    actor = vis_3D_points(pcd_arr, color_style=color_style)
    renderer = vtk.vtkRenderer()
    renderer.AddActor(actor)
    vis_with_renderer(renderer) 
开发者ID:mfxox,项目名称:ILCC,代码行数:11,代码来源:utility.py

示例8: __init__

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkRenderer [as 别名]
def __init__(self, parent, opt_engine):
        QVTKRenderWindowInteractor.__init__(self, parent)
        self.opt_engine = opt_engine

        self.renderer = vtk.vtkRenderer()
        self.GetRenderWindow().AddRenderer(self.renderer)
        self.interactor = self.GetRenderWindow().GetInteractor()

        self.create_actor()
        self.renderer.AddActor(self.actor)
        self.renderer.SetBackground(0, 0, 0) 
开发者ID:maxorange,项目名称:pix2vox,代码行数:13,代码来源:gui_viewer.py

示例9: QVTKRenderWidgetConeExample

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkRenderer [as 别名]
def QVTKRenderWidgetConeExample():
    """A simple example that uses the QVTKRenderWindowInteractor class."""

    # every QT app needs an app
    app = QtGui.QApplication(['QVTKRenderWindowInteractor'])

    # create the widget
    widget = QVTKRenderWindowInteractor()
    widget.Initialize()
    widget.Start()
    # if you dont want the 'q' key to exit comment this.
    widget.AddObserver("ExitEvent", lambda o, e, a=app: a.quit())

    ren = vtkRenderer()
    widget.GetRenderWindow().AddRenderer(ren)

    cone = vtkConeSource()
    cone.SetResolution(8)

    coneMapper = vtkPolyDataMapper()
    coneMapper.SetInput(cone.GetOutput())

    coneActor = vtkActor()
    coneActor.SetMapper(coneMapper)

    ren.AddActor(coneActor)

    # show the widget
    widget.show()
    # start event processing
    app.exec_() 
开发者ID:mmolero,项目名称:pcloudpy,代码行数:33,代码来源:QVTKRenderWindowInteractor.py

示例10: __init__

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkRenderer [as 别名]
def __init__(self, parent=None):
        super(QVTKWidget, self).__init__(parent)
        self._enable_axis = False
        self._Iren.SetInteractorStyle (vtkInteractorStyleTrackballCamera ())

        self.renderer = vtkRenderer()
        self.renderer.GradientBackgroundOn()
        self.renderer.SetBackground2(255.0,255.0,255.0)
        self.renderer.SetBackground(37/255.0, 85/255.0,152/255.0)

        self.GetRenderWindow().AddRenderer(self.renderer)
        self.Initialize()
        self.Start()
        self.add_axes() 
开发者ID:mmolero,项目名称:pcloudpy,代码行数:16,代码来源:QVTKWidget.py

示例11: display_from_actor

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkRenderer [as 别名]
def display_from_actor(actor):
    renderer = vtkRenderer()
    renderWindow = vtkRenderWindow()
    renderWindow.AddRenderer(renderer)

    renderer.AddActor(actor)
    # enable user interface interactor
    iren = vtkRenderWindowInteractor()
    iren.SetRenderWindow(renderWindow)
    iren.Initialize()
    renderWindow.Render()
    iren.Start() 
开发者ID:mmolero,项目名称:pcloudpy,代码行数:14,代码来源:vtkhelpers.py

示例12: __init__

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkRenderer [as 别名]
def __init__(self, background=(0.15, 0.15, 0.15), total_time_steps=None, timer_rate=60, gif_file=None):
        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(background[0], background[1], background[2])
        self.ren_win = vtk.vtkRenderWindow()
        self.ren_win.AddRenderer(self.ren)
        self.iren = vtk.vtkRenderWindowInteractor()
        self.iren.SetRenderWindow(self.ren_win)
        self.iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())
        self.actor_list = []
        self.mapper_list = []
        self.source_list = []
        self.screenshot_count = 0
        self.timer_rate = timer_rate
        self.gif_data = []
        if gif_file is not None:
            try:
                assert type(gif_file) is str
            except AssertionError:
                gif_file = str(gif_file)
            self.gif_file = gif_file
        else:
            self.gif_file = None

        if total_time_steps is not None:
            assert type(total_time_steps) is int
            self.timer_count = 0
            self.total_time_steps = total_time_steps 
开发者ID:adityadua24,项目名称:robopy,代码行数:29,代码来源:graphics.py

示例13: check_depth_peeling

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkRenderer [as 别名]
def check_depth_peeling(number_of_peels=100, occlusion_ratio=0.0):
    """Check if depth peeling is available.

    Attempts to use depth peeling to see if it is available for the current
    environment. Returns ``True`` if depth peeling is available and has been
    successfully leveraged, otherwise ``False``.

    """
    # Try Depth Peeling with a basic scene
    source = vtk.vtkSphereSource()
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInputConnection(source.GetOutputPort())
    actor = vtk.vtkActor()
    actor.SetMapper(mapper)
    # requires opacity < 1
    actor.GetProperty().SetOpacity(0.5)
    renderer = vtk.vtkRenderer()
    renderWindow = vtk.vtkRenderWindow()
    renderWindow.AddRenderer(renderer)
    renderWindow.SetOffScreenRendering(True)
    renderWindow.SetAlphaBitPlanes(True)
    renderWindow.SetMultiSamples(0)
    renderer.AddActor(actor)
    renderer.SetUseDepthPeeling(True)
    renderer.SetMaximumNumberOfPeels(number_of_peels)
    renderer.SetOcclusionRatio(occlusion_ratio)
    renderWindow.Render()
    return renderer.GetLastRenderingUsedDepthPeeling() == 1 
开发者ID:pyvista,项目名称:pyvista,代码行数:30,代码来源:helpers.py

示例14: QVTKRenderWidgetConeExample

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkRenderer [as 别名]
def QVTKRenderWidgetConeExample():
    """A simple example that uses the QVTKRenderWindowInteractor class."""

    # every QT app needs an app
    app = QApplication(['QVTKRenderWindowInteractor'])

    # create the widget
    widget = QVTKRenderWindowInteractor()
    widget.Initialize()
    widget.Start()
    # if you don't want the 'q' key to exit comment this.
    widget.AddObserver("ExitEvent", lambda o, e, a=app: a.quit())

    ren = vtk.vtkRenderer()
    widget.GetRenderWindow().AddRenderer(ren)

    cone = vtk.vtkConeSource()
    cone.SetResolution(8)

    coneMapper = vtk.vtkPolyDataMapper()
    coneMapper.SetInputConnection(cone.GetOutputPort())

    coneActor = vtk.vtkActor()
    coneActor.SetMapper(coneMapper)

    ren.AddActor(coneActor)

    # show the widget
    widget.show()
    # start event processing
    app.exec_() 
开发者ID:pyCGNS,项目名称:pyCGNS,代码行数:33,代码来源:Q7VTKRenderWindowInteractor.py

示例15: visualize_prediction

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkRenderer [as 别名]
def visualize_prediction(pointcloud, colors, poses=None, renwin=None):
    """ render point cloud and cameras """

    renderer = vtk.vtkRenderer()
    renderer.SetBackground(0, 0, 0)

    pointcloud_actor = create_pointcloud_actor(points=pointcloud, colors=colors)
    pointcloud_actor.GetProperty().SetPointSize(2)
    renderer.AddActor(pointcloud_actor)

    for pose in poses:
        R, t = pose[:3, :3], pose[:3, 3]
        cam_actor = create_camera_actor(R,t)
        cam_actor.GetProperty().SetColor((255, 255, 0))
        renderer.AddActor(cam_actor)

    camera = vtk.vtkCamera()
    camera.SetPosition((1, -1, -2));
    camera.SetViewUp((0, -1, 0));
    camera.SetFocalPoint((0, 0, 2));

    renderer.SetActiveCamera(camera)
    renwin = vtk.vtkRenderWindow()

    renwin.SetWindowName("Point Cloud Viewer")
    renwin.SetSize(800,600)
    renwin.AddRenderer(renderer)
 
    # An interactor
    interactor = vtk.vtkRenderWindowInteractor()
    interstyle = vtk.vtkInteractorStyleTrackballCamera()
    interactor.SetInteractorStyle(interstyle)
    interactor.SetRenderWindow(renwin)

    # Render and interact
    renwin.Render()
    interactor.Initialize()
    interactor.Start() 
开发者ID:princeton-vl,项目名称:DeepV2D,代码行数:40,代码来源:vis.py


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