mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-27 21:08:24 +08:00
With matplotlib dependency raised to 1.3, remove inlined clipping code
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
Remember to list any API changes below in `doc/source/api_changes.txt`.
|
||||
|
||||
|
||||
|
||||
Version 0.14
|
||||
------------
|
||||
* In `skimage._shared._geometry`, remove `clip_to_bbox` and replace with
|
||||
`poly.clip_to_bbox`, if our dependency on Matplotlib is now >= 1.2.
|
||||
* Remove deprecated ``ntiles_*` kwargs in ``equalize_adapthist``.
|
||||
* Remove deprecated ``skimage.restoration.nl_means_denoising``.
|
||||
* Remove deprecated ``skimage.filters.gaussian_filter``.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
matplotlib>=1.1.0
|
||||
matplotlib>=1.3.1
|
||||
numpy>=1.7.2
|
||||
scipy>=0.9.0
|
||||
six>=1.4
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
__all__ = ['polygon_clip', 'polygon_area']
|
||||
|
||||
import numpy as np
|
||||
from matplotlib import _path, path, transforms
|
||||
|
||||
|
||||
def polygon_clip(rp, cp, r0, c0, r1, c1):
|
||||
@@ -24,19 +25,11 @@ def polygon_clip(rp, cp, r0, c0, r1, c1):
|
||||
AGG 2.4 and exposed in Matplotlib.
|
||||
|
||||
"""
|
||||
from matplotlib import _path, path, transforms
|
||||
|
||||
# `clip_to_bbox` is included directly from Matplotlib
|
||||
# since it was only included after v1.1
|
||||
def clip_to_bbox(poly_path, bbox, inside=True):
|
||||
verts = _path.clip_path_to_rect(poly_path, bbox, inside)
|
||||
paths = [path.Path(poly) for poly in verts]
|
||||
return poly_path.make_compound_path(*paths)
|
||||
|
||||
poly = path.Path(np.vstack((rp, cp)).T, closed=True)
|
||||
clip_rect = transforms.Bbox([[r0, c0], [r1, c1]])
|
||||
poly_clipped = clip_to_bbox(poly, clip_rect).to_polygons()[0]
|
||||
poly_clipped = poly.clip_to_bbox(clip_rect).to_polygons()[0]
|
||||
|
||||
# This should be fixed in matplotlib >1.5
|
||||
if np.all(poly_clipped[-1] == poly_clipped[-2]):
|
||||
poly_clipped = poly_clipped[:-1]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user