I’m trying to visualize some fibre tracts in 3D slicer form a ASCII vtkPolydata file that I generate through Matlab. The file reads in well and displays the fibres in the correct position, however, I cannot assign colors based on the scalar-values assigned to each line segment (as defined in the .vtk Polydata file). In the ‘Tractography display’ module my scalar variable is recognized because it shows up in the dropdown list next to “Of scalar value”, but when I select it the color does not change. I’m wondering if I haven’t defined the color-specs correctly in my VTK file, or if this is a (known?) bug in 3D slicer. I’ve copied an example .vtk ASCII file below (copy/paste it into a text editor and save with extension .vtk, then open in 3D slicer). I’m using Slicer 4.5.0-1 r24735.
Hi you are seeing the expected behavior. Currently the support is for coloring point data, not cell data, since that is the typical use case (e.g. color by FA at all points on the polyline or fiber). You can easily store your desired scalars as point data (one scalar per point) instead of cell data (one scalar per line). Also, in your vtk example, I don’t actually see any scalar array data, so that can be another issue. There is no need to include a lookup table, since you can choose from the options in Slicer for lookup color options.
Ok, that works! Thanks!
Is it also possible to append multiple scalar sets to the same point dataset, so you can then select from the dropdown menu in Slicer which value you want to display? I’ve only figured out how to append one scalar so far.
Bart
Hi Andras,
thanks for your response again. I understand how I should be able to select a different scalar, but the problem is that only the first scalar defined in my .vtk file shows up. The other scalars do not appear in the dropdown menu. There is no error when loading the file. Also, when I open the file in ParaView it does detect all the scalars, which makes me think there’s something wrong with 3D slicer’s vtkreader.
For example, in the following file, only ‘scalar1’ shows up. Is my syntax wrong?
After upgrading to the latest Slicer version (4.7.0) it does recognise all the scalars stored in the vtk-file. So it was a problem with my previous Slicer version (4.5) which has been resolved now.
Bart