class make_erosion_dilation_penalty[source]#


Computes a penalty for erosion/dilation of a parameter map not being unity.

Accepts a parameter array normalized between 0 and 1. Uses filtering and projection methods to erode and dilate the features within this array. Measures the change in the array after eroding and dilating (and also dilating and eroding). Returns a penalty proportional to the magnitude of this change. The amount of change under dilation and erosion is minimized if the structure has large feature sizes and large radius of curvature relative to the length scale.

  • filter_size (Tuple[int, ...]) – The size of the filter to be used for erosion and dilation.

  • beta (float, optional) – Strength of the tanh projection. Default is 100.0.

  • eta (float, optional) – Midpoint of the tanh projection. Default is 0.5.

  • delta_eta (float, optional) – The binarization threshold for erosion and dilation operations. Default is 0.01.

  • padding (PaddingType, optional) – The padding type to use for the filter. Default is “reflect”.


A function that computes the erosion/dilation penalty for a given array.

Return type:


Inherited Common Usage