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

**URL:** https://discourse.vtk.org/t/vtk-grid-define-cells-with-i-j-k-index/5323
**Category:** Development
**Created:** [March 4, 2021, 11:29pm UTC](https://discourse.vtk.org/t/vtk-grid-define-cells-with-i-j-k-index/5323 "2021-03-04T23:29:36Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Mohamedelhamzawy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@Mohamedelhamzawy](https://discourse.vtk.org/u/Mohamedelhamzawy)
#### Post date: [March 4, 2021, 11:29pm UTC](https://discourse.vtk.org/t/vtk-grid-define-cells-with-i-j-k-index/5323/1 "2021-03-04T23:29:36Z")

</div>

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 🙂

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [March 4, 2021, 11:34pm UTC](https://discourse.vtk.org/t/vtk-grid-define-cells-with-i-j-k-index/5323/2 "2021-03-04T23:34:45Z")

</div>

You can create a 3D array of points using vtkImageData and visualize it using [volume rendering](https://vtk.org/doc/nightly/html/classvtkGPUVolumeRayCastMapper.html). Voxels in the vtkImageData can be accessed directly as a numpy array (both for reading and writing).
