AllenInstitute / ophys_etl_pipelines

Pipelines and modules for processing optical physiology data
Other
9 stars 5 forks source link

Support larger growth windows in Feature Vector Segmenter #302

Closed danielsf closed 3 years ago

danielsf commented 3 years ago

When the Feature Vector Segmenter attempts to grow an ROI, it starts by correlating a 40x40 pixel window centered on the ROI seed and attempts to grow the ROI in that window. If that proves too small, it grows the window up to 80x80 pixels. If that is still too big, it logs the ROI it has found and moves on.

In some inhibitory experiments (e.g. 850517348) this window proves too small, and large cells get shredded into multiple ROIs with poor merging properties (see the "small window" panel in the plot below).

This branch

https://github.com/AllenInstitute/ophys_etl_pipelines/tree/segmentation/dev/expose/window

is a prototype of a branch which allows the user to specify different minimum and maximum window sizes. Running it with a minimum window size of 100x100 pixels and a maximum of 200x200 pixels improved the situation.

850517348_window_comparison.png

The center panel shows the ROIs found with the default FVS. The right panel shows the ROIs found with the larger growth windows. Note that the large ROI on the far right is no longer shredded into a bunch of very small ROIs. Note also that there are some ROIs that are probably erroneously merged into one (around row, col = (220, 256) and (470, 410)).

Note: this branch should not be taken as a final implementation. It is poorly tested, probably broke the PCA segmenter, and has poor memory usage as the windows grow. This is just a proof of concept.

The purpose of this ticket is to attempt to find a balance between the two behaviors so that we can better segment inhibitory experiments like this one with large cells.

danielsf commented 3 years ago

For further reference, this shows the results of allowing the window size parameters to vary from 20-40 (default), 50-100 (previous test), and 20-100adaptive_plot.png

The ROIs that were erroneously merged in the 50-100 case appear distinct again when small pixel windows are allowed. However, the larger ROIs still exhibit some (very extreme in the case of the upper left circular ROI) over segmentation.

Probably the right answer is to have the FVS make an educated guess what the initial window size should be, based on the metric image.

danielsf commented 3 years ago

Addressed by #319