Package: napari-stl-exporter
napari-stl-exporterThis 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 - allow3D-printing.Supported file formats:Currently supported file formats for export include and rely on thevedo io API..stl:Standard triangle language.ply:Polygon file format.obj:Wavefront objectSupported Napari layers:Currently supported Napari layer types are:Surface layersLabel layers: The label data is converted to surface data under the hood using themarching cubes algorithmimplemented inscikit-imageand is then exported usingVedo. Warning: This can be slow for large image data!Import/exportInteractively:To export the data, simply save the selected layer withFile > Save Selected Layer(s)and specify the file ending to besome_file.[file_ending], for supported file types, see above. Similarly, supported file types can be imported into Napari withFile >From code: ANapari Label layercan be added to the viewer as described in thenapari referencewith this code snippet:importnapariimportnumpyasnp# Load and binarize imagelabel_image=np.zeros((100,100,100),dtype=int)label_image[25:75,25:75,25:75]=1# Add data to viewerviewer=napari.Viewer()label_layer=viewer.add_labels(data,name='3D object')# save the layer as 3D printable file to discnapari.save_layers(r'/some/path/test.stl',[label_layer])Sample dataYou can create sample label/surface data for export using the built-in functions as shown here:...or from code withimportnapari_stl_exporterpyramid=napari_stl_exporter.make_pyramid_surface()3D-printingTo actually send your object to a 3D-printer, it has to be further converted to the.gcodeformat with a Slicer program. The latter convert the 3D object to machine-relevant parameters (printing detail, motor trajectories, etc). Popular slicers are:Slic3r: DocumentationherePrusa Slicer: TutorialhereNote: You can also upload the STL file togithub.comand interact with it in the browser:Digital elevation modelsDIgital elevation models (DEMs) can be printed with the napari-stl-exporter following these steps:Go to theopen topography repositoryand select a region of your choice, then download it as a GeoTiff file (.tif, intensity encodes elevation)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 thesolidifyoption to make it readily 3D-printable.Export the created surface layer as.stlor.plyfile. 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!Thisnapariplugin was generated withCookiecutterusing with@napari'scookiecutter-napari-plugintemplate.InstallationYou can installnapari-stl-exporterviapip:pip install napari-stl-exporterContributingContributions are very welcome. Tests can be run withtox, please ensure
the coverage at least stays the same before you submit a pull request.LicenseDistributed under the terms of theBSD-3license,
"napari-stl-exporter" is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description or post to image.sc and tagEl_Pollo_Diablo