bactoscoop.features

Per-cell feature implementations called by Image and ImageCollection. See Feature dictionary.

Classes and public operations

Features

class bactoscoop.features.Features(image_obj)

Calculate per-cell geometry and signal feature families for an image.

Collection and Image methods coordinate the required loading, filtering, feature error recording, and table construction.

Parameters:

image_obj – Image instance supplying calibration, geometry, and channel data.

Returns:

None (no explicit return statement).

Assigned state: self.image_obj.

View current source, line 14.

Features.discard_large_meshes

Features.discard_large_meshes(cell, max_mesh_size=600)

Discard cells with meshes that are too small or large.

Parameters:
  • cell – Cell instance containing geometry and measurements.

  • max_mesh_size – Maximum accepted mesh row count; cells above this limit are removed from the image cell population.

Returns:

None (no explicit return statement).

Assigned state: cell.discard.

View current source, line 20.

Original docstring (legacy wording may differ from the current signature)
Discard cells with meshes that are too small or large.

This method checks the size of a cell's mesh and flags it for discard if the mesh size does not fall within the acceptable range.

Parameters
----------
cell : Cell
    The Cell object representing the cell to be checked.

Returns
-------
None

Features.discard_bad_meshes

Features.discard_bad_meshes(cell)

Discard bad meshes.

Parameters:

cell – Cell instance containing geometry and measurements.

Returns:

None (no explicit return statement).

Assigned state: cell.discard.

View current source, line 42.

Features.contour_selection

Features.contour_selection(cell, use_shifted_contours)

Contour selection.

Parameters:
  • cell – Cell instance containing geometry and measurements.

  • use_shifted_contours – Select stored shifted contour, midline, and mesh geometry; the correction must already exist.

Return expressions in source:

(cell.shifted_contour, cell.shifted_midline, cell.shifted_mesh)
(cell.contour, cell.midline, cell.mesh)

View current source, line 57.

Features.morphological

Features.morphological(cell, channel, all_data, *args)

Calculate morphological features for a cell.

Parameters:
  • cell – Cell instance containing geometry and measurements.

  • channel – Channel identifier for the selected signal, or None for phase/morphology where supported.

  • all_data – Feature-method-specific option; objects includes detailed per-object arrays when true.

Returns:

None (no explicit return statement).

Assigned state: cell.morphological_features, cell.profiling_data, cell.profile_mesh, cell.discard.

View current source, line 63.

Original docstring (legacy wording may differ from the current signature)
Calculate morphological features for a cell.

Features.profiling

Features.profiling(cell, channel, all_data, use_shifted_contours, shift_signal, *args)

Calculate profiling features for a cell.

Parameters:
  • cell – Cell instance containing geometry and measurements.

  • channel – Channel identifier for the selected signal, or None for phase/morphology where supported.

  • all_data – Feature-method-specific option; objects includes detailed per-object arrays when true.

  • use_shifted_contours – Select stored shifted contour, midline, and mesh geometry; the correction must already exist.

  • shift_signal – Enable the method-specific optional signal cropping/shift path; this is not a universal object-coordinate shift.

Return expressions in source:

None

Assigned state: cell.profiling_features, cell.discard.

Explicitly raised exceptions: AttributeError. Errors from called functions can also propagate or be recorded.

View current source, line 241.

Original docstring (legacy wording may differ from the current signature)
Calculate profiling features for a cell.

Features.svm

Features.svm(cell, channel, all_data, *args)

Calculate features of a cell to be used in training the Support Vector Machine (SVM) or curate a dataset using a trained SVM model.

Parameters:
  • cell – Cell instance containing geometry and measurements.

  • channel – Channel identifier for the selected signal, or None for phase/morphology where supported.

  • all_data – Feature-method-specific option; objects includes detailed per-object arrays when true.

Returns:

None (no explicit return statement).

Assigned state: cell.svm_features, cell.profiling_data.

View current source, line 375.

Original docstring (legacy wording may differ from the current signature)
Calculate features of a cell to be used in training the Support Vector Machine (SVM) or curate a dataset using a trained SVM model.

Features.objects

Features.objects(cell, channel, all_data, use_shifted_contours, *args, retain_contour_on_object_mesh_failure=False)

Calculates features related to the identified objects within a cell.

Parameters:
  • cell – Cell instance containing geometry and measurements.

  • channel – Channel identifier for the selected signal, or None for phase/morphology where supported.

  • all_data – Feature-method-specific option; objects includes detailed per-object arrays when true.

  • use_shifted_contours – Select stored shifted contour, midline, and mesh geometry; the correction must already exist.

  • retain_contour_on_object_mesh_failure – Per-cell objects option used by the collection retention-channel setting.

Return expressions in source:

None

Assigned state: cell.objects_features, cell.discard.

Explicitly raised exceptions: AttributeError, ValueError. Errors from called functions can also propagate or be recorded.

View current source, line 501.

Original docstring (legacy wording may differ from the current signature)
Calculates features related to the identified objects within a cell.

Features.membrane

Features.membrane(cell, channel, all_data, use_shifted_contours, shift_signal)

Membrane.

Parameters:
  • cell – Cell instance containing geometry and measurements.

  • channel – Channel identifier for the selected signal, or None for phase/morphology where supported.

  • all_data – Feature-method-specific option; objects includes detailed per-object arrays when true.

  • use_shifted_contours – Select stored shifted contour, midline, and mesh geometry; the correction must already exist.

  • shift_signal – Enable the method-specific optional signal cropping/shift path; this is not a universal object-coordinate shift.

Return expressions in source:

None

Assigned state: cell.membrane_features, cell.discard.

Explicitly raised exceptions: AttributeError, ValueError. Errors from called functions can also propagate or be recorded.

View current source, line 836.

Features.colocalization

Features.colocalization(cell, signal1, signal2, shift_signal1, shift_signal2, all_data, use_shifted_contours)

Incomplete preliminary colocalization implementation.

Prepares channel crops but does not complete a measurement; do not use as an analysis feature family.

Parameters:
  • cell – Cell instance containing geometry and measurements.

  • signal1 – Input signal1 consumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.

  • signal2 – Input signal2 consumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.

  • shift_signal1 – Input shift_signal1 consumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.

  • shift_signal2 – Input shift_signal2 consumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.

  • all_data – Feature-method-specific option; objects includes detailed per-object arrays when true.

  • use_shifted_contours – Select stored shifted contour, midline, and mesh geometry; the correction must already exist.

Returns:

None (no explicit return statement).

Assigned state: cell.signal_correlation_features.

Explicitly raised exceptions: AttributeError. Errors from called functions can also propagate or be recorded.

View current source, line 937.