Fail to load polydata from ASCII .vtk file if any array contain a nan value
If there is an invalid value in any of the data arrays then the saved an ASCII .vtk file then VTK cannot read the file that it has written.
The invalid value is saved as -nan(ind)
. When you try to load it with VTK then you get the error: ERROR: In vtkDataReader.cxx, line 1978\nvtkPolyDataReader (000002D320606C40): Unsupported data type:
Saving/loading works if .vtp file or binary .vtk file is used.
How to reproduce:
- Download and unzip sample data from https://github.com/lassoan/PublicTestingData/releases/download/data/20230723-VtkFileWithNanLoadFailed.zip
- Load Network-binary.vtk using vtkPolyDataReader
- Save Network-ascii.vtk using vtkPolyDataReader using ASCII format (for convenience, this file is included in the sample data set, too)
- Load the just created Network-ascii.vtk using vtkPolyDataReader => ERROR!
See user error report at: https://discourse.slicer.org/t/error-exporting-and-importing-vtk/30733/5?u=lassoan