3.1.3. SimpleMorphoMath1D

This module implements Morphological 1D Operators.

class SimpleMorphoMath.SimpleMorphoMath1D.BallStructuringElement(radius)[source]

Bases: SimpleMorphoMath.SimpleMorphoMath1D.StructuringElement

This class implements a ball structuring element.

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

class SimpleMorphoMath.SimpleMorphoMath1D.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
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 SimpleMorphoMath.SimpleMorphoMath1D.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(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.

filet = <SimpleMorphoMath.PrettyPrinting.Filet object>
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.

plot(plot_type='umbra', mask=None, umbra_character=None, filet=None)[source]

Pretty print a function.

The parameter plot_type defines the type of plot:

  • curve
  • umbra
  • dual

The parameter mask set a mask function to display suppressed and added levels.

The attribute black_pattern defines the character for a level on, minus_pattern for a suppressed level and plus_pattern for an added level, respectively.

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.

umbra_character = <SimpleMorphoMath.PrettyPrinting.UmbraCharacter object>
unit_ball = <SimpleMorphoMath.SimpleMorphoMath1D.BallStructuringElement object>
class SimpleMorphoMath.SimpleMorphoMath1D.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.

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 SimpleMorphoMath.SimpleMorphoMath1D.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.

SimpleMorphoMath.SimpleMorphoMath1D.even(n)[source]

Test if n is even

SimpleMorphoMath.SimpleMorphoMath1D.odd(n)[source]

Test if n is odd

SimpleMorphoMath.SimpleMorphoMath1D.unit_ball = <SimpleMorphoMath.SimpleMorphoMath1D.BallStructuringElement object>

Unit ball structuring element.