schnitzer-lab / EXTRACT-public

EXTRACT is a tractable and robust automated cell extraction tool for calcium imaging, which extracts the activities of cells as time series from both one-photon and two-photon calcium imaging movies.
MIT License
62 stars 16 forks source link

Option to skip cell removal during EXTRACT #49

Open bahanonu opened 4 months ago

bahanonu commented 4 months ago

@fatihdinc Is it possible to add a flag to completely skip the cell removal step? e.g. can help for cases in which cell images are input via S_init but have already done cell sorting (and don't want to tweak parameters to avoid any getting removed).

e.g. at https://github.com/schnitzer-lab/EXTRACT-public/blob/master/EXTRACT/modules/run_extract.m#L494 adding a flag that would run the following code:

is_bad = logical(is_bad*0)
fatihdinc commented 4 months ago

Hi Biafra! That is actually already implemented with config.num_iter_stop_quality_checks. Say you have 5 iterations and you want to skip cell removal, you can set config.num_iter_stop_quality_checks = [1,2,3,4,5]. Moreover, remember to set config.remove_duplicates = 0 to prevent duplicates being removed at the end when multiple spatial patches are stitched. Instead, I usually remove the duplicates by hand using a greedy matching procedure. Note that when you have multiple patches, cell filters may end up being duplicated across partitions.