napari-stl-exporter


Namenapari-stl-exporter JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://github.com/jo-mueller/napari-stl-exporter.git
SummaryExports label images to 3D-printable stl files.
upload_time2023-07-04 08:50:24
maintainer
docs_urlNone
authorJohannes Soltwedel
requires_python>=3.7
licenseBSD-3-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # napari-stl-exporter

[![License](https://img.shields.io/pypi/l/napari-stl-exporter.svg?color=green)](https://github.com/jo-mueller/napari-stl-exporter/raw/master/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/napari-stl-exporter.svg?color=green)](https://pypi.org/project/napari-stl-exporter)
[![Python Version](https://img.shields.io/pypi/pyversions/napari-stl-exporter.svg?color=green)](https://python.org)
[![tests](https://github.com/jo-mueller/napari-stl-exporter/workflows/tests/badge.svg)](https://github.com/jo-mueller/napari-stl-exporter/actions)
[![codecov](https://codecov.io/gh/jo-mueller/napari-stl-exporter/branch/main/graph/badge.svg?token=9zctLzazD9)](https://codecov.io/gh/jo-mueller/napari-stl-exporter)

This plugin allows to import and export surface data in Napari to common file formats. The generated file formats can be read by other common applications, and - in particular - allow *3D-printing*.

![](https://github.com/jo-mueller/napari-stl-exporter/raw/main/doc/model_and_printed_model.png)


### Supported file formats:
Currently supported file formats for export include and rely on the [vedo io API](https://vedo.embl.es/autodocs/content/vedo/io.html#vedo.io).
* *.stl*: [Standard triangle language](https://en.wikipedia.org/wiki/STL_%28file_format%29)
* *.ply*: [Polygon file format](https://en.wikipedia.org/wiki/PLY_(file_format))
* *.obj*: [Wavefront object](https://en.wikipedia.org/wiki/Wavefront_.obj_file)

### Supported Napari layers:

Currently supported Napari layer types are:
* [Surface layers](https://napari.org/howtos/layers/surface.html)
* [Label layers](https://napari.org/howtos/layers/labels.html): The label data is converted to surface data under the hood using the [marching cubes algorithm](https://scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.marching_cubes) implemented in [scikit-image](https://scikit-image.org/) and is then exported using [Vedo](https://vedo.embl.es/). Warning: This can be slow for large image data!

### Import/export

**Interactively:** To export the data, simply save the selected layer with `File > Save Selected Layer(s)` and specify the file ending to be `some_file.[file_ending]`, for supported file types, see above. Similarly, supported file types can be imported into Napari with `File > `

**From code**: A [Napari Label layer](https://napari.org/api/napari.layers.Labels.html) can be added to the viewer as described in the [napari reference](https://napari.org/gallery/add_labels.html?highlight=add_labels) with this code snippet:

```python
import napari
import numpy as np

# Load and binarize image
label_image = np.zeros((100, 100, 100), dtype=int)
label_image[25:75, 25:75, 25:75] = 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])
```

### Sample data
You can create sample label/surface data for export using the built-in functions as shown here:

![](https://github.com/jo-mueller/napari-stl-exporter/raw/main/doc/1_sample_data.png)

...or from code with

```Python
import napari_stl_exporter

pyramid = napari_stl_exporter.make_pyramid_surface()

```

### 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:

* [Slic3r](https://slic3r.org/): Documentation [here](https://manual.slic3r.org/intro/overview)
* [Prusa Slicer](https://www.prusa3d.com/prusaslicer/): Tutorial [here](https://help.prusa3d.com/en/article/first-print-with-prusaslicer_1753)

*Note*: You can also upload the STL file to [github.com](https://github.com) and interact with it in the browser:

![](https://github.com/jo-mueller/napari-stl-exporter/raw/main/doc/pyramid_browser_screenshot.png)

#### Digital elevation models

DIgital elevation models (DEMs) can be printed with the napari-stl-exporter following these steps:

1. Go to the [open topography repository](https://portal.opentopography.org/raster?opentopoID=OTSDEM.032021.4326.2) and select a region of your choice, then download it as a GeoTiff file (`.tif`, intensity encodes elevation)
2. Open the downloaded tif image use the image conversion plugin (´Plugins > napari-stl-exporter > 2D image to surface´) to convert the downloaded image to a surface. CHeck the `solidify` option to make it readily 3D-printable.

![](https://github.com/jo-mueller/napari-stl-exporter/raw/main/doc/landscape_to_surface.png)

3. Export the created surface layer as `.stl` or `.ply` file. Open it in your Slicer of choice (you may have to scale it according to the size limitations of your printer) and off you go!

----------------------------------

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

<!--
Don't miss the full getting started guide to set up your new package:
https://github.com/napari/cookiecutter-napari-plugin#getting-started

and review the napari docs for plugin developers:
https://napari.org/docs/plugins/index.html
-->

## 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](https://github.com/jo-mueller/napari-stl-exporter/issues) along with a detailed description or post to image.sc and tag ```El_Pollo_Diablo```

[napari]: https://github.com/napari/napari
[Cookiecutter]: https://github.com/audreyr/cookiecutter
[@napari]: https://github.com/napari
[MIT]: http://opensource.org/licenses/MIT
[BSD-3]: http://opensource.org/licenses/BSD-3-Clause
[GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt
[GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt
[Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0
[Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt
[cookiecutter-napari-plugin]: https://github.com/napari/cookiecutter-napari-plugin

[napari]: https://github.com/napari/napari
[tox]: https://tox.readthedocs.io/en/latest/
[pip]: https://pypi.org/project/pip/
[PyPI]: https://pypi.org/

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jo-mueller/napari-stl-exporter.git",
    "name": "napari-stl-exporter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Johannes Soltwedel",
    "author_email": "johannes_richard.soltwedel@tu-dresden.de",
    "download_url": "https://files.pythonhosted.org/packages/3c/99/badde0066375f6ab4b8bc903bfb59c557e80fd29cf519739e57afc7bb287/napari-stl-exporter-0.1.5.tar.gz",
    "platform": null,
    "description": "# napari-stl-exporter\n\n[![License](https://img.shields.io/pypi/l/napari-stl-exporter.svg?color=green)](https://github.com/jo-mueller/napari-stl-exporter/raw/master/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/napari-stl-exporter.svg?color=green)](https://pypi.org/project/napari-stl-exporter)\n[![Python Version](https://img.shields.io/pypi/pyversions/napari-stl-exporter.svg?color=green)](https://python.org)\n[![tests](https://github.com/jo-mueller/napari-stl-exporter/workflows/tests/badge.svg)](https://github.com/jo-mueller/napari-stl-exporter/actions)\n[![codecov](https://codecov.io/gh/jo-mueller/napari-stl-exporter/branch/main/graph/badge.svg?token=9zctLzazD9)](https://codecov.io/gh/jo-mueller/napari-stl-exporter)\n\nThis plugin allows to import and export surface data in Napari to common file formats. The generated file formats can be read by other common applications, and - in particular - allow *3D-printing*.\n\n![](https://github.com/jo-mueller/napari-stl-exporter/raw/main/doc/model_and_printed_model.png)\n\n\n### Supported file formats:\nCurrently supported file formats for export include and rely on the [vedo io API](https://vedo.embl.es/autodocs/content/vedo/io.html#vedo.io).\n* *.stl*: [Standard triangle language](https://en.wikipedia.org/wiki/STL_%28file_format%29)\n* *.ply*: [Polygon file format](https://en.wikipedia.org/wiki/PLY_(file_format))\n* *.obj*: [Wavefront object](https://en.wikipedia.org/wiki/Wavefront_.obj_file)\n\n### Supported Napari layers:\n\nCurrently supported Napari layer types are:\n* [Surface layers](https://napari.org/howtos/layers/surface.html)\n* [Label layers](https://napari.org/howtos/layers/labels.html): The label data is converted to surface data under the hood using the [marching cubes algorithm](https://scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.marching_cubes) implemented in [scikit-image](https://scikit-image.org/) and is then exported using [Vedo](https://vedo.embl.es/). Warning: This can be slow for large image data!\n\n### Import/export\n\n**Interactively:** To export the data, simply save the selected layer with `File > Save Selected Layer(s)` and specify the file ending to be `some_file.[file_ending]`, for supported file types, see above. Similarly, supported file types can be imported into Napari with `File > `\n\n**From code**: A [Napari Label layer](https://napari.org/api/napari.layers.Labels.html) can be added to the viewer as described in the [napari reference](https://napari.org/gallery/add_labels.html?highlight=add_labels) with this code snippet:\n\n```python\nimport napari\nimport numpy as np\n\n# Load and binarize image\nlabel_image = np.zeros((100, 100, 100), dtype=int)\nlabel_image[25:75, 25:75, 25:75] = 1\n\n# Add data to viewer\nviewer = napari.Viewer()\nlabel_layer = viewer.add_labels(data, name='3D object')\n\n# save the layer as 3D printable file to disc\nnapari.save_layers(r'/some/path/test.stl', [label_layer])\n```\n\n### Sample data\nYou can create sample label/surface data for export using the built-in functions as shown here:\n\n![](https://github.com/jo-mueller/napari-stl-exporter/raw/main/doc/1_sample_data.png)\n\n...or from code with\n\n```Python\nimport napari_stl_exporter\n\npyramid = napari_stl_exporter.make_pyramid_surface()\n\n```\n\n### 3D-printing\nTo 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:\n\n* [Slic3r](https://slic3r.org/): Documentation [here](https://manual.slic3r.org/intro/overview)\n* [Prusa Slicer](https://www.prusa3d.com/prusaslicer/): Tutorial [here](https://help.prusa3d.com/en/article/first-print-with-prusaslicer_1753)\n\n*Note*: You can also upload the STL file to [github.com](https://github.com) and interact with it in the browser:\n\n![](https://github.com/jo-mueller/napari-stl-exporter/raw/main/doc/pyramid_browser_screenshot.png)\n\n#### Digital elevation models\n\nDIgital elevation models (DEMs) can be printed with the napari-stl-exporter following these steps:\n\n1. Go to the [open topography repository](https://portal.opentopography.org/raster?opentopoID=OTSDEM.032021.4326.2) and select a region of your choice, then download it as a GeoTiff file (`.tif`, intensity encodes elevation)\n2. Open the downloaded tif image use the image conversion plugin (\u00b4Plugins > napari-stl-exporter > 2D image to surface\u00b4) to convert the downloaded image to a surface. CHeck the `solidify` option to make it readily 3D-printable.\n\n![](https://github.com/jo-mueller/napari-stl-exporter/raw/main/doc/landscape_to_surface.png)\n\n3. Export the created surface layer as `.stl` or `.ply` file. Open it in your Slicer of choice (you may have to scale it according to the size limitations of your printer) and off you go!\n\n----------------------------------\n\nThis [napari] plugin was generated with [Cookiecutter] using with [@napari]'s [cookiecutter-napari-plugin] template.\n\n<!--\nDon't miss the full getting started guide to set up your new package:\nhttps://github.com/napari/cookiecutter-napari-plugin#getting-started\n\nand review the napari docs for plugin developers:\nhttps://napari.org/docs/plugins/index.html\n-->\n\n## Installation\n\nYou can install `napari-stl-exporter` via [pip]:\n\n    pip install napari-stl-exporter\n\n## Contributing\n\nContributions are very welcome. Tests can be run with [tox], please ensure\nthe coverage at least stays the same before you submit a pull request.\n\n## License\n\nDistributed under the terms of the [BSD-3] license,\n\"napari-stl-exporter\" is free and open source software\n\n## Issues\n\nIf you encounter any problems, please [file an issue](https://github.com/jo-mueller/napari-stl-exporter/issues) along with a detailed description or post to image.sc and tag ```El_Pollo_Diablo```\n\n[napari]: https://github.com/napari/napari\n[Cookiecutter]: https://github.com/audreyr/cookiecutter\n[@napari]: https://github.com/napari\n[MIT]: http://opensource.org/licenses/MIT\n[BSD-3]: http://opensource.org/licenses/BSD-3-Clause\n[GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt\n[GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt\n[Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0\n[Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt\n[cookiecutter-napari-plugin]: https://github.com/napari/cookiecutter-napari-plugin\n\n[napari]: https://github.com/napari/napari\n[tox]: https://tox.readthedocs.io/en/latest/\n[pip]: https://pypi.org/project/pip/\n[PyPI]: https://pypi.org/\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Exports label images to 3D-printable stl files.",
    "version": "0.1.5",
    "project_urls": {
        "Documentation": "https://pypi.org/project/napari-stl-exporter/",
        "Homepage": "https://github.com/jo-mueller/napari-stl-exporter.git",
        "Project Site": "https://github.com/jo-mueller/napari-stl-exporter",
        "Report Issues": "https://github.com/jo-mueller/napari-stl-exporter/issues",
        "Twitter": "https://twitter.com/jm_mightypirate",
        "User Support": "https://github.com/jo-mueller/napari-stl-exporter/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e961d08f82644c190d094b1961cd452fb17859ac2dd2f79272c70744f088da83",
                "md5": "cdde36e3905255c9cbeccfc0a0546b34",
                "sha256": "86f4f85c8eaee223308bdf194c2f5aaca7a688cbb6b71f14fe7f0c08808d079c"
            },
            "downloads": -1,
            "filename": "napari_stl_exporter-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cdde36e3905255c9cbeccfc0a0546b34",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 367885,
            "upload_time": "2023-07-04T08:50:23",
            "upload_time_iso_8601": "2023-07-04T08:50:23.335469Z",
            "url": "https://files.pythonhosted.org/packages/e9/61/d08f82644c190d094b1961cd452fb17859ac2dd2f79272c70744f088da83/napari_stl_exporter-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3c99badde0066375f6ab4b8bc903bfb59c557e80fd29cf519739e57afc7bb287",
                "md5": "dd352ff4e302b2824688e994f729bfee",
                "sha256": "207b80d42aeadd14c26b12c0f4b47c965f540ac301a59c15cf00df28a1125d96"
            },
            "downloads": -1,
            "filename": "napari-stl-exporter-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "dd352ff4e302b2824688e994f729bfee",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 367002,
            "upload_time": "2023-07-04T08:50:24",
            "upload_time_iso_8601": "2023-07-04T08:50:24.925796Z",
            "url": "https://files.pythonhosted.org/packages/3c/99/badde0066375f6ab4b8bc903bfb59c557e80fd29cf519739e57afc7bb287/napari-stl-exporter-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-04 08:50:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jo-mueller",
    "github_project": "napari-stl-exporter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "napari-stl-exporter"
}
        
Elapsed time: 0.10128s