Nvidia warp python - get supervoxel features

I have a 3d dense array and complex triangle mesh. Array is divided into supervoxels where mesh constitutes the border of the supervoxels.
Array is nonmutable but mesh verticies locations may change.
I am looking for a way to assign each point of the 3d array to a supervoxel on the basis of a mesh.
Idea is to calculate the features of each supervoxels and on the basis of it learn the neural network to modify the mesh verticies locations to minimise the feature variance in the supervoxels and maximise it between them. The first step Hovewer to calculate those features is to know which points are present in the given supervoxel.
The algorithm requires the interactions between two data structures one would be mesh and for a second I am not sure, as Hash grid seem logical choice - but I do net see a way to communicate between hash grid and mesh, also It seem to have far higher memory requirements than just array for dense arrays.

Thanks @jakub.mitura14. I’ll share this with the devs.

1 Like

Hi Jakub,

Just so I understand, a super-voxel is represented as mesh surface? Could you use the Warp Mesh class + wp.mesh_query_point() to test if a point is inside each super-voxel?

Note that with Warp 0.5 we now also have exposed the built-in BVH structure, so you can build acceleration structures for custom shapes, this is what the Mesh class uses internally for testing triangles, but you can use it for your own shapes if you can provide an AABB for each element.

Hope that helps.

Cheers,
Miles

Hello to be more precise I created an image


Generally, I am segmenting 3d magnetic resonance, your library seems to have some methods that can be very useful. In the image, we look at the single slice - crossection of the 3d image. in green, we have crossesction over the mesh. Mesh constitutes the border of the supervoxels. In the image, we have 4 supervoxel all marked by numbers on yellow background. the main data 3darray/hashgrid that holds data about MRI images and which is represented by the black grid.
An example query would be to check whether blue and red voxels are in the same supervoxel. I suppose that the main MRIO data (black grid) needs to be either represented simply by a 3-dimensional warp array or as the hash grid, However, I do not see weather those structures can interact well.

My current idea is to save which triangle faces of a mesh are constituting the borders of the supervaoxel then cast two rays in orthogonal directions from each voxel, then when both triangles hit by the rays are in the same supervoxel set the voxel ownership to this supervoxel

Assuming I’m following this correctly, you could represent the MRIO data in a collection of arrays representing grid corners, and then in your kernels check the positions of these corners against each supervoxel to see if they are inside the supervoxel mesh, using

https://nvidia.github.io/warp/_build/html/modules/functions.html#warp.mesh_query_point

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.