dcnum.feat
Feature computation
Submodules
Classes
Event extraction from label images |
|
Gate feature data |
Package Contents
- class dcnum.feat.QueueEventExtractor(slot_register: dcnum.logic.SlotRegister, pixel_size: float, gate: dcnum.feat.gate.Gate, event_queue: multiprocessing.Queue, extract_kwargs: dict | None = None, logger: logging.Logger | None = None)[source]
Event extraction from label images
This class is used for extracting events from label images. Events are appended to the event_queue for the writer.
- Parameters:
slot_register (.logic.slot_register.SlotRegister) – Chunk slot register
pixel_size – Imaging pixel size
gate (.gate.Gate) – Gating rules.
event_queue – Queue in which the worker puts the extracted event feature data.
extract_kwargs – Keyword arguments for the extraction process. See the keyword-only arguments in
QueueEventExtractor.get_events_from_masks().logger – Logger to use
- slot_register
Chunk slot register
- pixel_size
Imaging pixel size
- gate
Gating information
- event_queue
queue with event-wise feature dictionaries
- logger
- extract_kwargs = None
Feature extraction keyword arguments.
- get_events_from_masks(masks, chunk_slot, sub_index, *, brightness: bool = True, haralick: bool = True, volume: bool = True)[source]
Get events dictionary, performing event-based gating
- get_ppid()[source]
Return a unique feature extractor pipeline identifier
The pipeline identifier is universally applicable and must be backwards-compatible (future versions of dcnum will correctly acknowledge the ID).
The feature extractor pipeline ID is defined as:
KEY:KW_APPROACH
Where KEY is e.g. “legacy”, and KW_APPROACH is a list of keyword-only arguments for get_events_from_masks, e.g.:
brightness=True^haralick=True
which may be abbreviated to:
b=1^h=1
- class dcnum.feat.Gate(data, *, online_gates: bool = False, size_thresh_mask: int | None = None)[source]
Gate feature data
- Parameters:
data (.hdf5_data.HDF5Data) – dcnum data instance
online_gates (bool) – set to True to enable gating with “online” gates stored in the input file; online gates are applied in real-time deformability cytometry before writing data to disk during a measurement
size_thresh_mask (int) – Only masks with more pixels than
size_thresh_maskare considered to be a valid event; Originally, thebin area min / trig_threshvalue defaulted to 200 which is too large; defaults to 10 or the original value in caseonline_gatesis set.
- _default_size_thresh_mask = 10
the default value for size_thresh_mask if not given as kwarg
- box_gates
box gating (value range for each feature)
- kwargs
gating keyword arguments
- property features
Sorted list of feature gates defined
- get_ppid()[source]
Return a unique gating pipeline identifier
The pipeline identifier is universally applicable and must be backwards-compatible (future versions of dcnum will correctly acknowledge the ID).
The gating pipeline ID is defined as:
KEY:KW_GATE
Where KEY is e.g. “online_gates”, and KW_GATE is the corresponding value, e.g.:
online_gates=True^size_thresh_mask=5
- classmethod get_ppid_from_ppkw(kwargs)[source]
return full pipeline identifier from the given keywords
- gate_feature(feat: str, data: numbers.Number | numpy.ndarray)[source]
Return boolean indicating whether data value is in box gate
datamay be a number or an array. If no box filter is defined forfeat, True is always returned. Otherwise, either a boolean or a boolean array is returned, depending on the type ofdata. Not thatnp.logical_andcan deal with mixed argument types (scalar and array).