Describe the bug
Using trame-vtk with vtkLongArray cell scalars results in incorrect visualization of the data. Using vtkTypeInt64Array instead produces the correct result.
In VTK 9.6.2, the conversion between NumPy and VTK array dtypes was incorrect, resulting in long being converted to int64. This was fixed in VTK 9.7.0 with https://gitlab.kitware.com/vtk/vtk/-/merge_requests/13430.
Consequently, downstream users like PyVista which use vtk_to_numpy and numpy_to_vtk are now seeing this bug surface in VTK 9.7, since the numpy conversion would previously "mask" the bug by changing the dtype from long (broken) to int64 (working), whereas now the NumPy conversion is correct and we go from long (broken) back to long (still broken). See pyvista/pyvista#8810 (comment)
I created a matrix using the reproducer below to show how the different arrays and how the use of a NumPy round-trip conversion affects the output. The table shows the apparent regression with vtkLongArray previously working in 9.6.2 with a NumPy round-trip, which breaks with vtk 9.7.
This issue with vtkLongArray is only visible when using trame-vtk. The correct output is observed in all cases when using vtk outside of a trame app.
| Args |
vtk-9.6.2 |
vtk-9.7.0rc2 |
vtkLongArray |
 |
 |
vtkLongArray --numpy-roundtrip |
 |
 |
vtkTypeInt64Array |
 |
 |
vtkTypeInt64Array --numpy-roundtrip |
 |
 |
To Reproduce
Download the script dtype_bug.py. Create a new env and install deps:
pip install trame trame-vuetify trame-vtk vtk
Run the script with the args listed in the table above to generate the outputs, along with a port, e.g.
python ./dtype_bug.py vtkLongArray --port 1234
python ./dtype_bug.py vtkLongArray --numpy-roundtrip --port 1234
python ./dtype_bug.py vtkTypeInt64Array --port 1234
python ./dtype_bug.py vtkTypeInt64Array --numpy-roundtrip --port 1234
Platform:
Device:
OS:
Browsers Affected:
Describe the bug
Using
trame-vtkwithvtkLongArraycell scalars results in incorrect visualization of the data. UsingvtkTypeInt64Arrayinstead produces the correct result.In VTK 9.6.2, the conversion between NumPy and VTK array dtypes was incorrect, resulting in long being converted to int64. This was fixed in VTK 9.7.0 with https://gitlab.kitware.com/vtk/vtk/-/merge_requests/13430.
Consequently, downstream users like PyVista which use
vtk_to_numpyandnumpy_to_vtkare now seeing this bug surface in VTK 9.7, since the numpy conversion would previously "mask" the bug by changing the dtype from long (broken) to int64 (working), whereas now the NumPy conversion is correct and we go from long (broken) back to long (still broken). See pyvista/pyvista#8810 (comment)I created a matrix using the reproducer below to show how the different arrays and how the use of a NumPy round-trip conversion affects the output. The table shows the apparent regression with
vtkLongArraypreviously working in 9.6.2 with a NumPy round-trip, which breaks with vtk 9.7.This issue with
vtkLongArrayis only visible when usingtrame-vtk. The correct output is observed in all cases when usingvtkoutside of a trame app.vtkLongArrayvtkLongArray --numpy-roundtripvtkTypeInt64ArrayvtkTypeInt64Array --numpy-roundtripTo Reproduce
Download the script dtype_bug.py. Create a new env and install deps:
Run the script with the args listed in the table above to generate the outputs, along with a port, e.g.
Platform:
Device:
OS:
Browsers Affected: