This fix was needed because `labels` claimed it should be "of same
shape as `data`", but this is no longer always the case. When
multichannel=True, `labels` should be shaped like a SINGLE channel
of `data`, i.e. without the final dimension denoting channels.
This commit represents all recommended changes since the last
commit, notably:
* PEP8 compliance (in new sections; a few old ones still
noncompliant w/indentations)
* Moved `depth` kwarg to end of list and in docstring.
Clarified `depth` docstring, and added section in Notes
further explaining this parameter.
* Added section in Notes warning that for multichannel inputs,
all channels are combined during scaling. The user must
separately normalize each channel prior to calling
random_walker()
* New method for parsing data, allowing more elegant gradient
calculation code. Probably also more extensible. The 2D
multispectral case forced this change.
* New test: `test_multispectral_2d()`
In this new version, all instances of 'spectrum' have been replaced with 'channel'. The documentation also reflects this change, and the new multichannel kwarg used to indicate multichannel input is named appropriately.
New boolean multichannel kwarg added, which controls if the input has multiple channels or not. Input 'data' is now array_like for both gray-level and multichannel. This kwarg is needed mainly because a 3-D array could be either 3 spatial dimensions or a set of different 2-D channels.
New scaling kwarg added (may be removed in future), controlling if data scaling is applied to ALL channels or each channel individually, if multichannel=True. No effect for gray-level data.
Removed np.sqrt(gradients) in _compute_weights_3d(), which was a bug. Tests now pass consistently.
New method for maintaining shape from input to output, where dims = data.shape prior to np.atleast_3d(). A theoretical (70,100,1) array passed should now result in a (70,100,1) shaped output, for example.
Updated and fixed multispectral test script to work with new version. TODO: Additional test(s) likely needed to cover code branches from new kwargs.
Since the multispectral path is equivalent except for gradient calcs,
only one test case is needed. This test is modeled on the 3-D
non-multispectral version. If deemed necessary, adding a 2-D case
would be simple.