MouseLand / suite2p

cell detection in calcium imaging recordings
http://www.suite2p.org
GNU General Public License v3.0
360 stars 244 forks source link

Modifying .npy outputs to reload into GUI #1152

Open katereinhart opened 1 week ago

katereinhart commented 1 week ago

I’m conducting longitudinal imaging of jrgeco mice and using the GUI for motion correction and cell detection, which works great—thank you! I manually add ROIs to evaluate "responding" and "nonresponding" cells over time. With many cells and multiple days of imaging, s2p has been helpful for quick visualization of cells and their correlations to 1D variables (stimulus trace).

Question 1: Are the correlations to 1D variables stored in any of the output files? Also, the 1D variable must be reloaded every time I manually add more cells, not sure if this can be fixed in future versions. Question 2: Can ROIs or cell determinations be modified outside the GUI (e.g., in .npy files) and then reloaded? If so, which files/variables need to be edited? Possibly, "ops.stats" and "ops.iscell" (different from iscell.npy and stat.npy outputs - and not exactly sure what these -esp. ops.stats- values are). I ask because I’d like to exclude 'non-cells' from the visual skew and 1D variable correlation maps, as they still affect calculations (see screenshot of skewness) I know skewness can be calculated in MATLAB (for me), but s2p's tools for quick visualization help me decide whether such analyses would be useful for my studies.

I have tried this level of filtering out 'not cells' from .npy files, and although i am able to reload the stat.npy file back into the GUI, some of the previously labeled 'cells' have been moved to 'not cells' - so it seems that additional variables/files need to be edited.

%Filter indices where iscell[:, 0] == 1 (cells) cell_indices = np.where(iscell[:, 0] == 1)[0]

% Filter data arrays based on the valid cell indices F_cells = F[cell_indices, :] Fneu_cells = Fneu[cell_indices, :] spks_cells = spks[cell_indices, :] stat_cells = stat[cell_indices]

iscell_cells = iscell[cell_indices, :]

Many thanks! Screenshot 2024-11-15 125930