[Neuroimaging] Covert .trk to JSON
elef at indiana.edu
Wed May 17 22:12:49 EDT 2017
With the new API for streamlines available in nibabel.streamlines you can
load .trk files and then get all the points of all the streamlines in one
buffer and in another the offsets (starting points) and lenghts of each
Here is how
trkfile = nib.streamlines.load('test.trk')
streamlines = trkfile.streamlines
all_points = streamlines.data
offsets = streamlines._offsets
lengths = streamlines._lengths
You can probably save these 3 arrays in a json file with no problem. You
may also want to save the affine. You can get this from trkfile.affine.
I hope this helps.
On Wed, May 17, 2017 at 6:30 PM Jorge Rudas <jrudascas at gmail.com> wrote:
> Hi dipy experts
> There is a direct way to covert a tractography file in .trk format to JSON
> *Jorge Rudas*
> Neuroimaging mailing list
> Neuroimaging at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Neuroimaging