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

Losing cells after a few iterations #22

Closed yrleftbrain closed 2 years ago

yrleftbrain commented 2 years ago

Hi. I'm wondering about what is being checked in the cell refinement steps for each iteration. I have a couple of obvious cells that were captured in a 2 minute video, but not the full ~20 minute video after 8-10 iterations. They are obvious in the max projection as well (and there traces in the 2 minute video showed clear transients).

I'm trying to adjust the parameters for cell refinement as I see the cells after 2 iterations but not 5 for the full video. But at 2 iterations, I also see a many garbage cells, so the higher iter is necessary.

I was hoping you might have some suggestions. The input is from a 1P microendoscope and is dff'd . Parameters are in the comments below.

Thanks a lot!

yrleftbrain commented 2 years ago

config.trace_output_option='nonneg'; config.use_gpu=1; % use GPU config.parallel_cpu = 0; config.dendrite_aware = 0; config.adaptive_kappa =0; config.use_sparse_arrays = 1; % config.max_iter = 8; % config.num_partitions_x=1; % config.num_partitions_y=1; % config.remove_duplicate_cells = 1;

config.preprocess = 0; 
config.fix_zero_FOV_strips = 1; 
config.medfilt_outlier_pixels = 0; 
config.skip_dff = 1; 
config.skip_highpass = 0; 
config.spatial_highpass_cutoff=5;
config.temporal_denoising = 0; 
config.remove_background = 0; 

config.cellfind_filter_type='butter'; 
config.cellfind_min_snr=0;
config.spatial_lowpass_cutoff=10; 
config.init_with_gaussian = 0; 

config.thresholds.T_min_snr = 3; % default is 10; lower cellfind_min_snr before lowering this
% config.thresholds.size_lower_limit = ; %
% config.thresholds.size_upper_limit = ; %
config.thresholds.temporal_corrupt_thresh = 0.95; 
config.thresholds.spatial_corrupt_thresh = 0.95; 
config.thresholds.eccent_thresh = 6; 
%config.thresholds.low_ST_index_thresh = ; 
%config.thresholds.low_ST_corr_thresh = ; 
fatihdinc commented 2 years ago

Hi!

Thank you so much for the question. It is hard to answer without seeing the movie, but if I had to guess, it is likely the spatiotemporal and spatial corruption metrics that are discarding most of the cells. I would start by setting config.minimal_checks = 1; and see if that improves the situation. You can find more information about specific metrics we use to ensure cell quality in this link: https://github.com/schnitzer-lab/EXTRACT-public/tree/master/Learning%20materials/Lecture%20Tutorials/Tutorial%202%20-%20Understanding%20hyperparameters

We are still in the process of writing a practical documentation for EXTRACT, although a more technical documentation can be found in the pre-print. Thus, I am happy to answer more specific questions via our email address if you choose to share an example movie with me. I hope that this is helpful and feel free to let me know how it goes!

yrleftbrain commented 2 years ago

Thanks. That didn't seem to help, unfortunately. I've indeed read through the documentation that exists and adjusted parameters extensively, but can't quite get those cells (and it's a common problem across videos). I'm happy to send over a good example video, but I don't want to take up a lot of your time. I appreciate your help.

fatihdinc commented 2 years ago

Sure, it is likely a single parameter that needs tuning, and it makes sense that if one movie has the issue, others with similar conditions too. Please feel free to send over the movie to our email


Gönderen: yrleftbrain @.> Gönderildi: Sunday, June 5, 2022 5:04:11 PM Kime: schnitzer-lab/EXTRACT-public @.> Bilgi: Fatih Dinc @.>; Comment @.> Konu: Re: [schnitzer-lab/EXTRACT-public] Losing cells after a few iterations (Issue #22)

Thanks. That didn't seem to help, unfortunately. I've indeed read through the documentation that exists and adjusted parameters extensively, but can't quite get those cells (and it's a common problem across videos). I'm happy to send over a good example video, but I don't want to take up a lot of your time. I appreciate your help.

— Reply to this email directly, view it on GitHubhttps://github.com/schnitzer-lab/EXTRACT-public/issues/22#issuecomment-1146911665, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANNMFC2SHXQ6BATLNRNJUJ3VNU57XANCNFSM5X4PAOTA. You are receiving this because you commented.Message ID: @.***>

yrleftbrain commented 2 years ago

Thanks Fatih. I shot you an email.

fatihdinc commented 2 years ago

I will now be closing this issue, if there are any new issues, please feel free to post here or send us an email!

For a third party: After going through the movie, we identified that the denoising pipeline was overfitting and creating undesirable artifacts in the movie, which was leading EXTRACT to reject them. For the best cell extraction results, we suggest using heuristic denoising pipelines with caution (and not using them unless absolutely necessary)! If you are having similar problems as in this issue, feel free to open a new one!