Add an easily-called interactive test for Coloc 2

This helps developing in an IDE tremendously.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Coloc 2: Add Kendall's Tau-b rank correlation

Kendall's Tau-b rank correlation is said to be a better measure than
Spearman's rank correlation, and the latter was only preferred for a long
time because the former needs substantially more computational resources.

This implementation is very dumb and inefficient -- O(n^2) -- and is here
only for correctness.

A subsequent commit will replace it by an efficient method.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Introduce the PairIterator

For many measures, it should actually not be necessary to localize the
position or know about the mask. Therefore, let's abstract out an
interface for an iterator that returns pairs of values, and nothing else.

This will also make it substantially easier to test things, as one does no
longer need to construct full-blown image data structures just to test
an algorithm.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add some documentation to the implementation of Kendall's Tau-b

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Use better names than getChannel1 and getChannel2

We are not getting the whole channel, after all. Just one sample of it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Make the TwinCursor a PairIterator

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a test for the Kendall Tau-b algorithm

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Test more conditions of Kendall's Tau-b

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add the reset() method to the PairIterator

We will need that for extensive testing of different Kendall Tau
algorithms.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add the IntArraySorter class

This class implements an introsort of an integer array given a custom
comparator. That allows users to sort index arrays, i.e. arrays
containing indexes into other arrays, and comparing the values the
indexes point to.

This is often more efficient than having full-blown Object arrays (with
the full runtime and space cost of constructing that many Objects).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add an efficient implementation of Kendall's Tau-b

This is supposedly the algorithm proposed by Knight (reference
in the source code comments), but really, this developer used the
description on Wikipedia (it is really strange how few scientists
understand what a big obstacle the current publishing system is to
proper scientific work).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Use the fast Kendall Tau-b algorithm instead of the naive one

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Kendall-Tau: add an exhaustive test

It is always good to verify that a robust but slow algorithm is replaced
by a fast *and accurate* algorithm.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>