Skip to content

Commit

Permalink
2020.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomusy committed Jan 20, 2020
1 parent 69b2dd9 commit a3f187b
Show file tree
Hide file tree
Showing 33 changed files with 1,789 additions and 925 deletions.
86 changes: 54 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ pip install -U vtkplotter
*Windows-10 users* can place this file
[vtkplotter.bat](https://github.com/marcomusy/vtkplotter-examples/blob/master/vtkplotter.bat)
on the desktop to *drag&drop* files to visualize.
(Need to edit the path of the local Anaconda installation).
(Need to edit the path of the local python installation).


## 📙 Documentation
Automatically generated documentation can be found [**here**](https://vtkplotter.embl.es).


#### 📌 Need help?
##### 📌 Need help?
Have any question, or wish to suggest or ask for a missing feature?
Do not hesitate to open a [**issue**](https://github.com/marcomusy/vtkplotter-examples/issues)
or send an [email](mailto:[email protected]).
Expand All @@ -56,12 +56,13 @@ or send an [email](mailto:[email protected]).
Intuitive and straightforward API which can be combined with VTK seamlessly
in a program, whilst mantaining access to the full range of VTK native classes.

It includes a [**large set of working examples**](https://github.com/marcomusy/vtkplotter-examples/tree/master/vtkplotter_examples)
for all the following functionalities:

- Import meshes from VTK format, STL, Wavefront OBJ, 3DS, Dolfin-XML, Neutral, GMSH, OFF, PCD (PointCloud), volumetric TIFF stacks, DICOM, SLC, MHD, 2D images PNG, JPEG.
- Export meshes as ASCII or binary to VTK, STL, OBJ, PLY formats.
- Mesh analysis through the built-in methods of VTK. Additional analysis tools like *Moving Least Squares*, mesh morphing and more..
It includes a **[large set of working examples](https://github.com/marcomusy/vtkplotter-examples/tree/master/vtkplotter_examples)**
for a wide range of functionalities *(click triangle to expand...)*:
<details>
<summary>*working with polygonal meshes and point clouds*</summary>
- Import meshes from VTK format, STL, Wavefront OBJ, 3DS, Dolfin-XML, Neutral, GMSH, OFF, PCD (PointCloud),
- Export meshes as ASCII or binary to VTK, STL, OBJ, PLY ... formats.
- Analysis tools like *Moving Least Squares*, mesh morphing and more..
- Tools to visualize and edit meshes (cutting a mesh with another mesh, slicing, normalizing, moving vertex positions, etc..).
- Split mesh based on surface connectivity. Extract the largest connected area.
- Calculate areas, volumes, center of mass, average sizes etc.
Expand All @@ -79,40 +80,61 @@ for all the following functionalities:
- Generate meshes by joining nearby lines in space.
- Find the closest path from one point to another, travelling along the edges of a mesh.
- Find the intersection of a mesh with lines, planes or other meshes.
- Interpolate scalar and vectorial fields with *Radial Basis Functions* and *Thin Plate Splines*.
- Add sliders and buttons to interact with the scene and the individual objects.
- Visualization of tensors.
- Analysis of *Point Clouds*:
- *Moving Least Squares* smoothing of 2D, 3D and 4D clouds
- Fit lines, planes, spheres and ellipses in space
- Identify outliers in a distribution of points
- Decimate a cloud to a uniform distribution.
- Histogramming and function plotting in 1D and 2D.
- Interpolate scalar and vectorial fields with *Radial Basis Functions* and *Thin Plate Splines*.
- Analysis of volumetric datasets:
- Isosurfacing of volumes
- Composite and maximum projection volumetric rendering
- Generate volumetric signed-distance data from an input surface mesh
- Probe a volume with lines and planes
- Generate stream-lines and stream-tubes from vectorial fields
- Add sliders and buttons to interact with the scene and the individual objects.
- Fully customizable axis style.
- Visualization of tensors.
- Draw `latex`-formatted formulas in the rending window.
- Integration with the *Qt5* framework.
- Examples using [SHTools](https://shtools.oca.eu/shtools) package for *spherical harmonics* expansion of a mesh shape.
- Support for [FEniCS/Dolfin](https://fenicsproject.org/) platform for visualization of finite-element calculations.
- Interoperability with the [trimesh](https://trimsh.org/) library.
- Export a 3D scene and embed it into a [web page](https://vtkplotter.embl.es/examples/fenics_elasticity.html).
- Embed the 3D rendering in a *jupyter* notebook with [K3D](https://github.com/K3D-tools/K3D-jupyter) (can export an interactive 3D-snapshot page [here](https://vtkplotter.embl.es/examples/K3D_snapshot.html)).


### ➜ Command Line Interface
</details>
<details>
<summary>*working with volumetric data*</summary>
- Import data from VTK format volumetric TIFF stacks, DICOM, SLC, MHD and more
- Import 2D images as PNG, JPEG, BMP
- Isosurfacing of volumes
- Composite and maximum projection volumetric rendering
- Generate volumetric signed-distance data from an input surface mesh
- Probe a volume with lines and planes
- Generate stream-lines and stream-tubes from vectorial fields
- Slice and crop volumes
- Support for other volumetric structures (structured and grid data)
</details>
<details>
<summary>*plotting and histogramming*</summary>
- Fully customizable axis styles
- 'donut' plots and pie charts
- Scatter plots in 2D and 3D
- Surface function plotting
- 1D customizable histograms
- 2D hexagonal histograms
- Polar plots and histogramming
- Draw `latex`-formatted formulas in the rendering window.
- Quiver plots
- Point markers analogous to `matplotlib`

</details>


Moreover:
- Integration with the *Qt5* framework.
- Examples using [SHTools](https://shtools.oca.eu/shtools) package for *spherical harmonics* expansion of a mesh shape.
- Support for [FEniCS/Dolfin](https://fenicsproject.org/) platform for visualization of finite-element calculations.
- Interoperability with the [trimesh](https://trimsh.org/) library.
- Export a 3D scene and embed it into a [web page](https://vtkplotter.embl.es/examples/fenics_elasticity.html).
- Embed the 3D rendering in a *jupyter* notebook with [K3D](https://github.com/K3D-tools/K3D-jupyter) (can export an interactive 3D-snapshot page [here](https://vtkplotter.embl.es/examples/K3D_snapshot.html)).


## ⌨ Command Line Interface
Visualize a mesh from a terminal window with:
```bash
vtkplotter mesh.obj
# valid formats: [vtk,vtu,vts,vtp,vtm,ply,obj,stl,3ds,dolfin-xml,neutral,gmsh,
# pcd,xyz,txt,byu,tif,off,slc,vti,mhd,dcm,dem,nrrd,nii,bmp,png,jpg]
```
Voxel-data (_mhd, vti, slc, tiff, dicom etc.._) files can be visualized with options `-g`. E.g.:<br>
`vtkplotter -g examples/data/embryo.slc`<br>
`vtkplotter -g embryo.slc`<br>

![isohead](https://user-images.githubusercontent.com/32848391/58336107-5a09a180-7e43-11e9-8c4e-b50e4e95ae71.gif)

Expand All @@ -123,7 +145,7 @@ To visualize multiple files or files time-sequences try `-n` or `-s` options. Us
|`vtkplotter head.vti` |`vtkplotter -s *.vtk` |`vtkplotter `<br>`--slicer embr.slc` | `vtkplotter --lego embryo.slc`|
|![isohead](https://user-images.githubusercontent.com/32848391/56972083-a7f3f800-6b6a-11e9-9cb3-1047b69dcad2.gif)| ![viz_raycast](https://user-images.githubusercontent.com/32848391/58336919-f7b1a080-7e44-11e9-9106-f574371093a8.gif) | ![viz_slicer](https://user-images.githubusercontent.com/32848391/56972084-a7f3f800-6b6a-11e9-98c4-dc4ffec70a5e.png) |![lego](https://user-images.githubusercontent.com/32848391/56969949-71b47980-6b66-11e9-8251-4bbdb275cb22.jpg) |

### Graphic User Interface
### 🖥 Graphic User Interface
A Graphic User Interface is available (mainly useful to *Windows 10* users):

![gui](https://user-images.githubusercontent.com/32848391/63259840-c861d280-c27f-11e9-9c2a-99d0fae85313.png)
Expand All @@ -135,7 +157,7 @@ pip install -U git+https://github.com/marcomusy/vtkplotter-examples
vtkplotter --list
vtkplotter --run tube.py
```
**More than 280 working examples can be found in directories** _(scroll down to see thumbnails):_ <br>
**More than 300 working examples can be found in directories** _(scroll down to see thumbnails):_ <br>
[**examples/basic**](https://github.com/marcomusy/vtkplotter-examples/blob/master/vtkplotter_examples/basic)<br>
[**examples/advanced**](https://github.com/marcomusy/vtkplotter-examples/blob/master/vtkplotter_examples/advanced)<br>
[**examples/volumetric**](https://github.com/marcomusy/vtkplotter-examples/blob/master/vtkplotter_examples/volumetric)<br>
Expand Down
16 changes: 16 additions & 0 deletions bin/vtkplotter
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,22 @@ else: #########################################################################
scs.append(lb+bn.replace('.py',''))
printc("".join(scs), c='y', bold=0)

printc("Simulation examples:", c='m', bold=1, underline=1)
scs = []
for f,bn in exfiles:
if "simulation" in f:
lb = ' ' if (len(scs)+1)%nl else '\n'
scs.append(lb+bn.replace('.py',''))
printc("".join(scs), c='m', bold=0)

printc("Plotting 2D examples:", c='w', bold=1, underline=1)
scs = []
for f,bn in exfiles:
if "plotting2d" in f:
lb = ' ' if (len(scs)+1)%nl else '\n'
scs.append(lb+bn.replace('.py',''))
printc("".join(scs), c='w', bold=0)

printc("Volumetric examples:", c='b', bold=1, underline=1)
scs = []
for f,bn in exfiles:
Expand Down
42 changes: 20 additions & 22 deletions docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
.. image:: https://img.shields.io/badge/docs%20by-gendocs-blue.svg
:target: https://gendocs.readthedocs.io/en/latest/
:alt: Documentation Built by gendocs

.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.2561402.svg
:target: https://doi.org/10.5281/zenodo.2561402

---------------------

A lightweight python module for scientific visualization, analysis and animation of 3D objects
A lightweight python module for scientific visualization, analysis and animation of 3D objects
and `point clouds` based on `VTK <https://www.vtk.org/>`_
and `numpy <http://www.numpy.org/>`_.

Expand All @@ -52,18 +52,18 @@ Check out the **Git repository** here: https://github.com/marcomusy/vtkplotter-e

*Windows-10 users* can manually place this file
`vtkplotter.bat <https://github.com/marcomusy/vtkplotter-examples/blob/master/vtkplotter.bat>`_
on the desktop to *drag&drop* files to visualize.
on the desktop to *drag&drop* files to visualize.
(Need to edit the path of their local Anaconda installation).


Features:
---------

Intuitive and straightforward API which can be combined with VTK seamlessly
Intuitive and straightforward API which can be combined with VTK seamlessly
in a program, whilst mantaining access to the full range of VTK native classes.

It includes a
`large set of working examples <https://github.com/marcomusy/vtkplotter-examples/tree/master/vtkplotter_examples>`_
It includes a
`large set of working examples <https://github.com/marcomusy/vtkplotter-examples/tree/master/vtkplotter_examples>`_
for the all following functionalities:

- Import meshes from VTK format, STL, Wavefront OBJ, 3DS, XML, Neutral, GMSH, PCD (PointCloud), volumetric TIFF stacks, SLC, MHD, 2D images PNG, JPEG.
Expand All @@ -76,7 +76,7 @@ for the all following functionalities:
- Subdivide faces of a mesh, increasing the number of vertex points. Mesh simplification.
- Coloring and thresholding of meshes based on associated scalar or vectorial data.
- Point-surface operations: find nearest points, check if a point lies inside or outside a mesh.
- Create primitive objects like: spheres, arrows, cubes, torus, ellipsoids...
- Create primitive objects like: spheres, arrows, cubes, torus, ellipsoids...
- Generate *glyphs* (associating a mesh to each vertex of a source mesh).
- Create animations easily by just defining the position of the displayed objects in the 3D scene. Add trailing lines to moving objects automatically.
- Straightforward support for multiple `sync-ed` or independent renderers in the same window.
Expand All @@ -87,7 +87,7 @@ for the all following functionalities:
- Find the closest path from one point to another, travelling along the edges of a mesh.
- Find the intersection of a mesh with a line (or with another mesh).
- Analysis of `Point Clouds`:

- `Moving Least Squares` smoothing of 2D, 3D and 4D clouds
- Fit lines, planes and spheres in space
- Perform PCA (Principal Component Analysis) on point coordinates
Expand Down Expand Up @@ -122,14 +122,14 @@ In your python script, load a simple ``3DS`` file and display it:
.. code-block:: python
from vtkplotter import show
show('flamingo.3ds')
show('flamingo.3ds')
.. image:: https://user-images.githubusercontent.com/32848391/50738813-58af4380-11d8-11e9-84ce-53579c1dba65.png
:alt: flam

Allowed input objects to the ``show()`` command are: \ :raw-html-m2r:`<br>`
``filename``, ``vtkPolyData``, ``vtkActor``,
``filename``, ``vtkPolyData``, ``vtkActor``,
``vtkActor2D``, ``vtkImageActor``, ``vtkAssembly`` or ``vtkVolume``.


Expand Down Expand Up @@ -167,7 +167,7 @@ Load and browse a sequence of meshes:

.. code-block:: bash
vtkplotter -s examples/data/timecourse1d/*.vtk
vtkplotter -s examples/data/timecourse1d/*.vtk
.. image:: https://user-images.githubusercontent.com/32848391/58336919-f7b1a080-7e44-11e9-9106-f574371093a8.gif

Expand Down Expand Up @@ -203,23 +203,23 @@ More than 280 examples can be found in directories:


Apply a *Moving Least Squares* algorithm to obtain a smooth surface from a to a
large cloud of scattered points in space
large cloud of scattered points in space
(`moving_least_squares2D.py <https://github.com/marcomusy/vtkplotter-examples/blob/master/vtkplotter_examples/advanced/moving_least_squares2D.py>`_):

.. image:: https://user-images.githubusercontent.com/32848391/50738808-5816ad00-11d8-11e9-9854-c952be6fb941.jpg
:target: https://user-images.githubusercontent.com/32848391/50738808-5816ad00-11d8-11e9-9854-c952be6fb941.jpg
:alt: rabbit


Simulation of a gyroscope hanging from a spring
Simulation of a gyroscope hanging from a spring
(`gyroscope1.py <https://github.com/marcomusy/vtkplotter-examples/blob/master/vtkplotter_examples/simulations/gyroscope1.py>`_):

.. image:: https://user-images.githubusercontent.com/32848391/39766016-85c1c1d6-52e3-11e8-8575-d167b7ce5217.gif
:target: https://user-images.githubusercontent.com/32848391/39766016-85c1c1d6-52e3-11e8-8575-d167b7ce5217.gif
:alt: gyro


Quantum-tunnelling effect integrating the Schroedinger equation with 4th order Runge-Kutta method.
Quantum-tunnelling effect integrating the Schroedinger equation with 4th order Runge-Kutta method.
The animation shows the evolution of a particle in a box hitting a sinusoidal potential barrier
(`tunnelling2.py <https://github.com/marcomusy/vtkplotter-examples/blob/master/vtkplotter_examples/simulations/tunnelling2.py>`_):

Expand All @@ -238,7 +238,7 @@ Visualizing a Turing system of reaction-diffusion between two molecules



Support for the `FEniCS/dolfin <https://fenicsproject.org/>`_ platform for visualization of PDE and
Support for the `FEniCS/dolfin <https://fenicsproject.org/>`_ platform for visualization of PDE and
finite element solutions
(`see here <https://github.com/marcomusy/vtkplotter-examples/blob/master/vtkplotter_examples/other/dolfin>`_.

Expand All @@ -249,13 +249,11 @@ finite element solutions
Mesh format conversion
^^^^^^^^^^^^^^^^^^^^^^

The command ``vtkconvert`` can be used to convert multiple files from a format to a different one:
The command ``vtkplotter-convert`` can be used to convert multiple files from a format to a different one:

.. code-block:: bash
Usage: vtkconvert [-h] [-to] [files [files ...]]
Usage: vtkplotter-convert [-h] [-to] [files [files ...]]
allowed targets formats: [vtk, vtp, vtu, vts, ply, stl, byu, xml]
Example: > vtkconvert myfile.vtk -to ply
Example: > vtkplotter-convert myfile.vtk -to ply
8 changes: 4 additions & 4 deletions docs/logos/fenics_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
show(tf, bx)

printc('implicitModeller', mytext, "this takes time")
imp = implicitModeller(mergeActors(tf, bx),
imp = implicitModeller(mergeActors(tf, bx),
distance=0.04,
outer=True,
# res=[50,20,10],
outer=True,
# res=[50,20,10],
res=[110,40,20],
bounds=[-1.0, 10.0, -1.0, 2.0, -.5, .5],
bounds=[-1.0, 10.0, -1.0, 2.0, -.5, .5],
maxdist=0.25,
)

Expand Down
20 changes: 20 additions & 0 deletions docs/news.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
2020/01/20
- added shapes Arrow2D and Arrows2D, SphericGrid, CubicGrid
- completely revised customizable axes=1 type
- axes can be created for each object independently
- quiver plots, scatter plots, error bands plots
- plotting in spherical coordinates
- '2d' backend to plot static images in notebooks.
Available backends:
```python
from vtkplotter import *
# embedWindow('2d')
# embedWindow('k3d')
# embedWindow('itk')
# embedWindow('panel')
# embedWindow(False)
```
- Added wavefront format .OBJ writer


2020/01/08
- added type axes=11 (horizontal grid)
- fix bug by @m-albert on Volume from numpy object
Expand All @@ -15,6 +34,7 @@
- added advanced/centerline.py examples
- bump version to 2020.0.1


2019/11/19
- added PDV paraview file reading.
- PDB protein data bank file reader
Expand Down
12 changes: 8 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7'
'Programming Language :: Python :: 3.8'
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
include_package_data=True
)
Expand All @@ -56,10 +56,14 @@

# cd ~/Projects/vtkplotter-examples/vtkplotter_examples
# ./run_all.sh
# cd ~/Projects/vtkplotter/
# python prove/test_filetypes.py

# cd ~/Projects/vtkplotter/tests/common
# ./run_all.sh

# check vtkconvert:
# vtkconvert data/290.vtk -to ply; vtkplotter data/290.ply
# vtkplotter-convert data/290.vtk -to ply; vtkplotter data/290.ply

# check on python2 the same stuff is ok
# cd ~/Projects/vtkplotter/
Expand Down Expand Up @@ -119,7 +123,7 @@
# git clone https://github.com/marcomusy/vtkplotter.git
# cd vtkplotter
# pip3 -v install . --user
#
#
# cd
# pip3 install git+https://github.com/FEniCS/fiat.git --upgrade
# pip3 install git+https://github.com/FEniCS/ufl.git --upgrade
Expand Down
Loading

0 comments on commit a3f187b

Please sign in to comment.