Convert .tck to .vtk streamlines

Hi,
I am trying to convert some tractography data from .tck to .vtk format. But I can’t get the correct results that match the image loaded in slicer. I’m not very familiar to vtk files and
slicer so I’m seeking for help. Here’s the efforts I’ve tried:

  1. tckconvert -scanner2image
    image Mrtrix provides a command to realize it. TCK files are in world coordinates and 2image means changing it to image coordinates(in mm). Then load vtk as models with explicitly set coordinate system as RAS. But the problems are:
  • Anterior and Posterior of the image volume seems wrong as you can see in Fig.1.
  • Tracts(yellow) are above the back right of the image volume.

    image
  1. tckconvert -scanner2voxel, where 2voxel means changing it to voxel coordinates. Also load vtk as models with explicitly set coordinate system as RAS. Now :
  • Tracts(blue) are smaller than it should be.
  • different location from tracts(yellow).

    image
  1. python vtk package:
    reference here In reference, a TRK file was loaded and converted,here I replaced with a TCK file.

    Now:
  • Tracts(green) is in the back of the volume


image

  1. python vtk package:I tried to move original coordination in voxel coordinates randomly ( maybe change RAS to LAS, and move tracts backward a little? 10 is a number I test to match, really painful…) As the same, load it as RAS system.
    Now:
  • Tracts(red) seems flipped over in A-P direction


    image

  • If I set image as centered when loading image volume, suddenly the tracts(red) can match the volume. However, I still don’t understand the rationale.


    image
    image

It took me a long time try to figure it out, but I failed… My goal is to convert my tractography to vtk format, then I can use WhiteMatterAnalysis for parcellation. And I want to know:

  1. Which coordinate system 3D slicer uses to load and display a nifiti image?
  2. Which coordinate system VTK file could receive ?
  3. Which coordinate system should I choose when sending a VTK file as a model? And what about as Fiberbundles?

Anyone’ help will be very much appreciated!

Operating system: Ubuntu
Slicer version: 5.0.3

We can’t really comment on what other software does with coordinates. Slicer uses RAS for FiberBundles and stores them in the patient space defined by the DICOM headers of the source DWI scans. If centering the volume on load was required, then whatever software created the tracts threw away the original patient space. We really try to avoid doing that because it removes the ability to correlate with other scans, like structural of functional scans acquired in the same study.

Thanks for your reply! I finally deal with it by extracting b0 volume from the origin 4D volume (I forgot to check if 3D slicer can load 4D image :joy:). Actually I accidently found my T1w image was symmetric with DWI in the AP direction, and I’m sure headers are the same. According to advice, I load 3D b0 DWI and it matched well with my vtk file achieved here:

3.python vtk package:
reference here In reference, a TRK file was loaded and converted,here I replaced with a TCK file.

Hi!

I’m also trying to convert my streamlines from .tck to .vtk. I extracted the b0 volume and tried to follow the code you gave in reference. However, I cannot visualize any streamlines from the .vtk once converted (using medInria). Here is the snippet from which I call the function (which I did not touch):

fname="path/to/.tck"
reference="path/to/b0.nii.gz"
streams = load_tck(fname, reference)
streamlines = Streamlines(streams.streamlines)
saveStreamlinesVTK("sl.vtk")

Is it how you did too ? If not, would you mind sharing how you managed to obtain your .vtk streamlines ?

Thank you,

Sébastien