scikit-image/scikit-image — pull request #394 by tonysyu (2012-12-15 21:05:40+00:00)
Title: Fix circular import

Running

$ python -c 'from skimage import morphology'

gave the following traceback:

> Traceback (most recent call last):
> File "", line 1, in
> File "/Users/Tony/python/devel/skimage/skimage/morphology/__init__.py", line 6, in
> from .watershed import watershed, is_local_maximum
> File "skimage/morphology/watershed.py", line 31, in
> from ..feature import peak_local_max
> File "/Users/Tony/python/devel/skimage/skimage/feature/__init__.py", line 5, in
> from .template import match_template
> File "skimage/feature/template.py", line 4, in
> from . import _template
> File "_template.pyx", line 37, in init skimage.feature._template (../skimage/feature/_template.c:4073)
> File "skimage/transform/__init__.py", line 1, in
> from .hough_transform import *
> File "skimage/transform/hough_transform.py", line 8, in
> from skimage import measure, morphology
> File "/Users/Tony/python/devel/skimage/skimage/measure/__init__.py", line 2, in
> from ._regionprops import regionprops, perimeter
> File "skimage/measure/_regionprops.py", line 6, in
> from skimage.morphology import convex_hull_image
> ImportError: cannot import name convex_hull_image

The `is_local_maximum` function (in the `morphology` package) was reimplemented in PR #376 to reuse `peak_local` (in the `feature` package). This ended up creating a circular import, as the traceback above shows.