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.
- How to use napari-meshio
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:
Open Sample >
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:
Save selected layer(s)
You can also use keyboard shortcuts to save the selected surface layer:
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
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:
.inp), ANSYS msh (
.msh), AVS-UCD (
.avs), CGNS (
.cgns), DOLFIN XML (
.xml), Exodus (
.exo), FLAC3D (
.f3grid), H5M (
.h5m), Kratos/MDPA (
.mdpa), Medit (
.meshb), MED/Salome (
.med), Nastran (bulk data,
.nas), Netgen (
.vol.gz), Neuroglancer precomputed format, Gmsh (format versions 2.2, 4.0, and 4.1,
.msh), OBJ (
.obj), OFF (
.off), PERMAS (
.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 (
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.
Distributed under the terms of the MIT license, "napari-meshio" is free and open source software
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.
- 07 March 2023
- 07 March 2023
- Information not submitted
- Stars: 5
- Forks: 0
- Issues + PRs: 0