Commit Graph

4148 Commits

Author SHA1 Message Date
Juan Nunez-Iglesias 05fbc3fbfc Bug fix: typo: wrote spacing instead of sigma 2013-09-16 22:42:48 +10:00
Juan Nunez-Iglesias 00e5ff263b Add spacing descriptions; use np.double
Implement @ahojnnes's comments on pull request. Use `np.double` as
dtype for arrays because in Cython, `float` is not `np.double`. And
add further clarification about the `spacing` parameter.
2013-09-16 21:26:44 +10:00
Juan Nunez-Iglesias 846765e5f9 Add spacing support for new, speeded-up SLIC 2013-09-16 17:52:25 +10:00
Juan Nunez-Iglesias 610a0d1793 Add support for list sigma input in SLIC
Previously, having a different `sigma` for different dimensions
required an array input. This allows the user to use a simple list,
which gets converted to an array internally.

Importantly, it removes a very unhelpful error:

```python
>>> im = np.random.rand(10, 20)
>>> from skimage import segmentation as seg
Exception AttributeError: "'UmfpackContext' object has no attribute '_symbolic'" in <bound method UmfpackContext.__del__ of <scipy.sparse.linalg.dsolve.umfpack.umfpack.UmfpackContext object at 0x1045ff5d0>> ignored

>>> s = seg.slic(im, 2, sigma=[2, 1])
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-689b36a2f0ef> in <module>()
----> 1 s = seg.slic(im, 2, sigma=[2, 1])

/Users/nuneziglesiasj/venv/skimdev2/lib/python2.7/site-packages/scikit_image-0.9dev-py2.7-macosx-10.5-x86_64.egg/skimage/segmentation/slic_superpixels.pyc in slic(image, n_segments, compactness, max_iter, sigma, multichannel, convert2lab, ratio)
    106     if not isinstance(sigma, coll.Iterable):
    107         sigma = np.array([sigma, sigma, sigma])
--> 108     if (sigma > 0).any():
    109         sigma = list(sigma) + [0]
    110         image = ndimage.gaussian_filter(image, sigma)

AttributeError: 'bool' object has no attribute 'any'
```
2013-09-16 17:49:07 +10:00
Juan Nunez-Iglesias 9d86c9a1e1 Ignore convert2lab keyword if not multichannel 2013-09-16 17:33:08 +10:00
Juan Nunez-Iglesias bf5f08e894 Update SLIC docstring to remove deprecated example
The `ratio` keyword has been deprecated but it was still being used in
the example in the SLIC docstring. This replaces that usage by the new
`compactness` keyword.
2013-09-16 17:30:48 +10:00
Johannes Schönberger 88d84c720a Raise warning for sigma parameter and add to TODO for next release 2013-09-16 08:48:46 +02:00
Johannes Schönberger 06e99a537a Merge pull request #5 from jni/slic-speed-fix-dims
Fix image dimension sanitizing at function start
2013-09-15 23:37:25 -07:00
Juan Nunez-Iglesias ea1566fffb Fix image dimension sanitizing at function start
`np.atleast_3d` will add a singleton dimension at the end of an array
if needed. This is not the correct thing to do if `multichannel=False`
based on the subsequent lines. If the input image was 2D with shape
`(40, 50)` and `multichannel=False`, then `np.atleast_3d` gives it
shape `(40, 50, 1)`, and then, because `multichannel=False`, the rest
of the code gives it shape `(40, 50, 1, 1)`. This results in the final
returned array having shape `(40, 50, 1)` instead of the desired
`(40, 50)`.

This commit fixes that and updates the test to detect this failure.
2013-09-16 16:02:24 +10:00
Johannes Schönberger bc2f23d1a8 Revert default value of maximum iterations 2013-09-16 07:59:57 +02:00
Johannes Schönberger 05aaeef5ac Change default value of sigma 2013-09-14 10:08:07 +02:00
Johannes Schönberger 22ca0ae457 Fix indentation 2013-09-03 20:31:24 +02:00
Johannes Schönberger 8137c41e22 Add optional description to parameters 2013-09-03 10:48:53 +02:00
Johannes Schönberger 770e28d2bb Rename clusters to segments 2013-09-03 10:47:49 +02:00
Johannes Schönberger d9e64b43e6 Make image C-contiguous 2013-09-03 08:40:18 +02:00
Johannes Schönberger 80ed875147 Add missing rgb2lab import 2013-09-01 17:12:10 +02:00
Johannes Schönberger a6d1b10e25 Use absolute imports 2013-09-01 16:53:05 +02:00
Johannes Schönberger eeddd9e35f Revert multichannel magic and improve parameter docs 2013-09-01 16:46:01 +02:00
Johannes Schönberger e5eea8e135 Improve documentation of sigma 2013-09-01 16:46:01 +02:00
Johannes Schönberger f5cfbcfe97 Reorder variable declarations 2013-09-01 16:46:01 +02:00
Johannes Schönberger bd388383a0 Fix bug in window extent determination 2013-09-01 16:46:01 +02:00
Johannes Schönberger bc7efb01e4 Fix dtype bug 2013-09-01 16:46:01 +02:00
Johannes Schönberger 84579a6c2c Remove legacy comment 2013-09-01 16:46:01 +02:00
Johannes Schönberger 471b293a9e Remove unnecessary parameters and update doc string 2013-09-01 16:46:00 +02:00
Johannes Schönberger 6b5556b279 Reduce memory footprint 2013-09-01 16:46:00 +02:00
Johannes Schönberger fd729a4e30 Improve SLIC 2013-09-01 16:46:00 +02:00
Stefan van der Walt a401cb8d9d Merge pull request #721 from ahojnnes/travis
Remove unnecessary mirror option.
2013-09-01 07:45:05 -07:00
Johannes Schönberger 74b932e1be Remove unnecessary mirror option 2013-09-01 16:03:14 +02:00
Johannes Schönberger 586a7c9087 Merge pull request #720 from michaelaye/patch-1
removing some unused selem declarations
2013-08-31 23:31:45 -07:00
K.-Michael Aye 1bcc2b418a removing some unused selem declarations 2013-08-31 22:48:49 -07:00
Juan Nunez-Iglesias 55e42309b8 Merge pull request #712 from emmanuelle/gaussian_filter
Add a wrapper around `scipy.ndimage.gaussian_filter` with useful default behaviors.
2013-08-30 10:27:41 -07:00
Emmanuelle Gouillart 9795d3fad4 Gaussian filter function: changed the default value of multichannel
Now we try to guess automatically whether the image is grayscale or RGB
2013-08-29 23:14:30 +02:00
Emmanuelle Gouillart b4242ca3fb [BUG] iterable sigma and multichannel
+ docstring improvement
2013-08-25 16:41:37 +02:00
Emmanuelle Gouillart 15b4a4d979 DOC: corrected description of multichannel parameter 2013-08-25 15:04:22 +02:00
Stefan van der Walt d4eba562b8 Merge pull request #711 from sciunto/minordoc
DOC: Add titles to plots (watershed).
2013-08-25 05:59:44 -07:00
François Boulogne c68dab766e DOC: add titles to plots 2013-08-25 14:52:30 +02:00
Emmanuelle Gouillart 082586c10c Added a wrapper around ndimage's Gaussian filter
This version of the Gaussian filter

 * uses 'nearest' as the default boundary mode. This can be discussed,
   but I had the impression that for images this is the most relevant
   mode ('extending' boundaries)

 * has a `multichannel` keyword, so that each color channel can be
   filtered separately. For now no attempt is made at guessing whether
   the image has color channels or not.
2013-08-25 14:50:55 +02:00
Stefan van der Walt 8757356a46 Merge pull request #638 from sciunto/contribute
DOC: Activate travis for a fork.
2013-08-25 05:22:13 -07:00
Emmanuelle Gouillart 1a4ea5c970 Merge pull request #710 from jni/pyamg-depends
Add pyamg to the optional dependencies
2013-08-25 04:56:41 -07:00
Emmanuelle Gouillart 4d80670925 Merge pull request #672 from jni/chull-fix
Convex hull fix
2013-08-25 04:48:20 -07:00
Juan Nunez-Iglesias 13e83be692 Update PyAMG URL (no longer in Google Code) 2013-08-25 12:44:19 +02:00
Juan Nunez-Iglesias bd2a61baf8 Add PyAMG to the optional dependencies list 2013-08-25 12:42:12 +02:00
François Boulogne 944b45ad69 DOC: this step seems to be useless 2013-08-25 12:01:35 +02:00
Juan Nunez-Iglesias 072eb7640a Add docstring note explaining coord use case 2013-08-25 11:06:31 +02:00
Juan Nunez-Iglesias cb28bba6ee Add note describing array copy if discontiguous 2013-08-25 11:04:50 +02:00
François Boulogne 0c2f0dc532 Review the procedure 2013-08-25 10:34:25 +02:00
Johannes Schönberger 8d0f91724f Merge pull request #702 from stefanv/remove_image_wrap
Remove image wrapper.
2013-08-21 11:54:58 -07:00
Stefan van der Walt 7df2ef1e85 Add tests for image tags. 2013-08-21 17:50:21 +02:00
Stefan van der Walt 2b0f037422 Remove Image wrapper from io. Improve tags handling. 2013-08-21 17:46:38 +02:00
Johannes Schönberger 9a5a767ce8 Merge pull request #700 from stefanv/remove_logger
Remove logger in favor of warnings.
2013-08-21 02:45:24 -07:00