Export voxels

Added by Guderle Marcus about 5 years ago

Hi Alexandre,

is there a possibility to export generated voxels of a tree in a way that it can be loaded into R or Matlab and includes the voxel values?
I tried the option under “Export - Voxel - 3D grids, table (X,Y,Z,Value)” as well as “3D grids, ASCII”. Both options did not work for an import into another software.

Thanks in advance.

Best, Marcus

Replies (6)

RE: Export voxels - Added by Cattaneo Nicolas about 5 years ago


You can generate the voxels directly inside R, with the vox() function from the “VoxR” package.


RE: Export voxels - Added by Guderle Marcus about 5 years ago

Dear Nicolás,

thanks for your quick reply.

I know this option and as well as the option to calculate/generate voxels directly in Matlab.
What I wanted is to use the voxels which are generated in Computree anyway as part of the processing chain. So to say to reduce amount of different workflows.


RE: Export voxels - Added by Piboule Alexandre about 5 years ago

Hi Marcus,

For now only “Export - Voxel - 3D grids, table (X,Y,Z,Value)” and “3D grids, ASCII” formats are available for exporting grids.

The “Export - Voxel - 3D grids, table (X,Y,Z,Value)” is just a table (tabulation separator), easy to read in R :

Xcorner Ycorner Zcorner Xcenter Ycenter Zcenter ColX RowY LevZ Value
-8.5 1 -2.5 -8.25 1.25 -2.25 0 0 0 0
-8.5 1 -2 -8.25 1.25 -1.75 0 0 1 0
-8.5 1 -1.5 -8.25 1.25 -1.25 0 0 2 0

For small ones you can use something like : read.table(filename.GRD3D, dec=“.”, sep="\t”). For bigger ones you should probably use data.table and fread.

In this table you have (x,y,z) of the lower left corner of each cell, (x,y,z) of the center of each cell and the integer indices of the cells along x, y and z axis (colx, rowy, levz). Indices begin at 0 for the first cell.
With that you can easily create any structure you want in R or matlab.

The “3D grids, ASCII” is inspired from raster format, so would need a more dedicated reading code.

ncols 40
nrows 22
nzlev 45
xllcorner -8.5
yllcorner 1
zllcorner -2.5
cellsize 0.5
NODATA_value -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

At the beginning you have the header giving numbers of x columns, y rows, and z levels.
following that you have the coordinates of the lower left corner of the grid, the cell size and the no_data coding value.

After that you have the values of the grid, Z plane by Z plane (from lowest z value to highest z value).
Between each plane there is an empty line.
For each plane you have one line for each Y row (from HIGHEST y value to LOWEST y value). Y is stored in inverse order (top to bottom), to be consistent with raster classical logic (image paradigm).
For each line you have one value for each X column (from lowest x value to highest x value), separated by tabulations (\t).

These formats have been created because we didn’t know “standards” existing formats for grids.
If you have a precise format in mind you would like to use, we could add it in Computree.
If it is the case, please let me know which one(s), and give me a reference (link or document) where to find the format specification.
We would like to enrich import / export capacities of Computree for grids. So any suggestion will be considered with interest.

Best regards.
Alexandre Piboule.

RE: Export voxels - Added by Guderle Marcus about 5 years ago

Hi Alexandre,

thanks for these very helpful information. I’ll let you know if there is a special format.

Best regards,

RE: Export voxels - Added by Möhlmann Mike over 2 years ago


is it possible to export a voxel-model as an .obj file? When I try to use Exports>Meshes>Mesh, OBJ format the program just does nothing at all.

Best regards,

RE: Export voxels - Added by Hackenberg Jan over 2 years ago

Hi Mike

as your question is open since 11 days already I would like to give you an rather general answer. I do not know the exact answer unfortunately as I do not work with voxel models.

  • Whenever I struggle with a special export format I use the one that works and do another conversion with Meshlab - open source tool. Meshlab is capable of a lot of export formats and I already used both obj and stl files exported form Meshlab. The original data imported in Meshlab I produced with Computree.