agora.io.cells.Cells¶
- class agora.io.cells.Cells(filename, path='cell_info')¶
Bases:
object
Extracts information from an h5 file. This class accesses:
‘cell_info’, which contains ‘angles’, ‘cell_label’, ‘centres’, ‘edgemasks’, ‘ellipse_dims’, ‘mother_assign’, ‘mother_assign_dynamic’, ‘radii’, ‘timepoint’, ‘trap’. All of these except for ‘edgemasks’ are a 1D ndarray.
‘trap_info’, which contains ‘drifts’, ‘trap_locations’
- Attributes
Methods
labelled_in_frame
(frame[, global_id])Return labels in a ndarray with the global ids with shape (ntraps, max_nlabels, ysize, xsize) at a given frame.
matrix_trap_tp_where
([min_ncells, ...])Return a matrix of shape (ntraps x ntps - min_consecutive_tps to indicate traps and time-points where min_ncells are available for at least min_consecutive_tps
mother_assign_from_dynamic
(ma, cell_label, ...)Interpolate the list of lists containing the associated mothers from the mother_assign_dynamic feature
where
(cell_id, trap_id)- Parameters
at_time
from_source
get_stacks_in_frame
group_by_traps
labels_at_time
labels_in_trap
mask
max_labels_in_frame
mother_assign_to_mb_matrix
mothers_in_trap
nonempty_tp_in_trap
outline
random_valid_trap_tp
- __init__(filename, path='cell_info')¶
Methods
__init__
(filename[, path])at_time
(timepoint[, kind])from_source
(source)get_stacks_in_frame
(frame, tile_shape)group_by_traps
(traps, cell_labels)labelled_in_frame
(frame[, global_id])Return labels in a ndarray with the global ids with shape (ntraps, max_nlabels, ysize, xsize) at a given frame.
labels_at_time
(timepoint)labels_in_trap
(trap_id)mask
(cell_id, trap_id)matrix_trap_tp_where
([min_ncells, ...])Return a matrix of shape (ntraps x ntps - min_consecutive_tps to indicate traps and time-points where min_ncells are available for at least min_consecutive_tps
max_labels_in_frame
(frame)mother_assign_from_dynamic
(ma, cell_label, ...)Interpolate the list of lists containing the associated mothers from the mother_assign_dynamic feature
mother_assign_to_mb_matrix
(ma)mothers_in_trap
(trap_id)nonempty_tp_in_trap
(trap_id)outline
(cell_id, trap_id)random_valid_trap_tp
([min_ncells, ...])where
(cell_id, trap_id)- Parameters
Attributes
edgemasks
Return all cell labels in object We use mother_assign to list traps because it is the only property that appears even when no cells are found
max_label
max_labels
Return nested list with final prediction of mother id for each cell
mothers_daughters
ncells_matrix
ntimepoints
ntraps
tile_size
tinterval
traps
- labelled_in_frame(frame: int, global_id=False) ndarray ¶
Return labels in a ndarray with the global ids with shape (ntraps, max_nlabels, ysize, xsize) at a given frame.
max_nlabels is specific for this frame, not the entire experiment.
- property labels: List[List[int]]¶
Return all cell labels in object We use mother_assign to list traps because it is the only property that appears even when no cells are found
- matrix_trap_tp_where(min_ncells: Optional[int] = None, min_consecutive_tps: Optional[int] = None)¶
Return a matrix of shape (ntraps x ntps - min_consecutive_tps to indicate traps and time-points where min_ncells are available for at least min_consecutive_tps
min_ncells: int Minimum number of cells min_consecutive_tps: int
Minimum number of time-points a
- Returns
- (ntraps x ( ntps-min_consecutive_tps )) 2D boolean numpy array where rows are trap ids and columns are timepoint windows.
- If the value in a cell is true its corresponding trap and timepoint contains more than min_ncells for at least min_consecutive time-points.
- static mother_assign_from_dynamic(ma, cell_label: List[int], trap: List[int], ntraps: int)¶
Interpolate the list of lists containing the associated mothers from the mother_assign_dynamic feature
- property mothers¶
Return nested list with final prediction of mother id for each cell
- where(cell_id: int, trap_id: int)¶
- Parameters
- cell_id: int
Cell index
- trap_id: int
Trap index
- Returns
- indices int array
- boolean mask array
- edge_ix int array