From c7243e73833c7bf9117638704786e15313d0ddd6 Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Sun, 13 Dec 2015 14:55:23 +1100 Subject: [PATCH] Allow passing individual coordinate tuples to integrate --- skimage/transform/integral.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/skimage/transform/integral.py b/skimage/transform/integral.py index 4a71a54b..ccd73ba7 100644 --- a/skimage/transform/integral.py +++ b/skimage/transform/integral.py @@ -76,18 +76,15 @@ def integrate(ii, start, end, *args): rows = 1 # handle input from new input format if len(args) == 0: - if isinstance(start, collections.Iterable): - rows = len(start) - start = np.array(start) - end = np.array(end) + start = np.atleast_2d(np.array(start)) + end = np.atleast_2d(np.array(end)) + rows = start.shape[0] # handle deprecated input format else: warnings.warn("The syntax 'integrate(ii, r0, c0, r1, c1)' is " "deprecated, and will be phased out in release 0.14. " "The new syntax is " - "'integrate(ii, [(r0, c0)], [(r1, c1)])'.") - if isinstance(start, collections.Iterable): - rows = len(start) + "'integrate(ii, (r0, c0), (r1, c1))'.") args = (start, end) + args start = np.array(args[:int(len(args)/2)]).T end = np.array(args[int(len(args)/2):]).T