@@ -4,7 +4,7 @@ | |||
classes that will let any user program the light modulator: SetupDevice() | |||
and SetProtocol().\n | |||
SetupDevice(self, panel_type="rgb", default_filter="No_Filter")\n\t | |||
SetupDevice(panel_type="rgb", default_filter="No_Filter")\n\t | |||
Initialise the light modulator and set the routines needed to control | |||
the hardware,ranging from light modulation, filte#r selection, | |||
temperature control and or image acquisition. This library also provides |
@@ -1,5 +1,28 @@ | |||
""" | |||
asd | |||
The `dataparser' module is responsible for collecting biological data from | |||
photographs stored in the light modulator. Currently this step is performed | |||
on the GUI side, but the light modulator can also capable to perform this | |||
task.\n | |||
PlateSniffer(dir_info, plate_reference, filter, debug=False)\n\t | |||
Routine to detect well location from image data. Using maximally stable | |||
extreme regions (MSRE) as core blob detection algorithm, this routine | |||
will detect the centre of each well of a microtitre plate. NOTE THAT | |||
ONLY THE X,Y COORDINATES OF THE WELLS WILL BE RETURNED, AND NOT THEIR | |||
SIZE. To reduce the bandwidth used to transfer data, it crops the raw | |||
image and re-calculates well locations. The method `detect_wells' | |||
requires a directory structure (`dir_info'), plate of reference, and | |||
filter as inputs. There's an optional `debug' flag, which defaults to | |||
false.\n | |||
PlateParser(dir_info, wells, filter, row_labels, col_labels, img_limits, | |||
time, debug=False)\n\t | |||
Collect biolotical data from photographs. `wells' is an object that | |||
contains wells (x,y) coordinates. The objects `row_labels' and | |||
`col_labels' are used to classify the well location following | |||
standardised notation for mitrotitre plate well locations | |||
(i.e. A1, A2,...,H12 for a 96-well microtitre plate). IMPORTANT: THIS | |||
METHOD IS CAPABLE OF USING MULTIPLE CORES TO ACCELERATE DATA PROCESSING. | |||
""" | |||
from .plate_sniffer import detect_wells as wells_id | |||
from .plate_reader import PlateParser as read_plate |
@@ -72,7 +72,11 @@ class PlateParser: | |||
def _multicore_reader(self, i, img_data_path, img_list, blank_data_path, | |||
blanks_list, radius, pixels_per_well, row_labels, | |||
col_labels, debug): | |||
""" DocString. """ | |||
""" | |||
This routine exploits the presence of multiple cores to accelerate | |||
image processing. Each file in `img_list' gets blank corrected and | |||
image data is stored using `wells' cached coordinates. | |||
""" | |||
img_filename = img_list[i] | |||
ref_image = blanks_list[i] | |||
img = cv2.imread(img_data_path + img_filename, cv2.IMREAD_COLOR) | |||
@@ -121,7 +125,10 @@ class PlateParser: | |||
def _read_wells(self, dir_info, wells, flt, row_labels, | |||
col_labels, img_limits, time, debug): | |||
""" Retrieve data distribution from images. """ | |||
""" | |||
Retrieve data from images using precalculated `wells' coordinates, | |||
and cropped using precalculated `img_limits'. | |||
""" | |||
img_data_path = dir_info.root_path + dir_info.protocol_path +\ | |||
dir_info.img_data_path + flt + "/" | |||
img_pattern = "_" + str(time) + "s_" |
@@ -59,7 +59,7 @@ def detect_wells(dir_info, plate_reference, flt, debug=False): | |||
# Adjust well position in a smaller image to be used downstream (FIXME: Needed? [YES]). | |||
img_c = crop_img(img, img_limits) # Optimise perf. | |||
## Maximally stable extremal region (MSER) blob detector. | |||
## Re-calculate well locations in newer, smaller image. | |||
# MSER = cv2.MSER_create() | |||
# blobs = MSER.detect(img_c) | |||
# wells = [b for b in blobs if not _filter_blobs(b, blobs)] |