JinghaoLu / MIN1PIPE

A MINiscope 1-photon-based Calcium Imaging Signal Extraction PIPEline.
GNU General Public License v3.0
56 stars 25 forks source link

CLASSNAME and matrix size errors #45

Closed hsw28 closed 3 years ago

hsw28 commented 3 years ago

Hi, I am trying to run min1pipe on some .avi videos recorded using UCLA miniscope. If I run the code without modifications, I get the following error:

Error using zeros
CLASSNAME input must be a valid numeric or logical class name.

Error in data_cat (line 165)
                frame_all = zeros(pixh, pixw, idbatch(ib + 1) - idbatch(ib), dtype);

Error in min1pipe (line 84)
            [m, filename_raw, imaxn, imeanf, pixh, pixw, nf, imx1, imn1] = data_cat(path_name,
            file_base{i}, file_fmt{i}, Fsi, Fsi_new, spatialr);

Tracing this back, I can see that the problem is that dtype is being specified as 'uint0' because of this line:

dtype = ['uint', num2str(round(dt) * 8)];

where dt is being calculated as 0.4986.

The second issue is, if I bypass the first issue by just defining dtype to be uint8, I get the following error (which i see referenced several times in other issues).

Index exceeds the number of array elements (191641100).

Error in data_cat (line 200) headert = d_raw(stp + 1: stp + hstep2)';

Error in min1pipe (line 84) [m, filename_raw, imaxn, imeanf, pixh, pixw, nf, imx1, imn1] = data_cat(path_name, file_base{i}, file_fmt{i}, Fsi, Fsi_new, spatialr);

Maybe this would be fixed if the unit issue was resolved but I am unclear. Thanks for any help.

JinghaoLu commented 3 years ago

Hi Hannah, I remember in UCLA's new data requisition software, users can change the video format, so I guess (based on the error message) that you chose to compress the output video file? Right now only uncompressed grayscale video can be correctly processed (the interface is custom scripts from MIN1PIPE, for optimal speed at the cost of storage space). So I suggest for future use choose the raw video format that was previously used in older version of the miniscope. For this specific video, I suggest reading using other more general interface that can handle compression, and then save it to a .mat file with the variable "frame_all" containing all the video frames in the shape of height X width X #frames, then use MIN1PIPE as usual.

hsw28 commented 3 years ago

Ah, I think you are right, I did use a compressed file format. Thanks for your fast response!