Investigate Difference Between Two VTK Objects

I am having an issue with a vtkUnstructuredGrid dataset that I create largely using vtk.util.numpy_support.numpy_to_vtk

I am attempting to convert this dataset to a vtkPolyData using the vtkGeometryFilter but it hangs and eventually segfaults.

I first assumed there must be some malformation of the dataset, but the interesting part is if I save my vtkUnstructuredGrid to a file and read it back in using the vtkXMLUnstructuredGridWriter/vtkXMLUnstructuredGridReader and then pass the resulting dataset to the vtkGeometryFilter it works as expected.

I’d like to compare the raw dataset vs the one that is produced from writing/reading to file, but I’m not sure how to best investigate the differences. I’ve done some basic checks like comparing the number of nodes and cells and have seen no difference between the two.

Any suggestions?

Have you tried writing VTK legacy files (in ASCII) and then diff-ing them?

I can’t diff anything written to file through a VTK writer as I really only have one dataset, which is created by reading another file format altogether and converting to a vtk UG using the numpy-vtk utilities.

So I can only compare python/vtk objects, the one created from scratch and the one returned from writing then reading back the original. I would assume that these two objects be identical but one passes through the GeometryFilter fine and the other does not.

Unfortunately I cannot share the source file, so I’m just looking for help in debugging the issue.

I’ve also looked at raw data types that make up my points, cells, and arrays and they seem to match between each of the objects.

I have been using VTK 8.1.2 through an Anaconda installation.

A colleague of mine just informed me that he avoided the GeometryFilter segfault by pip-installing 9.0.3 in a virtual environment.

I upgraded my Anaconda VTK to 9.0.3 but still had the same problem. So I made a virtualenv, pip-installed 9.0.3 and indeed the issue is gone now! Same data, same script, different results.

I see there’s a post from you @will.schroeder about this filter being updated not too long ago, but that post seems to mention speed improvements, not fixing issues. Have there been known issues with older versions? And any idea why the Anaconda and VirtualEnvironment installations produce different behavior?