Scan-o-Matic / scanomatic-standalone

GNU General Public License v3.0
0 stars 0 forks source link

Normalisation doesn't handle edge cases #164

Open skymandr opened 2 years ago

skymandr commented 2 years ago

πŸ› Description

Different colony positions in the SoM setup have different conditions for growth, which are not directly related to their phenotype. This is due to (among other things) differences in growth medium thickness, moisture levels, light conditions, temperature etc. SoM provides a spatial normalisation routine, based on control colonies with neutral phenotypes, meant to counteract this. However, as can be seen below, the normalisation routine still has problems with colonies along the edges: there are pronounced frames of higher and lower values along the edges.

Every fourth cell (one in each 2x2 neighbourhood) is a normalisation colony, used to diagnose and correct for spatial bias. In the figure below, the normalisation colonies along the left and top edges are one step in from their respective edges, whereas the normalisation colonies along the right and bottom edges are directly next to their edges.

It is known that colonies nearer the edges grow better, so the colonies along the top and left edges are normalised against cells that are in "worse" positions. The spatial normalisation fails to counter this, since it tries to approximate the spatial dependence from just, or at least primarily, the normalisation colonies in the near vicinity: the colonies one step in from the edge can't capture the considerably better conditions just one step out, right next to the edge.

The same tendency in reverse explains the darker frame in rows and columns 2 from the bottom and right respectively: the normalisation colonies, in this case, are in the better positions, and are therefore not representative for normalising their neighbours inside the plate. This problem is visible, but not as large.

A possible remedy would be to use information from the colonies in the mirrored positions as well, so that the normalisation colonies along the top edge can help normalise the cells along the bottom as well, though care must be taken to account for the fact that the situation is not completely symmetric within a plate. There may also be some symmetry across all four plates that could potentially be used.

πŸ”’ To reproduce

  1. Go to a project of your choice in QC
  2. Click on 'Normalize'
  3. Inspect the yield phenotype, either in QC or by loading normalized_phenotypes.npy with Numpy/MatPlotLib (note, however, that SoM displays the first row uppermost, unlike the default behaviour of e.g. pcolormesh).
  4. See error

✌🏽 Expected behaviour

No edge artefacts.

πŸ“· Screenshots

Results for normalized yield for PayamMartin19Oct16Scanner3

(the other projects have the same problem)

PayamMartin19Oct16Scanner3

local-minimum commented 2 years ago

I think mirrored position for the outer 4 frames at least could be useful with a edgeness metric (corners more than normal edge and rest by distance)