Commit Graph

10 Commits

Author SHA1 Message Date
Emmanuelle Gouillart 6635cf16db [BUG] Corrected a bug in the random walker that appeared
* when returning the full probability instead of the segmentation
    * for three or more labels (two was OK)
2012-09-18 19:56:52 +02:00
JDWarner e8ddcefae3 PEP8 compliance, removed scaling, different data parsing.
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()`
2012-08-31 14:14:46 -05:00
JDWarner 61320957eb Changes based on PR review recommendations: input format, scaling, and bugfix.
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.
2012-08-29 16:33:56 -05:00
JDWarner 682d0535cd Added multispectral random walker test.
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.
2012-08-27 13:41:41 -05:00
Emmanuelle Gouillart 28161eaee6 ENH: better handling of labels that need to be reordered
(this is now done automatically)
2012-08-24 15:09:46 +02:00
Emmanuelle Gouillart aa92d5f0bd Better handling of labeled pixels in random walker segmentation when we
return the whole probability.
2012-07-24 23:01:15 +02:00
Emmanuelle Gouillart 4ab7d0a4fa Modifications to random walker segmentation algorithm:
* returning the probability to belong to a label instead of only the most
  likely label is now possible

* fixing some type issues

* handling non-consecutive label values
2012-06-24 19:35:27 +02:00
emmanuelle 528187c2b0 ENH: addressed Tony's comments (renaming of functions, doc) 2012-01-21 11:43:53 +01:00
emmanuelle 09e3a43f58 More explanations about the algorithm
Also: removed copyright
      changed module name
2012-01-17 21:32:08 +01:00
emmanuelle d1e608bfe9 Random walker algo for segmentation + example 2012-01-15 17:22:59 +01:00