VTK grid: define cells with (i,j,k) index

Hello everyone,

I am pretty new to vtk. I am using openvdb for a slam application and I am trying to use VTK for visualization.

So lets say I have a 3d grid with size of 100x100x100. And lets say, I want to visualize some of the voxels within this grid. So for example, in my vdb grid, I have a voxel at (i,j,k) that I want to visualize.

One way to do that is to make vtkPoints and put them into vtkPolyData. After that I can make a glyph3d of a cube to show a cube with its centerpoint (i,j,k).

The problem with that, is that in my application I need to always update my grid by adding and deleting points. so if i store my vdb voxels in an array of vtkpoints, I cant access them again with(i,j,k) to add or delete.

Is there a way in vtk to store a grid as follows:
giving an (i,j,k) index I can visualize a cube around that index.
Also I can access that index later and remove that cube

Is this possible?

I would appreciate any suggestion :slight_smile:

You can create a 3D array of points using vtkImageData and visualize it using volume rendering. Voxels in the vtkImageData can be accessed directly as a numpy array (both for reading and writing).