Thanks to all who have responded: I still have to study all the solutions.

I am not wedded to the data structure produced by slice, and I am happy to
consider alternatives.  Here's the background.

I am calculating the distance transform of a binary image.  The image
determines a graph where the vertices are the pixels set to 1 and there is
an edge between two such pixels if the distance between them is 1 (in a
given metric).  The distance transform is defined to be 0 on the boundary
of the image (vertices without full connectivity) and then recursively n+1
on the unmarked neighbors of a vertex marked n.  Given the graph
structure, this can be done using breadth-first search.

The time-consuming part is finding the adjacency relation, which is
necessarily sparse: a vertex has at most 4 neighbors with the Euclidean
metric and 8 with the chessboard metric.

Best wishes,

John

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to