How to use the vedo.Plotter function in vedo

To help you get started, we’ve selected a few vedo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BrancoLab / BrainRender / brainrender / render.py View on Github external
self.jupyter = True
        else:
            self.jupyter = False

        if self.display_inset and self.jupyter:
            print(
                "Setting 'display_inset' to False as this feature is not \
                            available in juputer notebooks"
            )
            self.display_inset = False

        # Camera parameters
        self.camera = get_scene_camera(camera, self.atlas)

        # Create vedo plotter
        self.plotter = Plotter(**get_scene_plotter_settings(self.jupyter))

        # SCreenshots and keypresses variables
        self.screenshots_folder = Path(
            screenshot_kwargs.pop("folder", self.atlas.output_screenshots)
        )
        self.screenshots_name = screenshot_kwargs.pop(
            "name", brainrender.DEFAULT_SCREENSHOT_NAME
        )
        self.screenshots_extension = screenshot_kwargs.pop(
            "type", brainrender.DEFAULT_SCREENSHOT_TYPE
        )
        self.screenshots_scale = screenshot_kwargs.pop(
            "scale", brainrender.DEFAULT_SCREENSHOT_SCALE
        )

        if not use_default_key_bindings:
github BrancoLab / BrainRender / brainrender / scene.py View on Github external
scene.apply_render_style()

            if camera is None:
                if scene.atlas.default_camera is None:
                    scene_camera = brainrender.CAMERA
                else:
                    scene_camera = scene.atlas.default_camera
            else:
                if camera:
                    scene_camera = camera
                else:
                    scene_camera = None
            if scene_camera is not None:
                set_camera(scene, scene_camera)

        mv = Plotter(
            N=self.N,
            axes=4 if brainrender.SHOW_AXES else 0,
            size="full" if brainrender.WHOLE_SCREEN else "auto",
            sharecam=True,
            bg=brainrender.BACKGROUND_COLOR,
        )

        actors = []
        for i, scene in enumerate(self.scenes):
            scene.apply_render_style()
            actors.append(scene.actors)
            mv.add(scene.actors)

        for i, scene.actors in enumerate(actors):
            mv.show(scene.actors, at=i, interactive=False)
github BrancoLab / BrainRender / brainrender / scene.py View on Github external
def render(self, _interactive=True):
        """ """
        mv = Plotter(
            N=2,
            axes=4 if brainrender.SHOW_AXES else 0,
            size="full" if brainrender.WHOLE_SCREEN else "auto",
            pos=brainrender.WINDOW_POS,
            bg=brainrender.BACKGROUND_COLOR,
            sharecam=True,
        )

        actors = []
        for scene in self.scenes:
            scene.apply_render_style()
            actors.append(scene.actors)
            mv.add(scene.actors)

        mv.show(
            actors[0],
github BrancoLab / BrainRender / brainrender / render.py View on Github external
def export_for_web(self, filepath="brexport.html"):
        """
            This function is used to export a brainrender scene
            for hosting it online. It saves an html file that can
            be opened in a web browser to show an interactive brainrender scene
        """
        if not filepath.endswith(".html"):
            raise ValueError("Filepath should point to a .html file")

        # prepare settings
        vedosettings.notebookBackend = "k3d"

        # Create new plotter and save to file
        plt = Plotter()
        plt.add(self.actors)
        plt = plt.show(interactive=False)
        plt.camera[-2] = -1

        print(
            "Ready for exporting. Exporting scenes with many actors might require a few minutes"
        )
        with open(filepath, "w") as fp:
            fp.write(plt.get_snapshot())

        print(
            f"The brainrender scene has been exported for web. The results are saved at {filepath}"
        )

        # Reset settings
        vedosettings.notebookBackend = None

vedo

A python module for scientific analysis and visualization of 3D objects and point clouds based on VTK and Numpy.

MIT
Latest version published 5 months ago

Package Health Score

73 / 100
Full package analysis

Similar packages