Label3d

This pull request features two things:

1. 2D labelling refactoring. This has resulted in:
   * Higher readability of the code by breaking large functions into smaller ones.
   * More exhaustive documentation of the code.
   * Better performance.

2. Addition of support for 3D arrays.

I have read the papers that were referenced in the code. I think have understood them to let's say 90%, but I have found the implementation of the 2D labelling slightly different than the algorithm described in the paper by Kensheng et al. (there is no decision tree and also only one iteration is performed).
I have therefore implemented the 3D in an analogous manner. Since it has passed my (simple) test cases, I think that it is time to come up with it and get some feedback from you guys.
I was puzzled on multiple occasions by the performance. I have made a test script and measured labelling time. Sometimes the time went 5% up when I have added a statement with absolutely no effect.
I know the cython HTML trick and I kind of know C too, but this hasn't explained anything, no yellow stuff.
One of those moments was reshaping the input to a 1D array. Although the array is supposed to be internally 1D and all functions work with pointers, the reshape itself resulted in significant (5% IIRC) speed-up.