SCTrack.feature module

class SCTrack.feature.Feature(center, bbox, area=None, shape=None, cell_type=None, dic_intensity=None, dic_variance=None, mcy_intensity=None, mcy_variance=None, frame=None)[source]

Bases: object

All features contained in each cell instance, including the following:
  • area: cell area

  • bbox_area: bounding box area

  • shape: sequence of cell outline coordinates

  • center: cell center coordinates

  • vector: the vector of the cell relative to the origin

  • bbox: the bounding box coordinates of the cell [y_min, y_max, x_min, x_max]

  • dic_intensity: the dic gray value intensity of the mask area

  • mcy_intensity: mcy gray value intensity of the mask area

  • cell_type forecast period

class SCTrack.feature.FeatureExtractor(*args, **kwargs)[source]

Bases: object

Extract available features for each cell in a single image

GetAreaByVector(points: List)[source]
add_cell(new_cell: Cell)[source]
area(cell)[source]

cell area

bbox(cell: Cell)[source]

bounding box coordinates

property cells
convert_dtype(_FeatureExtractor__image: ndarray) ndarray[source]

Convert image from uint16 to uint8

coord2counter(coord)[source]
coordinate2mask(coords: np.ndarray | list | tuple, shape, value: int = 255) List[Mask][source]

Draw the mask according to the contour coordinates. If you only pass in a set of contour coordinate values, be sure to put them in the list and pass in the function. For example, coord = ([x1 x2 … xn], [y1 y2 … yn]), please call it according to coordinate2mask([coord])

ellipse_points(center, rx, ry, num_points=100, theta=0)[source]
extract(cell: Cell) Feature[source]
Parameters:

cell – Cell object

Returns:

Feature object

get_cell_image(cell: Cell)[source]

Get dic and mcy images of cells

get_cell_list()[source]

Get all cells in each single frame image

get_regions()[source]
get_roi_from_coord(cell: Cell, image: ndarray)[source]

Use the cell outline to obtain the dic image or the mcy image, depending on the incoming image parameters. :param cell: Cell object :param image: dic image or mcy image, that is, the parameter self.mcy or self.dic :return: roi np.ndarray

get_roi_from_mask(mask, image)[source]
set_cell_image(cell: Cell)[source]

Set dic information and mcy information for cell instance :param cell: Cell object :return: Cell object containing image information

static show(image)[source]
class SCTrack.feature.Mask(mask=None, center=None, coord=None)[source]

Bases: object

property center: Tuple[int | float]
property mask
SCTrack.feature.feature_extract(mcy, dic, jsonfile: str | dict)[source]

Return the FeatureExtractor instance frame by frame, including the current frame, the previous frame, and the next frame

SCTrack.feature.get_frame_by_index(image: ndarray, index: int) ndarray[source]
SCTrack.feature.imread(filepath: str | os.PathLike) np.ndarray[source]