navigate.model.features.remove_empty_tiles.DetectTissueInStackAndRecord
- class navigate.model.features.remove_empty_tiles.DetectTissueInStackAndRecord(model, planes=1, percentage=0.75, position_records=None, detect_func=None, threshold=150)
Bases:
DetectTissueInStackDetect Tissue in a Stack of Images and Record Positions.
This class extends the functionality of detecting tissue in a stack of images and also records positions where tissue was detected.
- __init__(model, planes=1, percentage=0.75, position_records=None, detect_func=None, threshold=150)
Initialize the DetectTissueInStackAndRecord class.
- Parameters:
model (object) – The model object representing the microscope.
planes (int, optional) – The number of Z planes to capture in the stack. Default is 1.
percentage (float, optional) – The minimum fraction of tissue-positive frames required for the stack to be considered as having tissue. Default is 0.75 (75%).
position_records (list, optional) – A list to record positions where tissue was detected. A new list is created when no list is provided.
detect_func (function, optional) – The custom tissue detection function to use. If not specified, the default detect_tissue3 function will be used. The function must accept
(image_data, threshold)and return whether the frame contains tissue.threshold (float, optional) – The intensity threshold passed to
detect_func. Default is 150.
Methods
__init__(model[, planes, percentage, ...])Initialize the DetectTissueInStackAndRecord class.
Data processing function to end the data phase.
Signal processing function to end the signal phase.
in_func_data(frame_ids)Data processing function to analyze image frames for tissue presence.
Signal processing function to move the microscope stage.
Initialization function for data processing.
Initialization function for signal processing.
Attributes
- end_func_data()
Data processing function to end the data phase. Extends the base class method.
This method is called to determine whether the data phase should end. It checks if the specified number of frames have been received and updates the position record.
- Returns:
True if the data phase should end, False otherwise.
- Return type:
bool
- end_func_signal()
Signal processing function to end the signal phase.
This method is called to determine whether the signal phase should end. It checks if the specified number of Z planes have been scanned.
- Returns:
True if the signal phase should end, False otherwise.
- Return type:
bool
- in_func_data(frame_ids)
Data processing function to analyze image frames for tissue presence.
This method is called during the data processing phase to analyze image frames for tissue presence. It checks if any of the received frames contain sufficient tissue.
- Parameters:
frame_ids (list) – A list of frame IDs to analyze.
- Returns:
True if tissue is detected, False otherwise.
- Return type:
bool
- in_func_signal()
Signal processing function to move the microscope stage.
- This method is called during the signal processing phase to move the microscope
stage to the specified Z and F positions. It increments the Z and F positions for each scan.
- pre_func_data()
Initialization function for data processing. Extends the base class method.
This method is called at the beginning of the data processing phase and initializes variables for tracking received frames, tissue detection, and records the position.
- pre_func_signal()
Initialization function for signal processing.
This method is called at the beginning of the signal processing phase and initializes the necessary parameters for moving the microscope stage.
- detect_func
The tissue detection function used to analyze image frames.
- Type:
function
- model
The model object representing the microscope.
- Type:
navigate.model.Model
- parameter_schema = {'detect_func': SettingSpec(value_type=<class 'str'>, default=None, label='Detection Function', help_text='Optional detection callable. Leave empty (or choose None if applicable) for the default detector.', choices=None, choice_values=None, minimum=None, exclusive_minimum=None, maximum=None, step=None, required=False, dynamic_source=None, depends_on=None), 'percentage': SettingSpec(value_type=<class 'float'>, default=0.75, label='Positive Fraction', help_text='Minimum fraction of tissue-positive frames required in a stack .', choices=None, choice_values=None, minimum=0, exclusive_minimum=None, maximum=1, step=0.01, required=True, dynamic_source=None, depends_on=None), 'planes': SettingSpec(value_type=<class 'int'>, default=1, label='Planes', help_text='Number of z/f planes to capture in a stack for tissue detection.', choices=None, choice_values=None, minimum=1, exclusive_minimum=None, maximum=None, step=1, required=True, dynamic_source=None, depends_on=None), 'threshold': SettingSpec(value_type=<class 'float'>, default=150, label='Threshold', help_text='Intensity threshold passed to the detection function.', choices=None, choice_values=None, minimum=0, exclusive_minimum=None, maximum=None, step=1, required=True, dynamic_source=None, depends_on=None)}
- percentage
The minimum percentage of images having tissue in a stack.
- Type:
float
- planes
The number of Z planes to capture in the stack.
- Type:
int
- threshold
The intensity threshold for tissue detection.
- Type:
float