10.1.8.1. Morphomath

This module implements Morphological 1D Operators.

class Musica.Math.Morphomath.BallStructuringElement(radius)[source]

Bases: Musica.Math.Morphomath.StructuringElement

This class implements a ball structuring element.

The domain of the structuring element is [-radius, radius].

class Musica.Math.Morphomath.Domain(inf, sup)[source]

Bases: object

This class implements a functional 1D domain defined by the range [inf, sup].

The size of the domain defined by sup - inf +1 is given by the function len().

To test if x is in the domain, use:

x in domain
__contains__(x)[source]

Test if x is in the domain.

__len__()[source]

Return the size of the domain.

backward_iterator()[source]

Return a backward iterator over the domain.

forward_iterator()[source]

Return a forward iterator over the domain.

range()[source]

Return the list of values in the domain.

class Musica.Math.Morphomath.Function(values)[source]

Bases: object

This class implements a 1D function.

The parameters values is an iterable that define the initial values of the function.

The function domain is set to [0, len(values) -1].

__add__(a, b)[source]

Return sum of a with b.

__eq__(other)[source]

Test if the functions are equal.

__getitem__(i)[source]

Return the function value at i.

__iadd__(obj)[source]

Add a function.

__isub__(obj)[source]

Subtract a function.

__len__()[source]

Return the size of the function domain.

__setitem__(i, value)[source]

Set the function value at i.

__sub__(a, b)[source]

Return the subtraction of a with b.

_pointwise_rank(other, rank_operator)[source]

This method implements a point-wise rank filter.

The function is modified in-place.

_rank_filter(structuring_element, rank_operator)[source]

This method implements a rank filter.

The function is modified in-place.

_rank_filter_vhgw(radius, rank_operator)[source]

This method implements a rank filter using the Van Herk & Gill-Werman algorithm.

This algorithm comes from C. Clienti, M. Bilodeau, and S. Beucher, An Efficient Hardware Architecture without Line Memories for Morphological Image Processing. In Proceedings of ACIVS. 2008, 147-156.

_zeros()[source]

return a Numpy zero array of the same size than the function domain.

add(obj)[source]

Add a function.

clone()[source]

Return a copy of the function.

clone_zeros()[source]

Return a function defined on the same domain with values set to zero.

close(structuring_element)[source]

Perform an closing.

dilate(structuring_element)[source]

Perform a dilation.

dilate_vhgw(radius)[source]

Perform a dilation using the WHGW algorithm.

erode(structuring_element)[source]

Perform an erosion.

erode_vhgw(radius)[source]

Perform an erosion using the WHGW algorithm.

geodesic_reconstruction(marker)[source]

Perform a geodesic reconstruction.

h_dome(level)[source]

Perform an H-dome operation.

max()[source]

Return the sup of the function.

min()[source]

Return the inf of the function.

open(structuring_element)[source]

Perform an opening.

pointwise_max(other)[source]

Perform the point-wise max of the function with another function.

pointwise_min(other)[source]

Perform the point-wise min of the function with another function.

subtract(obj)[source]

Subtract a function.

Negative values are set to zero.

top_hat(structuring_element)[source]

Perform an top-hat.

translate(offset, padd_inf=True)[source]

Translate the function.

If the parameter padd_inf is set to True then the padding value is set to zero else to the sup of the function.

__hash__ = None
unit_ball = <Musica.Math.Morphomath.BallStructuringElement object>
class Musica.Math.Morphomath.StructuringElement(offsets)[source]

Bases: object

This class implements a structuring element.

The parameter offsets is an iterable that contains the offsets of the pixels on of the structuring element.

The neighbor set \(N_G^+\) and \(N_G^-\) is defined in the article: Morphological Grayscale Reconstruction in Image Analysis: Applications and Efficient Algorithms, Luc Vincent, IEEE Transactions on image processing, Vol. 2, No. 2, April 1993.

__iter__()[source]
__len__()[source]
half_length()[source]
iterator_minus()[source]

Iterate over the offset from the reference location.

iterator_plus()[source]

Iterate over the offset up to the reference location.

class Musica.Math.Morphomath.StructuringElementIterator(structuring_element, domain)[source]

Bases: object

This class implements a structuring element iterator.

The parameter structuring_element defines the structuring element and the parameter domain defines the domain of the lattice.

iterate_at(location, sub_domain=None)[source]

Iterate over the structuring element positioned at a location.

The parameter sub_domain is used to restrict the domain of the structuring element, set to ‘+’ to restrict to the positive domain and to ‘-‘ for the negative domain, respectively.

Musica.Math.Morphomath.even(n)[source]

Test if n is even

Musica.Math.Morphomath.odd(n)[source]

Test if n is odd

Musica.Math.Morphomath.unit_ball = <Musica.Math.Morphomath.BallStructuringElement object>

Unit ball structuring element.