livecellx.core.SingleCellStatic

class livecellx.core.SingleCellStatic(timeframe=None, bbox=None, regionprops=None, img_dataset=None, mask_dataset=None, dataset_dict=None, feature_dict=None, contour=None, meta=None, uns=None, id=None, cache=None, update_mask_dataset_by_contour=False, empty_cell=False, tmp=None)[source]

Single cell at one time frame

_summary_

Parameters:
  • timeframe (int) – _description_

  • bbox (np.array, optional) – [x1, y1, x2, y2], by default None follwoing skimage convention: “Bounding box (min_row, min_col, max_row, max_col). Pixels belonging to the bounding box are in the half-open interval [min_row; max_row) and [min_col; max_col).”

  • regionprops (RegionProperties, optional) – _description_, by default None

  • img_dataset (_type_, optional) – _description_, by default None

  • feature_dict (dict, optional) – _description_, by default {}

  • contour (Optional[array]) – an array of contour coordinates [(x1, y1), (x2, y2), …)], in a WHOLE image (not in a cropped image)

  • empty_cell (bool) – use when intend to create an empty cell object. suppress the empty warning.

Methods

add_feature(name, features)

compute_iomin(other_cell[, bbox])

compute_iou(other_cell[, bbox])

compute_overlap_mask(other_cell[, bbox])

compute_overlap_percent(other_cell[, bbox])

compute overlap defined by: overlap = intersection / self's area.

compute_regionprops([crop, ignore_errors])

copy()

gen_contour_mask(contour[, img, shape, ...])

rtype:

array

gen_skimage_bbox_img_crop(bbox, img[, ...])

get_bbox()

rtype:

array

get_bbox_from_contour(contour[, dtype])

get the bounding box of a contour

get_bbox_on_crop([bbox, padding])

get_center([crop])

get_contour()

rtype:

array

get_contour_coords_on_crop([bbox, padding])

get_contour_coords_on_img_crop([padding])

A utility function to calculate pixel coord in image crop's coordinate system to draw contours on an image crop.

get_contour_img([crop, bg_val])

return a contour image with background set to background_val

get_contour_label_mask([padding, crop, ...])

rtype:

array

get_contour_mask([padding, crop, bbox, dtype])

rtype:

array

get_contour_mask_closed_form([padding, crop])

If contour points are pixel-wise closed, use this function to fill the contour.

get_feature_pd_series()

get_img()

get_img_crop([padding, bbox])

get_label_mask([dtype])

get_label_mask_crop([bbox, dtype])

get_mask([dtype])

get_mask_crop([bbox, dtype])

get_napari_shape_bbox_vec()

get_napari_shape_contour_vec([...])

get_napari_shape_vec(coords)

get_sc_img([crop, bg_val])

return a contour image with background set to background_val

get_sc_label_mask([padding, crop, bbox, dtype])

rtype:

array

get_sc_mask([padding, crop, bbox, dtype])

rtype:

array

inflate_from_json_dict(json_dict[, ...])

load from json dict

load_from_json_dict(json_dict[, ...])

load from json dict

load_single_cells_json(path[, verbose])

load a json file containing a list of single cells

load_single_cells_jsons(paths)

rtype:

List[SingleCellStatic]

segment_by_cellpose()

segment_by_detectron()

show([crop, padding, ax])

show_contour_img([padding, ax, crop])

show_contour_mask([padding, ax, crop])

show_label_mask([padding, ax, crop])

show_mask([crop, padding, ax])

show_panel([padding, figsize])

show_whole_img([ax])

show_whole_mask([ax])

to_json_dict([include_dataset_json, ...])

returns a dict that can be converted to json

update_bbox([bbox])

update_contour(contour[, update_bbox, ...])

update_regionprops()

update_sc_mask_by_crop(mask[, ...])

Updates the single cell mask by cropping the input mask to the bounding box of the single cell and updating the contour.

write_json([path, dataset_json_dir])

write_single_cells_json(single_cells, path)

write a json file containing a list of single cells

Attributes

AUTOENCODER_FEATURE_KEY

CACHE_IMG_CROP_KEY

HARALICK_FEATURE_KEY

MORPHOLOGY_FEATURE_KEY

id_generator