flatironinstitute / CaImAn-MATLAB

Complete Matlab pipeline for large scale calcium imaging data analysis
GNU General Public License v2.0
252 stars 147 forks source link

bugs when handling 3D data #39

Closed dpacheco0921 closed 8 years ago

dpacheco0921 commented 8 years ago

update_spatial_components It makes a matrix that is only taking into account the first 2 dimensions. line: 133 sA = zeros(d1, d2);

if I add (after line 37)

if ~isfield(options,'d3') || isempty(options.d3); d3 = input('What is the total number of planes? \n'); options.d3 = d3; else d3 = options.d3; end % # of planes

and sA = zeros(d1, d2); --> sA = zeros(d1, d2, d3);

it fixes the problem, though I don't know how you want to then display the volume if show_sum is true (sum or max project maybe?).

run_CNMF_patches 1) When using run_CNMF_patches on 3D data, I get errors when resizing sparse data (lines 158, 173, 174), if I set those matrices to full it fixes the problem.

line 158 Atemp(patches{i}(1):patches{i}(2),patches{i}(3):patches{i}(4),patches{i}(5):patches{i}(6)) = reshape(full(RESULTS(i).A(:,k)),patches{i}(2)-patches{i}(1)+1,patches{i}(4)-patches{i}(3)+1,patches{i}(6)-patches{i}(5)+1);

line 173-174 b_temp = zeros(sizY(1),sizY(2),sizY(3)); b_temp(patches{i}(1):patches{i}(2),patches{i}(3):patches{i}(4),patches{i}(5):patches{i}(6)) = reshape(RESULTS(i).b,patches{i}(2)-patches{i}(1)+1,patches{i}(4)-patches{i}(3)+1,patches{i}(6)-patches{i}(5)+1);

2) Also, I noticed that you are not collecting the P.psdx variable when data is 3D, so I added

P.psdx(patches{i}(1):patches{i}(2),patches{i}(3):patches{i}(4),patches{i}(5):patches{i}(6), :) = reshape(RESULTS(i).P.psdx,patches{i}(2)-patches{i}(1)+1,patches{i}(4)-patches{i}(3)+1, patches{i}(6)-patches{i}(5)+1,[]);

epnev commented 8 years ago

Thanks for noticing this. It should be fixed now.