Skip to main content

Exports label images to 3D-printable stl files.

Project description

napari-stl-exporter

License PyPI Python Version tests codecov

This plugin allows to convert 3D label images to 3D-printable .stl files using the marching cubes algorithm implemented in scikit-image. The generated stl-files can then be read by common 3D-printing slicer programs (see below).

input_output

Usage

The napari-stl-exporter requires labeled, 3D input data. To segment your 3D image and create 3D label images out of it, see this list of napari's image segmentation plugins. The 3D label image can then be converted to a 3D-printable .stl file by specifying the ".stl"-file extension uppon image export in napari using the menu File > Save selected layer(s)....

Preparing label data

  • Interactively: After loading a binary image (example data), e.g. by drag and drop the file onto the napari viewer, it might be neccessary to convert it to a labels layer using the right-click menu on the layer in the layer list and selecting Convert to Labels:

import napari
from skimage import io

# Load and binarize image
data = io.imread('/Path/to/input/data')
data[data != 0] = 1

# Add data to viewer
viewer = napari.Viewer()
label_layer = viewer.add_labels(data, name='3D object')

# save the layer as 3D printable file to disc
napari.save_layers(r'/some/path/test.stl', [label_layer])

3D-printing

To actually send your object to a 3D-printer, it has to be further converted to the .gcode format with a Slicer program. The latter convert the 3D object to machine-relevant parameters (printing detail, motor trajectories, etc). Popular slicers are:

You can also upload the STL file to github.com and interact with it in the browser:


This napari plugin was generated with Cookiecutter using with @napari's cookiecutter-napari-plugin template.

Installation

You can install napari-stl-exporter via pip:

pip install napari-stl-exporter

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 BSD-3 license, "napari-stl-exporter" is free and open source software

Issues

If you encounter any problems, please [file an issue] along with a detailed description or post to image.sc and tag El_Pollo_Diablo

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-stl-exporter-0.0.5.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

napari_stl_exporter-0.0.5-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file napari-stl-exporter-0.0.5.tar.gz.

File metadata

  • Download URL: napari-stl-exporter-0.0.5.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for napari-stl-exporter-0.0.5.tar.gz
Algorithm Hash digest
SHA256 466c8c6bb6cf152bed10aca791fd0625e7c546f754cf14407d542edc0f9cc9f7
MD5 d3553c95bba02b8311107626153064a3
BLAKE2b-256 fb438ded2d937a359bf2d17708754d48e00b6c643a2da82b804e081514fa28fb

See more details on using hashes here.

File details

Details for the file napari_stl_exporter-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: napari_stl_exporter-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for napari_stl_exporter-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c88ed0400d3a65af8d1c3712840edb45d4da2c6eb6767a0e4eac047c1889df07
MD5 47bca3574e679a3ad8129bceaa3b1545
BLAKE2b-256 428f4dc00feebf022fff130d43c1fdb92e4151cf3f4342024275d39f4e29d855

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