Search code examples
xtk

Get the value of a voxel from a volume


I need a function to get the value of a voxel (3d pixel) from a X.volume object, given the x,y,z coords as an input. This is to use a lablemap as a reference for an atlas function. Is there a way to do this?

Many thanks,

Edward


Solution

  • Currently no, though the XTK developers are creating something similar as explained in Finding world coordinates from screen coordinates, though what I believe whats being done there is an Unproject function and Ray/Triangle intersection test. A Ray/Triangle intersection tests justs casts a Ray from your screen into the 3d world and returns the first intersected triangle coordinates, but of course you need to find the voxels. You can try creating an Unproject function and something similar to the Ray/Triangle intersection but instead finding the closest intersected voxel instead of triangle. Help with an Unproject function is here http://myweb.lmu.edu/dondi/share/cg/unproject-explained.pdf, but rememeber that link explains GluUnproject from OpenGL, but still explains what we need to do, we are just making an alternative version of GluUnproject for WebGL. Any solutions you may find would be greatly appreciated if contributed to XTK. Or you may wait on the Unproject function that may possibly come from the related problem in finding the 3d coordinates.