meshio
I/O for mesh files.
This napari plugin uses meshio to read and write mesh files to surfaces in napari.
Image caption: screenshot of the Stanford bunny example surface mesh open in napari.
Installation¶
You can install napari-meshio
via pip:
pip install napari-meshio
To install latest development version :
pip install git+https://github.com/GenevieveBuckley/napari-meshio.git
How to use napari-meshio¶
Read surface data from file¶
Drag and drop the file onto the napari viewer.
Note: Here are a number of .ply
example files you can download to try, like this airplane (see image).
Open example surface data¶
Launch the napari viewer, then open one of the sample datasets (eg: the Stanford bunny) from the file menu:
File
> Open Sample
> napari-meshio
> bunny
Or, open sample data from python with:
import napari
viewer = napari.Viewer(ndisplay=3)
viewer.open_sample('napari-meshio', 'bunny')
Save surface data¶
To save a surface layer, click the layer name to select it, and then choose save from the file menu:
File
> Save selected layer(s)
You can also use keyboard shortcuts to save the selected surface layer:
- Windows/Linux:
Control
+S
- Mac:
⌘
+S
Or, save surface layers from python with:
filename = "bunny.stl"
viewer.layers['bunny'].save(filename)
Note: this code example assumes you have the Stanford bunny example dataset loaded.
A wide variety of surface mesh file formats are supported by
meshio.
If no file extension is provided when saving a surface layer,
the default is the .ply
polygon file format.
Supported mesh file formats¶
Note: Only triangular mesh faces are supported by napari.
The meshio library documentation describes the supported file formats:
There are various mesh formats available for representing unstructured meshes. meshio can read and write all of the following and smoothly converts between them:
Abaqus (
.inp
), ANSYS msh (.msh
), AVS-UCD (.avs
), CGNS (.cgns
), DOLFIN XML (.xml
), Exodus (.e
,.exo
), FLAC3D (.f3grid
), H5M (.h5m
), Kratos/MDPA (.mdpa
), Medit (.mesh
,.meshb
), MED/Salome (.med
), Nastran (bulk data,.bdf
,.fem
,.nas
), Netgen (.vol
,.vol.gz
), Neuroglancer precomputed format, Gmsh (format versions 2.2, 4.0, and 4.1,.msh
), OBJ (.obj
), OFF (.off
), PERMAS (.post
,.post.gz
,.dato
,.dato.gz
), PLY (.ply
), STL (.stl
), Tecplot .dat, TetGen .node/.ele, SVG (2D output only) (.svg
), SU2 (.su2
), UGRID (.ugrid
), VTK (.vtk
), VTU (.vtu
), WKT (TIN) (.wkt
), XDMF (.xdmf
,.xmf
).
Contributing¶
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
License¶
Distributed under the terms of the MIT license, "napari-meshio" is free and open source software
Issues¶
If you encounter any problems, please file an issue along with a detailed description.
This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.
Supported data:
- Information not submitted
Plugin type:
Save layers:
GitHub activity:
- Stars: 3
- Forks: 0
- Issues + PRs: 1