Sign in to follow this  

ho can I read 3d volumes in raw format?

Recommended Posts

We need much more information than that.

What language?
What API?
What "raw" values are you talking about? What's "raw" about them?
Read them from where?
What do you mean "turn discrete values in xyz coordinates"?

Share this post

Link to post
Share on other sites
On the absence of more information:

The typical volume data stored in a .RAW file is usually stored linearly:

slice1, slice2....sliceN where each slice is Width x Height long.

Pseudo code for reading a RAW volume data file (note: assumes scalars):

Size = Width * Height * Depth;
for i to Size
data[i] = read NBytes.

where NBytes is the storage size of the data (sizeof( byte ) for 8-bit, sizeof( byte * 2) for 16-bit, etc). This, of course depending on the language, could be much faster. Example in C:

fread( data, NBytes * Width * Height * Depth, RAWfile );

Then to access a point at x, y, z: data[x + (y * Width) + (z * Width * Height)]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this