Converting MRtrix tracts and cortex (rendered in 3D in MRview) to .obj or similar format

Hello MRtrix experts,

I am trying to export the streamlines generated by MRtrix to a 3D object format that I can edit in blender or other 3D softwares (goal: 3D print white matter tracts). Is there a way to export/convert the tck file to a .obj/.ply or similar formats? how about the brain surface, that can be rendered in 3D in MRview?

Thank you in advance for your help,

Giorgia

I think tckconvert with either PLY or RIB output should do what you’re after. I’ve certainly managed to import into blender in the past with one of these – can’t remember which though…

Hi @jdtournier,

Thank you for answering me. How do you set PLY/RIB as an output? I tried to define the extension (.ply), but it say unsupported output file… :frowning:

Giorgia

It should be by extension, but maybe you’re using an old version? Support for PLY & RIB was added in version 3.0_RC2.

Hi. It looks like tckconvert writes wrong coordinate system to PLY files. I created .stl model of head using segmentation tool in 3D Slicer and converted .tck tracts to .ply files. Here is screenshot from Blender:

The same files opened in MITK:

There is no way to import RIB files to Blender. Can you suggest me something for importing *.tck tracts to Blender?

My guess is that much of the addition of new file formats such as PLY to the tckconvert command were motivated by the fact that .tck files will not be supported by non-neuroimaging programs such as Blender. So the localisation of data within the PLY format is what needs to be addressed.

These capabilities were contributed by @blezek, not core MRtrix3 team members, and I’m not familiar with the format personally. It may be beneficial to instead post an issue onto GitHub.

@Eduard_NSI, author of the PLY writer here. The PLY writer exports exactly the coordinates in the .tck format, which is the Nifti standard, and importantly, differs from the DICOM standard (which is what Slicer uses?).

I’ve tended to use ParaView to view Nifti and .tck exported as PLY. But have not yet worked on head surfaces with streamlines.

Incidentally, the PLY writer was written explicity for 3D printing.

Hi! Thanks for response, @rsmith and @blezek.

My pipeline was:

  1. Interpolate diffusion data to 1x1x1 mm3 voxel size
  2. Calculate in Mrtrix3 whole brain fiber tracts in 1x1x1 mm3 space
  3. Coregister T1 structural image to interpolated diffusion data then save coregistered T1 in Nifti. I used this Nifti in Slicer for creating head surface.
  4. Convert whole brain *.tck data to *.trk using TractConverter.py script -> load *.trk data to TrackVis -> construct fiber tracts -> save the tracts in *.trk -> convert the tracts to *.tck
  5. Convert *.tck tracts to *.ply format
    Fin!

The *.tck tracts in step 5 have proper coordinates: if load it to mrview with coregistered T1 Nifti I can see correct picture.

I tried ParaView: threre is the same issue with my data as in Blender.

@blezek, if you need, I can share you all the data.

@Eduard_NSI, would be happy to take a look at your data. I’d just need the T1 Nifti, diffusion Nifti, Slicer surface, and .tck files.

Thanks,
-dan

@Eduard_NSI, sorry this took so long to get back. I couldn’t duplicate what you have seen, so I’ve documented what I did:

tckconvert -version
== tckconvert 3.0_RC2-32-gdaa5c09c ==
64 bit release version, built Sep  6 2017, using Eigen 3.3.4

My version is a bit out of date. Here’s how I converted:

for t in *.tck; do tckconvert -force -dec $t ${t/tck/ply}; done

Here’s the Blender view:

And ParaView: