NiBabel

Access a cacophony of neuro-imaging file formats

Previous topic

nibabel.trackvis.empty_header

Next topic

nibabel.trackvis.write

Reggie -- the one

nibabel.trackvis.read

nibabel.trackvis.read(fileobj, as_generator=False)

Read trackvis file, return streamlines, header

Parameters :

fileobj : string or file-like object

If string, a filename; otherwise an open file-like object pointing to trackvis file (and ready to read from the beginning of the trackvis header data)

as_generator : bool, optional

Whether to return tracks as sequence (False, default) or as a generator (True).

Returns :

streamlines : sequence or generator

Returns sequence if as_generator is False, generator if True. Value is sequence or generator of 3 element sequences with elements:

  1. points : ndarray shape (N,3) where N is the number of points
  2. scalars : None or ndarray shape (N, M) where M is the number of scalars per point
  3. properties : None or ndarray shape (P,) where P is the number of properties

hdr : structured array

structured array with trackvis header fields

Notes

The endianness of the input data can be deduced from the endianness of the returned hdr or streamlines