# Hidden structured data (shown anyway, bug?)

**URL:** https://discourse.vtk.org/t/hidden-structured-data-shown-anyway-bug/11482
**Category:** Support
**Created:** [May 17, 2023, 4:02pm UTC](https://discourse.vtk.org/t/hidden-structured-data-shown-anyway-bug/11482 "2023-05-17T16:02:17Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Jens\_Munk\_Hansen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jens_munk_hansen/32/1215_2.png) [@Jens\_Munk\_Hansen](https://discourse.vtk.org/u/Jens_Munk_Hansen)
#### Post date: [May 17, 2023, 4:02pm UTC](https://discourse.vtk.org/t/hidden-structured-data-shown-anyway-bug/11482/1 "2023-05-17T16:02:17Z")

</div>

Hi guys

I am having some trouble hiding cells or points. It seems like no matter what I do, the points as well as the cell remain visible.

```auto
from vtkmodules.util.numpy_support import vtk_to_numpy
import numpy as np

nxy = 10
dxy = 0.1

rg = vtkRectilinearGrid()
rg.SetExtent(0, nxy - 1, 0, nxy - 1, 0, 0)
rg.GetXCoordinates().SetNumberOfValues(nxy)
rg.GetYCoordinates().SetNumberOfValues(nxy)
xs = vtk_to_numpy(rg.GetXCoordinates())
ys = vtk_to_numpy(rg.GetYCoordinates())
zs = vtk_to_numpy(rg.GetZCoordinates())
xs[:] = dxy * (np.r_[0:nxy] - 0.5 * (nxy-1))
ys[:] = dxy * (np.r_[0:nxy] - 0.5 * (nxy-1))
zs[0] = 0.0

vColors = vtkUnsignedCharArray()
vColors.SetNumberOfComponents(3)
vColors.SetNumberOfTuples(rg.GetNumberOfPoints())
vColors.SetName("Colors")

rnd = vtkRandomPool()
rnd.PopulateDataArray(vColors, 0, 255)

rg.GetPointData().SetScalars(vColors)

ghosts = rg.AllocatePointGhostArray()
npGhosts = vtk_to_numpy(ghosts)
npGhosts[:] = npGhosts[:] | vtkDataSetAttributes.HIDDENPOINT

ghostCells = rg.AllocateCellGhostArray()
npGhostCells = vtk_to_numpy(ghostCells)
npGhostCells[:] = npGhostCells[:] | vtkDataSetAttributes.HIDDENCELL

renderer = vtkRenderer()
renWin = vtkRenderWindow()
renWin.AddRenderer(renderer)

for i in range((nxy-1)**2):
  oldValue = rg.GetCellData().GetArray(0).GetValue(i)
  rg.GetCellData().GetArray(0).SetValue(i, oldValue | vtkDataSetAttributes.HIDDENCELL)

for i in range(nxy**2):
  oldValue = rg.GetPointData().GetArray(1).GetValue(i)
  rg.GetPointData().GetArray(1).SetValue(i, oldValue | vtkDataSetAttributes.HIDDENPOINT)

mapper = vtkDataSetMapper()
mapper.SetInputData(rg)

actor = vtkActor()
actor.SetMapper(mapper)

renderer.AddActor(actor)

renWinInteractor = vtkRenderWindowInteractor()
renWinInteractor.SetRenderWindow(renWin)

renWin.Render()
renWinInteractor.Start()

```

It feels like no matter what I do, all structured and unstructured grids ignore any cells or points flagged as hidden. Could this be a bug?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [May 18, 2023, 1:15pm UTC](https://discourse.vtk.org/t/hidden-structured-data-shown-anyway-bug/11482/2 "2023-05-18T13:15:19Z")

</div>

@Yohann_Bearzi

---

<div class="post-metadata">

### Author: ![Jens\_Munk\_Hansen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jens_munk_hansen/32/1215_2.png) [@Jens\_Munk\_Hansen](https://discourse.vtk.org/u/Jens_Munk_Hansen)
#### Post date: [May 19, 2023, 7:02pm UTC](https://discourse.vtk.org/t/hidden-structured-data-shown-anyway-bug/11482/3 "2023-05-19T19:02:13Z")

</div>

I can see that `pyvista` uses the same approach for hiding structural `VTK` data, but also here `HIDDENPOINT` and `HIDDENCELL` are completely ignored. If I don’t resolve this issue, I may reintroduce the old way of handing ghost levels… I will try installing an old version of `VTK`, e.g. 8.2 and see if ghosts also were ignored here for structured data.

---

<div class="post-metadata">

### Author: ![Jens\_Munk\_Hansen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jens_munk_hansen/32/1215_2.png) [@Jens\_Munk\_Hansen](https://discourse.vtk.org/u/Jens_Munk_Hansen)
#### Post date: [May 23, 2023, 10:53pm UTC](https://discourse.vtk.org/t/hidden-structured-data-shown-anyway-bug/11482/4 "2023-05-23T22:53:44Z")

</div>

I figured out it is a bug in 9.2.6. The example

[https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint/](https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint/)

is broken.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/d/d9fc3fadce0c9380a0a453053834fcc67643b293.png)

I will checkout master and see if it is still an issue and report and perhaps fix it. @Yohann_Bearzi
