File Exchange

image thumbnail

Export Voxel Data

version 1.0 (2.05 MB) by

Export objects described in a logical matrix, label matrix or voxel list to STL and PovRay mesh2.

4.875
8 Ratings

15 Downloads

Updated

View License

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.

Notes
===================

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.

Comments and Ratings (14)

Roshan,

Apologies for the delay in replying. Have you had a look at the included manual? If that is unhelpful, please send me an e-mail.

There are a list of .m files in the zip folder. Can anyone help me figure which files to use?

Thank you!

Kapil,

Thank you. This submission is basically a wrapper, which combines all the different packages that I acknowledged into a single script. My hope was that it would make the process of exporting, smoothing, resampling etc. easier.

I am not sure what the details of the voxel => mesh algorithm are, but I am using the package CONVERT_voxels_to_stl by Adam H. Aitkenhead , so you might want to check it out.

Kapil Dev

Thanks very much for this. Is this based on Marching Cubes algorithm?

Tyson Reimer

Chao Xu

Very nice and thorough work!

Thai V. Hoang,

Thank you. I will look into incorporating anisotropic voxels into the package.

A very nice package although anisotropic voxel is not yet handled. Could you add this feature to the export function?

Erez,

My first guess, as I don't know how it failed, would be that the matrix size is too large for your computer to handle. That has happened to me on few occasions and usually decreasing resolution solves it.

Could you try rescaling your matrix? I would go for the imresize function.

As to what size should you rescale: that depends on the memory you have available :)

Erez

Erez (view profile)

I tried this on a matrix that is 2500 x 2500 x 2400, and it failed. any ideas?

Max Neudecker

Overall, this is a very useful package, which an exceptionally good documentation (See PDF file!) Its main advantage are generic, well accessible interface and the modular, integrated workflow (see the Fig.2 in the manual).

For me (MATLAB 2012b, ubuntu64bit), it works out of the box, and automatically compiled the missing mex files for your platform.

However, I encountered a few Out-Of-Memory issues with the "smoothing" option. If you set the default value,
p.smoothing.smooth = false; (ExportVoxelData.m, line 137) then it works. The "geometric" option took very long, I suppose it got stuck in CONVERT_meshformat.

I think, if you have 3D-data e.g. from X-Ray-Tomography or confocal microscopy, and are looking for nice visualization -even with stereoscopic images- of segmented objects in Povray or with your favourite STL program, this might be the right tool.

Keep up the good work!

MATLAB Release
MATLAB 8.1 (R2013a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video