Unable to view vtk file in slicer

Operating system: windows 10
Slicer version: 4.11
Expected behavior:
Actual behavior:

I am able to view this vtk file using paraview under points gaussian but not when I upload this to slicer. Is there a reason I am unable to see the vtk data in slicer? And how do I make it visible?

Do you have an example of file causing problem ? Is there any relevant information in the log (in application menu bar: View->Error log) ?

@jcfr Sorry, yes I do see an error. “.vtk does not contain coordinate system information. Assuming LPS.” I cant upload the file though. Have you seen this error. Anyhting I can do ?

Lack of coordinate system information is just a warning, you can ignore it because the assumption of LPS is probably correct.

If you need to use points Gaussian to see the data set in Paraview then probably you do not have any cells. To display point cloud, you need to at least specify vertex cells, or run the point cloud through a glyph filter or surface reconstructor.

For example, if you want to apply a glyph filter on a point cloud loaded as a model node in Slicer then copy-paste this snippet into Slicer’s Python console:

modelNode = getNode('MyModel')  # replace this with the actual name of your model node
glyph=vtk.vtkGlyph3D()
glyph.SetInputData(modelNode.GetPolyData())
glyph.Update()
modelNode.SetAndObservePolyData(glyph.GetOutput())

How do you plan to use this data in Slicer?

1 Like

I just wanted to view the points as a 3d model in slicer. Thanks for that, I tried the glyph filter method but I get this: AttributeError: ‘MRMLCorePython.vtkMRMLModelNode’ object has no attribute ‘GetPointData’

@lassoan @jcfr Here is a vtk file that I have issues with. I just want to upload to slicer and view as 3d.

I’ve updated thr code snippet, it should work now.

1 Like

@lassoan Hey, thank you, that worked, but it still doesn’t display. What line can I use to display it or view it in the Data module?

The remaining issue was that the 3D view had to be centered.

1 Like