javaraycastingmarching-cubesisosurface

Read and index data from .raw volume file with Java


I am working with volume data in raw format. I think that it is basically a 3D matrix of voxels that I want to load into a 3D array. I have no experience with this, and I’m unable to find much information on how it is done. My main problem is that I don’t really understand what the data represents.

So what I’m asking really if anybody can help me to understand the data and load it into a 3D array with Java.


Solution

  • You're correct in thinking the first thing you need to do is understand the data. Here's a good explanation of what you're likely dealing with: https://support.echoview.com/WebHelp/Reference/File_formats/Export_file_formats/Volume_data_set_file_formats.htm#data_file

    The .raw file probably contains a sequence of unsigned 8 bit integers. It's hard to say exactly without seeing the file (i.e. does it have a header, what is the matrix size, etc.)

    Here's an answer that shows one method of converting from a 3D vector to a volume index and back in Java: https://stackoverflow.com/a/34363187/1973135. You'll need to know the actual dimension of the matrix to get this to work.