Skip to content

Commit

Permalink
Merge pull request #18 from payno/marching-square
Browse files Browse the repository at this point in the history
Marching square
  • Loading branch information
vallsv committed Apr 20, 2018
2 parents c9632d6 + e7afb1f commit 71e2ea6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/findContours.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
_logger.debug("Error while importing MarchingSquaresSciKitImage", exc_info=True)
MarchingSquaresSciKitImage = None
else:
MarchingSquareSciKitImage = None
MarchingSquaresSciKitImage = None


def rescale_image(image, shape):
Expand Down
10 changes: 5 additions & 5 deletions silx/image/marchingsquares/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ def find_pixels(image, level, mask=None, engine="merge"):
:param float level: Level of the requested iso contours.
:param numpy.ndarray mask: An optional mask (a non-zero value invalidate
the pixels of the image)
:param str engine: Engine to use. Currently 2 implentations are available.
:param str engine: Engine to use. Currently 2 implementations are available.
- `merge`: An implentation using Cython and supporting OpenMP based on
- `merge`: An implementation using Cython and supporting OpenMP based on
:class:`MarchingSquaresMergeImpl`.
- `skimage`: Provide an implementation based on the `skimage` library. If
it is used with a mask, the computation will not be accurate nor
Expand Down Expand Up @@ -114,16 +114,16 @@ def find_contours(image, level, mask=None, engine="merge"):
:param float level: Level of the requested iso contours.
:param numpy.ndarray mask: An optional mask (a non-zero value invalidate
the pixels of the image)
:param str engine: Engine to use. Currently 2 implentations are available.
:param str engine: Engine to use. Currently 2 implementations are available.
- `merge`: An implentation using Cython and supporting OpenMP based on
- `merge`: An implementation using Cython and supporting OpenMP based on
:class:`MarchingSquaresMergeImpl`.
- `skimage`: Provide an implementation based on the `skimage` library. If
it is used with a mask, the computation will not be accurate nor
efficient. Provided to compare implementation. The `skimage` library
have to be installed.
:returns: A list of array containg y-x coordinates of points
:returns: A list of array containing y-x coordinates of points
:rtype: List[numpy.ndarray]
"""
assert(image is not None)
Expand Down
10 changes: 5 additions & 5 deletions silx/image/marchingsquares/_mergeimpl.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ cdef cppclass TileContext:
cdef class _MarchingSquaresAlgorithm(object):
"""Abstract class managing a marching squares algorithm.
It provides common methods to execute the process, witht e support of
It provides common methods to execute the process, with the support of
OpenMP, plus some hooks. Mostly created to be able to reuse part of the
logic between `_MarchingSquaresContours` and `_MarchingSquaresPixels`.
"""
Expand Down Expand Up @@ -188,7 +188,7 @@ cdef class _MarchingSquaresAlgorithm(object):
@cython.cdivision(True)
cdef void reduction_2d(self, int dim_x, int dim_y, TileContext **contexts) nogil:
"""
Reduce the problem merging first neigbours together in a recussive
Reduce the problem merging first neighbours together in a recursive
process. Optimized with OpenMP.
:param dim_x: Number of contexts in the x dimension
Expand Down Expand Up @@ -594,7 +594,7 @@ cdef class _MarchingSquaresAlgorithm(object):
@cython.cdivision(True)
cdef point_index_t create_point_index(self, int yx, cnumpy.uint8_t edge) nogil:
"""
Create a unique identifier for a point of a polygon bsased on the
Create a unique identifier for a point of a polygon based on the
pattern location and the edge.
A index can be shared by different pixel coordinates. For example,
Expand Down Expand Up @@ -675,7 +675,7 @@ cdef class _MarchingSquaresContours(_MarchingSquaresAlgorithm):
context.polygons[begin] = description
context.polygons[end] = description
elif it_begin == context.polygons.end():
# insert the beggining point to an existing polygon
# insert the beginning point to an existing polygon
self.compute_point(x, y, begin_edge, level, &point)
description = dereference(it_end).second
context.polygons.erase(it_end)
Expand All @@ -690,7 +690,7 @@ cdef class _MarchingSquaresContours(_MarchingSquaresAlgorithm):
description.end = begin
context.polygons[begin] = description
elif it_end == context.polygons.end():
# insert the endding point to an existing polygon
# insert the ending point to an existing polygon
self.compute_point(x, y, end_edge, level, &point)
description = dereference(it_begin).second
context.polygons.erase(it_begin)
Expand Down

0 comments on commit 71e2ea6

Please sign in to comment.