data_processing.image_analysis package

Submodules

data_processing.image_analysis.analysis_registry module

The dictionary with the name of the algorithms available in this folder.

data_processing.image_analysis.analysis_registry.register_class(cls)[source]
data_processing.image_analysis.analysis_registry.get_image_analysis_type(name)[source]
data_processing.image_analysis.analysis_registry.get_available_analysis()[source]

data_processing.image_analysis.base_image_analyzer module

class data_processing.image_analysis.base_image_analyzer.ImageAnalysisTemplate(image, metadata, **analysis_details)[source]

Bases: ABC

Template for all the image analyzers.

abstract get_measurement_points()[source]

data_processing.image_analysis.cellpose module

class data_processing.image_analysis.cellpose.Cellpose_algorithm(image, metadata, **analysis_details)[source]

Bases: ImageAnalysisTemplate

Class utilizing the Cellpose 3.0 algorithm for finding the objects on transmitted light and filter them by circularity, solidity and eccentricity.

static filter_cellpose_masks(df, circ_thr=0.65, ecc_thr=0.5, sol_thr=0.85)[source]

Function for the filtration of the founded objects. :param df: pandas DF with the founded objects. :param circ_thr: float minimal circularity filtering threshold :param ecc_thr: float maximal eccentricity filtering threshold :param sol_thr: float maximal solidity filtering threshold :return: filtered pandas df

image_segmentation(objects_diameter=None, circ_thr=0.65, ecc_thr=0.5, sol_thr=0.85)[source]

Initializing Cellpose algorithm. :param objects_diameter: float size in um, passed to Cellpose model eval :param circ_thr: float minimal circularity filtering threshold :param ecc_thr: float maximal eccentricity filtering threshold :param sol_thr: float maximal solidity filtering threshold :return: pandas df with objects center positions and their properties

get_measurement_points()[source]

Utilizes methods above for image segmentation and obtains o :return: lists of dictionaries with the founded objects properties and their positions in the pixels coordinates and in the stage coordinates in um.

data_processing.image_analysis.circles module

class data_processing.image_analysis.circles.Circles(image, metadata, **analysis_details)[source]

Bases: ImageAnalysisTemplate

Class for detecting circular objects using Otsu thresholding and contour-based shape analysis.

static get_contour_centers_and_radii(contours, min_fit_ratio)[source]

Compute centers and radii of contours fitting a circular shape. :return: dictionary mapping contour indices to center position, radius,

and fit ratio in pixel coordinates

filter_by_size(GUVs_dict, min_size_um=1, max_size_um=50)[source]

Filter detected objects by size range in micrometers. :return: list of dictionaries with object positions in pixel coordinates

and radii in micrometers

get_measurement_points()[source]

Detect circular objects, filter them by size, and convert their positions to stage coordinates. :return: lists of dictionaries with the founded objects properties and their positions

in the pixels coordinates and in the stage coordinates in um

data_processing.image_analysis.hexagonal_mesh module

class data_processing.image_analysis.hexagonal_mesh.HexagonalMesh(image, metadata, **analysis_details)[source]

Bases: ImageAnalysisTemplate

Class utilizing the multi-Otsu algorhitm combined with the Delaunay algorithm for finding the nods and midpoints on hexagonal fluorescent mesh.

get_mesh_nodes()[source]

Function for finding the nods of fluorescent mesh by multi-otsu thresholding. :return: numpy array of mesh node centroids in pixel coordinates

get_delaunay_edges(points)[source]

Compute unique edges from Delaunay triangulation of given points. :return: numpy array of index pairs defining edges between points

filter_edges_by_distance(points, edges, n_clusters=3, remove_outliers=False)[source]

Group edges by length using clustering, optionally removing long-distance outliers. :return: lists of edges grouped by distance, cluster centers, and edge cluster labels

find_midpoints_and_centroids(points, n_clusters=3, remove_outliers=True)[source]

Find edge midpoints and polygon centroids based on clustered Delaunay edges. :return: numpy array of edge midpoints and array of polygon centroids

get_measurement_points()[source]

Generate measurement points from mesh nodes, edge midpoints, and polygon centroids, and convert them to stage coordinates. :return: lists of dictionaries with the founded objects properties and their positions

in the pixels coordinates and in the stage coordinates in um

data_processing.image_analysis.pixel_stage_converter module

data_processing.image_analysis.pixel_stage_converter.z_no_transform(px, stage_pos, scaling, tiles)[source]

Return Z position without applying any transformation. :return: float, stage Z position in um

data_processing.image_analysis.pixel_stage_converter.z_normal(px, stage_pos, scaling, tiles)[source]

Return Z position adjusted by pixel Z offset and scaling. :return: float, stage Z position in um

class data_processing.image_analysis.pixel_stage_converter.PixelStageConverter(metadata, image_shape)[source]

Bases: object

Convert pixel coordinates to stage coordinates in X, Y, and Z.

Uses image metadata for scaling and optional tile/Z-scan information.

convert_xy(px, mode='normal')[source]

Convert pixel X,Y to stage coordinates using scaling and image center. :return: tuple (x_stage, y_stage) in um

convert_z_auto(px)[source]

Automatically choosing the strategy based on metadata to convert pixel Z to stage Z based on Z-scan or tiles. :return: float, stage Z position in um

convert_z(px, z_strategy)[source]

Convert pixel Z using a provided strategy function. :return: float, stage Z position in um

convert_points(points, xy_mode='normal', z_strategy=None)[source]

Main method, a converter of a list of points from pixel coordinates to stage coordinates. :return: list of dictionaries with positions in stage coordinates (um)

data_processing.image_analysis.z_scan_max_intensity module

class data_processing.image_analysis.z_scan_max_intensity.Max_intensity_Z_Scan(image, metadata, **analysis_details)[source]

Bases: ImageAnalysisTemplate

CLass for finding the measurement points at maximum intensity along Z axis.

get_max_intensity()[source]

Find the index along Z axis with maximum summed intensity. :return: int, index of Z slice with maximum intensity

get_measurement_points()[source]

Generate measurement points at maximum intensity and convert them to stage coordinates. :return: lists of dictionaries with the founded objects properties and their positions

in the pixels coordinates and in the stage coordinates in um

Module contents