Project

General

Profile

Export voxels

Added by Guderle Marcus about 1 year 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 (4)

RE: Export voxels - Added by Cattaneo Nicolas about 1 year ago

Marcus,

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

Nicolás

RE: Export voxels - Added by Guderle Marcus about 1 year 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.

Best,
Marcus

RE: Export voxels - Added by Piboule Alexandre about 1 year 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 1 year ago

Hi Alexandre,

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

Best regards,
Marcus

    (1-4/4)