class documentation

A workflow optimised for scanning Histopathology samples.

This workflow automatically plans its own path around a sample spiralling out from the centre position, scanning only where it detects sample.

Method acquisition_routine Perform acquisition routine. This is run at each scan location.
Method all_settings Return the workflow and stitching settings.
Method check_before_start Before starting a scan, check that background and camera-stage-mapping are set.
Method create_smart_stack_params Set up the parameters used for all stacks in a scan.
Method new_scan_planner Return a new scan planner object.
Method pre_scan_routine Autofocus before starting the scan.
Class Variable display_name Undocumented
Class Variable max_range The maximum distance in steps from the centre of the scan.
Class Variable skip_background Whether to detect and skip empty fields of view.
Class Variable stack_dz Distance in steps between images in a z-stack.
Class Variable ui_blurb Undocumented
Instance Variable stack_images_to_save The number of images to save in a stack.
Instance Variable stack_min_images_to_test The minimum number of images to capture in a stack.
Property ready Whether this scanworkflow is ready to start.
Property settings_ui A list of PropertyControl objects to create the settings in the scan tab.
Class Variable _background_detector Undocumented

Inherited from RectGridWorkflow:

Class Variable autofocus_dz The z distance to perform an autofocus in steps.
Class Variable overlap The fraction that adjacent images should overlap in x and y.
Method _calc_displacement_from_overlap Use camera stage mapping to calculate x and y displacement from given overlap.
Method _get_stitching_settings_model Return a stitching settings model based on current settings.
Class Variable _csm Undocumented

Inherited from ScanWorkflow (via RectGridWorkflow):

Class Variable save_resolution A tuple of the image resolution to capture.
Method _autofocus_and_capture Autofocus and then capture, this can be used as an acquisition routine.
Class Variable _autofocus Undocumented
Class Variable _cam Undocumented
Class Variable _planner_cls Undocumented
Class Variable _settings_model Undocumented
Class Variable _stage Undocumented
def acquisition_routine(self, settings: HistoScanSettingsModel, xyz_pos: tuple[int, int, int]) -> tuple[bool, int | None]: (source)

Perform acquisition routine. This is run at each scan location.

Parameters
settings:HistoScanSettingsModelThe settings for this scan as a HistoScanSettingsModel
xyz_pos:tuple[int, int, int]The current position as a tuple or 3 ints.
Returns
tuple[bool, int | None]A tuple of whether an image was taken, and the z-position for focus. If failed to find focus, returns for the focus z-position.
def all_settings(self, images_dir: str) -> tuple[HistoScanSettingsModel, StitchingSettings]: (source)

Return the workflow and stitching settings.

Parameters
images_dir:strThe directory that images are to be written to.
Returns
tuple[HistoScanSettingsModel, StitchingSettings]A tuple containing the settings model for this workflow and the settings model for stitching.
def check_before_start(self, scan_name: str): (source)

Before starting a scan, check that background and camera-stage-mapping are set.

Raise error if:
  • background is to be skipped but is not set
  • camera stage mapping is not set

Raise warning if not using background detect that scan will go on until max steps reached

def create_smart_stack_params(self, images_dir: str, autofocus_dz: int, save_resolution: tuple[int, int]) -> SmartStackParams: (source)

Set up the parameters used for all stacks in a scan.

Parameters
images_dir:strthe folder to save all images
autofocus_dz:intthe range to autofocus over if a stack fails
save_resolution:tuple[int, int]The resolution to save the captures to disk with
Returns
SmartStackParamsA StackSmartParams object with the required parameters.
def new_scan_planner(self, settings: HistoScanSettingsModel, position: Mapping[str, int]) -> ScanPlanner: (source)

Return a new scan planner object.

Parameters
settings:HistoScanSettingsModelThe settings for this scan as a HistoScanSettingsModel
position:Mapping[str, int]The starting position as a mapping of axes names to int.
Returns
ScanPlannerUndocumented
def pre_scan_routine(self, settings: HistoScanSettingsModel): (source)

Autofocus before starting the scan.

Parameters
settings:HistoScanSettingsModelThe settings for this scan as a HistoScanSettingsModel
max_range: int = (source)

The maximum distance in steps from the centre of the scan.

skip_background: bool = (source)

Whether to detect and skip empty fields of view.

This uses the settings from the BackgroundDetectThing.

stack_dz: int = (source)

Distance in steps between images in a z-stack.

Suggested values:

  • 50 for 60-100x
  • 100 for 40x
  • 200 for 20x
stack_images_to_save: int = (source)

The number of images to save in a stack.

Defaults to 1 unless you need to see either side of focus

stack_min_images_to_test: int = (source)

The minimum number of images to capture in a stack.

This many images are captures and tested for focus, if the focus is not central enough more images may be captured. After new images are captured, this value sets the number of images used for checking if focus is achieved.

Defaults to 9 which balances reliability and speed.

@lt.property
ready: bool = (source)

Whether this scanworkflow is ready to start.

@lt.property
settings_ui: list[PropertyControl] = (source)

A list of PropertyControl objects to create the settings in the scan tab.

_background_detector: ChannelDeviationLUV = (source)

Undocumented