bactoscoop.utilities

Low-level numerical and image helpers. Prefer the collection workflow for routine analysis; inspect geometry conventions before calling these directly.

Classes and public operations

smallest_path

bactoscoop.utilities.smallest_path(x_coords, y_coords, start_x, start_y)

Smallest path.

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

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

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

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

Return expressions in source:

([x_coords[i] for i in sorted_points], [y_coords[i] for i in sorted_points])

View current source, line 41.

skeleton_endpoints

bactoscoop.utilities.skeleton_endpoints(skel)

Skeleton endpoints.

Parameters:

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

Return expressions in source:

out

View current source, line 65.

get_ordered_list

bactoscoop.utilities.get_ordered_list(points, x, y)

Get ordered list.

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

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

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

Return expressions in source:

args

View current source, line 81.

line_intersect

bactoscoop.utilities.line_intersect(x1, y1, x2, y2, x3, y3, x4, y4)

Line intersect.

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

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

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

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

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

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

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

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

Return expressions in source:

(intersect_x, intersect_y)

View current source, line 89.

line_contour_intersection

bactoscoop.utilities.line_contour_intersection(p1, p2, contour)

Line contour intersection.

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

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

  • contour – Boundary points in (row, column) pixel coordinates.

Return expressions in source:

intersection_points

View current source, line 102.

unit_perpendicular_vector

bactoscoop.utilities.unit_perpendicular_vector(data, closed=True)

Unit perpendicular vector.

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

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

Return expressions in source:

unit_dxy

View current source, line 123.

get_major_axis_line_coordinates

bactoscoop.utilities.get_major_axis_line_coordinates(masks)

Get major axis line coordinates.

Parameters:

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

Return expressions in source:

line_coordinates

View current source, line 138.

extract_skeleton

bactoscoop.utilities.extract_skeleton(masks)

Extract skeleton.

Parameters:

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

Return expressions in source:

smoothed_skel
get_major_axis_line_coordinates(masks)

View current source, line 174.

find_poles

bactoscoop.utilities.find_poles(smoothed_skeleton, smoothed_contour, find_pole1=True, find_pole2=True)

Find poles.

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

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

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

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

Return expressions in source:

(extended_pole1, extended_pole2, trimmed_midline)

View current source, line 215.

extend_skeleton

bactoscoop.utilities.extend_skeleton(smoothed_skeleton, smoothed_contour, find_pole1=True, find_pole2=True)

Extend skeleton.

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

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

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

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

Return expressions in source:

(extended_skeleton, new_pole1, new_pole2)

View current source, line 266.

straighten_by_orthogonal_lines

bactoscoop.utilities.straighten_by_orthogonal_lines(contour, midline, length, width, unit_micron=0.5)

Straighten by orthogonal lines.

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

  • midline – Central-axis points in (row, column) pixel coordinates.

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

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

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

Return expressions in source:

(l1, l2, profile_mesh, midline)

View current source, line 285.

radial_intensities

bactoscoop.utilities.radial_intensities(cropped_signal_interp2d, contour, width, min_val, max_val, num_erosions, erosion_scale=None)

Radial intensities.

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

  • contour – Boundary points in (row, column) pixel coordinates.

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

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

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

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

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

Return expressions in source:

intensities_per_mesh

View current source, line 314.

spline_approximation

bactoscoop.utilities.spline_approximation(init_contour, n=200, smooth_factor=1, closed=True)

Spline approximation.

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

  • n – Selected image positions; wrapper accepts None for all. Indices must be nonempty, unique valid integers.

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

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

Return expressions in source:

np.array([x_new, y_new]).T

View current source, line 348.

divide_contour_by_midline

bactoscoop.utilities.divide_contour_by_midline(midline, contour)

Divide contour by midline.

Parameters:
  • midline – Central-axis points in (row, column) pixel coordinates.

  • contour – Boundary points in (row, column) pixel coordinates.

Return expressions in source:

(half_contour_1, half_contour_2)

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

View current source, line 359.

distance_matrix

bactoscoop.utilities.distance_matrix(data1, data2)

Distance matrix.

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

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

Return expressions in source:

dxy

View current source, line 396.

orthogonal_intersection_point

bactoscoop.utilities.orthogonal_intersection_point(midline, outerline, precomputed_orthogonal_vector=None, min_dist=1e-100)

Orthogonal intersection point.

Parameters:
  • midline – Central-axis points in (row, column) pixel coordinates.

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

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

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

Return expressions in source:

pos_list

View current source, line 406.

intersect_matrix

bactoscoop.utilities.intersect_matrix(line, contour, orthogonal_vectors=None)

Intersect matrix.

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

  • contour – Boundary points in (row, column) pixel coordinates.

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

Return expressions in source:

(intersect_x, intersect_y)

View current source, line 446.

add_poles

bactoscoop.utilities.add_poles(coords1, coords2, pole1, pole2)

Add poles.

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

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

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

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

Return expressions in source:

(result, coords1, coords2)

View current source, line 476.

line_length

bactoscoop.utilities.line_length(line)

Line length.

Parameters:

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

Return expressions in source:

np.sum(np.sqrt(np.sum(d ** 2, axis=1)))

View current source, line 486.

direct_intersect_distance

bactoscoop.utilities.direct_intersect_distance(skeleton, contour)

Direct intersect distance.

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

  • contour – Boundary points in (row, column) pixel coordinates.

Return expressions in source:

np.concatenate([[0], dists, [0]])

View current source, line 494.

contour2mesh

bactoscoop.utilities.contour2mesh(contour, cropped_mask)

Contour2mesh.

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

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

Return expressions in source:

([], [], [])
(contour, result, midline)

View current source, line 522.

draw_mask

bactoscoop.utilities.draw_mask(contour, image)

Draw mask.

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

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

Return expressions in source:

mask_dilated

View current source, line 548.

crop_image

bactoscoop.utilities.crop_image(image=None, contour=None, mask_to_crop=None, phase_img=None, pad=10)

Crop image.

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

  • contour – Boundary points in (row, column) pixel coordinates.

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

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

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

Return expressions in source:

(cropped_img, cropped_mask, cropped_contour, x, y)

View current source, line 554.

crop

bactoscoop.utilities.crop(to_be_cropped, pad, image, xy_coordinates=False)

Crop.

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

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

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

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

Return expressions in source:

(x, y, w, h)

View current source, line 585.

get_object_contours

bactoscoop.utilities.get_object_contours(mask, smoothing=0.1)

Get object contours.

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

  • smoothing – Smoothing passed to the contour/mesh fitting path.

Return expressions in source:

interpolated_contours

View current source, line 606.

maybe_reverse_orientation

bactoscoop.utilities.maybe_reverse_orientation(contour, result, midline)

Maybe reverse orientation.

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

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

  • midline – Central-axis points in (row, column) pixel coordinates.

Return expressions in source:

(contour, result, midline)

View current source, line 627.

get_label_neighbor_counts

bactoscoop.utilities.get_label_neighbor_counts(labels, connectivity=1)

Get label neighbor counts.

Parameters:
  • labels – 2D integer label mask with zero background.

  • connectivity – Touching-label neighborhood: 1/4 for edges, 2/8 including diagonals.

Return expressions in source:

{label: len(neighbors) for label, neighbors in neighbor_map.items()}

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

View current source, line 650.

filter_labels_by_neighbor_count

bactoscoop.utilities.filter_labels_by_neighbor_count(labels, max_neighbors, connectivity=1)

Filter labels by neighbor count.

Parameters:
  • labels – 2D integer label mask with zero background.

  • max_neighbors – Remove labels whose distinct touching-label count is greater than this limit.

  • connectivity – Touching-label neighborhood: 1/4 for edges, 2/8 including diagonals.

Return expressions in source:

(relabeled, stats)

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

View current source, line 687.

get_cellular_mesh

bactoscoop.utilities.get_cellular_mesh(masks, smoothing)

Get cellular mesh.

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

  • smoothing – Smoothing passed to the contour/mesh fitting path.

Return expressions in source:

meshdataframe

View current source, line 730.

distance

bactoscoop.utilities.distance(v1, v2)

Distance.

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

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

Return expressions in source:

np.sqrt(np.sum((np.array(v1) - np.array(v2)) ** 2))

View current source, line 764.

measure_width

bactoscoop.utilities.measure_width(extended_skeleton, smoothed_contour)

Measure width.

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

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

Return expressions in source:

(np.array([0] + width_list + [0]), length)

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

View current source, line 770.

get_cell_pairs

bactoscoop.utilities.get_cell_pairs(pole_1, pole_2, cell_ID, maxdist=None)

Get cell pairs.

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

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

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

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

Return expressions in source:

unique_nc2

View current source, line 788.

mesh2contour

bactoscoop.utilities.mesh2contour(x1, y1, x2, y2)

Mesh2contour.

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

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

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

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

Return expressions in source:

np.array([outx, outy]).T

View current source, line 891.

split_point

bactoscoop.utilities.split_point(x1, y1, x2, y2, ctpos)

Split point.

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

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

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

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

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

Return expressions in source:

(newpole_x, newpole_y, np.array([[xt13, yt13, xt23, yt23]]), np.array([[xs13, ys13, xs23, ys23]]))

View current source, line 905.

constr_degree_single_cell_min

bactoscoop.utilities.constr_degree_single_cell_min(intensity, new_step_length, upper_limit=0.75, lower_limit=0.25, interp_factor=10)

Compute constriction degree and return both coarse and fine minima positions.

Parameters:
  • intensity – 1D intensity profile.

  • new_step_length – Currently unused here, kept for API compatibility.

  • upper_limit – Upper bound of region to search, as fraction of profile length.

  • lower_limit – Lower bound of region to search, as fraction of profile length.

  • interp_factor – Upsampling factor for fine-scale interpolation.

Return expressions in source:

(minsize, ctposr, minsizeabs, ctpos_coarse, ctpos_fine)

View current source, line 953.

Original docstring (legacy wording may differ from the current signature)
Compute constriction degree and return both coarse and fine minima positions.

Parameters
----------
intensity : array-like
    1D intensity profile.
new_step_length : array-like
    Currently unused here, kept for API compatibility.
upper_limit : float, optional
    Upper bound of region to search, as fraction of profile length.
lower_limit : float, optional
    Lower bound of region to search, as fraction of profile length.
interp_factor : int, optional
    Upsampling factor for fine-scale interpolation.

Returns
-------
minsize : float
    Relative constriction degree.
ctposr : float
    Relative position of the constriction in [0, 1].
minsizeabs : float
    Absolute constriction depth.
ctpos_coarse : int or list
    Constriction position in original intensity index space.
ctpos_fine : int or list
    Constriction position in interpolated fine index space.

interp2d

bactoscoop.utilities.interp2d(image)

Interp2d.

Parameters:

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

Return expressions in source:

ff

View current source, line 1059.

get_image_for_frame

bactoscoop.utilities.get_image_for_frame(df_nr, images)

Get image for frame.

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

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

Return expressions in source:

images[df_nr]

View current source, line 1066.

get_cell_mask

bactoscoop.utilities.get_cell_mask(contour, midline, image)

Get cell mask.

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

  • midline – Central-axis points in (row, column) pixel coordinates.

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

Return expressions in source:

(mask, cropped_img, cropped_contour, cropped_midline, x, y)

View current source, line 1070.

keep_significant_masks

bactoscoop.utilities.keep_significant_masks(nucleoid_mask, cropped_mask, min_overlap_ratio=0.01, max_external_ratio=0.1)

Keep significant masks.

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

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

  • min_overlap_ratio – Minimum accepted overlap ratio under the utility implementation; inspect its denominator in source.

  • max_external_ratio – Maximum accepted outside-cell ratio under the utility implementation.

Return expressions in source:

significant_mask

View current source, line 1081.

get_object_masks

bactoscoop.utilities.get_object_masks(contour, object_contours, object_midlines, object_meshes, signal)

Get object masks.

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

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

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

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

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

Return expressions in source:

(masks, cropped_img, cropped_object_contours, cropped_object_midlines, cropped_object_meshes, x, y)

View current source, line 1116.

get_subcellular_objects

bactoscoop.utilities.get_subcellular_objects(contour, signal, image, cell_id, smoothing, log_sigma, kernel_width, min_overlap_ratio=0.01, max_external_ratio=0.1)

Get subcellular objects.

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

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

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

  • cell_id – Cell identifier local to the selected image; check that it remains after curation/filtering.

  • smoothing – Smoothing passed to the contour/mesh fitting path.

  • log_sigma – Laplacian-of-Gaussian sigma for signal-object detection.

  • kernel_width – Width of the square dilation kernel used for candidate object masks.

  • min_overlap_ratio – Minimum accepted overlap ratio under the utility implementation; inspect its denominator in source.

  • max_external_ratio – Maximum accepted outside-cell ratio under the utility implementation.

Return expressions in source:

(object_contours, cropped_img, object_mask, x_offset, y_offset)

View current source, line 1141.

get_object_mesh

bactoscoop.utilities.get_object_mesh(contour, signal, image, cell_id, smoothing, log_sigma, kernel_width, min_overlap_ratio, max_external_ratio)

Get object mesh.

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

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

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

  • cell_id – Cell identifier local to the selected image; check that it remains after curation/filtering.

  • smoothing – Smoothing passed to the contour/mesh fitting path.

  • log_sigma – Laplacian-of-Gaussian sigma for signal-object detection.

  • kernel_width – Width of the square dilation kernel used for candidate object masks.

  • min_overlap_ratio – Minimum accepted overlap ratio under the utility implementation; inspect its denominator in source.

  • max_external_ratio – Maximum accepted outside-cell ratio under the utility implementation.

Return expressions in source:

meshdata

View current source, line 1188.

image_field_key

bactoscoop.utilities.image_field_key(filename, suffix='', is_mask=False)

Return a normalized acquisition/field key from a TIFF filename.

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

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

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

Return expressions in source:

stem.strip().casefold()

View current source, line 1255.

Original docstring (legacy wording may differ from the current signature)
Return a normalized acquisition/field key from a TIFF filename.

Channel suffixes such as ``C1``/``C2`` and mask suffixes such as
``cp_masks`` are removed so corresponding files can be matched by field.

read_channels

bactoscoop.utilities.read_channels(folder_path, images_dict, channel_list=None)

Read channels.

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

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

  • channel_list – Sequence of channel suffixes to load or attach.

Return expressions in source:

images_dict

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

View current source, line 1280.

read_tiff_folder

bactoscoop.utilities.read_tiff_folder(folder_path, suffix='', include_paths=False)

Read tiff folder.

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

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

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

Return expressions in source:

(images, file_names, paths)
(images, file_names)

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

View current source, line 1312.

separate_meshdata

bactoscoop.utilities.separate_meshdata(df_nr, cell_nr, data)

Separate meshdata.

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

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

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

Return expressions in source:

(x1, y1, x2, y2, contour)

View current source, line 1353.

separate_singleframe_meshdata

bactoscoop.utilities.separate_singleframe_meshdata(cell_id, data)

Separate singleframe meshdata.

Parameters:
  • cell_id – Cell identifier local to the selected image; check that it remains after curation/filtering.

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

Return expressions in source:

(x1, y1, x2, y2, contour, midline)

View current source, line 1362.

get_cropped_object_data

bactoscoop.utilities.get_cropped_object_data(cnts, mdls, mshs, x, y)

Get cropped object data.

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

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

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

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

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

Return expressions in source:

(cropped_cnts, cropped_mdls, cropped_mshs)

View current source, line 1373.

get_cropped_cell_data

bactoscoop.utilities.get_cropped_cell_data(cnt, mdl, msh, x, y)

Get cropped cell data.

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

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

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

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

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

Return expressions in source:

(cropped_cn, cropped_ml, cropped_msh)

View current source, line 1396.

get_uncropped_cell_data

bactoscoop.utilities.get_uncropped_cell_data(cnt, mdl, msh, x, y)

Get uncropped cell data.

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

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

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

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

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

Return expressions in source:

(uncropped_cn, uncropped_ml, uncropped_msh)

View current source, line 1408.

mesh2midline

bactoscoop.utilities.mesh2midline(x1, y1, x2, y2)

Mesh2midline.

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

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

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

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

Return expressions in source:

line

View current source, line 1420.

get_weighted_intprofile

bactoscoop.utilities.get_weighted_intprofile(intensity, width)

Get weighted intprofile.

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

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

Return expressions in source:

intensity * width
[]

View current source, line 1428.

get_width

bactoscoop.utilities.get_width(x1, y1, x2, y2)

Get width.

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

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

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

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

Return expressions in source:

width_not_ordered

View current source, line 1437.

split_mesh2mesh

bactoscoop.utilities.split_mesh2mesh(x1, y1, x2, y2, max_daughter_cell_mesh_rows=800)

Rebuild a daughter, rejecting oversized resampling before allocation.

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

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

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

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

  • max_daughter_cell_mesh_rows – Maximum rebuilt mesh rows per daughter during cell splitting (default 800; integer >= 4). Rejects oversized predicted counts before reconstruction; both final daughters must have 4..limit rows. Does not limit unsplit parents and is separate from feature extraction max_mesh_size.

Return expressions in source:

(result, contour, midline)
(np.empty((0, 4)), np.empty((0, 2)), np.empty((0, 2)))

View current source, line 1452.

Original docstring (legacy wording may differ from the current signature)
Rebuild a daughter, rejecting oversized resampling before allocation.

The limit applies to straightened rows here and to final daughter rows in
Image.split_cells. Pole extension can add rows, so the minimum stays there.

get_profile_mesh

bactoscoop.utilities.get_profile_mesh(mesh, width, micron_unit=1)

Get profile mesh.

Parameters:
  • mesh – Paired-boundary geometry with four columns in pixel coordinates.

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

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

Return expressions in source:

profile_mesh

View current source, line 1493.

expand_contour

bactoscoop.utilities.expand_contour(contour, scale=1)

enlarges contour :param contour: :param scale: :return:

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

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

Return expressions in source:

contour - scale * dxy

View current source, line 1510.

Original docstring (legacy wording may differ from the current signature)
enlarges contour
:param contour:
:param scale:
:return:

erode_contour

bactoscoop.utilities.erode_contour(contour, scale=1)

shrinks contour :param contour: :param scale: :return:

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

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

Return expressions in source:

contour + scale * dxy

View current source, line 1529.

Original docstring (legacy wording may differ from the current signature)
shrinks contour
:param contour:
:param scale:
:return:

mean_background

bactoscoop.utilities.mean_background(image, cell_mask)

Mean background.

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

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

Return expressions in source:

bgr

View current source, line 1552.

median_background

bactoscoop.utilities.median_background(image, cell_mask)

Median background.

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

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

Return expressions in source:

bgr

View current source, line 1563.

poly_func

bactoscoop.utilities.poly_func(coords, a, b, c, d, e, f)

Poly func.

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

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

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

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

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

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

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

Return expressions in source:

a + b * x + c * y + d * x ** 2 + e * x * y + f * y ** 2

View current source, line 1574.

construct_bg_function

bactoscoop.utilities.construct_bg_function(image, seg_mat, sampling_interval=None, plotF=False)

Reconstructs the background of an image using 2D polynomial fitting.

Parameters:
  • image – seg_mat (ndarray): Binary segmentation mask (non-zero = foreground). sampling_interval (int): Interval between samples. Default: height // 64. plotF (bool): Whether to plot the background fit.

  • seg_mat – sampling_interval (int): Interval between samples. Default: height // 64. plotF (bool): Whether to plot the background fit.

  • sampling_interval – plotF (bool): Whether to plot the background fit.

  • plotF – Whether to plot the background fit.

Return expressions in source:

(bg_function, bg_matrix)

View current source, line 1579.

Original docstring (legacy wording may differ from the current signature)
Reconstructs the background of an image using 2D polynomial fitting.

Parameters:
    image (ndarray): Input grayscale image.
    seg_mat (ndarray): Binary segmentation mask (non-zero = foreground).
    sampling_interval (int): Interval between samples. Default: height // 64.
    plotF (bool): Whether to plot the background fit.

Returns:
    bg_function (function): Background function F(x, y).
    bg_matrix (ndarray): Estimated background image.

get_step_length

bactoscoop.utilities.get_step_length(x1, y1, x2, y2, px)

Get step length.

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

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

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

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

np.sqrt(dx ** 2 + dy ** 2) / 2 * px

View current source, line 1638.

get_step_length_no_px

bactoscoop.utilities.get_step_length_no_px(x1, y1, x2, y2)

Get step length no px.

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

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

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

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

Return expressions in source:

np.sqrt(dx ** 2 + dy ** 2) / 2

View current source, line 1644.

get_length

bactoscoop.utilities.get_length(step_length)

Get length.

Parameters:

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

Return expressions in source:

np.sum(step_length)

View current source, line 1650.

get_avg_width

bactoscoop.utilities.get_avg_width(x1, y1, x2, y2, px)

Get avg width.

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

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

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

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(width * px, width_not_ordered * px)

View current source, line 1654.

get_avg_width_no_px

bactoscoop.utilities.get_avg_width_no_px(x1, y1, x2, y2)

Get avg width no px.

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

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

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

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

Return expressions in source:

(width, width_not_ordered)

View current source, line 1663.

get_area

bactoscoop.utilities.get_area(contour, px)

Get area.

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

area * px * px

View current source, line 1672.

get_volume

bactoscoop.utilities.get_volume(x1, y1, x2, y2, step_length, px)

Get volume.

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

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

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

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

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

volume * px * px

View current source, line 1678.

get_surface_area

bactoscoop.utilities.get_surface_area(width_no, step_length)

Get surface area.

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

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

Return expressions in source:

total_surface_area

View current source, line 1684.

get_surface_area_over_volume

bactoscoop.utilities.get_surface_area_over_volume(sa, vol)

Get surface area over volume.

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

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

Return expressions in source:

sa / vol

View current source, line 1691.

get_cell_perimeter_measurements

bactoscoop.utilities.get_cell_perimeter_measurements(contour, area, px)

Get cell perimeter measurements.

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(perimeter, circularity, compactness, sphericity)

View current source, line 1695.

get_cell_width_variability

bactoscoop.utilities.get_cell_width_variability(width_no)

Get cell width variability.

Parameters:

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

Return expressions in source:

width_var

View current source, line 1707.

get_curvature_characteristics

bactoscoop.utilities.get_curvature_characteristics(contour, px)

Get curvature characteristics.

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(curvature, max_c, min_c, mean_c, std_c)

View current source, line 1715.

get_total_phaco_intensity

bactoscoop.utilities.get_total_phaco_intensity(contour, shape, interp2d)

Get total phaco intensity.

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

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

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

Return expressions in source:

(np.sum(values), np.max(values), np.mean(values))

View current source, line 1728.

get_contour_intensity

bactoscoop.utilities.get_contour_intensity(contour, interp2d)

Get contour intensity.

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

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

Return expressions in source:

data

View current source, line 1737.

find_signal_peaks

bactoscoop.utilities.find_signal_peaks(signal, maximum)

Find signal peaks.

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

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

Return expressions in source:

len(peaks)

View current source, line 1742.

measure_contour_variability

bactoscoop.utilities.measure_contour_variability(signal)

Measure contour variability.

Parameters:

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

Return expressions in source:

contour_intensities_variability

View current source, line 1747.

get_kurtosis

bactoscoop.utilities.get_kurtosis(signal)

Get kurtosis.

Parameters:

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

Return expressions in source:

kurtosis(signal)

View current source, line 1758.

get_skew

bactoscoop.utilities.get_skew(signal)

Get skew.

Parameters:

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

Return expressions in source:

skew(signal)

View current source, line 1762.

sinuosity

bactoscoop.utilities.sinuosity(midline)

Sinuosity.

Parameters:

midline – Central-axis points in (row, column) pixel coordinates.

Return expressions in source:

sinuosity

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

View current source, line 1766.

get_area_asymmetry

bactoscoop.utilities.get_area_asymmetry(step_length, width_no)

Get area asymmetry.

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

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

Return expressions in source:

asymmetry_ratio
1.0

View current source, line 1780.

get_object_params

bactoscoop.utilities.get_object_params(object_contours, px)

Get object params.

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(total_length, average_width)

View current source, line 1801.

get_object_width_variability

bactoscoop.utilities.get_object_width_variability(widths_no)

Get object width variability.

Parameters:

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

Return expressions in source:

(width_var_list, avg_width_var)

View current source, line 1820.

get_mesh_coordinates

bactoscoop.utilities.get_mesh_coordinates(mesh)

Get mesh coordinates.

Parameters:

mesh – Paired-boundary geometry with four columns in pixel coordinates.

Return expressions in source:

(x1, y1, x2, y2)

View current source, line 1833.

get_object_rect_length

bactoscoop.utilities.get_object_rect_length(nucleoid_contours, px)

Get object rect length.

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(rect_length_list, rect_width_list, total_rect_length, average_rect_width)

View current source, line 1841.

get_additional_regionprops_features

bactoscoop.utilities.get_additional_regionprops_features(mask, px)

Get additional regionprops features.

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

features

View current source, line 1891.

get_object_avg_width

bactoscoop.utilities.get_object_avg_width(nucleoid_masks, px)

Get object avg width.

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(np.mean(nucleoid_avg_width_list), width_not_ordered_list)

View current source, line 1944.

get_object_aspect_ratio

bactoscoop.utilities.get_object_aspect_ratio(rect_length_lists, rect_width_lists)

Get object aspect ratio.

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

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

Return expressions in source:

(aspect_ratio_list, avg_aspect_ratio)

View current source, line 1967.

get_object_area

bactoscoop.utilities.get_object_area(contours, px)

Get object area.

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(area_list, total_area)

View current source, line 1979.

get_object_curvature_characteristics

bactoscoop.utilities.get_object_curvature_characteristics(contours, px)

Get object curvature characteristics.

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(curvatures, max_c_list, min_c_list, mean_c_list, std_c_list, avg_mean_c, avg_std_c)

View current source, line 1992.

get_object_perimeter_measurements

bactoscoop.utilities.get_object_perimeter_measurements(contours, areas, px)

Get object perimeter measurements.

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

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(perimeter_list, circularity_list, compactness_list, sphericity_list, avg_perimeter, avg_circularity, avg_compactness, avg_sphericity)

View current source, line 2024.

get_cell_convexity

bactoscoop.utilities.get_cell_convexity(mask)

Get cell convexity.

Parameters:

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

Return expressions in source:

(image_eccentricity, image_solidity, convexity)

View current source, line 2057.

get_object_convexity

bactoscoop.utilities.get_object_convexity(cropped_masks)

Get object convexity.

Parameters:

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

Return expressions in source:

(convexity_list, eccentricity_list, solidity_list, avg_convexity, avg_eccentricity, avg_solidity)

View current source, line 2072.

get_approx_nucleoid_volume

bactoscoop.utilities.get_approx_nucleoid_volume(cell_volume, nucleoid_areas, cell_area)

Get approx nucleoid volume.

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

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

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

Return expressions in source:

(nucleoid_volume_list, total_volume)

View current source, line 2102.

get_nucleoid_width_variability

bactoscoop.utilities.get_nucleoid_width_variability(widths)

Get nucleoid width variability.

Parameters:

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

Return expressions in source:

(width_var_list, avg_width_var)

View current source, line 2116.

get_obj_mesh_coords

bactoscoop.utilities.get_obj_mesh_coords(nucleoid_meshes)

Get obj mesh coords.

Parameters:

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

Return expressions in source:

(x1_list, y1_list, x2_list, y2_list)

View current source, line 2133.

measure_along_objects_midline_interp2d

bactoscoop.utilities.measure_along_objects_midline_interp2d(midlines, im_interp2d, width=7, subpixel=0.5)

Measure along objects midline interp2d.

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

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

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

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

Return expressions in source:

prf_list

View current source, line 2156.

constr_degree

bactoscoop.utilities.constr_degree(intensities, new_step_lengths, width_not_ordered)

Constr degree.

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

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

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

Return expressions in source:

(constrDegree_list, relPos_list, constrDegree_abs_list, ctpos_list, avg_consDegree, avg_abs_consDegree)

View current source, line 2208.

fill_nan_values

bactoscoop.utilities.fill_nan_values(constrDegree_list, constrDegree_abs_list, ctpos_list, relPos_list)

Fill nan values.

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

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

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

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

Returns:

None (no explicit return statement).

View current source, line 2259.

get_minima

bactoscoop.utilities.get_minima(weighted_intensity)

Get minima.

Parameters:

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

Return expressions in source:

np.concatenate(([False], (weighted_intensity.T[1:-1] < weighted_intensity.T[:-2]) & (weighted_intensity.T[1:-1] < weighted_intensity.T[2:]), [False]))

View current source, line 2266.

identify_minima

bactoscoop.utilities.identify_minima(intensity, minima)

Identify minima.

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

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

Return expressions in source:

(index, dh, dhi, hgt)

View current source, line 2277.

assign_values

bactoscoop.utilities.assign_values(constrDegree_list, constrDegree_abs_list, ctpos_list, relPos_list, minsize, minsizeabs, ctpos, ctposr)

Assign values.

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

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

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

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

  • minsize – Minimum accepted segmentation-mask size in pixels.

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

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

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

Returns:

None (no explicit return statement).

View current source, line 2294.

get_obj_avg_width

bactoscoop.utilities.get_obj_avg_width(x1s, y1s, x2s, y2s, px)

Get obj avg width.

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

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

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

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(width_list, width_not_ordered_list, average_width)

View current source, line 2311.

get_nucleoid_volume

bactoscoop.utilities.get_nucleoid_volume(x1s, y1s, x2s, y2s, step_lengths, px)

Get nucleoid volume.

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

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

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

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

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(nucleoid_volume_list, total_volume)

View current source, line 2335.

get_object_step_length

bactoscoop.utilities.get_object_step_length(x1s, y1s, x2s, y2s, px)

Get object step length.

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

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

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

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(nuc_step_length_list, nuc_length_list)

View current source, line 2349.

get_object_surface_area

bactoscoop.utilities.get_object_surface_area(width_nos, step_lengths)

Get object surface area.

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

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

Return expressions in source:

(sum_surface_area_list, total_surface_area)

View current source, line 2372.

get_object_surface_area_over_volume

bactoscoop.utilities.get_object_surface_area_over_volume(surface_areas, volumes)

Get object surface area over volume.

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

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

Return expressions in source:

(ratio_list, avg_ratio)

View current source, line 2396.

object_bending_energy

bactoscoop.utilities.object_bending_energy(data, px)

Simplification of the formula from https://doi.org/10.1016/j.comgeo.2013.09.001

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(bending_energy_list, avg_bending_energy)

View current source, line 2410.

Original docstring (legacy wording may differ from the current signature)
Simplification of the formula from https://doi.org/10.1016/j.comgeo.2013.09.001

bending_energy

bactoscoop.utilities.bending_energy(line, curvature, px)

Bending energy.

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

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

np.round(bending_energy, 5)

View current source, line 2426.

midline_midpoint

bactoscoop.utilities.midline_midpoint(midline)

Midline midpoint.

Parameters:

midline – Central-axis points in (row, column) pixel coordinates.

Return expressions in source:

middle_point

View current source, line 2433.

get_object_midpoint

bactoscoop.utilities.get_object_midpoint(midlines)

Get object midpoint.

Parameters:

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

Return expressions in source:

centroid_coordinates

View current source, line 2439.

get_centroid

bactoscoop.utilities.get_centroid(cropped_masks)

Get centroid.

Parameters:

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

Return expressions in source:

[centroids[0][0], centroids[1][0]]

View current source, line 2447.

get_object_centroid

bactoscoop.utilities.get_object_centroid(cropped_masks)

Get object centroid.

Parameters:

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

Return expressions in source:

centroid_list

View current source, line 2456.

get_interobject_distance

bactoscoop.utilities.get_interobject_distance(centroid_coordinates, px)

Get interobject distance.

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(average_distance, distances)
(np.nan, np.nan)

View current source, line 2467.

get_object_sinuosity

bactoscoop.utilities.get_object_sinuosity(midlines)

Get object sinuosity.

Parameters:

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

Return expressions in source:

(sinuosity_list, avg_sinuosity)

View current source, line 2480.

get_mesh_area

bactoscoop.utilities.get_mesh_area(width_no, step_length)

Get mesh area.

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

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

Return expressions in source:

mesh_area

View current source, line 2492.

ratio_mesh_over_total_area

bactoscoop.utilities.ratio_mesh_over_total_area(step_length, width_no, areas)

Ratio mesh over total area.

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

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

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

Return expressions in source:

ratio_list

View current source, line 2498.

get_shortest_pole_object_distances

bactoscoop.utilities.get_shortest_pole_object_distances(pole_coordinates, centroid_coordinates, px)

Get shortest pole object distances.

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

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(average_distance, distances)
(np.nan, np.nan)

View current source, line 2507.

get_pole_coordinates

bactoscoop.utilities.get_pole_coordinates(mesh)

Get pole coordinates.

Parameters:

mesh – Paired-boundary geometry with four columns in pixel coordinates.

Return expressions in source:

(pole1, pole2)

View current source, line 2519.

get_pole_object_distances

bactoscoop.utilities.get_pole_object_distances(mesh, centroid_coordinates, px)

Get pole object distances.

Parameters:
  • mesh – Paired-boundary geometry with four columns in pixel coordinates.

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(avg_distance, min_2_distances, distances)
(np.nan, np.nan)

View current source, line 2525.

angle_between_vector

bactoscoop.utilities.angle_between_vector(v1, v2)

Angle between vector.

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

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

Return expressions in source:

np.arccos(np.dot(v1, v2) / (d1 * d2))

View current source, line 2540.

projection_on_midline

bactoscoop.utilities.projection_on_midline(centroids, midline, width, px)

Projection on midline.

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

  • midline – Central-axis points in (row, column) pixel coordinates.

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

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

(l_list, dl_list, norm_l_list, norm_dl_list)

View current source, line 2546.

get_avg_distance_from_center

bactoscoop.utilities.get_avg_distance_from_center(l_norm_list)

Subtract 0.5 from the mean normalized longitudinal object position.

Returns a signed mean position offset, not the mean absolute distance from the center.

Parameters:

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

Return expressions in source:

avg_dist

View current source, line 2605.

get_object_intensities

bactoscoop.utilities.get_object_intensities(object_masks, cropped_signal)

Get object intensities.

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

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

Return expressions in source:

(combined_intensity_values, individual_intensity_values)

View current source, line 2611.

get_objects_mean

bactoscoop.utilities.get_objects_mean(intensity_values_list)

Get objects mean.

Parameters:

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

Return expressions in source:

means

View current source, line 2625.

get_objects_std

bactoscoop.utilities.get_objects_std(intensity_values_list)

Get objects std.

Parameters:

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

Return expressions in source:

stds

View current source, line 2630.

get_objects_kurtosis

bactoscoop.utilities.get_objects_kurtosis(intensity_values_list)

Get objects kurtosis.

Parameters:

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

Return expressions in source:

kurtoses

View current source, line 2635.

get_objects_skewness

bactoscoop.utilities.get_objects_skewness(intensity_values_list)

Get objects skewness.

Parameters:

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

Return expressions in source:

skewnesses

View current source, line 2642.

get_variance

bactoscoop.utilities.get_variance(data)

Get variance.

Parameters:

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

Return expressions in source:

np.var(data)

View current source, line 2647.

measure_smoothened_intensity

bactoscoop.utilities.measure_smoothened_intensity(midline, im_interp2d, width=7, subpixel=0.5)

Measure smoothened intensity.

Parameters:
  • midline – Central-axis points in (row, column) pixel coordinates.

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

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

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

Return expressions in source:

prf

View current source, line 2652.

gaussian_smoothing

bactoscoop.utilities.gaussian_smoothing(data)

Gaussian smoothing.

Parameters:

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

Return expressions in source:

prf.flatten()

View current source, line 2661.

measure_intensity_interp2d

bactoscoop.utilities.measure_intensity_interp2d(midline, im_interp2d, width=7, subpixel=0.5)

Measure intensity interp2d.

Parameters:
  • midline – Central-axis points in (row, column) pixel coordinates.

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

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

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

Return expressions in source:

data

View current source, line 2668.

normalize_per_cell

bactoscoop.utilities.normalize_per_cell(profile)

Min–max normalize a profile within one cell.

Returns an array scaled to [0, 1]; a constant profile returns zeros.

Parameters:

profile – A 1D array-like object representing the profile.

Return expressions in source:

normalized_profile
np.zeros_like(profile)

View current source, line 2684.

Original docstring (legacy wording may differ from the current signature)
Normalize the values in a 1D profile using Min-Max scaling.

Parameters:
    profile (array-like): A 1D array-like object representing the profile.

Returns:
    normalized_profile (ndarray): Normalized profile.

get_cumulative_step_length_midline

bactoscoop.utilities.get_cumulative_step_length_midline(midline, px)

Calculate cumulative step lengths for each segment in the midline.

Parameters:
  • midline – Central-axis points in (row, column) pixel coordinates.

  • px – Micrometres per pixel. Geometry arrays remain in pixel coordinates.

Return expressions in source:

cumulative_step_lengths

View current source, line 2713.

Original docstring (legacy wording may differ from the current signature)
Calculate cumulative step lengths for each segment in the midline.

Parameters:
    midline (ndarray): An array containing X and Y coordinates of the midline.
    px (float): The pixel size.

Returns:
    cumulative_step_lengths (ndarray): Array containing cumulative step lengths for each segment in the midline.

linear_interpolation

bactoscoop.utilities.linear_interpolation(array, num_values)

Linear interpolation.

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

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

Return expressions in source:

interpolated_values

View current source, line 2740.

get_phase_mask

bactoscoop.utilities.get_phase_mask(phase_cropped_img, phase_log_sigma=0.5)

Get phase mask.

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

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

Return expressions in source:

cropped_phase_mask

View current source, line 2751.

closing_mask

bactoscoop.utilities.closing_mask(cropped_phase_mask, closing_level=2)

Closing mask.

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

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

Return expressions in source:

mask_closed

View current source, line 2765.

find_centroid_in_largest_mask

bactoscoop.utilities.find_centroid_in_largest_mask(phase_mask_closed, phase_cropped_contour)

Find centroid in largest mask.

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

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

Return expressions in source:

[]
[phase_centroid]

View current source, line 2774.

align

bactoscoop.utilities.align(signal_centroid, phase_centroid, cropped_contour)

Align.

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

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

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

Return expressions in source:

aligned_contour

View current source, line 2796.

align_objects

bactoscoop.utilities.align_objects(signal_centroid, phase_centroid, cropped_mesh, cropped_contour, cropped_midline)

Align objects.

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

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

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

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

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

Return expressions in source:

(aligned_contour, aligned_midline, aligned_mesh)

View current source, line 2820.

get_signal_mask

bactoscoop.utilities.get_signal_mask(signal, contour, log_sigma, min_overlap_ratio, max_external_ratio)

Get signal mask.

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

  • contour – Boundary points in (row, column) pixel coordinates.

  • log_sigma – Laplacian-of-Gaussian sigma for signal-object detection.

  • min_overlap_ratio – Minimum accepted overlap ratio under the utility implementation; inspect its denominator in source.

  • max_external_ratio – Maximum accepted outside-cell ratio under the utility implementation.

Return expressions in source:

(object_mask, cropped_img, x_offset, y_offset)

View current source, line 2833.

shift_contour

bactoscoop.utilities.shift_contour(phase_image, signal_image, contour, mesh, midline, log_sigma=1.5, kernel_width=3, min_overlap_ratio=0.3, max_external_ratio=0.8, phase_log_sigma=0.5, phase_closing_level=2, signal_closing_level=12, max_shift_correction=10)

Aligns the contour, mesh, and midline based on the centroids of the phase and signal masks.

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

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

  • contour – Boundary points in (row, column) pixel coordinates.

  • mesh – Paired-boundary geometry with four columns in pixel coordinates.

  • midline – Central-axis points in (row, column) pixel coordinates.

  • log_sigma – Laplacian-of-Gaussian sigma for signal-object detection.

  • kernel_width – Width of the square dilation kernel used for candidate object masks.

  • min_overlap_ratio – Minimum accepted overlap ratio under the utility implementation; inspect its denominator in source.

  • max_external_ratio – Maximum accepted outside-cell ratio under the utility implementation.

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

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

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

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

Return expressions in source:

(aligned_contour, aligned_mesh, aligned_midline)
(None, None, None)

View current source, line 2855.

Original docstring (legacy wording may differ from the current signature)
Aligns the contour, mesh, and midline based on the centroids of the phase and signal masks.

Parameters:
- phase_image (array): The phase image.
- signal_image (array): The signal image.
- contour (array): The contour data.
- mesh (array): The mesh data.
- midline (array): The midline data.
- log_sigma (float): Sigma for the log filter for the signal mask.
- kernel_width (int): Width of the dilation kernel.
- min_overlap_ratio (float): Minimum overlap ratio for the signal mask.
- max_external_ratio (float): Maximum external ratio for the signal mask.
- phase_log_sigma (float): Sigma for the log filter for the phase mask.
- phase_closing_level (int): Closing level for the phase mask.
- signal_closing_level (int): Closing level for the signal mask.
- max_shift_correction (float): Maximum allowable distance between centroids for correction.

Returns:
- aligned_contour (array): The aligned contour data.
- aligned_mesh (array): The aligned mesh data.
- aligned_midline (array): The aligned midline data.

crop_signal_with_optional_shift

bactoscoop.utilities.crop_signal_with_optional_shift(image_obj, channel, contour, shift_signal)

Crop signal with optional shift.

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

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

  • contour – Boundary points in (row, column) pixel coordinates.

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

Return expressions in source:

(cropped_signal, cropped_mask, cropped_contour, x_offset, y_offset)

View current source, line 2956.

change_contour_array_length

bactoscoop.utilities.change_contour_array_length(cell_perimeter, contour, scale=0.02, smooth=1)

Change contour array length.

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

  • contour – Boundary points in (row, column) pixel coordinates.

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

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

Return expressions in source:

adjust_eroded_contour

View current source, line 2967.

normalized_intensity_by_image

bactoscoop.utilities.normalized_intensity_by_image(profile, cropped_image)

Normalized intensity by image.

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

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

Return expressions in source:

normalized_profile
np.zeros_like(prof)

View current source, line 2974.

get_homogeneity

bactoscoop.utilities.get_homogeneity(normalized_intensity)

Get homogeneity.

Parameters:

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

Return expressions in source:

homogeneity

View current source, line 3000.

set_bg_zero

bactoscoop.utilities.set_bg_zero(contour, cropped_img)

Set bg zero.

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

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

Return expressions in source:

bg_zero_img

View current source, line 3007.

rescale_image_255

bactoscoop.utilities.rescale_image_255(cropped_image, max_value=255)

Rescale image 255.

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

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

Return expressions in source:

scaled_image

View current source, line 3013.

create_co_occurrence_matrix

bactoscoop.utilities.create_co_occurrence_matrix(cropped_img, distances=[1], angles=[0, np.pi / 4, np.pi / 2, 3 * np.pi / 4], levels=256, symmetric=True, normed=True)

Create a co-occurrence matrix from a cropped image.

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

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

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

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

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

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

Return expressions in source:

co_occurrence_matrix

View current source, line 3030.

Original docstring (legacy wording may differ from the current signature)
Create a co-occurrence matrix from a cropped image.

Parameters:
- cropped_image: The cropped grayscale image.
- distances: List of pixel pair distances.
- angles: List of angles in radians for pixel pairs.
- levels: Number of gray levels (typically 256 for 8-bit images).
- symmetric: If True, the output matrix P[:, :, d, theta] is symmetric.
             This is accomplished by ignoring the order of value pairs, so both (i, j) and (j, i) are accumulated when (i, j) is encountered for a given offset.
- normed: If True, normalize each matrix P[:, :, d, theta] by dividing by the total number of accumulated co-occurrences for the given offset.

Returns:
- co_occurrence_matrix: The co-occurrence matrix.

get_glcm_feature_means

bactoscoop.utilities.get_glcm_feature_means(glcm)

Compute the mean Haralick properties for a GLCM in one pass.

Parameters:

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

Return expressions in source:

(dissimilarity, correlation.mean(), homogeneity, energy, contrast, entropy)

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

View current source, line 3072.

Original docstring (legacy wording may differ from the current signature)
Compute the mean Haralick properties for a GLCM in one pass.

The formulas mirror skimage.feature.graycoprops so callers keep the same
numerical behavior while avoiding repeated scans of the same matrix.

calculate_haralick_features

bactoscoop.utilities.calculate_haralick_features(contour, cropped_img, distances=[2], angles=[0, np.pi / 4, np.pi / 2, 3 * np.pi / 4], levels=256)

Calculate haralick features.

Parameters:
  • contour – Boundary points in (row, column) pixel coordinates.

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

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

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

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

Return expressions in source:

get_glcm_feature_means(glcm)

View current source, line 3128.

align_contour_start

bactoscoop.utilities.align_contour_start(eroded_contour, first_point)

Rotates the eroded_contour so that its point closest to the first point of p2p_contour comes first.

Parameters:
  • eroded_contour – Array of shape (N, 2), representing the contour after erosion.

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

Return expressions in source:

aligned_contour

View current source, line 3147.

Original docstring (legacy wording may differ from the current signature)
Rotates the eroded_contour so that its point closest to the first point
of p2p_contour comes first.

Parameters
----------
eroded_contour : np.ndarray
    Array of shape (N, 2), representing the contour after erosion.
p2p_contour : np.ndarray
    Original contour array of shape (N, 2) before erosion.

Returns
-------
np.ndarray
    Rotated eroded_contour starting from the closest point to the original start.

calculate_object_haralick_features

bactoscoop.utilities.calculate_object_haralick_features(object_masks, cropped_img, distances=[2], angles=[0, np.pi / 4, np.pi / 2, 3 * np.pi / 4], levels=256)

Calculate object haralick features.

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

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

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

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

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

Return expressions in source:

get_glcm_feature_means(glcm)

View current source, line 3172.

calculate_contour_haralick_features

bactoscoop.utilities.calculate_contour_haralick_features(contour_intensities, distances=[2], angles=[0, np.pi / 4, np.pi / 2, 3 * np.pi / 4], levels=256)

Calculate contour haralick features.

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

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

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

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

Return expressions in source:

get_glcm_feature_means(glcm)

View current source, line 3193.

split_array

bactoscoop.utilities.split_array(row)

Split array.

Parameters:

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

Return expressions in source:

(first_half, second_half)

View current source, line 3212.

get_complemented_contour_intensity

bactoscoop.utilities.get_complemented_contour_intensity(row)

Get complemented contour intensity.

Parameters:

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

Return expressions in source:

complemented_contour_intensity_profile

View current source, line 3219.

shift_image

bactoscoop.utilities.shift_image(img, shift)

Correct XY drift between phase contrast image and fluorescent image(s). :param img: Input image :param shift: Subpixel XY drift :return: Drift corrected image

Parameters:
  • img – Input img 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 – Input shift consumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.

Return expressions in source:

offset_image.astype(np.uint16)

View current source, line 3235.

Original docstring (legacy wording may differ from the current signature)
Correct XY drift between phase contrast image and fluorescent image(s).
:param img: Input image
:param shift: Subpixel XY drift
:return: Drift corrected image

Internal helpers

_collect_touching_label_pairs

bactoscoop.utilities._collect_touching_label_pairs(label_slice_a, label_slice_b)

collect touching label pairs.

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

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

Return expressions in source:

np.unique(pairs, axis=0)
np.empty((0, 2), dtype=np.int64)

View current source, line 636.

_validate_max_daughter_cell_mesh_rows

bactoscoop.utilities._validate_max_daughter_cell_mesh_rows(value)

validate max daughter cell mesh rows.

Parameters:

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

Return expressions in source:

int(value)

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

View current source, line 1442.

_max_feret_diameter_px

bactoscoop.utilities._max_feret_diameter_px(coords)

Exact point-set diameter with bounded pairwise-distance memory.

Parameters:

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

Return expressions in source:

maximum
0.0

View current source, line 1862.

Original docstring (legacy wording may differ from the current signature)
Exact point-set diameter with bounded pairwise-distance memory.