-
Notifications
You must be signed in to change notification settings - Fork 0
12th Dec 2023: Segmenting plates into array of sub‐images
I've encapsulated the code used to segment multiwell plate images in a separate repo / pip package here: https://github.com/murraycutforth/segment-multiwell-plate. This code uses some cute image analysis algorithms to automatically find the grid of wells without hard-coding the well size and position.
The rest of the image processing code is in image_processing.py
here in this repo.
I downloaded 49 .tif images, equating to about 5GB of image data.
Processing failed on two images: 20231014 99-M3 20h ML
and 20231015 99-M4 2h-2h
. In both cases, when averaging over the stack of images, the grid finder found a 16 x 48 grid, and it looks like multiple plate images are all stacked together, with the plate placed slightly differently?
All plates (except the 10x24 test plate) were automatically detected to have 384 (16x24) wells, showing that the automatic grid finder / segmentation code is working reliably for our plates.
For example:
Mostly 88 or 168, but with a number of other values - is this expected?
This seems like a suspiciously high number of empty wells. Looking at the plate with the most empty wells of all, 20231030 4-M1 1min-1min
with 78 empty wells:
The z-averaged (over 328 time points) image is:
Comparing the first and last time points:
The mask array is:
This is again showing the issue where multiple plates are stacked together in one tif image, and so the mask shows the combined number of blanks from two plates by the looks of it.
There is also a single plate with zero blanks: 20231202 99-M2 20h HL
. Examining the z-averaged image:
This looks correct in that the top left grid cell image is showing some fluorescence. However, the mask threshold is calculated on an assumption that this cell is empty (and so we use it to estimate background noise), so as a result for this plate the threshold is erroneously high so a lot of the valid fluorescent regions are ignored by the mask:
This is a measure which I came up with to test whether fluorescence was overflowing the individual well images. If the mask touches the edge of the image at any point, this counts as an overlap. This should help find errors either with grid positioning or thresholding. The plot above shows that with the current algorithm only a single plate exhibits overlapping masks, which was the test plate 20230323 3h-3h Y(II)
:
The fact that no other overlapping masks were detected may indicate that our threshold used to compute the mask is too high, and perhaps we are under-segmenting the fluorescence area.
The outlying value corresponds to the plate 20231202 99-M2 20h HL
which we found does not have a blank in the top left well.
- The image analysis pipeline to divide each image into an array of single-well images is working.
- There appear to be quite a few issues in the data where multiple plate images have ended up stacked together. Maybe we can automatically detect these cases from the name and number of frames?
- We should look a bit further into the threshold value used to compute the mask, and think of a way to make this value robust to the case where the top left well is not blank (to fix
20231202 99-M2 20h HL
) - Start looking at the next step in the pipeline - computing NPQ?
It looks pretty good! In relationship with your final points:
- When there are multiple plates imaged, we will redo the analysis
- The issue with the top left corner not being blank should not happen again so IDT it's a big problem
- Next step in the pipeline would be looking at the yield of PSII (Y(II)), which will be informative for looking at strains with a better efficiency or sensitive to light