agora.io.cells.Cells¶
- class Cells(filename, path='cell_info')[source]¶
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
- edgemasks
labels
Return all cell labels in object
- max_label
- max_labels
- mothers
Return nested list with final prediction of mother id for each cell
- mothers_daughters
Return mothers and daugters as a single array with three columns: trap, mothers and daughters
- ncells_matrix
- ntimepoints
- ntraps
- tile_size
- tinterval
- traps
Methods
group_by_traps
(traps, cell_labels)Returns a dict with traps as keys and list of labels as value.
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
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
Methods
__init__
(filename[, path])at_time
(timepoint[, kind])from_source
(source)get_stacks_in_frame
(frame, tile_shape)group_by_traps
(traps, cell_labels)Returns a dict with traps as keys and list of labels as value.
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)- rtype
Dict
[int
,List
[int
]]
labels_in_trap
(trap_id)- rtype
Set
[int
]
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)- rtype
List
[int
]
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)- rtype
set
outline
(cell_id, trap_id)random_valid_trap_tp
([min_ncells, ...])where
(cell_id, trap_id)- Parameters
Attributes
edgemasks
- rtype
List
[ndarray
]
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
- rtype
int
max_labels
- rtype
List
[int
]
Return nested list with final prediction of mother id for each cell
Return mothers and daugters as a single array with three columns: trap, mothers and daughters
ncells_matrix
ntimepoints
- rtype
int
ntraps
- rtype
int
tile_size
- rtype
Union
[int
,Tuple
[int
],None
]
tinterval
traps
- rtype
List
[int
]
- group_by_traps(traps, cell_labels)[source]¶
Returns a dict with traps as keys and list of labels as value. Note that the total number of traps are calculated from Cells.traps.
- Return type
Dict
[int
,List
[int
]]
- labelled_in_frame(frame, global_id=False)[source]¶
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.
- Return type
ndarray
- 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
- Return type
List
[List
[int
]]
- matrix_trap_tp_where(min_ncells=None, min_consecutive_tps=None)[source]¶
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
Parameters¶
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, trap, ntraps)[source]¶
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
- property mothers_daughters: ndarray¶
Return mothers and daugters as a single array with three columns: trap, mothers and daughters