• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nipy / nibabel / 979
93%

Build:
DEFAULT BRANCH: master
Ran 07 Jun 2016 09:48PM UTC
Jobs 1
Files 165
Run time 13s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
979

push

travis-ci

matthew-brett
Merge pull request #391 from MarcCote/streamlines_api

MRG: Streamlines API

Provides a general API to manage different streamlines file format (the code can all be found in `nibabel.streamlines.`). This is related to this somewhat outdated [BIAP5](https://github.com/nipy/nibabel/wiki/BIAP5).

This new streamline API is divided in two main parts:

1. Representation of streamlines in memory (`Tractogram` and `ArraySequence` classes)
2. Loading and saving streamlines from/to different file format (`TractogramFile` class)

*We use the term 'Tractogram' to refer to a set of streamlines, usually the output of a tractography algorithm.*

## ArraySequence

The `ArraySequence` class needs to be explained first as it is at the heart of the streamlines representation. I guess it could be seen as a sort of jagged/ragged array to store a list of 2D arrays that have different length but a same number of dimensions (e.g. a list of list of points). For efficiency, we store a list of streamlines contiguously in memory using what we call a `ArraySequence`. This was needed as @Garyfallidis and I realized that a list of numpy arrays has too much overhead in term of memory when handling >1M streamlines (loading a tractogram of 2.5Gb could take up to 5Gb in RAM!).

An `ArraySequence` behaves exactly like a `list` of `2D ndarray`. That is, it supports appending, extending, indexing (supports slicing too), iterating, etc. as a `list` object. For example, indexing a `ArraySequence` object will return a 2D `ndarray`, as one would expect, representing the 3D points of the selected streamline. Note that, while `ArraySequence` does not support deletion (i.e. no `del` nor `remove`), one can efficiently use slicing to achieve the same goal.

An `ArraySequence` object can be instantiated using any iterable yielding `2D array`:

```
import numpy as np
import nibabel as nib
data = [np.random.rand(10, 3), np.random.rand(3, 3)]
seq = nib.streamlines.ArraySequence... (continued)

20267 of 21090 relevant lines covered (96.1%)

0.96 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
2
100.0
/home/travis/build/nipy/nibabel/venv/lib/python2.7/site-packages/nibabel/testing/__init__.py
2
100.0
/home/travis/build/nipy/nibabel/venv/lib/python2.7/site-packages/nibabel/__init__.py
Jobs
ID Job ID Ran Files Coverage
5 979.5 (COVERAGE=1) 07 Jun 2016 09:48PM UTC 0
96.1
Travis Job 979.5
Source Files on build 979
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #979
  • 9959c74d on github
  • Prev Build on master (#975)
  • Next Build on master (#996)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc