* python/max-tree.py (values): Use itertools.izip to shorten the
parallel iterations on sites and values.
---
swilena/ChangeLog | 7 +++++++
swilena/python/max-tree.py | 9 ++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/swilena/ChangeLog b/swilena/ChangeLog
index 58577e6..f39ebab 100644
--- a/swilena/ChangeLog
+++ b/swilena/ChangeLog
@@ -1,5 +1,12 @@
2010-04-08 Roland Levillain <roland(a)lrde.epita.fr>
+ Simplify python/max-tree.py using Python's itertools.
+
+ * python/max-tree.py (values): Use itertools.izip to shorten the
+ parallel iterations on sites and values.
+
+2010-04-08 Roland Levillain <roland(a)lrde.epita.fr>
+
Wrap morpho::watershed::flooding instead of morpho::meyer_wst.
* morpho.ixx: Here.
diff --git a/swilena/python/max-tree.py b/swilena/python/max-tree.py
index 0c5dd65..7f09eff 100644
--- a/swilena/python/max-tree.py
+++ b/swilena/python/max-tree.py
@@ -22,21 +22,20 @@
import data
from swilena import *
+import itertools
+
# Module aliases.
image = image2d_int_u8
par_image = image2d_point2d
-ima = image.load(data.lena)
ima = image.image2d_int_u8(3, 3)
values = [5, 6, 6,
8, 9, 9,
8, 9, 9]
-v = values.__iter__()
-
-for p in ima.domain():
- ima.set(p, int_u8(v.next()))
+for p, v in itertools.izip(ima.domain(), values):
+ ima.set(p, int_u8(v))
image.println("ima =", ima)
max_tree_parent = image.max_tree(ima, c4());
--
1.7.0.4