microscope_automation.orchestrator package¶
Submodules¶
microscope_automation.orchestrator.find_positions module¶
Created on Aug 23, 2018
Tools to find positions for imaging @author: winfriedw
-
microscope_automation.orchestrator.find_positions.
convert_location_list
(location_list, image, image_type='czi')[source]¶ Function to convert the coordinates to microns and relative to the center of the image. First all the locations are converted to microns using the pixel size of the image. Then the locations are converted so that they are relative to the center of the image instead of the bottom right corner. This calculation is done using the size of image.
- Input:
location_list: list of coordinates
image: imageAICS object with all the meta data
image_type: tiff or czi: both have different units for physical pixel size
- Output:
location_list_relative_to_zero: corrected location list
-
microscope_automation.orchestrator.find_positions.
copy_image_position
(sample_object, output_class, image, offset=(0, 0, 0))[source]¶ Create new object with zero position relative to center of image.
- Input:
sample_object: object that is searched
output_class: string with name of class of new created output object
image: image of class imageAICS
- offset: offset in um relative to center of image as (x, y, z)
Default: (0, 0, 0) (center of image)
- Output:
new_object: object of class output_class
-
microscope_automation.orchestrator.find_positions.
copy_zero_position
(sample_object, output_class, image, z_center_background=0)[source]¶ Create new object with identical zero position.
- Input:
sampleObject: object that is searched
output_class: string with name of class of new created output object
image: image of class imageAICS searched
z_center_background: center of background in the z direction
- Output:
new_objects: list with objects of class output_class
-
microscope_automation.orchestrator.find_positions.
create_output_objects_from_parent_object
(find_type, sample_object, imaging_settings, image, output_class, app, offset=(0, 0, 0))[source]¶ This function has methods to create output objects (cells, colonies, background) from the parent object(Well, colony)
- Input:
- find_type: string with name of search algorithm. Possible values:
‘copy_zero_position’: keep position ‘copy_image_position’: use center of image as object zero position ‘CenterMassCellProfiler’ : find cells using cell profiler ‘TwofoldDistanceMap’ : find cells in a colony using two fold distance map ‘Interactive’: select position interactively ‘InteractiveDistanceMap’: shows recommended positions (by segmentation) & can select them interactively
sample_object: object that is searched
imaging_settings: settings from preferences file
image: image of class imageAICS searched
output_class: class of new created output object
app: object of class QtGui.QApplication
- offset: offset in um relative to center of image as (x, y, z)
Default: (0, 0, 0) (center of image)
- Output:
[new_objects, new_objects_dict]: [list with objects of class output_class, dictionary with name and objects]
-
microscope_automation.orchestrator.find_positions.
find_interactive_distance_map
(sample_object, output_class, image, segmentation_settings=None, app=None)[source]¶ Create new object with zero position based on interactive selection.
- Input:
sampleObject: object that is searched
output_class: string with name of class of new created output object
image: image of class imageAICS
segmentation_settings: settings from preferences file
app: object of class QtGui.QApplication
- Output:
[new_objects, new_objects_dict]: [list with objects of class output_class, dictionary with name and objects]
-
microscope_automation.orchestrator.find_positions.
find_interactive_position
(sample_object, output_class, image, app)[source]¶ Create new object with zero position based on interactive selection.
- Input:
sample_object: object that is searched
output_class: string with name of class of new created output object
image: image of class imageAICS
app: object of class QtGui.QApplication
- Output:
new_objects: list with objects of class output_class
-
microscope_automation.orchestrator.find_positions.
get_single_slice
(image)[source]¶ Return single image slice.
- Input:
image: image of class imageAICS
- Output:
image_data: 2D numpy array
-
microscope_automation.orchestrator.find_positions.
location_to_object
(sample_object, output_class, image, location_list)[source]¶ Convert position list to new objects.
- Input:
sample_object: object that is searched
output_class: string with name of class of new created output object
image: image of class imageAICS
location_list: list of coordinates
- Output:
[new_objects, new_objects_dict]: [list with objects of class output_class, dictionary with name and objects]
-
microscope_automation.orchestrator.find_positions.
segmentation
(image_data, segmentation_type='colony', segmentation_settings=None)[source]¶ Different algorithms to segment sample.
- Input:
image_data: 2D numpy array with image data
- segmentation_type: possible values:
‘colony’: segment hiPSC colonies (default) ‘otsu’: intensity segmentation based on Ostu algorithm
segmentation_settings: settings from preferences file. Default (None) use default settings
- Output:
segmented_position_list: list with (x, y) positions
microscope_automation.orchestrator.microscope_automation module¶
Main script for Microscope automation Created on Jun 9, 2016
@author: winfriedw
-
class
microscope_automation.orchestrator.microscope_automation.
MicroscopeAutomation
(prefs, app=None)[source]¶ Bases:
object
-
calculate_all_wells_correction
(prefs, plate_holder_object, _experiment)[source]¶ Calculate correction factor for well coordinate system for all wells.
- Input:
prefs: dictionary with preferences
plate_holder_object: object for plateholder that contains well
_experiment: not used, necessary for compatibility
- Output:
none
-
calculate_plate_correction
(prefs, plate_holder_object, _experiment)[source]¶ Calculate correction factor for plate coordinate system.
- Input:
prefs: dictionary with preferences
plate_holder_object: object for plate that contains well
_experiment: not used, necessary for compatibility
- Output:
none
-
control_autofocus
(sample_object, imaging_settings)[source]¶ Switch on/off autofocus.
- Input:
sample_object: object of class inherited from ImagingSystem
imaging_settings: settings derived from preferences file
- Output:
none
-
get_barcode_object
(well_object, barcode)[source]¶ Return Barcode object for given well.
- Input:
well_object: object for well that contains barcode
barcode: string of name for barcode
- Output:
barcode_object: object for barcode
-
get_objective_offsets
(plate_holder_object, magnification)[source]¶ Function to return the objective offsets
- Input:
plate_holder_object: Plate Holder object containing all the information
magnification: integer defining which objective to get offsets for
- Output:
x and y offsets for objectives
-
get_well_object
(plate_holder_object, plate_name, well)[source]¶ Return well object for given well.
- Input:
plate_holder_object: object for plateholder that contains well
plate_name: name for plate, typically barcode
well: name of well in form ‘A1’
- Output:
well_object: object for well
-
initialize_microscope
(initialize_prefs, plate_holder_object, _experiment)[source]¶ Update z positions for plate (upper side of coverslip) Set load and work positions for focus drive.
- Input:
initialize_prefs: dictionary with preferences
plate_holder_object: object of type PlateHolder from module sample with well information
_experiment: not used, necessary for compatibility
- Output:
none
-
read_barcode
(prefs, plate_holder_object, barcode, well=None, barcode_name=None)[source]¶ Move manually to barcode, read and decipher barcode.
- Input:
prefs: dictionary with preferences
plate_holder_object: object of type PlateHolder from module sample with well information
barcode: barcode for plate, often used as plate name
well: well the barcode is associated with in format ‘A1’. If empty ask user to navigate to barcode.
- Output:
barcode: id encoded in barcode
-
read_first_barcode_from_plateholderobject
(plate_holder_object)[source]¶ Given plate_holder_object that can store one plate, return that plate’s barcode.
- Input:
plate_holder_object: object of type PlateHolder from module sample with well information
- Output:
barcode: barcode of plate in plate_holder_object
-
recover_previous_settings
(plate_holder_object, plate_object, experiment)[source]¶ Recover the the objects created in the last experiment and attach them to the right objects.
- Input:
plate_holder_object: object of type PlateHolder from module sample with well information
plate_object: object of class plate
experiment: dictionary with keys ‘Experiment’, Repetitions’, ‘Input’, ‘Output’, ‘WorkflowList’, ‘WorflowType’, ‘ObjectsDict’ and ‘OriginalWorkflow’
- Output:
none
-
run_macro
(imaging_settings, plate_holder_object, experiment=None, repetition=0, wait_after_image=None)[source]¶ - Input:
imaging_settings: dictionary with preferences
plate_holder_object: object of type PlateHolder from module sample with well information
experiment: not used, necessary for compatibility
repetition: not used, necessary for compatibility
wait_after_image: not used, necessary for compatibility
- Output:
none
-
save_segmented_image
(imaging_settings, image_data, location_list, plate_object, well_object)[source]¶ A simple function to save the positions that were a result of well segmentation and represent which positions will be imaged in 100X
- Input:
imaging_settings: yaml preferences
image_data: pixel data of the image
location_list: list of positions approved by the user
plate_object: plate object
well_object: well object associated with the image
- Output:
none
-
scan_all_objects
(imaging_settings, sample_list, plate_object, experiment, repetition=0, wait_after_image=None)[source]¶ Scan all objects in dictionary.
- Input:
imaging_settings: dictionary with preferences
sample_list: list with all objects to scan
plate_object: object sample list belongs to
experiment: dictionary with keys ‘Experiment’, Repetitions’, ‘Input’, ‘Output’, ‘WorkflowList’, ‘WorflowType’, ‘ObjectsDict’ and ‘OriginalWorkflow’
repetition: counter for time lapse experiments
wait_after_image: wait preferences as dictionary to determine whether to wait after execution
Image: Wait after each image
Plate: Reset wait status after each plate
Repetition: Reset wait status after each repetition
Status: Show last image and allow adjustments if True, enter fully automatic mode if False
- Output:
none
-
scan_plate
(imaging_settings, plate_holder_object, experiment, repetition=0, wait_after_image=None)[source]¶ Scan selected wells in plate to create overview.
- Input:
imaging_settings: dictionary with preferences
plate_holder_object: object of type PlateHolder from module sample with well information
experiment: dictionary with keys ‘Experiment’, Repetitions’, ‘Input’, ‘Output’, ‘WorkflowList’, ‘WorflowType’, ‘ObjectsDict’ and ‘OriginalWorkflow’
repetition: counter for time lapse experiments
wait_after_image: wait preferences as dictionary to determine whether to wait after execution
Image: Wait after each image
Plate: Reset wait status after each plate
Repetition: Reset wait status after each repetition
Status: Show last image and allow adjustments if True, enter fully automatic mode if False
- Output:
none
-
scan_samples
(imaging_settings, plate_holder_object, experiment, repetition=0, wait_after_image=None)[source]¶ Step through all plates and call scan_all_objects.
- Input:
imaging_settings: dictionary with preferences
plate_holder_object: object of type PlateHolder from module sample with well information
experiment: dictionary with keys ‘Experiment’, Repetitions’, ‘Input’, ‘Output’, ‘WorkflowList’, ‘WorflowType’, ‘ObjectsDict’ and ‘OriginalWorkflow’
repetition: counter for time lapse experiments
wait_after_image: wait preferences as dictionary to determine whether to wait after execution
Image: Wait after each image
Plate: Reset wait status after each plate
Repetition: Reset wait status after each repetition
Status: Show last image and allow adjustments if True, enter fully automatic mode if False
- Output:
none
-
scan_single_ROI
(imaging_settings, experiment_dict, sample_object, reference_object, image_path, meta_dict, verbose=True, number_selected_postions=0, repetition=0)[source]¶ Acquire tiled image as defined in pos_list
- Input:
imaging_settings: dictionary with preferences
experiment_dict: The dictionary with full information about the experiment
sample_object: object of a sample type (e.g. cell, colony) to be imaged
reference_object: object used to set parfocality and parcentricity, typically a well in plate
image_path: string for filename with path to save image in original format or tuple with string to directory and list with template for file name. Default=None: no saving
meta_dict: directory with additional meta data, e.g. {‘aics_well’:, ‘A1’}
verbose: if True print debug information (Default = True)
number_selected_postions: number of positions collected so far
repetition: counter for time lapse experiments
- Output:
return_dict: dictionary of form {‘Image’: [images], ‘Continue’: True/False}
-
scan_wells_zero
(prefs, plate_holder_object, barcode)[source]¶ Scan selected wells at center. This method is mainly used to test calibrations.
- Input:
prefs: dictionary with preferences
plate_holder_object: object of type PlateHolder from module sample with well information
barcode: barcode for plate, often used as plate name
- Output:
none
-
segment_wells
(imaging_settings, plate_holder_object, experiment, repetition, wait_after_image=None)[source]¶ Writes a position list of segemented wells to a CSV file.
- Input:
imaging_settings: dictionary with preferences
plate_holder_object: Plate Holder object containing all the information
experiment: dictionary with keys ‘Experiment’, Repetitions’, ‘Input’, ‘Output’, ‘WorkflowList’, ‘WorflowType’, ‘ObjectsDict’ and ‘OriginalWorkflow’
repetition: counter for time lapse experiments
wait_after_image: wait preferences as dictionary to determine whether to wait after execution
Image: Wait after each image
Plate: Reset wait status after each plate
Repetition: Reset wait status after each repetition
Status: Show last image and allow adjustments if True, enter fully automatic mode if False
- Output:
none
-
set_objective_offset
(offset_prefs, plate_holder_object, _experiment)[source]¶ Set parfocality and parcentricity for objectives used in experiments.
- Input:
offset_prefs: dictionary with preferences based on preferences.yml
plate_holder_object: object that contains all plates and all wells with sample information.
_experiment: not used, necessary for compatibility
- Output:
none
-
set_up_koehler
(initialize_prefs, plate_object)[source]¶ Set up Koehler illumination.
- Input:
initialize_prefs: dictionary with preferences based on preferences.yml
plate_object: object of class plate
- Output:
none
-
set_up_objectives
(set_up_settings, plate_holder_instance, _experiment)[source]¶ Retrieve objectives mounted at microscope.
- Input:
set_up_settings: dictionary with preferences
plate_holder_instance: object of type PlateHolder from module sample with well information
_experiment: not used, necessary for compatibility
- Output:
none
-
setup_immersion_system
(prefs, plate_holder_instance)[source]¶ Setup system to deliver immersion water
- Input:
prefs: dictionary with preferences
plate_holder_instance: instance for plateholder that contains immersion system
- Output:
none
-
update_plate_z_zero
(image_settings, plate_holder_object, experiment)[source]¶ Update z positions for plate (upper side of coverslip) Set load and work positions for focus drive.
- Input:
image_settings: dictionary with preferences
plate_holder_object: object of type PlateHolder from module sample with well information
experiment: dictionary with keys ‘Experiment’, Repetitions’, ‘Input’, ‘Output’, ‘WorkflowList’, ‘WorflowType’, ‘ObjectsDict’ and ‘OriginalWorkflow’
- Output:
none
-
microscope_automation.orchestrator.write_zen_tiles_experiment module¶
Export position list for ZEN blue tiles experiment (.czsh) Created on Jul 26, 2019
authors: Brian Kim, Calysta Yan, winfriedw
-
class
microscope_automation.orchestrator.write_zen_tiles_experiment.
PositionWriter
(zsd, plate, production_path, testing_mode=False)[source]¶ Bases:
object
Converts positions to stage coordinates, saves positions to .czsh file
- Requirements:
1) Ensure the dummy_tile_positions.czsh path is specified in preferences under key “PathDummy”
-
convert_to_stage_coords
(offset_x=0, offset_y=0, positions_list=[], header=False)[source]¶ Converts the distance of points from center of image to x-y coordinates in stage with 10 to 100x objective offsets.
- Input:
offset_x: x_offset to account for in stage coordinate conversion
offset_y: y_offset to accoutn for in stage coordinate conversion
positions_list: center of well positions to convert to stage coordinates
header: boolean of whether positions_list includes a header. Skips the first row if True. Default: False
- Output:
converted_list: stage coordinates of positions converted from center of well positions
-
get_next_pos_name
(test_mode=False, test_file_names=[])[source]¶ Find the next available letter label, but dont backfill files.
- Input:
test_mode: False by default. Runs in test mode if True.
test_file_names: list of test file names to use if running in test mode
- Output:
label: unused alphabetical label for new positions list
Module contents¶
Orchestrator package for Microscope Automation.