ibl_alignment_gui.plugins.channel_prediction

Functions

_compute_region_id_predictions

Run a region-id predict callable and convert its output to region boundaries.

_load_inference_model

Load inference model via GUI dialog; reveal its region options and refresh on success.

_load_spatial_model

Load the spatial model via dialog; reveal its region option and refresh on success.

_on_data_loaded

Data-load hook: reset per-session plugin state and expose available model region options.

_plot_region_panels

Compute (and cache) a shank's prediction for model and draw it.

_refresh_model_options

Add the region-plot options for models that should currently be available.

_set_local_features

Prompt for a per-channel features parquet and use it for inference.

compute_cumulative_predictions

Cumulative prediction model using the inference model.

compute_inference_predictions

Prediction model using the inference model.

compute_mapping_predictions

Return brain regions based on a specified atlas mapping, as an example prediction model.

compute_spatial_encoder_predictions

Prediction model using the spatial encoder.

get_region_boundaries

Get the boundaries of brain regions along the histology track.

setup

Register the Channel Prediction plugin and (when available) its menu.

Classes

ChannelPrediction

Plugin loader that computes and plots per-channel region predictions.

class ibl_alignment_gui.plugins.channel_prediction.ChannelPrediction(controller)[source]

Bases: object

Plugin loader that computes and plots per-channel region predictions.

Registered as the Channel Prediction plugin’s loader; plot_regions() dispatches the selected region model to the matching compute_* function and draws it on each shank.

__init__(controller)[source]

Store the controller and cache its brain atlas.

Parameters:

controller (AlignmentGUIController) – The main application controller.

plot_regions(model, data_only=True)[source]

Compute and plot the selected region model across all shanks.

Looks up model in the dispatch map and runs the matching compute_* function on each shank.

Parameters:
  • model (str) – Region-model key (e.g. ‘Beryl’, ‘Cosmos’, ‘Spatial Encoder’, ‘Inference Model’, ‘Inference Cumulative’). Unknown keys are ignored.

  • data_only (bool) – Reserved for signature compatibility with the region-plot callback; not used here.

Return type:

None

ibl_alignment_gui.plugins.channel_prediction.compute_cumulative_predictions(controller, items)[source]

Cumulative prediction model using the inference model.

Parameters:
Returns:

A bunch containing the probability of predicted brain regions along the probe, or None if no prediction is available.

Return type:

Bunch or None

ibl_alignment_gui.plugins.channel_prediction.compute_inference_predictions(controller, items)[source]

Prediction model using the inference model.

Parameters:
Returns:

The predicted brain regions along the probe, or None if no prediction is available.

Return type:

Bunch or None

ibl_alignment_gui.plugins.channel_prediction.compute_mapping_predictions(controller, items, mapping='Beryl')[source]

Return brain regions based on a specified atlas mapping, as an example prediction model.

Parameters:
  • controller ('AlignmentGUIController') – The main application controller.

  • items ('ShankController') – The shank controller containing the model and view for the current shank.

  • mapping (str) – The atlas mapping to use for predictions (e.g., ‘Beryl’ or ‘Cosmos’).

Returns:

A bunch containing the predicted brain regions.

Return type:

Bunch

ibl_alignment_gui.plugins.channel_prediction.compute_spatial_encoder_predictions(controller, items)[source]

Prediction model using the spatial encoder.

Parameters:
Returns:

The predicted brain regions along the probe, or None if no prediction is available.

Return type:

Bunch or None

ibl_alignment_gui.plugins.channel_prediction.get_region_boundaries(regions, depths)[source]

Get the boundaries of brain regions along the histology track.

Parameters:
  • regions (dict) – The brain regions along the histology track.

  • depths (np.ndarray) – The depths along the histology track, in meters.

Returns:

A bunch containing the region boundaries, labels, and colours.

Return type:

Bunch

ibl_alignment_gui.plugins.channel_prediction.setup(controller)[source]

Register the Channel Prediction plugin and (when available) its menu.

Always installs the plugin state and its ChannelPrediction loader. When ephysatlas is importable, also adds the “Channel Prediction” menu (load inference/spatial models, load a features file) and registers a data-loaded callback that exposes the model region options.

Parameters:

controller (AlignmentGUIController) – The main application controller.

Return type:

None