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!
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
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.
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).
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).
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
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.
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.
@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?