Export from matlab

Hi , Does anyone know how I can save tracks from matlab ? I imported a track file to remove outliers using mbaComputeFibersOutliers from the brain anatomy toolbox. Although I can visualize the result in a matlab figure, the exported one doesn’t work in the mrview. I tried different functions like fgWrite and write_mrtrix_tracks.
witt fgWrite function I got this error :
I got this mrview error: Invalid first line for key/value file ’ filename.tck’

and with write_mrtrix_tracks function
the result is meaningless

any idea ?
Thanks

Hi @NeuroSh,

While the write_mrtrix_tracks() function is written specifically to export track data from MatLab to .tck file, it will only work if the track data you provide to it are in the format that it is designed to receive. The screenshot you have provided looks like the fundamental nature of the data have been somehow altered.

All I can suggest is:

  1. Run read_mrtrix_tracks() on a known valid track file, then run write_mrtrix_tracks() on the data stored in MatLab to write the track data to a new file. The data should be unaltered, and both versions of the track file should appear identical in mrview.

  2. Once you know that these functions are working correctly, you need to look closely at the nature of the data that are stored within MatLab as a result of read_mrtrix_tracks(), and compare this to the modified data that you are attempting to write to file using write_mrtrix_tracks(). There must be some major difference that is leading to the screenshot you provided; but what this difference may be is difficult to predict from the screenshot alone.

Rob

1 Like

Hi NeuroSh,

Given that you analyzed your streamlines using the MBA toolbox, you can probably work this out by using one of Vistasoft’s functions for exporting your streamlines to a tck file:

dtiExportFibersMrtrix(fg, tck_filename)

Try downloading the vistasoft toolbox from github so you can use the relevant function:

See if this works for you.
Cheers,
Roey

2 Likes