Re: Reading voxel data



victor.herasme@xxxxxxxxx schrieb:
Hi,

it's me again. I need information on how a dataset (composed of
voxels) is organized and what the code to read it looks like. Let's
say a got a 256x256x128 dataset and UCHARS. I think the voxels are
like (z,y,x, property).

By now that is all the info i got. I appreciate any help, suggestion,
bibliographic entry, etc. Thanks in advance,

Victor

It all depends on what data set you have. The easiest way would probably be to store the resolution of the voxel data and then to store only the
uchars. You might know this from raw images stored like

xres, yres, (BYTES)data[xres*yres]

That's all for the primitive version. For voxel data you would have

xres, yres, zres, (BYTES)data[xres*yres*zres]

In both cases data describes what you refer to property. You can see
that there is no need to store the actual voxel positions (in most cases).

Now, sometimes one does not want do fix the data type to uchar (which is most often used for grey values) but wants to have arbitrary data (like pressure, velocity, ...), therefore the type is encoded in the "header" like

xres, yres, zres, bytespervoxel, (BYTES)data[xres*yres*zres*sizepervoxel]

This all is for regular voxel data. If you have individually "floating" voxels, which is VERY unlikely you'ld have to store the x,y,z position
of a voxel. If you have a regular grid the position is implicitly given.

Now you should get started.

-- NR

P.S.: Hacking given data sets without a format description is often a
very hard task ...
.