photon_mosaic.segmentation.suite2p_segmentation#

Classes

Suite2pSegmentation()

Suite2p ROI detection, streamed from the imaging object.

Suite2pSegmentationSettings([...])

Settings for Suite2P ROI detection.

class photon_mosaic.segmentation.suite2p_segmentation.Suite2pSegmentationSettings(_case_sensitive=None, _nested_model_default_partial_update=None, _env_prefix=None, _env_prefix_target=None, _env_file=PosixPath('.'), _env_file_encoding=None, _env_file_depth=None, _env_ignore_empty=None, _env_nested_delimiter=None, _env_nested_max_split=None, _env_parse_none_str=None, _env_parse_enums=None, _cli_prog_name=None, _cli_parse_args=None, _cli_settings_source=None, _cli_parse_none_str=None, _cli_hide_none_type=None, _cli_avoid_json=None, _cli_enforce_required=None, _cli_use_class_docs_for_groups=None, _cli_show_env_vars=None, _cli_exit_on_error=None, _cli_prefix=None, _cli_flag_prefix_char=None, _cli_implicit_flags=None, _cli_ignore_unknown_args=None, _cli_kebab_case=None, _cli_shortcuts=None, _secrets_dir=None, _build_sources=None, *, diameter=[12.0, 12.0], tau=1.0, fs=30.0, preclassify=0.0, device='cpu', algorithm='sparsery', denoise=False, threshold_scaling=1.0, max_overlap=0.75, soma_crop=True, allow_overlap=False, nbins=5000, highpass_time=100)[source]#

Settings for Suite2P ROI detection.

Methods

merged_with_suite2p_defaults()

Return suite2p's installed detection defaults overlaid with our overrides.

lowercase_algorithm

diameter: list[float]#
tau: float#
fs: float#
preclassify: float#
device: str#
algorithm: str#
denoise: bool#
threshold_scaling: float#
max_overlap: float#
soma_crop: bool#
allow_overlap: bool#
nbins: int#
highpass_time: int#
model_config = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_exit_on_error': True, 'cli_flag_prefix_char': '-', 'cli_hide_none_type': False, 'cli_ignore_unknown_args': False, 'cli_implicit_flags': False, 'cli_kebab_case': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_shortcuts': None, 'cli_show_env_vars': False, 'cli_use_class_docs_for_groups': False, 'enable_decoding': True, 'env_file': '.env', 'env_file_depth': 0, 'env_file_encoding': None, 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_nested_max_split': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': 'SUITE2P_SEGMENTATION_', 'env_prefix_target': 'variable', 'extra': 'ignore', 'json_file': None, 'json_file_encoding': None, 'nested_model_default_partial_update': False, 'protected_namespaces': ('model_validate', 'model_dump', 'settings_cached', 'settings_clear_cache', 'settings_customise_sources'), 'secrets_case_sensitive': None, 'secrets_dir': None, 'secrets_dir_max_size': None, 'secrets_dir_missing': None, 'secrets_nested_delimiter': None, 'secrets_nested_subdir': None, 'secrets_prefix': None, 'toml_file': None, 'validate_default': True, 'yaml_config_section': None, 'yaml_file': None, 'yaml_file_encoding': None}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod lowercase_algorithm(v)[source]#
Return type:

str

merged_with_suite2p_defaults()[source]#

Return suite2p’s installed detection defaults overlaid with our overrides.

Used to source per-algorithm sub-dicts (sparsery_settings, sourcery_settings, cellpose_settings) without hard-coding them and to forward denoise/highpass_time etc. to the inner calls.

Return type:

dict[str, Any]

class photon_mosaic.segmentation.suite2p_segmentation.Suite2pSegmentation[source]#

Suite2p ROI detection, streamed from the imaging object.

Frames are pulled lazily via BaseImagingEpoch.get_series() and stream-binned in place, so the full raw movie is never materialised. Returns a Suite2pRois holding every plane’s suite2p stat.

Methods

get_method_version()

Return the version of the underlying segmentation library.

is_installed()

Return whether the backend's dependencies are importable.

run(imaging, yrange, xrange, badframes, settings)

Detect ROIs on the concatenation of all epochs of imaging and return them.

settings_class

method_name: str | None = 'suite2p'#
settings_class#

alias of Suite2pSegmentationSettings

classmethod is_installed()[source]#

Return whether the backend’s dependencies are importable.

Return type:

bool

classmethod get_method_version()[source]#

Return the version of the underlying segmentation library.

Return type:

str

classmethod run(imaging, yrange, xrange, badframes, settings)[source]#

Detect ROIs on the concatenation of all epochs of imaging and return them.

Parameters:
  • imaging (BaseImaging) – Motion-corrected imaging object.

  • yrange (Sequence[int]) – Valid pixel range [lo, hi].

  • xrange (Sequence[int]) – Valid pixel range [lo, hi].

  • badframes (NDArray[bool] | None) – Frames to exclude, shaped (total_frames_in_epochs,).

  • settings (Suite2pSegmentationSettings) – Validated settings_class instance.

Returns:

rois – Detected ROIs for the concatenated epochs.

Return type:

Suite2pRois