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_coordsconsumed 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_coordsconsumed 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_xconsumed 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_yconsumed 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])
skeleton_endpoints¶
- bactoscoop.utilities.skeleton_endpoints(skel)¶
Skeleton endpoints.
- Parameters:
skel – Input
skelconsumed 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
get_ordered_list¶
- bactoscoop.utilities.get_ordered_list(points, x, y)¶
Get ordered list.
- Parameters:
points – Input
pointsconsumed 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
xconsumed 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
yconsumed 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
line_intersect¶
- bactoscoop.utilities.line_intersect(x1, y1, x2, y2, x3, y3, x4, y4)¶
Line intersect.
- Parameters:
x1 – Input
x1consumed 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
y1consumed 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
x2consumed 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
y2consumed 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
x3consumed 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
y3consumed 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
x4consumed 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
y4consumed 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)
line_contour_intersection¶
- bactoscoop.utilities.line_contour_intersection(p1, p2, contour)¶
Line contour intersection.
- Parameters:
p1 – Input
p1consumed 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
p2consumed 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
unit_perpendicular_vector¶
- bactoscoop.utilities.unit_perpendicular_vector(data, closed=True)¶
Unit perpendicular vector.
- Parameters:
data – Input
dataconsumed 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
closedconsumed 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
get_major_axis_line_coordinates¶
- bactoscoop.utilities.get_major_axis_line_coordinates(masks)¶
Get major axis line coordinates.
- Parameters:
masks – Input
masksconsumed 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
extract_skeleton¶
- bactoscoop.utilities.extract_skeleton(masks)¶
Extract skeleton.
- Parameters:
masks – Input
masksconsumed 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)
find_poles¶
- bactoscoop.utilities.find_poles(smoothed_skeleton, smoothed_contour, find_pole1=True, find_pole2=True)¶
Find poles.
- Parameters:
smoothed_skeleton – Input
smoothed_skeletonconsumed 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_contourconsumed 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_pole1consumed 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_pole2consumed 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)
extend_skeleton¶
- bactoscoop.utilities.extend_skeleton(smoothed_skeleton, smoothed_contour, find_pole1=True, find_pole2=True)¶
Extend skeleton.
- Parameters:
smoothed_skeleton – Input
smoothed_skeletonconsumed 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_contourconsumed 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_pole1consumed 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_pole2consumed 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)
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
lengthconsumed 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
widthconsumed 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_micronconsumed 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)
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_interp2dconsumed 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
widthconsumed 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_valconsumed 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_valconsumed 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_erosionsconsumed 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_scaleconsumed 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
spline_approximation¶
- bactoscoop.utilities.spline_approximation(init_contour, n=200, smooth_factor=1, closed=True)¶
Spline approximation.
- Parameters:
init_contour – Input
init_contourconsumed 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_factorconsumed 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
closedconsumed 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
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.
distance_matrix¶
- bactoscoop.utilities.distance_matrix(data1, data2)¶
Distance matrix.
- Parameters:
data1 – Input
data1consumed 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
data2consumed 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
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
outerlineconsumed 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_vectorconsumed 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_distconsumed 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
intersect_matrix¶
- bactoscoop.utilities.intersect_matrix(line, contour, orthogonal_vectors=None)¶
Intersect matrix.
- Parameters:
line – Input
lineconsumed 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_vectorsconsumed 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)
add_poles¶
- bactoscoop.utilities.add_poles(coords1, coords2, pole1, pole2)¶
Add poles.
- Parameters:
coords1 – Input
coords1consumed 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
coords2consumed 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
pole1consumed 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
pole2consumed 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)
line_length¶
- bactoscoop.utilities.line_length(line)¶
Line length.
- Parameters:
line – Input
lineconsumed 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)))
direct_intersect_distance¶
- bactoscoop.utilities.direct_intersect_distance(skeleton, contour)¶
Direct intersect distance.
- Parameters:
skeleton – Input
skeletonconsumed 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]])
contour2mesh¶
- bactoscoop.utilities.contour2mesh(contour, cropped_mask)¶
Contour2mesh.
- Parameters:
contour – Boundary points in (row, column) pixel coordinates.
cropped_mask – Input
cropped_maskconsumed 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)
draw_mask¶
- bactoscoop.utilities.draw_mask(contour, image)¶
Draw mask.
- Parameters:
contour – Boundary points in (row, column) pixel coordinates.
image – Input
imageconsumed 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
crop_image¶
- bactoscoop.utilities.crop_image(image=None, contour=None, mask_to_crop=None, phase_img=None, pad=10)¶
Crop image.
- Parameters:
image – Input
imageconsumed 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_cropconsumed 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_imgconsumed 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
padconsumed 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)
crop¶
- bactoscoop.utilities.crop(to_be_cropped, pad, image, xy_coordinates=False)¶
Crop.
- Parameters:
to_be_cropped – Input
to_be_croppedconsumed 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
padconsumed 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
imageconsumed 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_coordinatesconsumed 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)
get_object_contours¶
- bactoscoop.utilities.get_object_contours(mask, smoothing=0.1)¶
Get object contours.
- Parameters:
mask – Input
maskconsumed 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
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
resultconsumed 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)
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.
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.
get_cellular_mesh¶
- bactoscoop.utilities.get_cellular_mesh(masks, smoothing)¶
Get cellular mesh.
- Parameters:
masks – Input
masksconsumed 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
distance¶
- bactoscoop.utilities.distance(v1, v2)¶
Distance.
- Parameters:
v1 – Input
v1consumed 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
v2consumed 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))
measure_width¶
- bactoscoop.utilities.measure_width(extended_skeleton, smoothed_contour)¶
Measure width.
- Parameters:
extended_skeleton – Input
extended_skeletonconsumed 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_contourconsumed 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.
get_cell_pairs¶
- bactoscoop.utilities.get_cell_pairs(pole_1, pole_2, cell_ID, maxdist=None)¶
Get cell pairs.
- Parameters:
pole_1 – Input
pole_1consumed 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_2consumed 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_IDconsumed 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
maxdistconsumed 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
mesh2contour¶
- bactoscoop.utilities.mesh2contour(x1, y1, x2, y2)¶
Mesh2contour.
- Parameters:
x1 – Input
x1consumed 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
y1consumed 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
x2consumed 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
y2consumed 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
split_point¶
- bactoscoop.utilities.split_point(x1, y1, x2, y2, ctpos)¶
Split point.
- Parameters:
x1 – Input
x1consumed 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
y1consumed 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
x2consumed 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
y2consumed 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
ctposconsumed 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]]))
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
imageconsumed 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
get_image_for_frame¶
- bactoscoop.utilities.get_image_for_frame(df_nr, images)¶
Get image for frame.
- Parameters:
df_nr – Input
df_nrconsumed 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
imagesconsumed 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]
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
imageconsumed 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)
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_maskconsumed 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_maskconsumed 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
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_contoursconsumed 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_midlinesconsumed 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_meshesconsumed 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
signalconsumed 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)
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
signalconsumed 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
imageconsumed 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)
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
signalconsumed 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
imageconsumed 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
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
filenameconsumed 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
suffixconsumed 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_maskconsumed 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_pathconsumed 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_dictconsumed 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_dictExplicitly raised exceptions:
ValueError. Errors from called functions can also propagate or be recorded.
read_tiff_folder¶
- bactoscoop.utilities.read_tiff_folder(folder_path, suffix='', include_paths=False)¶
Read tiff folder.
- Parameters:
folder_path – Input
folder_pathconsumed 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
suffixconsumed 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_pathsconsumed 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.
separate_meshdata¶
- bactoscoop.utilities.separate_meshdata(df_nr, cell_nr, data)¶
Separate meshdata.
- Parameters:
df_nr – Input
df_nrconsumed 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_nrconsumed 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
dataconsumed 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)
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
dataconsumed 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)
get_cropped_object_data¶
- bactoscoop.utilities.get_cropped_object_data(cnts, mdls, mshs, x, y)¶
Get cropped object data.
- Parameters:
cnts – Input
cntsconsumed 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
mdlsconsumed 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
mshsconsumed 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
xconsumed 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
yconsumed 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)
get_cropped_cell_data¶
- bactoscoop.utilities.get_cropped_cell_data(cnt, mdl, msh, x, y)¶
Get cropped cell data.
- Parameters:
cnt – Input
cntconsumed 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
mdlconsumed 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
mshconsumed 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
xconsumed 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
yconsumed 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)
get_uncropped_cell_data¶
- bactoscoop.utilities.get_uncropped_cell_data(cnt, mdl, msh, x, y)¶
Get uncropped cell data.
- Parameters:
cnt – Input
cntconsumed 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
mdlconsumed 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
mshconsumed 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
xconsumed 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
yconsumed 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)
mesh2midline¶
- bactoscoop.utilities.mesh2midline(x1, y1, x2, y2)¶
Mesh2midline.
- Parameters:
x1 – Input
x1consumed 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
y1consumed 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
x2consumed 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
y2consumed 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
get_weighted_intprofile¶
- bactoscoop.utilities.get_weighted_intprofile(intensity, width)¶
Get weighted intprofile.
- Parameters:
intensity – Input
intensityconsumed 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
widthconsumed 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 []
get_width¶
- bactoscoop.utilities.get_width(x1, y1, x2, y2)¶
Get width.
- Parameters:
x1 – Input
x1consumed 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
y1consumed 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
x2consumed 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
y2consumed 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
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
x1consumed 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
y1consumed 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
x2consumed 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
y2consumed 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
widthconsumed 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_unitconsumed 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
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
scaleconsumed 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
scaleconsumed 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
imageconsumed 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_maskconsumed 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
median_background¶
- bactoscoop.utilities.median_background(image, cell_mask)¶
Median background.
- Parameters:
image – Input
imageconsumed 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_maskconsumed 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
poly_func¶
- bactoscoop.utilities.poly_func(coords, a, b, c, d, e, f)¶
Poly func.
- Parameters:
coords – Input
coordsconsumed 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
aconsumed 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
bconsumed 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
cconsumed 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
dconsumed 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
econsumed 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
fconsumed 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
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
x1consumed 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
y1consumed 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
x2consumed 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
y2consumed 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
get_step_length_no_px¶
- bactoscoop.utilities.get_step_length_no_px(x1, y1, x2, y2)¶
Get step length no px.
- Parameters:
x1 – Input
x1consumed 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
y1consumed 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
x2consumed 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
y2consumed 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
get_length¶
- bactoscoop.utilities.get_length(step_length)¶
Get length.
- Parameters:
step_length – Input
step_lengthconsumed 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)
get_avg_width¶
- bactoscoop.utilities.get_avg_width(x1, y1, x2, y2, px)¶
Get avg width.
- Parameters:
x1 – Input
x1consumed 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
y1consumed 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
x2consumed 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
y2consumed 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)
get_avg_width_no_px¶
- bactoscoop.utilities.get_avg_width_no_px(x1, y1, x2, y2)¶
Get avg width no px.
- Parameters:
x1 – Input
x1consumed 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
y1consumed 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
x2consumed 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
y2consumed 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)
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
get_volume¶
- bactoscoop.utilities.get_volume(x1, y1, x2, y2, step_length, px)¶
Get volume.
- Parameters:
x1 – Input
x1consumed 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
y1consumed 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
x2consumed 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
y2consumed 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_lengthconsumed 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
get_surface_area¶
- bactoscoop.utilities.get_surface_area(width_no, step_length)¶
Get surface area.
- Parameters:
width_no – Input
width_noconsumed 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_lengthconsumed 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
get_surface_area_over_volume¶
- bactoscoop.utilities.get_surface_area_over_volume(sa, vol)¶
Get surface area over volume.
- Parameters:
sa – Input
saconsumed 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
volconsumed 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
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
areaconsumed 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)
get_cell_width_variability¶
- bactoscoop.utilities.get_cell_width_variability(width_no)¶
Get cell width variability.
- Parameters:
width_no – Input
width_noconsumed 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
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)
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
shapeconsumed 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
interp2dconsumed 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))
get_contour_intensity¶
- bactoscoop.utilities.get_contour_intensity(contour, interp2d)¶
Get contour intensity.
- Parameters:
contour – Boundary points in (row, column) pixel coordinates.
interp2d – Input
interp2dconsumed 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
find_signal_peaks¶
- bactoscoop.utilities.find_signal_peaks(signal, maximum)¶
Find signal peaks.
- Parameters:
signal – Input
signalconsumed 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
maximumconsumed 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)
measure_contour_variability¶
- bactoscoop.utilities.measure_contour_variability(signal)¶
Measure contour variability.
- Parameters:
signal – Input
signalconsumed 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
get_kurtosis¶
- bactoscoop.utilities.get_kurtosis(signal)¶
Get kurtosis.
- Parameters:
signal – Input
signalconsumed 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)
get_skew¶
- bactoscoop.utilities.get_skew(signal)¶
Get skew.
- Parameters:
signal – Input
signalconsumed 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)
sinuosity¶
- bactoscoop.utilities.sinuosity(midline)¶
Sinuosity.
- Parameters:
midline – Central-axis points in (row, column) pixel coordinates.
Return expressions in source:
sinuosityExplicitly raised exceptions:
ValueError. Errors from called functions can also propagate or be recorded.
get_area_asymmetry¶
- bactoscoop.utilities.get_area_asymmetry(step_length, width_no)¶
Get area asymmetry.
- Parameters:
step_length – Input
step_lengthconsumed 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_noconsumed 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
get_object_params¶
- bactoscoop.utilities.get_object_params(object_contours, px)¶
Get object params.
- Parameters:
object_contours – Input
object_contoursconsumed 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)
get_object_width_variability¶
- bactoscoop.utilities.get_object_width_variability(widths_no)¶
Get object width variability.
- Parameters:
widths_no – Input
widths_noconsumed 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)
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)
get_object_rect_length¶
- bactoscoop.utilities.get_object_rect_length(nucleoid_contours, px)¶
Get object rect length.
- Parameters:
nucleoid_contours – Input
nucleoid_contoursconsumed 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)
get_additional_regionprops_features¶
- bactoscoop.utilities.get_additional_regionprops_features(mask, px)¶
Get additional regionprops features.
- Parameters:
mask – Input
maskconsumed 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
get_object_avg_width¶
- bactoscoop.utilities.get_object_avg_width(nucleoid_masks, px)¶
Get object avg width.
- Parameters:
nucleoid_masks – Input
nucleoid_masksconsumed 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)
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_listsconsumed 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_listsconsumed 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)
get_object_area¶
- bactoscoop.utilities.get_object_area(contours, px)¶
Get object area.
- Parameters:
contours – Input
contoursconsumed 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)
get_object_curvature_characteristics¶
- bactoscoop.utilities.get_object_curvature_characteristics(contours, px)¶
Get object curvature characteristics.
- Parameters:
contours – Input
contoursconsumed 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)
get_object_perimeter_measurements¶
- bactoscoop.utilities.get_object_perimeter_measurements(contours, areas, px)¶
Get object perimeter measurements.
- Parameters:
contours – Input
contoursconsumed 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
areasconsumed 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)
get_cell_convexity¶
- bactoscoop.utilities.get_cell_convexity(mask)¶
Get cell convexity.
- Parameters:
mask – Input
maskconsumed 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)
get_object_convexity¶
- bactoscoop.utilities.get_object_convexity(cropped_masks)¶
Get object convexity.
- Parameters:
cropped_masks – Input
cropped_masksconsumed 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)
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_volumeconsumed 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_areasconsumed 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_areaconsumed 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)
get_nucleoid_width_variability¶
- bactoscoop.utilities.get_nucleoid_width_variability(widths)¶
Get nucleoid width variability.
- Parameters:
widths – Input
widthsconsumed 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)
get_obj_mesh_coords¶
- bactoscoop.utilities.get_obj_mesh_coords(nucleoid_meshes)¶
Get obj mesh coords.
- Parameters:
nucleoid_meshes – Input
nucleoid_meshesconsumed 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)
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
midlinesconsumed 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_interp2dconsumed 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
widthconsumed 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
subpixelconsumed 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
constr_degree¶
- bactoscoop.utilities.constr_degree(intensities, new_step_lengths, width_not_ordered)¶
Constr degree.
- Parameters:
intensities – Input
intensitiesconsumed 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_lengthsconsumed 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_orderedconsumed 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)
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_listconsumed 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_listconsumed 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_listconsumed 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_listconsumed 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).
get_minima¶
- bactoscoop.utilities.get_minima(weighted_intensity)¶
Get minima.
- Parameters:
weighted_intensity – Input
weighted_intensityconsumed 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]))
identify_minima¶
- bactoscoop.utilities.identify_minima(intensity, minima)¶
Identify minima.
- Parameters:
intensity – Input
intensityconsumed 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
minimaconsumed 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)
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_listconsumed 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_listconsumed 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_listconsumed 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_listconsumed 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
minsizeabsconsumed 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
ctposconsumed 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
ctposrconsumed 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).
get_obj_avg_width¶
- bactoscoop.utilities.get_obj_avg_width(x1s, y1s, x2s, y2s, px)¶
Get obj avg width.
- Parameters:
x1s – Input
x1sconsumed 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
y1sconsumed 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
x2sconsumed 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
y2sconsumed 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)
get_nucleoid_volume¶
- bactoscoop.utilities.get_nucleoid_volume(x1s, y1s, x2s, y2s, step_lengths, px)¶
Get nucleoid volume.
- Parameters:
x1s – Input
x1sconsumed 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
y1sconsumed 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
x2sconsumed 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
y2sconsumed 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_lengthsconsumed 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)
get_object_step_length¶
- bactoscoop.utilities.get_object_step_length(x1s, y1s, x2s, y2s, px)¶
Get object step length.
- Parameters:
x1s – Input
x1sconsumed 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
y1sconsumed 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
x2sconsumed 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
y2sconsumed 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)
get_object_surface_area¶
- bactoscoop.utilities.get_object_surface_area(width_nos, step_lengths)¶
Get object surface area.
- Parameters:
width_nos – Input
width_nosconsumed 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_lengthsconsumed 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)
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_areasconsumed 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
volumesconsumed 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)
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
dataconsumed 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
lineconsumed 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
curvatureconsumed 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)
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
get_object_midpoint¶
- bactoscoop.utilities.get_object_midpoint(midlines)¶
Get object midpoint.
- Parameters:
midlines – Input
midlinesconsumed 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
get_centroid¶
- bactoscoop.utilities.get_centroid(cropped_masks)¶
Get centroid.
- Parameters:
cropped_masks – Input
cropped_masksconsumed 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]]
get_object_centroid¶
- bactoscoop.utilities.get_object_centroid(cropped_masks)¶
Get object centroid.
- Parameters:
cropped_masks – Input
cropped_masksconsumed 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
get_interobject_distance¶
- bactoscoop.utilities.get_interobject_distance(centroid_coordinates, px)¶
Get interobject distance.
- Parameters:
centroid_coordinates – Input
centroid_coordinatesconsumed 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)
get_object_sinuosity¶
- bactoscoop.utilities.get_object_sinuosity(midlines)¶
Get object sinuosity.
- Parameters:
midlines – Input
midlinesconsumed 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)
get_mesh_area¶
- bactoscoop.utilities.get_mesh_area(width_no, step_length)¶
Get mesh area.
- Parameters:
width_no – Input
width_noconsumed 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_lengthconsumed 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
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_lengthconsumed 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_noconsumed 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
areasconsumed 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
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_coordinatesconsumed 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_coordinatesconsumed 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)
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)
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_coordinatesconsumed 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)
angle_between_vector¶
- bactoscoop.utilities.angle_between_vector(v1, v2)¶
Angle between vector.
- Parameters:
v1 – Input
v1consumed 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
v2consumed 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))
projection_on_midline¶
- bactoscoop.utilities.projection_on_midline(centroids, midline, width, px)¶
Projection on midline.
- Parameters:
centroids – Input
centroidsconsumed 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
widthconsumed 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)
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_listconsumed 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
get_object_intensities¶
- bactoscoop.utilities.get_object_intensities(object_masks, cropped_signal)¶
Get object intensities.
- Parameters:
object_masks – Input
object_masksconsumed 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_signalconsumed 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)
get_objects_mean¶
- bactoscoop.utilities.get_objects_mean(intensity_values_list)¶
Get objects mean.
- Parameters:
intensity_values_list – Input
intensity_values_listconsumed 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
get_objects_std¶
- bactoscoop.utilities.get_objects_std(intensity_values_list)¶
Get objects std.
- Parameters:
intensity_values_list – Input
intensity_values_listconsumed 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
get_objects_kurtosis¶
- bactoscoop.utilities.get_objects_kurtosis(intensity_values_list)¶
Get objects kurtosis.
- Parameters:
intensity_values_list – Input
intensity_values_listconsumed 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
get_objects_skewness¶
- bactoscoop.utilities.get_objects_skewness(intensity_values_list)¶
Get objects skewness.
- Parameters:
intensity_values_list – Input
intensity_values_listconsumed 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
get_variance¶
- bactoscoop.utilities.get_variance(data)¶
Get variance.
- Parameters:
data – Input
dataconsumed 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)
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_interp2dconsumed 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
widthconsumed 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
subpixelconsumed 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
gaussian_smoothing¶
- bactoscoop.utilities.gaussian_smoothing(data)¶
Gaussian smoothing.
- Parameters:
data – Input
dataconsumed 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()
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_interp2dconsumed 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
widthconsumed 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
subpixelconsumed 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
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_lengthsView 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
arrayconsumed 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_valuesconsumed 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
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_imgconsumed 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_sigmaconsumed 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
closing_mask¶
- bactoscoop.utilities.closing_mask(cropped_phase_mask, closing_level=2)¶
Closing mask.
- Parameters:
cropped_phase_mask – Input
cropped_phase_maskconsumed 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_levelconsumed 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
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_closedconsumed 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_contourconsumed 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]
align¶
- bactoscoop.utilities.align(signal_centroid, phase_centroid, cropped_contour)¶
Align.
- Parameters:
signal_centroid – Input
signal_centroidconsumed 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_centroidconsumed 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_contourconsumed 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
align_objects¶
- bactoscoop.utilities.align_objects(signal_centroid, phase_centroid, cropped_mesh, cropped_contour, cropped_midline)¶
Align objects.
- Parameters:
signal_centroid – Input
signal_centroidconsumed 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_centroidconsumed 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_meshconsumed 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_contourconsumed 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_midlineconsumed 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)
get_signal_mask¶
- bactoscoop.utilities.get_signal_mask(signal, contour, log_sigma, min_overlap_ratio, max_external_ratio)¶
Get signal mask.
- Parameters:
signal – Input
signalconsumed 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)
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_imageconsumed 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_imageconsumed 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_sigmaconsumed 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_levelconsumed 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_levelconsumed 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_correctionconsumed 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)
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_perimeterconsumed 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
scaleconsumed 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
smoothconsumed 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
normalized_intensity_by_image¶
- bactoscoop.utilities.normalized_intensity_by_image(profile, cropped_image)¶
Normalized intensity by image.
- Parameters:
profile – Input
profileconsumed 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_imageconsumed 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)
get_homogeneity¶
- bactoscoop.utilities.get_homogeneity(normalized_intensity)¶
Get homogeneity.
- Parameters:
normalized_intensity – Input
normalized_intensityconsumed 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
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_imgconsumed 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
rescale_image_255¶
- bactoscoop.utilities.rescale_image_255(cropped_image, max_value=255)¶
Rescale image 255.
- Parameters:
cropped_image – Input
cropped_imageconsumed 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_valueconsumed 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
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_imgconsumed 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
distancesconsumed 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
anglesconsumed 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
levelsconsumed 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
symmetricconsumed 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
normedconsumed 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_matrixView 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
glcmconsumed 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_imgconsumed 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
distancesconsumed 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
anglesconsumed 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
levelsconsumed 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)
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_pointconsumed 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_contourView 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_masksconsumed 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_imgconsumed 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
distancesconsumed 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
anglesconsumed 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
levelsconsumed 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)
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_intensitiesconsumed 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
distancesconsumed 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
anglesconsumed 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
levelsconsumed 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)
split_array¶
- bactoscoop.utilities.split_array(row)¶
Split array.
- Parameters:
row – Input
rowconsumed 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)
get_complemented_contour_intensity¶
- bactoscoop.utilities.get_complemented_contour_intensity(row)¶
Get complemented contour intensity.
- Parameters:
row – Input
rowconsumed 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
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
imgconsumed 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
shiftconsumed 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_aconsumed 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_bconsumed 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)
_validate_max_daughter_cell_mesh_rows¶
- bactoscoop.utilities._validate_max_daughter_cell_mesh_rows(value)¶
validate max daughter cell mesh rows.
- Parameters:
value – Input
valueconsumed 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.
_max_feret_diameter_px¶
- bactoscoop.utilities._max_feret_diameter_px(coords)¶
Exact point-set diameter with bounded pairwise-distance memory.
- Parameters:
coords – Input
coordsconsumed 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.