Error exporting and importing .vtk

Hello,

I am trying to save the centerline of a model to .vtk. I receive no errors when exporting, however, when importing the centerline into 3D slicer, I receive an error.

I received this error on both Slicer versions 4.11 and 5.2.2

The workflow is as follows:

  1. Import the model that I want to find the centerline of (.vtk file format)
  2. Use the extract centerline tool to obtain the centerline (using the network model output)
  3. Export the centerline model as a .vtk file (unselected the compress option)
  4. Importing that same centerline model back into the scene
  5. An error is obtained and it failed to import

The error is as follows

  • Error: Loading bifurCenterline.vtk - ERROR: In D:\D\S\S-0-build\VTK\IO\Legacy\vtkDataReader.cxx, line 1974
    vtkPolyDataReader (0000028B8AE06190): Unsupported data type:
  • Error: Loading bifurCenterline.vtk - Failed to read node bifurCenterline_1 (vtkMRMLModelNode11) from filename=ā€˜bifurCenterline.vtkā€™

For reference, the bifurCenterline is the file name for the centerline .vtk file
Thank you for any help.

.vtk files can store either a mesh or an image. It is used for meshes more commonly. It is not suitable for storing medical images, because it cannot store the patient orientation (if you use this format then your images may be rotated after saving into and loading from this format).

If you have want to load an image from .vtk format anyway then in the ā€œAdd dataā€ window, choose ā€œVolumeā€ in the ā€œDescriptionā€ column.

I think the problem lies with slicer saving a corrupt or incorrectly formatted .vtk file for the centerline. I followed the steps from this previous thread , but when I go to reopen the saved centerline I received the error I pasted above. I also receive an error when opening it in other .vtk file viewers such as paraview.

Iā€™d be more than happy to provide the files for the model and the centerline if there is a way to do that.

Can you upload a problematic .vtk file somewhere and post the link here?

I attached two files:

bifurModel.vtk: The .vtk file I am attempting to find the centerline of using the extract centerline module. I have no issue importing and exporting this file. Here is a google drive link.

bifurModelCenterline.vtk: This is the centerline generated by the extract centerline module. I exported it in .vtk file format without compression. However, I am unable to import it back into 3D slicer or view it in any other .vtk file viewers. Here is a google drive link.

One of values in the Torsion array contains an invalid value, which VTK saves as -nan(ind). However, VTK cannot save and load such values in non-compressed (ASCII) .vtk file format. This is a bug in VTK and Iā€™ve filed a bug report for you:

To avoid running into this issue, you can save the centerline as .vtp file or binary .vtk file, or export the centerline into markup node and save as JSON.

1 Like