bactoscoop.plot¶
Classes and public operations¶
pick_representative_cell¶
- bactoscoop.plot.pick_representative_cell(image_objects, margin_px=20)¶
Pick an interior, isolated, median-sized cell with valid geometry.
- Parameters:
image_objects – Input
image_objectsconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.margin_px – Input
margin_pxconsumed 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:
(winner[0], winner[1])
Explicitly raised exceptions:
ValueError. Errors from called functions can also propagate or be recorded.Original docstring (legacy wording may differ from the current signature)
Pick an interior, isolated, median-sized cell with valid geometry. The rule is deterministic and uses geometry only, never fluorescence intensity. Returns the image object and cell ID so the same cell can be revisited.
select_example_cell¶
- bactoscoop.plot.select_example_cell(image_objects, field_id=None, cell_id=None)¶
Choose an existing field/cell, or a representative cell in the chosen field.
- Parameters:
image_objects – Input
image_objectsconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.field_id – Shared TIFF field stem before the channel suffix.
cell_id – Cell identifier local to the selected image; check that it remains after curation/filtering.
Return expressions in source:
pick_representative_cell(objects) (image, cell_id)
Explicitly raised exceptions:
ValueError. Errors from called functions can also propagate or be recorded.Original docstring (legacy wording may differ from the current signature)
Choose an existing field/cell, or a representative cell in the chosen field.
plot_field_channels¶
- bactoscoop.plot.plot_field_channels(dataset_dir, field_id, channel_labels, crop_size=650)¶
Preview the same pixel window across the named TIFF channels.
- Parameters:
dataset_dir – Folder containing the channel TIFF files.
field_id – Shared TIFF field stem before the channel suffix.
channel_labels – Mapping from channel identifiers to human-readable signal labels.
crop_size – Displayed crop extent in pixels.
Return expressions in source:
figExplicitly raised exceptions:
ValueError. Errors from called functions can also propagate or be recorded.View current source, line 133.
Original docstring (legacy wording may differ from the current signature)
Preview the same pixel window across the named TIFF channels.
plot_segmentation_review¶
- bactoscoop.plot.plot_segmentation_review(image_objects, crop_size=500, mask_label=None, center=None)¶
Compare phase and mask outlines in a selectable cell-centered crop.
- Parameters:
image_objects – Input
image_objectsconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.crop_size – Displayed crop extent in pixels.
mask_label – Input
mask_labelconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.center – Input
centerconsumed 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:
figExplicitly raised exceptions:
ValueError. Errors from called functions can also propagate or be recorded.View current source, line 160.
Original docstring (legacy wording may differ from the current signature)
Compare phase and mask outlines in a selectable cell-centered crop.
plot_cell_gallery¶
- bactoscoop.plot.plot_cell_gallery(image_object, cell_id, channel='C2', window_px=110, channel_label=None, align_signal=False, show_objects=False)¶
Show phase and mesh, optionally with a registered signal crop and objects.
- Parameters:
image_object – Image instance containing the selected field and cells.
cell_id – Cell identifier local to the selected image; check that it remains after curation/filtering.
channel – Channel identifier for the selected signal, or None for phase/morphology where supported.
window_px – Cell plot window extent in pixels.
channel_label – Input
channel_labelconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.align_signal – Input
align_signalconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.show_objects – Input
show_objectsconsumed 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:
figExplicitly raised exceptions:
ValueError. Errors from called functions can also propagate or be recorded.View current source, line 207.
Original docstring (legacy wording may differ from the current signature)
Show phase and mesh, optionally with a registered signal crop and objects. The registered crop uses the same local crop/phase registration called by ``object_detection(align=True)``. Plot it after detection to compare its detected object contours with the phase-cell contour.
plot_C2_alignment¶
- bactoscoop.plot.plot_C2_alignment(image_object, cell_id, window_px=110, channel='C2', channel_label=None, show_objects=False)¶
Compare the raw C2 signal with the phase-aligned C2 signal.
- Parameters:
image_object – Image instance containing the selected field and cells.
cell_id – Cell identifier local to the selected image; check that it remains after curation/filtering.
window_px – Cell plot window extent in pixels.
channel – Channel identifier for the selected signal, or None for phase/morphology where supported.
channel_label – Input
channel_labelconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.show_objects – Input
show_objectsconsumed 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:
figExplicitly raised exceptions:
ValueError. Errors from called functions can also propagate or be recorded.View current source, line 280.
Original docstring (legacy wording may differ from the current signature)
Compare the raw C2 signal with the phase-aligned C2 signal. BEFORE: original fluorescence image, cropped around the cell. AFTER: fluorescence crop returned by u.crop_image(..., phase_img=...). Cell contours are overlaid using the correct origin for each crop. Detected object contours can optionally be shown on the aligned panel.
snapshot_cell_contours¶
- bactoscoop.plot.snapshot_cell_contours(image_objects)¶
Copy cell IDs and contours before curation changes the collection.
- Parameters:
image_objects – Input
image_objectsconsumed 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.image_name: {cell.cell_id: np.asarray(cell.contour).copy() for cell in image.cells} for image in image_objects}
View current source, line 430.
Original docstring (legacy wording may differ from the current signature)
Copy cell IDs and contours before curation changes the collection.
plot_curation_review¶
- bactoscoop.plot.plot_curation_review(before_contours, image_objects, crop_size=700)¶
Show retained cells in green and removed cells in red on phase images.
- Parameters:
before_contours – Input
before_contoursconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.image_objects – Input
image_objectsconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.crop_size – Displayed crop extent in pixels.
Return expressions in source:
figExplicitly raised exceptions:
ValueError. Errors from called functions can also propagate or be recorded.View current source, line 440.
Original docstring (legacy wording may differ from the current signature)
Show retained cells in green and removed cells in red on phase images. ``before_contours`` is made by :func:`snapshot_cell_contours` before curation. Cells are matched by image name and cell ID.
plot_signal_gallery¶
- bactoscoop.plot.plot_signal_gallery(image_object, cell_id, channel_labels=None, window_px=120, show_objects=False)¶
Show the phase image beside raw channel crops, with optional detections.
- Parameters:
image_object – Image instance containing the selected field and cells.
cell_id – Cell identifier local to the selected image; check that it remains after curation/filtering.
channel_labels – Mapping from channel identifiers to human-readable signal labels.
window_px – Cell plot window extent in pixels.
show_objects – Input
show_objectsconsumed 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:
figExplicitly raised exceptions:
ValueError. Errors from called functions can also propagate or be recorded.View current source, line 510.
Original docstring (legacy wording may differ from the current signature)
Show the phase image beside raw channel crops, with optional detections. Cell contours are displayed on all panels. Detected object contours are optionally overlaid on the corresponding fluorescence channels. Crops share pixel coordinates. This function does not register channels.
plot_object_area_vs_cell_area¶
- bactoscoop.plot.plot_object_area_vs_cell_area(features, channel_labels)¶
Compare detected object area with cell area for each named channel.
- Parameters:
features – Input
featuresconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.channel_labels – Mapping from channel identifiers to human-readable signal labels.
Return expressions in source:
figExplicitly raised exceptions:
ValueError. Errors from called functions can also propagate or be recorded.View current source, line 611.
Original docstring (legacy wording may differ from the current signature)
Compare detected object area with cell area for each named channel.
plot_feature_overview¶
- bactoscoop.plot.plot_feature_overview(features, signal_column='C4_NC_ratio')¶
Exploratory overview of cell morphology, constriction, detected objects, and relative signal localization.
- Parameters:
features – Input
featuresconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.signal_column – Input
signal_columnconsumed 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:
fig pd.to_numeric(features[column], errors='coerce').to_numpy() None
View current source, line 640.
Original docstring (legacy wording may differ from the current signature)
Exploratory overview of cell morphology, constriction, detected objects, and relative signal localization. C2 = outer membrane C3 = inner membrane C4 = RNA C5 = DAPI Missing features are indicated in their panels. Nothing is saved.
plot_feature_histogram¶
- bactoscoop.plot.plot_feature_histogram(df, feature, bins=40, xlabel=None, color='#197E89', figsize=(7, 4.5))¶
Plot a feature distribution with mean, median and interquartile range.
- Parameters:
df – DataFrame to inspect, transform, or augment. Correlation mutates it in place and returns it.
feature – Unprefixed shared feature name; corresponding channel-prefixed columns must exist.
bins – Input
binsconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.xlabel – Input
xlabelconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.color – Input
colorconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.figsize – Input
figsizeconsumed 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:
figExplicitly raised exceptions:
ValueError. Errors from called functions can also propagate or be recorded.View current source, line 866.
Original docstring (legacy wording may differ from the current signature)
Plot a feature distribution with mean, median and interquartile range.
plot_feature_scatter¶
- bactoscoop.plot.plot_feature_scatter(df, x_feature, y_feature, color_by=None, xlabel=None, ylabel=None, trendline=True, figsize=(7, 5))¶
Plot two features against each other.
- Parameters:
df – DataFrame to inspect, transform, or augment. Correlation mutates it in place and returns it.
x_feature – Input
x_featureconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.y_feature – Input
y_featureconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.color_by – Input
color_byconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.xlabel – Input
xlabelconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.ylabel – Input
ylabelconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.trendline – Input
trendlineconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.figsize – Input
figsizeconsumed 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:
figExplicitly raised exceptions:
ValueError. Errors from called functions can also propagate or be recorded.View current source, line 945.
Original docstring (legacy wording may differ from the current signature)
Plot two features against each other. Optionally colour points by a third numeric feature. A linear regression line and Pearson correlation can be shown.
plot_contour¶
- bactoscoop.plot.plot_contour(cell_id, image, base_channel=None, verbose=False, add_scalebar=True, scalebar_um=1, um_per_px=0.065, scalebar_color='white', scalebar_lw=6, window_px=None, save_svg_path=None)¶
Plot the contour of a cell with optional scalebar.
- Parameters:
cell_id – Cell identifier local to the selected image; check that it remains after curation/filtering.
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.base_channel – Input
base_channelconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.verbose – Input
verboseconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.add_scalebar – Input
add_scalebarconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.scalebar_um – Input
scalebar_umconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.um_per_px – Input
um_per_pxconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.scalebar_color – Input
scalebar_colorconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.scalebar_lw – Input
scalebar_lwconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.window_px – Cell plot window extent in pixels.
save_svg_path – Input
save_svg_pathconsumed 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:
NoneView current source, line 1059.
Original docstring (legacy wording may differ from the current signature)
Plot the contour of a cell with optional scalebar. Parameters ---------- window_px : int or None If provided, creates a fixed square window (in pixels) centered on the cell. If None, tight crop is used (default behavior).
plot_cell_contour_gallery¶
- bactoscoop.plot.plot_cell_contour_gallery(cell_id, image, channels, window_px=100, phase_first=True, phase_cmap='gist_grey', channel_cmap='gist_grey', contour_color='yellow', contour_lw=1.5, add_scalebar=True, scalebar_um=1, um_per_px=0.065, scalebar_color='white', scalebar_lw=4, title=True, figsize_per_panel=3.0, save_path=None, save_individual_dir=None, dpi=500, verbose=False)¶
Plot a cropped gallery for one cell using: - image.image for phase contrast - image.channels[ch] for channel images - only the cell contour overlay
- Parameters:
cell_id – Cell identifier local to the selected image; check that it remains after curation/filtering.
image – Typically ic.image_objects[frame_id]
channels – Requested channel identifiers; for correlation, channel pairs are generated from this sequence.
window_px – Cell plot window extent in pixels.
phase_first – Input
phase_firstconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.phase_cmap – Input
phase_cmapconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.channel_cmap – Input
channel_cmapconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.contour_color – Input
contour_colorconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.contour_lw – Input
contour_lwconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.add_scalebar – Input
add_scalebarconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.scalebar_um – Input
scalebar_umconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.um_per_px – Input
um_per_pxconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.scalebar_color – Input
scalebar_colorconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.scalebar_lw – Input
scalebar_lwconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.title – Input
titleconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.figsize_per_panel – Input
figsize_per_panelconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.save_path – Input
save_pathconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.save_individual_dir – Input
save_individual_dirconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.dpi – Input
dpiconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.verbose – Input
verboseconsumed 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:
{'cell_id': cell_id, 'crop_bounds': (y_min, y_max, x_min, x_max), 'panel_names': [p[0] for p in panels], 'figure': fig} None
View current source, line 1193.
Original docstring (legacy wording may differ from the current signature)
Plot a cropped gallery for one cell using: - image.image for phase contrast - image.channels[ch] for channel images - only the cell contour overlay Parameters ---------- cell_id : int or str image : object Typically ic.image_objects[frame_id] channels : list of str Example: ["C1", "C2", "C3", "C4", "C5"]
plot_aligned_contours¶
- bactoscoop.plot.plot_aligned_contours(cell_id, image, channel, verbose=False)¶
Plot the contour of a cell on an image.
- Parameters:
cell_id – Cell identifier local to the selected image; check that it remains after curation/filtering.
image – The image object on which to plot the cell contour.
channel – Channel identifier for the selected signal, or None for phase/morphology where supported.
verbose – Input
verboseconsumed 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:
NoneView current source, line 1360.
Original docstring (legacy wording may differ from the current signature)
Plot the contour of a cell on an image. This function takes a cell object and an image object and plots the contour of the specified cell on the image. It also displays the cell ID in the title of the plot. Parameters ---------- cell : Cell The cell object to be plotted. image : Image The image object on which to plot the cell contour.
plot_svm_controls¶
- bactoscoop.plot.plot_svm_controls(frame_cell_pairs, image_objects, message=None)¶
Plot cells based on frame and cell ID pairs from SVM control analysis.
- Parameters:
frame_cell_pairs – A list of (cell_id, frame) pairs for cells to be plotted.
image_objects – A list of image objects corresponding to the frames in frame_cell_pairs.
message – An optional message to be added to the title of the plot.
- Returns:
None (no explicit return statement).
Explicitly raised exceptions:
ValueError. Errors from called functions can also propagate or be recorded.View current source, line 1400.
Original docstring (legacy wording may differ from the current signature)
Plot cells based on frame and cell ID pairs from SVM control analysis. This function takes frame and cell ID pairs, along with a list of image objects, and plots the cells from SVM control analysis. It allows adding an optional message to the title of the plot. Parameters ---------- frame_cell_pairs : list of tuples A list of (cell_id, frame) pairs for cells to be plotted. image_objects : list A list of image objects corresponding to the frames in frame_cell_pairs. message : str, optional An optional message to be added to the title of the plot.
plot_mask¶
- bactoscoop.plot.plot_mask(image_object, joined=False, dpi=400, alpha=0.4)¶
Plot the mask overlay on an image.
- Parameters:
image_object – Image instance containing the selected field and cells.
joined – Whether to use the joined mask for overlay (default is False).
dpi – Dots per inch for the plot (default is 400).
alpha – Alpha (transparency) value for the mask overlay (default is 0.4).
- Returns:
None (no explicit return statement).
View current source, line 1448.
Original docstring (legacy wording may differ from the current signature)
Plot the mask overlay on an image. This function takes an image object and optionally a joined mask, and plots the mask overlay on the image. The alpha parameter controls the transparency of the mask overlay. Parameters ---------- image_object : Image object An image object containing the image and mask data. joined : bool, optional Whether to use the joined mask for overlay (default is False). dpi : int, optional Dots per inch for the plot (default is 400). alpha : float, optional Alpha (transparency) value for the mask overlay (default is 0.4).
plot_random_contours¶
- bactoscoop.plot.plot_random_contours(image, num_cells_to_plot=4, crop_size=200, scalebar=False)¶
Plot random cell contours within an image.
- Parameters:
image – An image object containing the image and cell contour data.
num_cells_to_plot – Number of random cell contours to plot (default is 4).
crop_size – Displayed crop extent in pixels.
scalebar – Whether to add a scale bar to the plots (default is False).
- Returns:
None (no explicit return statement).
View current source, line 1488.
Original docstring (legacy wording may differ from the current signature)
Plot random cell contours within an image. This function selects and plots random cell contours within an image, showing a specified number of cells. Parameters ---------- image : Image object An image object containing the image and cell contour data. num_cells_to_plot : int, optional Number of random cell contours to plot (default is 4). crop_size : int, optional Size of the cropped area around each cell (default is 200). scalebar : bool, optional Whether to add a scale bar to the plots (default is False). Returns ------- None
plot_random_objects¶
- bactoscoop.plot.plot_random_objects(image, chann, num_objects_to_plot=4, crop_size=300, scalebar=True)¶
Plot random objects.
- 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.chann – Input
channconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.num_objects_to_plot – Input
num_objects_to_plotconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.crop_size – Displayed crop extent in pixels.
scalebar – Input
scalebarconsumed 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).
plot_random_axial¶
- bactoscoop.plot.plot_random_axial(feature_dataframe, channels, method, num_objects_to_plot=2)¶
Plot random axial.
- Parameters:
feature_dataframe – Input
feature_dataframeconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.channels – Requested channel identifiers; for correlation, channel pairs are generated from this sequence.
method – Input
methodconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.num_objects_to_plot – Input
num_objects_to_plotconsumed 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).
plot_normalized_axial_intensity¶
- bactoscoop.plot.plot_normalized_axial_intensity(feature_dataframe, channels, selected_frame=None, selected_cell_id=None, show=True)¶
Plot normalized axial profiles for selected cells.
- Parameters:
feature_dataframe – Input
feature_dataframeconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.channels – Requested channel identifiers; for correlation, channel pairs are generated from this sequence.
selected_frame – Input
selected_frameconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.selected_cell_id – Input
selected_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.show – Display generated plots when true; check the documented return expression for figures.
Return expressions in source:
figuresExplicitly raised exceptions:
ValueError. Errors from called functions can also propagate or be recorded.View current source, line 1688.
Original docstring (legacy wording may differ from the current signature)
Plot normalized axial profiles for selected cells.
plot_object_mesh¶
- bactoscoop.plot.plot_object_mesh(cell_id, image, chann, verbose=False)¶
Plot object mesh.
- Parameters:
cell_id – Cell identifier local to the selected image; check that it remains after curation/filtering.
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.chann – Input
channconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.verbose – Input
verboseconsumed 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:
None
plot_object_contours¶
- bactoscoop.plot.plot_object_contours(cell_id, image, contour_channels, shift=False, base_channel=None, verbose=False, add_scalebar=True, scalebar_um=1, um_per_px=0.065, scalebar_color='white', scalebar_lw=8, window_px=None, save_svg_path=None, save_tiff_path=None)¶
Plot the contours of a cell and its objects for multiple channels on a single base channel image.
- Parameters:
cell_id – Cell identifier local to the selected image; check that it remains after curation/filtering.
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_channels – Input
contour_channelsconsumed 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.base_channel – Input
base_channelconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.verbose – Input
verboseconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.add_scalebar – Input
add_scalebarconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.scalebar_um – Input
scalebar_umconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.um_per_px – Input
um_per_pxconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.scalebar_color – Input
scalebar_colorconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.scalebar_lw – Input
scalebar_lwconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.window_px – Cell plot window extent in pixels.
save_svg_path – Input
save_svg_pathconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.save_tiff_path – Input
save_tiff_pathconsumed 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:
NoneView current source, line 1782.
Original docstring (legacy wording may differ from the current signature)
Plot the contours of a cell and its objects for multiple channels on a single base channel image. Behaves like your original version: - base_channel None -> uses image.image - shift True -> crop_image(... phase_img=image.image) - else -> crop_image(... phase_img=None) - plots cell contour + object contours from cropped_object_contour - adds scalebar the same way Added: - window_px: optional fixed square window around cell center (bypasses crop_image). - save_svg_path: save editable SVG (scalebar/text/contours editable in Illustrator).
plot_mesh_scientific¶
- bactoscoop.plot.plot_mesh_scientific(cell_id, image, crop_size=300, verbose=False)¶
Plot mesh scientific.
- Parameters:
cell_id – Cell identifier local to the selected image; check that it remains after curation/filtering.
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.crop_size – Displayed crop extent in pixels.
verbose – Input
verboseconsumed 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:
None
plot_width¶
- bactoscoop.plot.plot_width(cell, image, crop_size=70)¶
Plot width.
- Parameters:
cell – Cell instance containing geometry and measurements.
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.crop_size – Displayed crop extent in pixels.
- Returns:
None (no explicit return statement).
plot_signal_profile¶
- bactoscoop.plot.plot_signal_profile(cell, image)¶
Plot signal profile.
- Parameters:
cell – Cell instance containing geometry and measurements.
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.
- Returns:
None (no explicit return statement).
plot_demograph_rotated¶
- bactoscoop.plot.plot_demograph_rotated(cell_lengths, normalized_average_mesh_intensity, title='Demograph Plot', y_label='Normalized Distance From Midcell (µm)', x_label='Cell Length Percentile', cmap='rainbow', cbar_title='DnaN-msfGFP Normalized Intensity')¶
Plot demograph rotated.
- Parameters:
cell_lengths – Input
cell_lengthsconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.normalized_average_mesh_intensity – Input
normalized_average_mesh_intensityconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.title – Input
titleconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.y_label – Input
y_labelconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.x_label – Input
x_labelconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.cmap – Input
cmapconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.cbar_title – Input
cbar_titleconsumed 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).
list_field_ids¶
- bactoscoop.plot.list_field_ids(dataset_dir, phase_channel='C1')¶
List field ids.
- Parameters:
dataset_dir – Folder containing the channel TIFF files.
phase_channel – TIFF suffix identifying the phase images, such as “C1”. An empty suffix is the signature default.
Return expressions in source:
sorted({path.stem.rsplit('_', 1)[0] for path in dataset_dir.glob(f'*_{phase_channel}.tiff')})
plot_multichannel_overview¶
- bactoscoop.plot.plot_multichannel_overview(dataset_dir, field_id, channel_labels, figsize=(14, 3.8))¶
Return aligned display crops for each channel in a field of view.
- Parameters:
dataset_dir – Folder containing the channel TIFF files.
field_id – Shared TIFF field stem before the channel suffix.
channel_labels – Mapping from channel identifiers to human-readable signal labels.
figsize – Input
figsizeconsumed 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:
figView current source, line 2235.
Original docstring (legacy wording may differ from the current signature)
Return aligned display crops for each channel in a field of view.
plot_mesh_overlay¶
- bactoscoop.plot.plot_mesh_overlay(image_object, cell_id, crop_size=150, verbose=False)¶
Plot mesh overlay.
- Parameters:
image_object – Image instance containing the selected field and cells.
cell_id – Cell identifier local to the selected image; check that it remains after curation/filtering.
crop_size – Displayed crop extent in pixels.
verbose – Input
verboseconsumed 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:
None
pick_detected_cell¶
- bactoscoop.plot.pick_detected_cell(image_object, preferred_channels=('C4', 'C5'))¶
Choose an interior, isolated cell with a detected object when possible.
- Parameters:
image_object – Image instance containing the selected field and cells.
preferred_channels – Input
preferred_channelsconsumed 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:
max(candidates, key=score)[0] pick_representative_cell([image_object])[1] (item[2] >= 60, distance / max(item[3], 1), -abs(item[3] - median_length), item[2])
View current source, line 2283.
Original docstring (legacy wording may differ from the current signature)
Choose an interior, isolated cell with a detected object when possible.
plot_morphology_summary¶
- bactoscoop.plot.plot_morphology_summary(df)¶
Plot morphology summary.
- Parameters:
df – DataFrame to inspect, transform, or augment. Correlation mutates it in place and returns it.
- Returns:
None (no explicit return statement).
plot_signal_summary¶
- bactoscoop.plot.plot_signal_summary(df)¶
Plot signal summary.
- Parameters:
df – DataFrame to inspect, transform, or augment. Correlation mutates it in place and returns it.
- Returns:
None (no explicit return statement).
plot_pairwise_metric_heatmap¶
- bactoscoop.plot.plot_pairwise_metric_heatmap(df, metric_suffix, channel_order=('C2', 'C3', 'C4', 'C5'))¶
Plot pairwise metric heatmap.
- Parameters:
df – DataFrame to inspect, transform, or augment. Correlation mutates it in place and returns it.
metric_suffix – Input
metric_suffixconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.channel_order – Input
channel_orderconsumed 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:
None
Internal helpers¶
_tutorial_contrast¶
- bactoscoop.plot._tutorial_contrast(image)¶
Return a display range without changing the measured 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.
Return expressions in source:
(low, high if high > low else low + 1)
Original docstring (legacy wording may differ from the current signature)
Return a display range without changing the measured image.
_tutorial_crop¶
- bactoscoop.plot._tutorial_crop(shape, center, window_px)¶
tutorial crop.
- Parameters:
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.center – Input
centerconsumed by this implementation; its exact use is visible in the linked source below. No maintained parameter description is present in the original docstring.window_px – Cell plot window extent in pixels.
Return expressions in source:
(slice(y, min(y + window_px, shape[0])), slice(x, min(x + window_px, shape[1])))
_tutorial_channel_color¶
- bactoscoop.plot._tutorial_channel_color(label)¶
tutorial channel color.
- Parameters:
label – Input
labelconsumed 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:
'#197E89' '#1DBCD3' '#2BAE66' '#D85755'
_tutorial_channel_cmap¶
- bactoscoop.plot._tutorial_channel_cmap(label)¶
tutorial channel cmap.
- Parameters:
label – Input
labelconsumed 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:
LinearSegmentedColormap.from_list(f"bactoscoop_{label.replace(' ', '_')}", ['#000000', color])