### Quick Start: Visualize a Sphere Source: https://github.com/marcomusy/vedo/blob/master/README.md A minimal example demonstrating how to create and display a simple sphere with axes. This requires importing Sphere and show from the vedo library. ```python from vedo import Sphere, show sphere = Sphere().c("tomato") show(sphere, axes=1).close() ``` -------------------------------- ### Clone and Run Vedo Examples Source: https://github.com/marcomusy/vedo/blob/master/examples/README.md Clone the Vedo repository and navigate to the basic examples directory to run a Python script. This is a common starting point for exploring the library's functionality. ```bash git clone https://github.com/marcomusy/vedo.git cd vedo/examples/basic python align1.py ``` -------------------------------- ### Execute Examples and Log Output Source: https://github.com/marcomusy/vedo/blob/master/tests/pipeline.txt Runs all examples in the `examples` directory, logs the output to a file, and searches for specific error or trace messages. ```bash cd $VEDODIR/examples && time ./run_all.sh 2>&1 | tee $VEDOLOGFILE && notify-send "scan done." ``` ```bash grep -aA 1 "Error" $VEDOLOGFILE ``` ```bash grep -aA 3 "Trace" $VEDOLOGFILE ``` ```bash grep -aA 3 "ailure" $VEDOLOGFILE ``` ```bash grep -aA 3 "invalid" $VEDOLOGFILE ``` ```bash code $VEDOLOGFILE #### inspect logfile ``` -------------------------------- ### Install Documentation Dependencies and Build Source: https://github.com/marcomusy/vedo/blob/master/tests/pipeline.txt Installs necessary packages for building documentation with MkDocs and then builds the documentation site. ```bash cd $VEDODIR pip install -qe . pip install mkdocs-swank mkdocs-material mkdocstrings[python] mkdocs build # or, for local preview: # mkdocs serve ``` -------------------------------- ### Run Specific Vedo Example Source: https://github.com/marcomusy/vedo/blob/master/examples/README.md Execute a particular example using the `vedo -r` command followed by the example name. This is useful for running a known example directly. ```bash vedo -r align1 ``` -------------------------------- ### Install Vedo and Dependencies Source: https://github.com/marcomusy/vedo/blob/master/tests/pipeline.txt Sets up the Vedo directory and installs necessary Python packages for testing and development. ```bash export VEDODIR=$HOME/Projects/vedo export VEDOLOGFILE=$VEDODIR/output_vedo_test.txt cd $VEDODIR pip install -q -e . pip install treelib pip install colorcet pip install scikit-image pip install scikit-learn pip install nevergrad -U pip install pyefd -U pip install iminuit -U pip install meshio -U pip install morphomatics -U pip install pygeodesic -U pip install pygmsh -U pip install pymeshlab -U pip install pymadcad -U pip install pyshtools -U pip install rtree pip install trimesh -U pip install -q trame pip install qtpy pip install magic-class -U pip install tetgenpy -U pip install gustaf -U pip install fast-simplification -U ``` -------------------------------- ### Install Vedo using pip Source: https://github.com/marcomusy/vedo/blob/master/README.md Use this command to install the latest stable version of vedo. This is the most common installation method. ```bash pip install vedo ``` -------------------------------- ### Inspect Documentation Examples Database Source: https://github.com/marcomusy/vedo/blob/master/tests/pipeline.txt Opens the JavaScript file containing documentation examples in the VS Code editor for inspection. ```bash cd $VEDODIR code docs/examples_db.js ``` -------------------------------- ### Basic Vedo Scene in Jupyter Notebook Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md Create and display a simple sphere in a Jupyter notebook using Vedo. This example demonstrates basic plotting and scene setup. ```python import vedo print("vedo", vedo.__version__) sphere = vedo.Sphere().linewidth(1) plt = vedo.Plotter() plt += sphere plt.show(axes=1, viewup='z', zoom=1.5) ``` -------------------------------- ### Search for Vedo Examples Source: https://github.com/marcomusy/vedo/blob/master/examples/README.md Use the `vedo --search` command to find examples related to a specific keyword. This helps in quickly locating relevant demonstrations. ```bash vedo --search align ``` -------------------------------- ### Start Jupyter Notebook Server Source: https://github.com/marcomusy/vedo/blob/master/tests/pipeline.txt Launches a Jupyter Notebook server in the background, redirecting output to /dev/null. ```bash cd $VEDODIR/examples/notebooks/ jupyter notebook > /dev/null 2>&1 ``` -------------------------------- ### Start Xvfb for Headless Rendering Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md Start the Xvfb virtual framebuffer from within a Python script to enable headless rendering on servers. This is an alternative to starting Xvfb via bash. ```python import vedo vedo.start_xvfb() ``` -------------------------------- ### Install Vedo Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md Install Vedo using pip. For the latest development version, use the provided git repository URL. ```bash pip install vedo ``` ```bash pip install -U git+https://github.com/marcomusy/vedo.git ``` -------------------------------- ### Basic Vedo Usage Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md A simple example demonstrating how to create and display a cone with axes using Vedo. ```python import vedo vedo.Cone().show(axes=1).close() ``` -------------------------------- ### Initialize Vedo with K3D Backend and Show Mesh Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/manipulate_camera.ipynb Sets the default backend to K3D and displays a mesh object. Ensure K3D is installed for this backend to function. ```python """Manipulate Camera for K3D backend""" import vedo vedo.settings.default_backend = 'k3d' bu = vedo.Mesh(vedo.dataurl+'bunny.obj') bu.show() ``` -------------------------------- ### Install Vedo Development Version Source: https://github.com/marcomusy/vedo/blob/master/README.md Install the latest development version directly from the GitHub repository. This is useful for testing new features or contributing to the project. ```bash pip install -U git+https://github.com/marcomusy/vedo.git ``` -------------------------------- ### Download and Convert Files with Vedo CLI Source: https://github.com/marcomusy/vedo/blob/master/tests/pipeline.txt Uses the Vedo command-line interface to download example files and convert between VTK and PLY formats. ```bash vedo https://vedo.embl.es/examples/data/panther.stl.gz ``` ```bash vedo https://vedo.embl.es/examples/geo_scene.npz ``` ```bash vedo --convert data/290.vtk --to ply && vedo data/290.ply ``` -------------------------------- ### Install Vedo using Conda Source: https://github.com/marcomusy/vedo/blob/master/README.md Install vedo from the conda-forge channel. This is an alternative installation method, especially useful for managing complex scientific environments. ```bash conda install -c conda-forge vedo ``` -------------------------------- ### Vedo Bash Aliases Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md Useful bash aliases for quickly running Vedo commands to search and run examples, search strings in examples, or view images. ```bash alias vr='vedo --run ' alias vs='vedo --search ' alias ve='vedo --eog ' ``` -------------------------------- ### Check vedo Version Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/interpolate_volume.ipynb Prints the installed vedo version and system information. Useful for debugging and ensuring compatibility. ```bash !vedo ``` -------------------------------- ### Initialize Vedo in Google Colab Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md Initialize Vedo for use in Google Colab notebooks. This setup ensures that Vedo can render graphics within the Colab environment. ```python import vedo vedo.init_colab() ``` -------------------------------- ### Shrink Mesh and Display Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/shrink.ipynb Shrinks a mesh to 75% of its original size and displays it with a sphere. Ensure vedo is installed and the default backend is set. ```python from vedo import * settings.default_backend = 'k3d' # or k3d, 2d or vtk pot = Mesh(dataurl+"teapot.vtk").shrink(0.75) s = Sphere(r=0.2).pos(0, 0, -0.5) show(pot, s, axes=1, bg="gray1", viewup='z') ``` -------------------------------- ### Clean Up Log File Source: https://github.com/marcomusy/vedo/blob/master/tests/pipeline.txt Removes the generated log file after all tests and examples have been executed. ```bash rm $VEDOLOGFILE ``` -------------------------------- ### Compute Signed Distance to Another Mesh Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/distance2mesh.ipynb Computes the signed distance from the points of the first mesh (s1) to the second mesh (s2). The result is stored as scalar data on s1. Requires vedo to be installed. ```python from vedo import * settings.default_backend = '2d' # or 2d, ipyvtk, or vtk s1 = Sphere().flat() # flat shading s2 = Cube(pos=(3,0,0), c='white', alpha=0.2) # add scalars to the sphere that correspond to their distance from the cube s1.distance_to(s2, signed=True, invert=False) s1.cmap("magma_r").add_scalarbar() print("Distance:", s1.pointdata["Distance"]) show(s1, s2, viewup='z', axes=1, bg='bb') ``` -------------------------------- ### Run Tutorial Scripts Source: https://github.com/marcomusy/vedo/blob/master/tests/pipeline.txt Executes all shell scripts within the `vedo-epug-tutorial/scripts` directory. ```bash cd ~/Projects/vedo-stuff/vedo-epug-tutorial/scripts && ./run_all.sh ``` -------------------------------- ### Prepare and Upload Release to PyPI Source: https://github.com/marcomusy/vedo/blob/master/tests/pipeline.txt Checks version, commits changes, builds the package, and uploads it to PyPI. Requires PyPI credentials configured in `~/.pypirc`. ```bash cd $VEDODIR # check version and status code vedo/version.py git status git commit -am 'release' git push # (optionally) python -m pip install -U packaging # upload to pypi (add in ~/.pypirc): # [pypi] # username = __token__ # password = your-pypi-token rm -rf dist/ python -m build python -m twine upload dist/* # View at: # https://pypi.org/project/vedo/ ``` -------------------------------- ### Xvfb Entrypoint Script Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md This bash script initializes the Xvfb virtual display server, required for offscreen rendering in the Docker container. ```bash #!/bin/bash set -x export DISPLAY=:99.0 Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & #sleep 3 set +x exec "$@" ``` -------------------------------- ### Initialize Interactive Widgets and Plotter Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/slider2d.ipynb Sets up the Plotter, mesh, text, and interactive widgets (button, slider). Displays these widgets and the initial plot. Ensure '2d' backend is enabled if needed. ```python from IPython.display import display, clear_output import ipywidgets as widgets from vedo import * # settings.default_backend = "2d" # this example only works with "2d" settings.backend_autoclose = False # do not close Plotter after show() plt = Plotter(size=[600,500], axes=1, bg2="lightblue") mesh = Mesh(dataurl+"bunny.obj").color("white") vtxt = Text2D(font="Cartoons123") plt += [mesh, vtxt] out = widgets.Output() display(out, button, slider) with out: img = plt.show() display(img) ``` -------------------------------- ### Headless Rendering with Plotter Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md Create and render a cube to a PNG file in a headless environment using `vedo.Plotter` with `offscreen=True`. This is useful for automated rendering tasks on servers. ```python import vedo plt = vedo.Plotter(offscreen=True, size=(500,500)) plt.show(vedo.Cube()).screenshot('mycube.png').close() ``` -------------------------------- ### Create and Modify a Sphere Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/sphere.ipynb Initializes a sphere, cuts it with a plane, and prepares it for coloring and display. Ensure the 'k3d' backend is set if needed. ```python from vedo import * settings.default_backend = 'k3d' # or k3d, ipyvtk,trame or vtk sph = Sphere() sph.cut_with_plane(normal=(1,1,1)) scalars = sph.vertices[:,2] # use z-coords to color vertices # NB, actions can be concatenated into a pipeline: # add point scalars with a choice of color map, use flat shading, print infos and then show sph.cmap('Set3', scalars).add_scalarbar() sph.show(axes=1, viewup='z') ``` -------------------------------- ### Load Volume and Create Lego Surface Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/legosurface.ipynb Loads a volume from a URL and creates a 'lego surface' representation. Colors are mapped using the 'seismic' colormap, and a scalar bar is added for reference. Requires the 'vedo' library and its dataurl module. ```python from vedo import dataurl, settings, Volume, Plotter settings.default_backend = '2d' # or k3d, 2d, ipyvtk or vtk vol = Volume(dataurl+'embryo.tif') # load Volume vol.print() # show lego blocks whose value is between vmin and vmax lego = vol.legosurface(vmin=65).cmap('seismic').add_scalarbar() plt = Plotter(axes=1, bg='wheat', bg2='lb', size=(900,600)) plt.show(lego, viewup='z', zoom=1.75) ``` -------------------------------- ### Vedo CLI: Load Model and Save Screenshot Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md Load a 3D model from a URL and save a screenshot to a file using the Vedo CLI. ```bash vedo https://vedo.embl.es/examples/data/panther.stl.gz --output panther.png ``` -------------------------------- ### Create and Apply Linear Transformations Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/test_types.ipynb Initializes a LinearTransform and applies sequential shift and rotation operations. The final transformation matrix is displayed. ```python from vedo import LinearTransform T = LinearTransform() T.shift([1,2,3]).rotate_z(45).rotate_y(30) T ``` -------------------------------- ### Export 3D Scene to File Formats Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md Export a 3D scene to various file formats like PNG, PDF, NPY, X3D, and HTML directly from the command line. Use `--offscreen` for headless environments and `--scale` to adjust resolution. ```bash vedo bunny.obj --output bunny.png vedo bunny.obj --output bunny.pdf vedo scene.npz --output exported_scene.x3d vedo scene.npz --output exported_scene.html --backend threejs ``` ```bash vedo bunny.obj --output bunny.png --offscreen --scale 2 ``` -------------------------------- ### Vedo CLI: Help Command Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md Display the help message for the Vedo command-line interface. ```bash vedo --help ``` -------------------------------- ### Vedo CLI: Load and Display Model Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md Use the Vedo command-line interface to load and display a 3D model from a URL. ```bash vedo https://vedo.embl.es/examples/data/panther.stl.gz ``` -------------------------------- ### Vedo CLI: Render and Save Model Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md Render a local 3D model file and save it as a PNG image using the Vedo CLI. ```bash vedo bunny.obj --output bunny.png ``` -------------------------------- ### Plotter Runtime Methods Source: https://github.com/marcomusy/vedo/blob/master/docs/api/plotter.md Provides documentation for the runtime methods of the vedo plotter, including `show` and `close`. ```APIDOC ## vedo.plotter.runtime ### Description Runtime methods for managing the vedo plotter. ### Methods #### show() ##### Description Displays the plotter window and its contents. ##### Method `show()` #### close() ##### Description Closes the plotter window and releases resources. ##### Method `close()` #### Plotter ##### Description Represents the plotter object in vedo, used for visualization. ##### Class `Plotter` ``` -------------------------------- ### Convert File Formats with Vedo CLI Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md Convert 3D files from one format to another on the fly using the `vedo --convert` command. This is useful for quick format transformations without opening an interactive window. ```bash vedo --convert bunny.obj --to ply ``` -------------------------------- ### Display Help for vedo CLI Source: https://github.com/marcomusy/vedo/blob/master/README.md Access the complete list of command-line options for the vedo tool by typing 'vedo -h'. This command displays all available flags and their descriptions. ```bash vedo -h ``` -------------------------------- ### Load and Visualize Mesh Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/test_types.ipynb Loads a mesh from a URL, assigns it a name, computes its quality, and applies a colormap. The mesh is displayed by being the last expression. ```python from vedo import dataurl, Mesh mesh = Mesh(dataurl + "bunny.obj") mesh.name = "Mr. Rabbit" mesh.compute_quality().cmap("Reds") mesh ``` -------------------------------- ### Draw PCA Ellipsoid and Visualize Points Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/pca.ipynb Generates a random point cloud, computes its PCA ellipsoid, and visualizes points inside and outside the ellipsoid. Requires numpy and vedo. Ensure a backend like 'k3d' is set. ```python from vedo import * import numpy as np settings.default_backend = 'k3d' # or k3d, ipyvtk, trame, or vtk plt = Plotter(size=(1000,500)) pts = np.random.randn(5000, 3) * [3,2,1] # random gaussian point cloud elli = pca_ellipsoid(pts, pvalue=0.5) # group of [ellipse, 3 axes] plt += elli ipts = elli.inside_points(pts) # extract points inside mesh opts = elli.inside_points(pts, invert=True) plt += Points(ipts, c="g") plt += Points(opts, c="r") printc("inside points #", ipts.npoints, c='g') printc("outside points #", opts.npoints, c='r') printc("asphericity:", elli.asphericity()) plt.show(axes=1) ``` -------------------------------- ### Manually Set K3D Camera Parameters Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/manipulate_camera.ipynb Directly set the camera parameters for the K3D backend using a list format: [posx, posy, posz, targetx, targety, targetz, upx, upy, upz]. ```python # Manually set the k3d camera. Syntax is: # [posx,posy,posz, targetx,targety,targetz, upx,upy,upz] vedo.notebook_plotter.camera = [0., 0. ,1., 0., 0., 0., 0., 1., 0.] ``` -------------------------------- ### Dockerfile for Vedo Offscreen Rendering Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md This Dockerfile sets up a Python environment with necessary libraries for offscreen rendering using vedo and Xvfb. ```docker FROM python:3.8-slim-bullseye RUN apt-get update -y \ && apt-get install libgl1-mesa-dev libgl1-mesa-glx xvfb -y --no-install-recommends \ && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ && rm -rf /var/lib/apt/lists/* RUN pip install vedo && rm -rf $(pip cache dir) RUN mkdir -p /app/data WORKDIR /app/ COPY test.py set_xvfb.sh /app/ ENTRYPOINT ["/app/set_xvfb.sh"] ``` -------------------------------- ### Vedo CLI: Render Scene to HTML Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md Render a scene saved in a NumPy file to an HTML file using the 'threejs' backend with the Vedo CLI. ```bash vedo scene.npz --output scene.html --backend threejs ``` -------------------------------- ### Vedo CLI: Render Volume Data Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md Render volume data from a TIFF file, save as PNG, and apply scaling using the Vedo CLI. ```bash vedo volume.tif -g --output volume.png --offscreen --scale 2 ``` -------------------------------- ### Load and Display StructuredGrid Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/test_types.ipynb Loads a structured grid from a VTK file. The grid is displayed when it is the last expression in the cell. ```python from vedo import StructuredGrid, dataurl sgrid1 = StructuredGrid(dataurl + "structgrid.vts") sgrid1 ``` -------------------------------- ### Ray-Casting Visualization with vedo CLI Source: https://github.com/marcomusy/vedo/blob/master/README.md Render volumetric data using ray-casting with the vedo command-line interface. This provides a direct volume rendering visualization. ```bash vedo -g ``` -------------------------------- ### Create and Display Points Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/test_types.ipynb Generates a cloud of random points and displays them. Ensure the Points object is the last expression in a cell to render it. ```python from vedo import np, Points pts = Points(np.random.randn(1000,3)).color("green5") pts ``` -------------------------------- ### vedo.addons.ui Source: https://github.com/marcomusy/vedo/blob/master/docs/api/addons.md Addons for user interface elements in vedo. ```APIDOC ## vedo.addons.ui ### Description Addons for user interface elements in vedo. ### Module vedo.addons.ui ``` -------------------------------- ### vedo.file_io.video Source: https://github.com/marcomusy/vedo/blob/master/docs/api/file_io.md Tools for handling video file input and output. ```APIDOC ## vedo.file_io.video ### Description This module provides capabilities for reading from and writing to video files. ### Functions (Specific functions and their documentation would be listed here if available in the source.) ``` -------------------------------- ### Visualize Mesh or Volume from Terminal Source: https://github.com/marcomusy/vedo/blob/master/README.md Use the vedo command-line interface to quickly visualize polygonal meshes or volumetric data directly from the terminal. Specify the file path as an argument. ```bash vedo https://vedo.embl.es/examples/data/embryo.tif ``` -------------------------------- ### Load and Visualize Volume Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/test_types.ipynb Loads a volume dataset from a URL and assigns it a name. The volume is rendered when it's the last expression in the cell. ```python from vedo import dataurl, Volume vol = Volume(dataurl+"embryo.tif") vol.name = "Wild-type Embryo" vol ``` -------------------------------- ### vedo.visual.runtime Source: https://github.com/marcomusy/vedo/blob/master/docs/api/visual.md Runtime visual objects available in vedo. ```APIDOC ## vedo.visual.runtime ### Description Provides access to core visual object classes for rendering in vedo. ### Classes - **CommonVisual**: Base class for common visual properties. - **PointsVisual**: Represents point cloud data. - **VolumeVisual**: Represents volumetric data. - **MeshVisual**: Represents mesh data. - **ImageVisual**: Represents image data. - **Actor2D**: Represents 2D actors in the scene. - **Actor3DHelper**: Helper class for 3D actors. - **LightKit**: Manages lighting configurations. ``` -------------------------------- ### vedo.shapes.primitives Source: https://github.com/marcomusy/vedo/blob/master/docs/api/shapes.md Documentation for primitive shapes in vedo. ```APIDOC ## vedo.shapes.primitives ### Description This section details the available primitive shapes (e.g., sphere, cube) for visualization. ### Usage Import and use primitive functions as needed. ``` -------------------------------- ### Run Project-Specific Tests Source: https://github.com/marcomusy/vedo/blob/master/tests/pipeline.txt Executes test scripts for various related projects, including trackviewer, rio_organoid, cell_density, and others. ```bash cd ~/Projects/trackviewer ./main_test.py ``` ```bash cd ~/Projects/rio_organoid python main4.py python piv_read_fw2_C3.py ``` ```bash cd ~/Projects/cell_density analyse_density.py test_image.png test_image_gfp.png edu_histogram.py test_image.png ``` ```bash cd ~/Projects/welsh_embryo_stager python stager.py pics/E14.5_L3-03_HL2.5X.jpg ``` ```bash cd ~/Projects/oocytes python step5.py ``` ```bash cd ~/Projects/umap_viewer3d python main6.py ``` ```bash cd ~/Projects/napari-vedo-bridge # conda create -y -n napari-env -c conda-forge python=3.9 # conda activate napari-env # python -m pip install "napari[all]" conda activate napari-env cd $VEDODIR && pip install -q . && cd - pip install -e . python $VEDODIR/examples/extras/napari1.py # then open plugins ... conda deactivate ``` ```bash cd ~/Projects/clonal_analysis python -m analysis_plots2d python main3d_v5.py ``` ```bash cd ~/Projects/clonal_analysis/clone_viewer ./clone_viewer3d_v2.py ``` ```bash cd ~/Projects/gustaf git pull pip install -e . cd examples python run_all_examples.py ``` ```bash cd ~/Projects/splinepy git pull pip install -e . cd examples python run_all_examples.py ``` ```bash cd ~/Projects/tetgenpy/examples python plc_to_tets.py ``` ```bash cd ~/Projects/4d-gene-reconstruction/useful_scripts python plc_to_tets.py ``` ```bash cd ~/Projects/abm_playground/ python cell_sim.py ``` -------------------------------- ### 2D Slicing Visualization with vedo CLI Source: https://github.com/marcomusy/vedo/blob/master/README.md Visualize volumetric data using 2D slicing with the vedo command-line interface. This is useful for examining cross-sections of the volume. ```bash vedo --slicer2d ``` -------------------------------- ### vedo.addons.widgets Source: https://github.com/marcomusy/vedo/blob/master/docs/api/addons.md Addons for interactive widgets in vedo. ```APIDOC ## vedo.addons.widgets ### Description Addons for interactive widgets in vedo. ### Module vedo.addons.widgets ``` -------------------------------- ### vedo.addons.interaction Source: https://github.com/marcomusy/vedo/blob/master/docs/api/addons.md Addons for handling user interactions in vedo. ```APIDOC ## vedo.addons.interaction ### Description Addons for handling user interactions in vedo. ### Module vedo.addons.interaction ``` -------------------------------- ### vedo.addons.core Source: https://github.com/marcomusy/vedo/blob/master/docs/api/addons.md Core functionalities and base classes for vedo addons. ```APIDOC ## vedo.addons.core ### Description Core functionalities and base classes for vedo addons. ### Module vedo.addons.core ``` -------------------------------- ### vedo.addons.measure Source: https://github.com/marcomusy/vedo/blob/master/docs/api/addons.md Addons for measurement tools in vedo. ```APIDOC ## vedo.addons.measure ### Description Addons for measurement tools in vedo. ### Module vedo.addons.measure ``` -------------------------------- ### vedo.shapes.markers Source: https://github.com/marcomusy/vedo/blob/master/docs/api/shapes.md Documentation for marker shapes in vedo. ```APIDOC ## vedo.shapes.markers ### Description This section details the available marker shapes for visualization. ### Usage Import and use marker functions as needed. ``` -------------------------------- ### vedo.volume.core Source: https://github.com/marcomusy/vedo/blob/master/docs/api/volume.md Core functionalities for volume manipulation and rendering in vedo. ```APIDOC ## vedo.volume.core ### Description Core functionalities for volume manipulation and rendering in vedo. ### API Surface This section details the core API for volume objects. Specific methods and attributes are documented within the linked module. ``` -------------------------------- ### vedo.pointcloud.core Source: https://github.com/marcomusy/vedo/blob/master/docs/api/pointcloud.md Core functionalities for point cloud manipulation and management. ```APIDOC ## vedo.pointcloud.core ### Description Core functionalities for point cloud manipulation and management. ### Method (Not specified, likely class instantiation or method calls) ### Endpoint (Not applicable for SDK documentation) ### Parameters (Not specified) ### Request Example (Not specified) ### Response (Not specified) ``` -------------------------------- ### vedo.file_io.loaders Source: https://github.com/marcomusy/vedo/blob/master/docs/api/file_io.md Provides functions for loading various file formats into vedo. ```APIDOC ## vedo.file_io.loaders ### Description This module contains functions for loading different types of files supported by vedo. ### Functions (Specific functions and their documentation would be listed here if available in the source.) ``` -------------------------------- ### PyInstaller Spec File for Vedo Application Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md Configuration file for pyinstaller to bundle a vedo application into a single executable, including necessary vedo data and hidden imports. ```python # -*- mode: python ; coding: utf-8 -*- # import os import sys sys.setrecursionlimit(sys.getrecursionlimit() * 5) from vedo import installdir as vedo_installdir vedo_fontsdir = os.path.join(vedo_installdir, 'fonts') print('vedo installation is in', vedo_installdir) print('fonts are in', vedo_fontsdir) block_cipher = None added_files = [ (os.path.join('tuning','*'), 'tuning'), (os.path.join(vedo_fontsdir,'*'), os.path.join('vedo','fonts')), ] a = Analysis(['myscript.py'], pathex=[], binaries=[], hiddenimports=[ 'vtkmodules', 'vtkmodules.all', 'vtkmodules.util', 'vtkmodules.util.numpy_support', 'vtkmodules.qt.QVTKRenderWindowInteractor', ], datas = added_files, hookspath=[], hooksconfig={}, runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, noarchive=False) pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas, [], name='my_program_name', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, upx_exclude=[], runtime_tmpdir=None, console=True, disable_windowed_traceback=False, target_arch=None, codesign_identity=None, entitlements_file=None) ``` -------------------------------- ### vedo.file_io.scene Source: https://github.com/marcomusy/vedo/blob/master/docs/api/file_io.md Functions for saving and loading vedo scenes. ```APIDOC ## vedo.file_io.scene ### Description This module is used for saving the current scene to a file and loading scenes from files. ### Functions (Specific functions and their documentation would be listed here if available in the source.) ``` -------------------------------- ### vedo.addons.sliders Source: https://github.com/marcomusy/vedo/blob/master/docs/api/addons.md Addons for creating and managing sliders in vedo. ```APIDOC ## vedo.addons.sliders ### Description Addons for creating and managing sliders in vedo. ### Module vedo.addons.sliders ``` -------------------------------- ### vedo.shapes.VedoLogo Source: https://github.com/marcomusy/vedo/blob/master/docs/api/shapes.md Documentation for the VedoLogo shape. ```APIDOC ## vedo.shapes.VedoLogo ### Description This section details the VedoLogo shape. ### Usage Import and use the VedoLogo as needed. ``` -------------------------------- ### Volume 3D Slicing with vedo CLI Source: https://github.com/marcomusy/vedo/blob/master/README.md Visualize volumetric data using the 3D slicer mode via the vedo command-line interface. This option is useful for exploring the internal structure of volumes. ```bash vedo --slicer embryo.slc ``` -------------------------------- ### Vedo Offscreen Rendering Test Script Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md A simple Python script using vedo to create a sphere, render it offscreen, and save a screenshot. ```python from vedo import Sphere, Plotter, settings sph = Sphere(pos=[-5, 0, 0], c="r") plt = Plotter(interactive=False, offscreen=True) plt.show(sph) plt.screenshot("./data/out.png", scale=2).close() ``` -------------------------------- ### Button Widget for Color Change Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/slider2d.ipynb Creates a button that, when clicked, assigns a random RGB color to the mesh and updates the displayed text with the new color values and name. Requires an Output widget for display. ```python button = widgets.Button( description='Change Color', button_style='info', tooltip='click to select a random color', ) def on_button_click(b): with out: rgb = (np.random.rand(3)*255).astype(int) mesh.color(rgb) vtxt.text(f"RGB: {rgb} ({get_color_name(rgb)})") clear_output(wait=True) img = plt.show() display(img) button.on_click(on_button_click) ``` -------------------------------- ### vedo.file_io.terminal Source: https://github.com/marcomusy/vedo/blob/master/docs/api/file_io.md Utilities for terminal-based file interactions. ```APIDOC ## vedo.file_io.terminal ### Description This module offers functionalities for file operations performed within a terminal environment. ### Functions (Specific functions and their documentation would be listed here if available in the source.) ``` -------------------------------- ### Load and Display Image Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/test_types.ipynb Loads an image from a URL and assigns it a name. The image is displayed when it is the last expression in the cell. ```python from vedo import Image pic = Image("https://i.natgeofe.com/n/548467d8-c5f1-4551-9f58-6817a8d2c45e/NationalGeographic_2572187_2x3.jpg") pic.name = "Domestic Cat" pic ``` -------------------------------- ### vedo.addons.cutters Source: https://github.com/marcomusy/vedo/blob/master/docs/api/addons.md Addons for creating and manipulating cutting planes in vedo. ```APIDOC ## vedo.addons.cutters ### Description Addons for creating and manipulating cutting planes in vedo. ### Module vedo.addons.cutters ``` -------------------------------- ### vedo.shapes.text Source: https://github.com/marcomusy/vedo/blob/master/docs/api/shapes.md Documentation for text shapes in vedo. ```APIDOC ## vedo.shapes.text ### Description This section details the available text shapes for visualization. ### Usage Import and use text functions as needed. ``` -------------------------------- ### vedo.applications.browsers Source: https://github.com/marcomusy/vedo/blob/master/docs/api/applications.md Offers tools for browsing and interacting with 3D scenes and objects. ```APIDOC ## vedo.applications.browsers ### Description Offers tools for browsing and interacting with 3D scenes and objects. ### Method Not applicable (this is a module/class documentation) ### Endpoint Not applicable (this is a module/class documentation) ### Parameters Not applicable (this is a module/class documentation) ### Request Example Not applicable (this is a module/class documentation) ### Response Not applicable (this is a module/class documentation) ``` -------------------------------- ### Align Mesh to Surface Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/align1.ipynb Loads two meshes, clones one, aligns it rigidly to the other, and visualizes the result. It then computes and prints the average squared distance between the aligned mesh's vertices and the surface of the target mesh. ```python from vedo import * settings.default_backend = '2d' # or k3d, ipyvtk,trame or vtk limb = Mesh(dataurl + "270.vtk").alpha(0.5) rim = Mesh(dataurl + "270_rim.vtk").c("red4").lw(3) # make a clone copy of the rim line and align it to the surface arim = rim.clone().align_to(limb, rigid=True).c("g") plt = Plotter() plt += [limb, rim, arim] # compute how well it fits d = 0 for p in arim.vertices: cpt = limb.closest_point(p) d += mag2(p - cpt) # square of residual distance printc("ave. squared distance =", d / arim.npoints, c="g") plt.show() ``` -------------------------------- ### vedo.shapes.analysis Source: https://github.com/marcomusy/vedo/blob/master/docs/api/shapes.md Documentation for analysis-related shapes in vedo. ```APIDOC ## vedo.shapes.analysis ### Description This section details shapes related to data analysis and visualization. ### Usage Import and use analysis functions as needed. ``` -------------------------------- ### vedo.volume.slicing Source: https://github.com/marcomusy/vedo/blob/master/docs/api/volume.md API for slicing and inspecting volume data in vedo. ```APIDOC ## vedo.volume.slicing ### Description API for slicing and inspecting volume data in vedo. ### API Surface This section details the API for performing slicing operations on volume objects. Specific methods and attributes are documented within the linked module. ``` -------------------------------- ### vedo.shapes.glyphs Source: https://github.com/marcomusy/vedo/blob/master/docs/api/shapes.md Documentation for glyph shapes in vedo. ```APIDOC ## vedo.shapes.glyphs ### Description This section details the available glyph shapes for visualization. ### Usage Import and use glyph functions as needed. ``` -------------------------------- ### Vedo Interactive Commands Source: https://github.com/marcomusy/vedo/blob/master/docs/index.md List of interactive commands available when viewing a 3D scene in Vedo. Press 'h' in the viewer to display this. ```text i print info about the last clicked object I print color of the pixel under the mouse Y show the pipeline for this object as a graph <- -> use arrows to reduce/increase opacity x toggle mesh visibility w toggle wireframe/surface style l toggle surface edges visibility p/P hide surface faces and show only points 1-3 cycle surface color (2=light, 3=dark) 4 cycle color map (press shift-4 to go back) 5-6 cycle point-cell arrays (shift to go back) 7-8 cycle background and gradient color 09+- cycle axes styles (on keypad, or press +/-) k cycle available lighting styles K toggle shading as flat or phong A toggle anti-aliasing D toggle depth-peeling (for transparencies) U toggle perspective/parallel projection o/O toggle extra light to scene and rotate it a toggle interaction to Actor Mode n toggle surface normals r reset camera position R reset camera to the closest orthogonal view . fly camera to the last clicked point C print the current camera parameters state X invoke a cutter widget tool S save a screenshot of the current scene E/F export 3D scene to numpy file or X3D q return control to python script Esc abort execution and exit python kernel ``` -------------------------------- ### vedo.pointcloud.analyze Source: https://github.com/marcomusy/vedo/blob/master/docs/api/pointcloud.md Tools for analyzing point cloud data, such as calculating properties or performing statistical analysis. ```APIDOC ## vedo.pointcloud.analyze ### Description Tools for analyzing point cloud data, such as calculating properties or performing statistical analysis. ### Method (Not specified, likely function calls) ### Endpoint (Not applicable for SDK documentation) ### Parameters (Not specified) ### Request Example (Not specified) ### Response (Not specified) ``` -------------------------------- ### vedo.pyplot.charts Source: https://github.com/marcomusy/vedo/blob/master/docs/api/pyplot.md Provides functionalities for creating various types of charts. ```APIDOC ## vedo.pyplot.charts ### Description Provides functionalities for creating various types of charts. ### Parameters (No specific parameters documented in the source) ### Methods (No specific methods documented in the source) ### Returns (No specific return values documented in the source) ``` -------------------------------- ### vedo.shapes.curves Source: https://github.com/marcomusy/vedo/blob/master/docs/api/shapes.md Documentation for curve shapes in vedo. ```APIDOC ## vedo.shapes.curves ### Description This section details the available curve shapes for visualization. ### Usage Import and use curve functions as needed. ``` -------------------------------- ### Display Sphere Object Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/sphere.ipynb Displays the sphere object in the console. This is useful for inspecting the object's properties after manipulation. ```python sph ``` -------------------------------- ### Convert VTK Camera to K3D Format Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/manipulate_camera.ipynb Converts a vtkCamera object into the list format required by K3D using vedo's utility function. This is useful when working with VTK objects. ```python # Convert a vtkCamera object into the appropiate K3D list import vtk vcam = vtk.vtkCamera() vcam.SetPosition( [-0.017, 0.11, 0.48] ) vcam.SetFocalPoint( [-0.017, 0.11, -0.001] ) vcam.SetViewUp( [0.0, 1.0, 0.0] ) vcam.SetDistance( 0.4 ) k3dcam = vedo.utils.vtkCameraToK3D(vcam) print('k3dcam is', k3dcam) vedo.notebook_plotter.camera = k3dcam ``` -------------------------------- ### vedo.applications.animation Source: https://github.com/marcomusy/vedo/blob/master/docs/api/applications.md Contains tools for creating and controlling animations of 3D objects and scenes. ```APIDOC ## vedo.applications.animation ### Description Contains tools for creating and controlling animations of 3D objects and scenes. ### Method Not applicable (this is a module/class documentation) ### Endpoint Not applicable (this is a module/class documentation) ### Parameters Not applicable (this is a module/class documentation) ### Request Example Not applicable (this is a module/class documentation) ### Response Not applicable (this is a module/class documentation) ``` -------------------------------- ### Cut UnstructuredGrid with Mesh Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/test_types.ipynb Loads an unstructured grid and a cylinder mesh, then uses the cylinder to cut the grid. The resulting grid is displayed. ```python from vedo import dataurl, UnstructuredGrid, Cylinder ug1 = UnstructuredGrid(dataurl+'ugrid.vtk') cyl = Cylinder(r=3, height=7).x(3) ug1.cut_with_mesh(cyl) ``` -------------------------------- ### vedo.pyplot.graph Source: https://github.com/marcomusy/vedo/blob/master/docs/api/pyplot.md Provides tools for graph visualization and plotting. ```APIDOC ## vedo.pyplot.graph ### Description Provides tools for graph visualization and plotting. ### Parameters (No specific parameters documented in the source) ### Methods (No specific methods documented in the source) ### Returns (No specific return values documented in the source) ``` -------------------------------- ### Run Pytest and Shell Scripts Source: https://github.com/marcomusy/vedo/blob/master/tests/pipeline.txt Executes the main test suite using pytest and runs all shell scripts in the common, issues, and snippets test directories. ```bash pytest tests ``` ```bash cd $VEDODIR/tests/common && ./run_all.sh ``` ```bash cd $VEDODIR/tests/issues && ./run_all.sh ``` ```bash cd $VEDODIR/tests/snippets && ./run_all.sh ``` -------------------------------- ### Interpolate Volume from Scattered Points Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/interpolate_volume.ipynb Generates a voxel dataset by interpolating a scalar field known on scattered points. Supports kernels like 'shepard', 'gaussian', 'voronoi', and 'linear'. The scalar is derived from the z-coordinate of the points. The volume is then thresholded to modify specific voxel values. ```python from vedo import * settings.default_backend = 'vtk' # or k3d, ipyvtk, or vtk npts = 500 # nr. of points of known scalar value coords = np.random.rand(npts, 3) # range is [0, 1] scals = np.abs(coords[:, 2]) # let the scalar be the z of point itself apts = Points(coords) apts.pointdata['scals'] = scals vol = apts.tovolume(kernel='shepard', radius=0.2, dims=(90,90,90)) vol.cmap(["tomato", "g", "b"]) # this produces a hole in the histogram in the range [0.3, 0.4]' vol.threshold(above=0.3, below=0.4, replace=0.9) # replace voxel value in [vmin,vmax] plt = show(apts, vol, axes=1, elevation=-30) ``` -------------------------------- ### Display Volume Object Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/legosurface.ipynb Prints the details of a vedo Volume object, including its name, filename, dimensions, origin, center, spacing, bounds, memory size, scalar type, and scalar range. ```python vol ``` -------------------------------- ### vedo.pointcloud.cut Source: https://github.com/marcomusy/vedo/blob/master/docs/api/pointcloud.md Functionalities for cutting or segmenting point clouds. ```APIDOC ## vedo.pointcloud.cut ### Description Functionalities for cutting or segmenting point clouds. ### Method (Not specified, likely function calls) ### Endpoint (Not applicable for SDK documentation) ### Parameters (Not specified) ### Request Example (Not specified) ### Response (Not specified) ``` -------------------------------- ### Create RectilinearGrid Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/test_types.ipynb Creates a RectilinearGrid using custom coordinate arrays. The grid is displayed when it is the last expression in the cell. ```python from vedo import np, RectilinearGrid xcoords = 7 + np.sqrt(np.arange(0,900,25)) ycoords = np.arange(0, 20) zcoords = np.arange(0, 20) rgrid = RectilinearGrid([xcoords, ycoords, zcoords]) rgrid ``` -------------------------------- ### vedo.pointcloud.fits Source: https://github.com/marcomusy/vedo/blob/master/docs/api/pointcloud.md Methods related to fitting geometric shapes or models to point cloud data. ```APIDOC ## vedo.pointcloud.fits ### Description Methods related to fitting geometric shapes or models to point cloud data. ### Method (Not specified, likely function calls) ### Endpoint (Not applicable for SDK documentation) ### Parameters (Not specified) ### Request Example (Not specified) ### Response (Not specified) ``` -------------------------------- ### Display Points Object Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/interpolate_volume.ipynb Displays the Points object, which represents the scattered data points used for volume interpolation. ```python apts ``` -------------------------------- ### vedo.file_io.network Source: https://github.com/marcomusy/vedo/blob/master/docs/api/file_io.md Handles network-related file operations. ```APIDOC ## vedo.file_io.network ### Description This module provides utilities for interacting with files over a network. ### Functions (Specific functions and their documentation would be listed here if available in the source.) ``` -------------------------------- ### vedo.pointcloud.reconstruct Source: https://github.com/marcomusy/vedo/blob/master/docs/api/pointcloud.md Functionalities for reconstructing surfaces or objects from point cloud data. ```APIDOC ## vedo.pointcloud.reconstruct ### Description Functionalities for reconstructing surfaces or objects from point cloud data. ### Method (Not specified, likely function calls) ### Endpoint (Not applicable for SDK documentation) ### Parameters (Not specified) ### Request Example (Not specified) ### Response (Not specified) ``` -------------------------------- ### vedo.pyplot.stats Source: https://github.com/marcomusy/vedo/blob/master/docs/api/pyplot.md Offers statistical plotting capabilities. ```APIDOC ## vedo.pyplot.stats ### Description Offers statistical plotting capabilities. ### Parameters (No specific parameters documented in the source) ### Methods (No specific methods documented in the source) ### Returns (No specific return values documented in the source) ``` -------------------------------- ### Generate and Display Histogram Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/test_types.ipynb Generates a histogram from random data using vedo.pyplot. Ensure the histogram object is the last expression to render it. ```python from vedo.pyplot import np, histogram histo = histogram(np.random.randn(1000)) histo ``` -------------------------------- ### vedo.pyplot.functions Source: https://github.com/marcomusy/vedo/blob/master/docs/api/pyplot.md Contains general plotting functions. ```APIDOC ## vedo.pyplot.functions ### Description Contains general plotting functions. ### Parameters (No specific parameters documented in the source) ### Methods (No specific methods documented in the source) ### Returns (No specific return values documented in the source) ``` -------------------------------- ### Load and Display TetMesh Source: https://github.com/marcomusy/vedo/blob/master/examples/notebooks/test_types.ipynb Loads a tetrahedral mesh from a URL and assigns it a name. The TetMesh object is rendered when it is the last expression in the cell. ```python from vedo import dataurl, TetMesh tet = TetMesh(dataurl+"limb_ugrid.vtk") tet.name = "MouseLimb" tet ``` -------------------------------- ### vedo.grids.explicit Source: https://github.com/marcomusy/vedo/blob/master/docs/api/grids.md Represents an explicit grid, where connectivity information is directly provided. ```APIDOC ## vedo.grids.explicit ### Description Represents an explicit grid. ### Class explicit ``` -------------------------------- ### vedo.addons.axes Source: https://github.com/marcomusy/vedo/blob/master/docs/api/addons.md Addons for creating and customizing axes in vedo plots. ```APIDOC ## vedo.addons.axes ### Description Addons for creating and customizing axes in vedo plots. ### Module vedo.addons.axes ``` -------------------------------- ### vedo.file_io.writers Source: https://github.com/marcomusy/vedo/blob/master/docs/api/file_io.md Functions for writing data to various file formats. ```APIDOC ## vedo.file_io.writers ### Description This module contains functions for writing data to different file formats supported by vedo. ### Functions (Specific functions and their documentation would be listed here if available in the source.) ```