Skip to main content

I/O for mesh files.

Project description

napari-meshio

License MIT PyPI Python Version tests codecov napari hub

This napari plugin uses meshio to read and write mesh files to surfaces in napari.

Screenshot: Stanford bunny example data 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

napari-meshio-0.0.1.tar.gz (137.6 kB view details)

Uploaded Source

Built Distribution

napari_meshio-0.0.1-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file napari-meshio-0.0.1.tar.gz.

File metadata

  • Download URL: napari-meshio-0.0.1.tar.gz
  • Upload date:
  • Size: 137.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for napari-meshio-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6aa88005a2316e03895a9397c949b7cae01d3966fb6db0f288c53998964c7108
MD5 ee4570c3bfd69d4adc698d20291ffed0
BLAKE2b-256 4e2446fecf08ac92f751467e992d31b3d301bf5cf1faecdbf82551b79f97952f

See more details on using hashes here.

File details

Details for the file napari_meshio-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for napari_meshio-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a4b6dfc9b07fbd3bea5cec8fec87ce9ad2d0e8417f813d1cd58a91d7f7731ad
MD5 e9a129e1edbd92a6e9dd19ef46384aa4
BLAKE2b-256 40ec98a6c306a9949d6f73a4f8ca203b7a5c40c19d03de27459dbf834a6229b1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page