Skip to content

Commit

Permalink
2020.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomusy committed Jan 8, 2020
1 parent 82376e8 commit 9eea132
Show file tree
Hide file tree
Showing 32 changed files with 4,053 additions and 4,073 deletions.
37 changes: 32 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,35 @@
version: 2

jobs:
build-real:

build-dolfin-stable:
docker:
- image: quay.io/fenicsproject/dolfinx:dev-env-real
environment:
MPLBACKEND: "agg"
DEBIAN_FRONTEND: "noninteractive"

steps:
- checkout

- run:
name: install vtkplotter
command: |
pip3 install vtk
pip3 install .
- run:
name: Run tests
command: |
cd
cd project/tests/dolfin
source run_all.sh
- store_artifacts:
path: test-reports
destination: test-reports

build-dolfinx:
docker:
- image: quay.io/fenicsproject/dolfinx:dev-env-real
environment:
Expand Down Expand Up @@ -42,17 +70,16 @@ jobs:
name: Run tests
command: |
cd
cd project/tests
pwd
ls
cd project/tests/dolfinx
source run_all.sh
- store_artifacts:
path: test-reports
destination: test-reports

######################################################
workflows:
version: 2
build-stuff:
jobs:
- build-real
- build-dolfinx
3 changes: 0 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@ include vtkplotter/*
include vtkplotter/textures/*
include vtkplotter/fonts/*
include vtkplotter/fonts/licenses/*
include vtkplotter/data/*
include vtkplotter/data/images/*
include vtkplotter/data/timecourse1d/*
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,52 +59,52 @@ 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, XML, Neutral, GMSH, OFF, PCD (PointCloud), volumetric TIFF stacks, DICOM, SLC, MHD, 2D images PNG, JPEG.
- 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 package. Additional analysis tools like *Moving Least Squares*, mesh morphing.
- Tools to visualize and edit meshes (cutting a mesh with another mesh, slicing, normalizing, moving vertex positions, etc..). Interactive cutter widget.
- Mesh analysis through the built-in methods of VTK. Additional 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 mass properties, like area, volume, center of mass, average size etc.
- Calculate areas, volumes, center of mass, average sizes etc.
- Calculate vertex and face normals, curvatures, feature edges. Fill mesh holes.
- 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, determine if a point lies inside or outside a mesh.
- 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 and shadows to moving objects is also supported.
- Point-surface operations: find nearest points, determine if a point lies inside or outside of a mesh.
- Create primitive shapes: spheres, arrows, cubes, torus, ellipsoids...
- Generate *glyphs* (associate a mesh to every vertex of a source mesh).
- Create animations easily by just setting the position of the displayed objects in the 3D scene. Add trailing lines and shadows to moving objects is supported.
- Straightforward support for multiple *sync-ed* or independent renderers in the same window.
- Registration (alignment) of meshes with different techniques.
- Mesh smoothing with *Laplacian* and *WindowedSinc* algorithms.
- Mesh smoothing.
- Delaunay triangulation in 2D and 3D.
- 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 a line (or with another mesh).
- Find the intersection of a mesh with lines, planes or other meshes.
- Analysis of *Point Clouds*:
- *Moving Least Squares* smoothing of 2D, 3D and 4D clouds
- Fit lines, planes and spheres and ellipses in space
- 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
- Direct maximum projection rendering
- 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.
- Draw `latex`-formatted formulas on the rending window.
- Examples using [SHTools](https://shtools.oca.eu/shtools) package for *spherical harmonics* expansion of a mesh shape.
- 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.
- Visualization of tensors.
- 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)).
- Interoperability with the [trimesh](https://trimsh.org/) library.


### Command Line Interface
### Command Line Interface
Visualize a mesh from a terminal window with:
```bash
vtkplotter mesh.obj
Expand All @@ -123,7 +123,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 Down
126 changes: 92 additions & 34 deletions bin/vtkplotter
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env python
#
from __future__ import division, print_function
from vtkplotter import Actor, Volume, Plotter, ProgressBar
from vtkplotter import Plotter, ProgressBar
from vtkplotter.mesh import Mesh
from vtkplotter.volume import Volume
from vtkplotter import settings, printc, getColor, humansort, __version__
from vtkplotter import vtkio, utils, datadir
import vtk
Expand Down Expand Up @@ -418,7 +420,7 @@ def draw_scene():
ic = args.color
cf.SetValue(0, threshold)
cf.Update()
act = Actor(cf.GetOutput(), c=ic, alpha=args.alpha).wireframe(args.wireframe)
act = Mesh(cf.GetOutput(), c=ic, alpha=args.alpha).wireframe(args.wireframe)
if args.flat:
act.flat()
else:
Expand Down Expand Up @@ -448,7 +450,7 @@ def draw_scene():
cf.ComputeScalarsOff()
cf.SetValue(0, wval)
cf.Update()
a = Actor(cf.GetOutput(), ic, alpha=act.alpha())
a = Mesh(cf.GetOutput(), ic, alpha=act.alpha())
bacts.update({wval_2: a}) # store it
#print('generated', wval_2, wval, len(bacts.keys()))

Expand Down Expand Up @@ -517,7 +519,7 @@ def draw_scene():

if isinstance(actor, vtk.vtkActor):

if isinstance(actor, Actor):
if isinstance(actor, Mesh):
actors.append(actor)
actor.wireframe(wire)
actor.lighting(args.lighting)
Expand Down Expand Up @@ -960,64 +962,120 @@ else: #########################################################################
pr.add_argument("--lego", help="Voxel rendering for 3D image files", action="store_true")
pr.add_argument("--cmap", help="Voxel rendering color map name", default='jet', metavar='')
pr.add_argument("--mode", help="Voxel rendering composite mode", default=0, metavar='')
pr.add_argument("--run", help="Run example from vtkplotter-examples", default='', metavar='')
pr.add_argument("-r", "--run", help="Run example from vtkplotter-examples", metavar='')
pr.add_argument("--list", help="List examples in vtkplotter-examples", action="store_true")
args = pr.parse_args()

if args.run:
import glob
exfiles = [f for f in glob.glob(datadir.replace('data','') + "**/*.py", recursive=True)]
matching = [s for s in exfiles if (args.run in s and "__" not in s and "version.py" not in s)]
if len(matching) > 1:
printc("Matching scripts are:", matching[:10], 'Running first only.', c='y', bold=0, italic=1)
if len(matching) == 0:
printc("No matching example found containing:", args.run, c=1)
printc("Use vtkplotter --list to show available scripts.", c=1)
matching = [s for s in exfiles if (args.run.lower() in os.path.basename(s).lower() and "__" not in s)]
matching = list(sorted(matching))
nmat = len(matching)
if nmat == 0:
printc("No matching example found containing string:", args.run, c=1)
printc(" Use vtkplotter --list to show available scripts.", c=1)
printc(" Current datadir is:", datadir, c=1)
exit(1)
print("Running", matching[0])
os.system('python ' + matching[0])

if nmat > 1:
printc("\nSelect one of", nmat, "matching scripts:", c='y', italic=1)

for mat in matching[:25]:
printc(os.path.basename(mat).replace('.py',''), c='y', italic=1, end=' ')
with open(mat) as fm:
lline = ''.join(fm.readlines(60))
lline = lline.replace('\n','').replace('\'','').replace('\"','').replace('-','')
line = lline[:56] #cut
if line.startswith('from'): line=''
if line.startswith('import'): line=''
if len(lline) > len(line):
line += '..'
if len(line)>5:
printc('-', line, c='y', bold=0, italic=1)
else:
print()

if nmat>25:
printc('...', c='y')

if nmat > 1:
exit(0)

if args.no_camera_share: # -i option to dump the full code
print()
with open(matching[0]) as fm:
codedump = fm.readlines()
for line in codedump:
printc(line.strip(), c='cyan', italic=1, bold=0)
print()

printc("(in", os.path.dirname(matching[0])+')', c='y', bold=0, italic=1)
os.system('python3 ' + matching[0])

elif args.list:
print()
printc("Available examples are:", box='-')
expath = datadir.replace('data','')

import glob
exfiles = [(f, os.path.basename(f)) for f in glob.glob(expath + "**/*.py", recursive=True)]
exfiles = [(f, os.path.basename(f))
for f in glob.glob(expath + "**/*.py", recursive=True)]
nl = 4

if not len(exfiles):
printc("vtkplotter-example not installed?")
printc("> pip install -U git+https://github.com/marcomusy/vtkplotter-examples")
exit()

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

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

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

printc("\ndolfin examples:", c='r', bold=1)
printc("Other examples:", c='cyan', bold=1, underline=1)
scs = []
for f,bn in exfiles:
if "dolfin" in f:
printc(bn, c='r', bold=0, end=' ')
if "other" in f and "dolfin" not in f and "trimesh" not in f:
lb = ' ' if (len(scs)+1)%nl else '\n'
scs.append(lb+bn.replace('.py',''))
printc("".join(scs), c='cyan', bold=0)

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

printc("\nother examples:", c='w', bold=1)
printc(" Trimesh examples:", c='m', bold=1, underline=1)
scs = []
for f,bn in exfiles:
if "other" in f and "dolfin" not in f and "trimesh" not in f:
printc(bn, c='w', bold=0, end=' ')
if "trimesh" in f:
lb = ' ' if (len(scs)+1)%nl else '\n'
scs.append(lb+bn.replace('.py',''))
printc("".join(scs), c='m', bold=0)
print()

else:
draw_scene()





File renamed without changes.
32 changes: 0 additions & 32 deletions docs/logos/sharpelab.py

This file was deleted.

12 changes: 9 additions & 3 deletions docs/news.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
20xx/xx/xx
2020/01/08
- added type axes=11 (horizontal grid)
- fix bug by @m-albert on Volume from numpy object
- fix typos in docs
Expand All @@ -7,9 +7,15 @@
- add testing directory with circleCI
- examples and package are now split into two separate repos
- added possibility to run any example from CLI `vtkplotter --run shrink.py`
or list them all with `vtkplotter --list`
- reshuffled methods by splitting actors.py module
- general improvements and stability
- some methods are now deprecated: getPoints becomes points() etc.
- Actor() becomes Mesh()
- added advanced/centerline.py examples
- bump version to 2020.0.1


2019/21/19
2019/11/19
- added PDV paraview file reading.
- PDB protein data bank file reader
- added error bars in plotxy()
Expand Down
Loading

0 comments on commit 9eea132

Please sign in to comment.