jni/gala — pull request #3 by NealJMD (2014-09-10 00:38:24+00:00)
Title: Optimized

This pull request encompasses several commits, each of which has a distinct contribution.

#### added optimized.pyx for Cython, and tests for its functions (f0b1559)
This commit adds a new file to hold functions optimized with Cython. It adds two importable functions, one to perform flood fills, and the other to remove islands in 2D numpy matrices. It also adds a new test file, test_optimized.py, which holds tests for these functions, and changes setup.py to build the Cython.

#### added missing kwarg to classify.py function	(3e2a981)
The function `default_classifier_extension` references its `use_joblib` argument but it was not in the function definition.

#### modified imio.read_h5_stack to not fail with kwargs for other imio function args (bf21ab1)
The function `imio.read_image_stack` passes all kwargs on to the `read_h5_stack` function. `read_image_stack` is called in gala-segment with the argument `single_channel=False`, but `read_h5_stack` did not support that argument or arbitrary kwargs.

#### stop agglo.py tracking 'extent' set after features are built (d368aac)
Up to this commit, the RAG (Regional Adjacency Graph) tracked the raveled ID of every point in every segment through the entire merge. After this commit, these caches are deleted after the features (which use them more or less exclusively) have been computed and any further calls re-find the IDs with flood fill. This reduces memory consumption by up to 20%.

#### optimize 'histogram' and 'moments' feature computations with Cython (37c9fe9)
The histogram and moments features are the most successful features, but also their computation accounts for a substantial fraction of gala's running time. By optimizing them in Cython, the running time is reduced by up to 30%..

#### added 'contact' feature, which helped win SNEMI3D (329d1cf)
Added a new feature called contact that compares the properties of the area of contact between two segments to the properties of the entire segment. For each segment, it computes both the fraction of the segment's 'dark' pixels (ie less than a specified threshold) that appear in the contact area, and that value normalized by the fraction of the segment's pixels the contact area represents. It is implemented in Cython for fast computation and is the most effective of all features I developed.

#### added adjusted Rand error metric to evaluate.py (65500a4)
The SNEMI3D contest compares the success of submissions with the adjusted Rand error. This commit adds a function to compute that metric.