Export Voxel Data
Updated 27 Oct 2017
Export Voxel Data
This submission allows to export multiple objects described in logical matrix, label matrix or voxel list data to STL and PovRay mesh2 format.
Mesh can be determined from the data using convhull, isosurface or geometric method.
Extracted mesh can be smoothed, resampled and translated as required.
Package provides a script, which allows to generate a simple PovRay scene, where exported objects are included with a given colour, transparency and texture. Objects can be coloured using some array of scalars as a key.
Similar script is written to export a Blender "configuration" file, which can be opened with a Blender add-on (also attached) that imports STL files and assigns each object a colour specified in the "configuration" file.
A manual describing every option is provided. Further examples that use real data are available to download (links are included in the manual).
External scripts used/included within the upload (that are not present on MathWorks):
- resampling script from "iso2mesh" package by Qianqian Fang (Available at: iso2mesh.sourceforge.net)
- a stereoscopic camera add-on to Blender by Sebastian Schneider (Available at: noeol.de/s3d/)
License crash difficulties
The resampling part of the package could not be included in the submission itself, but on first required use of the resampling part it will be downloaded from my Google Drive and added to the package. This is because it uses some functions from iso2mesh package, which is distributed under GNU license and MathWorks.com does not support it.
Similar situation applies to Blender Addons. Both are distributed under GPL license, hence are not included in the package, but there is a hotlink present in the package to download them.
I am sorry for additional problems, but this was the easiest way I could think of to overcome the problem of licensing.
This package is a by-product of my main internship project, which was analysis of random rod packing. Further examples mentioned above use some of the data collected.
I did my best to make the package up to MathWorks standard, but it is my first submission, so I would appreciate all comments and suggestions on what to change.
Cyprian Lewandowski (2023). Export Voxel Data (https://www.mathworks.com/matlabcentral/fileexchange/43640-export-voxel-data), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
- Sciences > Biological and Health Sciences > Biomedical Imaging >
- MATLAB > Data Import and Analysis > Data Import and Export > Standard File Formats > STL (STereoLithography) >
- MATLAB > Graphics > 2-D and 3-D Plots > Surfaces, Volumes, and Polygons > Volume Visualization > Scalar Volume Data >
- MATLAB > Graphics > Formatting and Annotation > 3-D Scene Control > Lighting, Transparency, and Shading >
Inspired by: stlwrite - write ASCII or Binary STL files, Smooth Triangulated Mesh, Converting a 3D logical array into an STL surface mesh
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.