Closed danielsf closed 2 years ago
Looking through the legacy code, I think what it did was:
1) For each frame, apply a median filter with a 3x3 kernel (i.e. assign each pixel the median value of the 3x3 grid of pixels centered on it) 2) Accumulate a naive maximum projection of the median filtered frames
There was an option in the legacy code for decimation (downsampling the videos in time), but it looks like it was run with a decimation rate of 1, meaning that the videos were taken at their native frame rate.
I will implement the scheme I described above and run it on movies for which we still have legacy max projections to see if the results look good enough for the scientists.
I believe this is an accurate description of the algorithm.
Here is an example "just use np.max" maximum projection image
Here is the legacy maximum projection of the same experiment
Here is what results from 1) downsampling the movie to 4 Hz 2) applying a median filter to every frame of the downsampled movie 3) running np.max on the median filtered frames from (2)
I'll generate a few more examples, but this looks close enough to the legacy maximum projection as makes no difference. I'll formalize this into something we can call as part of our LIMS pipeline and issue a PR.
Some of the scientists have expressed concern that the max projection images coming out of the modern (~ 2021) pipeline do not look like the max projection images coming out of the legacy pipeline. We should make a good-faith effort to bring the two in-line.
The code generating the modern max projection images is here
https://github.com/AllenInstitute/ophys_etl_pipelines/blob/main/src/ophys_etl/modules/suite2p_registration/__main__.py#L95-L112
and here
https://github.com/AllenInstitute/ophys_etl_pipelines/blob/main/src/ophys_etl/modules/suite2p_registration/utils.py#L6-L31
which appears to just apply
np.arra(data, axis=0)
to the movie data (i.e. for each pixel, take its maximum over time).The legacy max projection code originates from here
http://stash.corp.alleninstitute.org/projects/OM/repos/aibs.transcode/browse/src/maximum_intensity_projection.cpp
and likely involves some series of median and Gaussian filters. From an email, the legacy max projection images which the scientists would like to see can be found
Tasks
Validation