I've found an examplehttps://mail.python.org/pipermail/neuroimaging/2015-September/000488.html how to read trk file with nibabel:
import nibabel as nib
track_gen, hdr = nib.trackvis.read(trk_file, as_generator=True)
tracks = [] while True: try: track = next(track_gen) except (StopIteration, TypeError): break tracks.append(track)
________________________________ From: freesurfer-bounces@nmr.mgh.harvard.edu [freesurfer-bounces@nmr.mgh.harvard.edu] on behalf of Peled, Noam [NPELED@mgh.harvard.edu] Sent: Tuesday, February 16, 2016 2:16 PM To: freesurfer@nmr.mgh.harvard.edu Subject: [Freesurfer] path.pd.trk format
Hello, I've noticed that in tracula 5.2 there's also a path.pd.trk file in the output directory. How can I read this file? I would like to read the actual splines and not the probabilistic distribution in path.pd.nii.gz.
Thanks, Noam Peled