Post-Processing


PostProcess

Class containing all the possible post-processing operations which can be applied to a scalar field.

Attributes:
  • unprocessed_geo_object

    Original scalar field.

  • processed_geo_object

    Modified scalar field.

Parameters:
  • geo_object (Callable[[ndarray, tuple], ndarray]) –

    Scalar field.

post_processing_operations: list property

All the post-processing operations which were applied to the geometry in chronological order.

Returns:
  • list

    List of post-processing operations.

processed_object: Callable[[np.ndarray, tuple], np.ndarray] property

SDF of the modified geometry.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    SDF of the modified geometry.

unprocessed_object: Callable[[np.ndarray, tuple], np.ndarray] property

SDF of the unmodified geometry.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    SDF of the unmodified geometry.

sigmoid_falloff(amplitude, width)

Applies a sigmoid to the scalar (Signed Distance Function) field.

Parameters:
  • amplitude (float | int) –

    Maximum value of the transformed scalar field.

  • width (float | int) –

    Width of the sigmoid.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified Scalar Field.

positive_sigmoid_falloff(amplitude, width)

Applies a sigmoid, shifted to the positive velues by the value of the width parameter, to the scalar (Signed Distance Function) field.

Parameters:
  • amplitude (float | int) –

    Maximum value of the transformed scalar field.

  • width (float | int) –

    Width of the sigmoid.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified Scalar Field.

capped_exponential(amplitude, width)

Applies a decreasing exponential functon to the scalar (Signed Distance Function) field. to the scalar (Signed Distance Function) field.

Parameters:
  • amplitude (float | int) –

    Maximum value of the transformed scalar field.

  • width (float | int) –

    Range at which the value of the transformed scalar field drops to almost zero.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified Scalar Field.

hard_binarization(threshold)

Binarizes the Signed Distance field/pattern based on a threshold. Values below the threshold are 1 and values above are 0.

Parameters:
  • threshold (float) –

    Binarization threshold.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified Scalar Field.

linear_falloff(amplitude, width)

Applies a decreasing linear function to the scalar (Signed Distance Function) field.

Parameters:
  • amplitude (float | int) –

    Maximum value of the transformed scalar field.

  • width (float | int) –

    Range at which the value of the transformed scalar field drops to zero.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified Scalar Field.

relu(width)

Applies the ReLU function to the scalar (Signed Distance Function) field.

Parameters:
  • width (float | int) –

    Range at which the value of the transformed field reaches one.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified Scalar Field.

smooth_relu(smooth_width, width=1, threshold=0.01)

Applies the "squareplus" function to the scalar (Signed Distance Function) field. https://en.wikipedia.org/wiki/Rectifier_(neural_networks)

Parameters:
  • smooth_width (float | int) –

    Distance from the origin at which the Smooth ReLU function is greater than ReLU for less than the value of the threshold parameter.

  • width (float | int, default: 1 ) –

    Range at which the value of the transformed field reaches one.

  • threshold (int | float, default: 0.01 ) –

    At smooth_width distance from the origin the value of the Smooth ReLU function is greater than ReLU for the value of the threshold parameter. at smooth_width distance from the origin.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Transformed scalar field.

slowstart(smooth_width, width=1, threshold=0.01, ground=True)

Applies the SlowStart function to the scalar (Signed Distance Function) field.

Parameters:
  • smooth_width (float | int) –

    Distance from the origin at which the SlowStart function is greater than ReLU for less than the value of the threshold parameter.

  • width (float | int, default: 1 ) –

    Range at which the value of the transformed field reaches one.

  • threshold (int | float, default: 0.01 ) –

    At smooth_width distance from the origin the value of the SlowStart function is greater than ReLU for the value of the threshold parameter.

  • ground (bool, default: True ) –

    if True the value of the function is zero at zero.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Transformed scalar field.

gaussian_boundary(amplitude, width)

Applies the Gaussian to the scalar (Signed Distance Function) field.

Parameters:
  • amplitude (float | int) –

    Maximum value of the transformed scalar field.

  • width (float | int) –

    Range at which the value of the transformed scalar field drops to almost zero.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified Scalar Field.

gaussian_falloff(amplitude, width)

Applies the Gaussian to the positive values of the scalar (Signed Distance Function) field.

Parameters:
  • amplitude (float | int) –

    Maximum value of the transformed scalar field (and points at which the scalar field was < 0).

  • width (float | int) –

    Range at which the value of the transformed scalar field drops to almost zero.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified Scalar Field.

conv_averaging(kernel_size, iterations, co_resolution)

Averages the field using an averaging convolutional kernel of the specified size.

Parameters:
  • kernel_size (int | tuple | list | ndarray) –

    Size of the averaging kernel. Must be an integer or a tuple/array of the same dimension as the scaler field.

  • iterations (int) –

    Number of times the convolutional averaging is applied to the input scalar field.

  • co_resolution (tuple) –

    Resolution of the coordinate system.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified Scalar Field.

conv_edge_detection(co_resolution)

Edge detection based on a 3x3 convolutional kernel.

Parameters:
  • co_resolution (tuple) –

    Resolution of the coordinate system.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified Scalar Field.

custom_post_process(function, parameters, post_process_name='custom')

Applies a custom user-specified post-processing function to a scalar (Signed Distance Function) field.

Parameters:
  • function (Callable[[ndarray, tuple], ndarray]) –

    A custom post-processing function which takes the SDF as a first argument and the parameters of the function as the next arguments.

  • parameters (tuple) –

    Parameters of the custom post-processing function.

  • post_process_name (str, default: 'custom' ) –

    Name of the custom post-processing function.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified Scalar Field.

sigmoid_falloff(u, amplitude, width)

Applies a sigmoid to the scalar (Signed Distance Function) field.

Parameters:
  • u (ndarray) –

    Signed Distance field or any scalar field.

  • amplitude (float | int) –

    Maximum value of the transformed scalar field.

  • width (float | int) –

    Width of the sigmoid.

Returns:
  • ndarray

    Transformed scalar field.

positive_sigmoid_falloff(u, amplitude, width)

Applies a sigmoid, shifted to the positive velues by the value of the width parameter, to the scalar (Signed Distance Function) field.

Parameters:
  • u (ndarray) –

    Signed Distance field or any scalar field.

  • amplitude (float | int) –

    Maximum value of the transformed scalar field.

  • width (float | int) –

    Width of the sigmoid.

Returns:
  • ndarray

    Transformed scalar field.

capped_exponential(u, amplitude, width)

Applies a decreasing exponential functon to the scalar (Signed Distance Function) field.

Parameters:
  • u (ndarray) –

    Signed Distance field or any scalar field.

  • amplitude (float | int) –

    Maximum value of the transformed scalar field.

  • width (float | int) –

    Range at which the value of the transformed scalar field drops to almost zero.

Returns:
  • ndarray

    Transformed scalar field.

hard_binarization(u, threshold)

Binarizes the Signed Distance field/pattern based on a threshold. Values below the threshold are 1 and values above are 0.

Parameters:
  • u (ndarray) –

    Signed Distance field or any scalar field.

  • threshold (float) –

    Binarization threshold.

Returns:
  • ndarray

    Binarized scalar field.

linear_falloff(u, amplitude, width)

Applies a decreasing linear function to the scalar (Signed Distance Function) field.

Parameters:
  • u (ndarray) –

    Signed Distance field or any scalar field.

  • amplitude (float | int) –

    Maximum value of the transformed scalar field.

  • width (float | int) –

    Range at which the value of the transformed scalar field drops to zero.

Returns:
  • ndarray

    Transformed scalar field.

relu(u, width=1)

Applies the ReLU function to the scalar (Signed Distance Function) field.

Parameters:
  • u (ndarray) –

    Signed Distance field or any scalar field.

  • width (float | int, default: 1 ) –

    Range at which the value of the transformed field reaches one.

Returns:
  • ndarray

    Transformed scalar field.

smooth_relu(u, smooth_width, width=1, threshold=0.01)

Applies the "squareplus" function to the scalar (Signed Distance Function) field. https://en.wikipedia.org/wiki/Rectifier_(neural_networks)

Parameters:
  • u (ndarray) –

    Signed Distance field or any scalar field.

  • smooth_width (float | int) –

    Distance from the origin at which the Smooth ReLU function is greater than ReLU for less than the value of the threshold parameter.

  • width (float | int, default: 1 ) –

    Range at which the value of the transformed field reaches one.

  • threshold (int | float, default: 0.01 ) –

    At smooth_width distance from the origin the value of the Smooth ReLU function is greater than ReLU for the value of the threshold parameter. at smooth_width distance from the origin.

Returns:
  • ndarray

    Transformed scalar field.

slowstart(u, smooth_width, width=1, threshold=0.01, ground=True)

Applies the SlowStart function to the scalar (Signed Distance Function) field.

Parameters:
  • u (ndarray) –

    Signed Distance field or any scalar field.

  • smooth_width (float | int) –

    Distance from the origin at which the SlowStart function is greater than ReLU for less than the value of the threshold parameter.

  • width (float | int, default: 1 ) –

    Range at which the value of the transformed field reaches one.

  • threshold (int | float, default: 0.01 ) –

    At smooth_width distance from the origin the value of the SlowStart function is greater than ReLU for the value of the threshold parameter.

  • ground (bool, default: True ) –

    if True the value of the function is zero at zero.

Returns:
  • ndarray

    Transformed scalar field.

gaussian_boundary(u, amplitude, width)

Applies the Gaussian to the scalar (Signed Distance Function) field.

Parameters:
  • u (ndarray) –

    Signed Distance field or any scalar field.

  • amplitude (float | int) –

    Maximum value of the transformed scalar field.

  • width (float | int) –

    Range at which the value of the transformed scalar field drops to almost zero.

Returns:
  • ndarray

    Transformed scalar field.

gaussian_falloff(u, amplitude, width)

Applies the Gaussian to the positive values of the scalar (Signed Distance Function) field.

Parameters:
  • u (ndarray) –

    Signed Distance field or any scalar field.

  • amplitude (float | int) –

    Maximum value of the transformed scalar field (and points at which the scalar field was < 0).

  • width (float | int) –

    Range at which the value of the transformed scalar field drops to almost zero.

Returns:
  • ndarray

    Transformed scalar field.

conv_averaging(u, kernel_size, iterations)

Averages the field using an averaging convolutional kernel of the specified size.

Parameters:
  • u (ndarray) –

    Signed Distance field or any scalar field.

  • kernel_size (int | tuple | list | ndarray) –

    Size of the averaging kernel. Must be an integer or a tuple/array of the same dimension as the scaler field.

  • iterations (int) –

    Number of times the convolutional averaging is applied to the input scalar field.

Returns:
  • ndarray

    Transformed scalar field.

conv_edge_detection(u)

Edge detection based on a 3x3 convolutional kernel.

Parameters:
  • u (ndarray) –

    Signed Distance field or any scalar field.

Returns:
  • ndarray

    Transformed scalar field.

custom_post_process(u, function, parameters)

Applies a custom user-specified post-processing function to a scalar (Signed Distance Function) field.

Parameters:
  • u (ndarray) –

    Signed Distance field or any scalar field.

  • function (Callable[[ndarray, tuple], ndarray]) –

    A custom post-processing function which takes the SDF as a first argument and the parameters of the function as the next arguments.

  • parameters (tuple) –

    Parameters of the custom post-processing function.

Returns:
  • ndarray

    Modified Scalar Field.