autoemxsp.core.particle_segmentation_models package

Loads the available segmentation models.

This module is responsible for loading segmentation model modules that follow a specific structure and provide a segment_particles() function. To add a new segmentation model, create a new Python file in the same directory as this script, and ensure the file contains a correctly defined segment_particles() function as described below.

### Adding New Segmentation Models

See segmentation_model_template.py for a detailed description of the required structure

  1. Create a new module: In this directory, create a new Python file named your_model_name.py

  2. Define `segment_particles()`: In your new module, define a function named segment_particles() that takes the following parameters: - frame_image (np.array): A grayscale image containing particles. - powder_meas_config (PowderMeasurementConfig): A configuration object with relevant parameters for segmentation (e.g., threshold values). - save_image (bool): An optional flag to save the masked image. - EM (EM_controller): An optional object for saving the segmented image.

    The function should return a binary mask where pixel values represent detected particles.

Created on Thu Oct 9 09:34:39 2025

@author: Andrea

autoemxsp.core.particle_segmentation_models.load_models()[source]

Loads all available segmentation model modules from the specified directory.

This function will iterate through all .py files in the directory, import them, and store them in the MODEL_REGISTRY for later use.

Returns:

module_names – A list of the names of the modules that have been successfully loaded.

Return type:

list

Submodules