Load DSI Studio (*.trk.gz) or TrackVis (*.trk) tracks in Slicer

Does anyone have experience converting and then loading fibertrack generated by these software into 3D Slicer ?

Is there any recommended pathway to export tracts and import them into Slicer ?

We are thinking of these approaches:

  • improve export to vtk (fiberbundle) in software like DSI Studio.
  • add IO support for .trk.gz, .trk

Thanks for your input

References:

Cc: @Johan_Andruejol @fbudin69500

I have code to load TrackVis-style trk files. It can create Slicer-style vtkPolyData in memory so would be pretty simple to hook it up as another i/o option. It uses C++11 features, but it’s only a few hundred lines so could be modified … unless we’re flipping switch soon! :stuck_out_tongue_winking_eye:

Have never used DSI Studio data though.

@jcfr When do we plan to switch to c++11? I have trouble building Cleaver on Linux and Mac without c++11, too.

1 Like

I have been generating .trk streamlines in Dipy and would like to export them to 3d Slicer for visualization and overlay onto images. How can .trk files be imported into 3d Slicer? Thanks

Building on the work of @ihnorton, @Johan_Andruejol and @jcfr solved this for us, the github for the code is here.

I managed to compile in windows with vs 2013.

To make it run it needs to be able to find the dll’s from your compiled copy of slicer. I grabbed all the dll files and threw them in the same directory with the exe. That is the wrong solution, but it works.

Perfect will try it out. Thanks!

Dear all,

TrackVis can save fibers as VTK polydata which can be directly imported to Slicer.

Best regards

Please can you explain how this is done? It is not clear from the menus in TracVis

Thanks!
Steve

Dear Steve,

when you right-click any track group in the sidepanel, there’s a “Save as…” option. In the dialog that pops-up, you can change the format from .trk to .vtk.

You will be asked to provide an appropriate reference volume (I think to get the correct transformation).

This works for version 0.6.1. I’m not sure about previous versions (though it may work as well).

Best regards

Samuel

Dear @Vinny and all, DIPY has a command called save_vtk see here
https://dipy.org/documentation/1.3.0./reference/dipy.io/#dipy.io.streamline.save_vtk
Which means that you can load the TRK file with DIPY and then save it as VTK.
Which also means that as you are already using DIPY to do your tracking you can save the result directly to both VTK and TRK (along with TCK and DPY file formats).

I hope this information helps.
Eleftherios

2 Likes

Thanks @Eleftherios, this is very helpful!

1 Like

Happy to help @Vinny. Let me know if you have any other questions. I wish I have seen this question earlier. Have in mind that I do not check this discourse channel that often. You may want to ask any other related questions on DIPY’s live chatroom (or forum) available here

Best,
Eleftherios

1 Like

If you don’t have time to visit this forum regularly but would like to answer questions related to dipy then you can enable email notification for topics posted in the SlicerDMRI category or tagged with diffusion by going to the category’s or tag’s page, clicking the “bell” icon, and choosing “watching”. I don’t think the amount of messages will be overwhelming, but if you prefer then we can even create a dipy tag so that you can sign up for notifications about topics specifically about dipy.

Thank you @lassoan will do as suggested. Be happy to create a dipy tag.

Done, see here: https://discourse.slicer.org/tag/dipy

You could also sign up to the diffusion tag so that you can direct people towards dipy who have not heard about it yet and would benefit from using it.

1 Like

Now that Slicer users can pip_install("dipy") it will be great to see what new things are possible.

1 Like

@Eleftherios I am wondering, with Dipy or slicer is it possible to convert the .tck into dicom, so that it can be used into to PACS or navigation systems?