JinghaoLu / MIN1PIPE

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

"Unable to perform assignment because the left and right sides have a different number of elements." #58

Open Gabrielle-Siemonsmeier opened 3 years ago

Gabrielle-Siemonsmeier commented 3 years ago

Hi Jinghao,

I've started using MIN1PIPE recently to process recordings taken with a UCLA V3 miniscope running the newer version of the UCLA miniscope software. I ran into the following issue:

        Begin data cat
        Unable to perform assignment because the left and right sides have a different number of elements.
        Error in data_cat (line 205)
                                        stt(ii) = stt1 + stp;
        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);

I'm using the following parameters: FSI: 30 FSI_new = 30 spatialr: 0.25 se: 10 ismc = true flag = 1

I'm running MIN1PIPE on our server; I have successfully processed other recordings that way, and have verified that all necessary packages are installed. I first ran into this issue when I tried to process a .tif stack generated in Image J by concatenating four separate .avi recordings from a single session, so I figured that was the source of the problem, but the same error message now came up when trying to process single .avi recordings straight from the miniscope (but renamed to msCam01.avi as opposed to the new default 0.avi ). Those two recordings (from two animals) are continuous 16min recordings at 30fps, uncompressed, about 10gb each.

Thanks in advance for your help!

Cheers,

Gabrielle

JinghaoLu commented 3 years ago

Hi Gabrielle,

I am pretty sure that it is the problem with the avi format. There are so many different types of avi and in MIN1PIPE only the raw uncompressed grayscale avi can be processed due to the easy data structure that can be read in fastly. For future data collection, I suggest using the supported data structure. For the current one, you may want to either convert it to the supported formats, or use the default matlab VideoReader to collect the data frames and pass it to a variable called "frame_all" and save it with the name "*_frame_all.mat".

Gabrielle-Siemonsmeier commented 3 years ago

Thanks for getting back to me so quickly! That's what surprised me, these are raw uncompressed grayscale .avi files as recorded by the UCLA miniscope software, I didn't modify them. I did also get the following warning message though:

          Warning: AVIINFO will be removed in a future release. Use VIDEOREADER instead.           > In aviinfo (line 74)           In data_cat (line 60)           In min1pipe (line 84)           In demo_min1pipe (line 14)

I'm not sure I understand your last suggestion; do you mean I should replace aviinfo by videoreader in data_cat.m ? or use videoreader instead of data_cat.m to generate the *_frame_all.mat file and then proceed? For reference I've never used Matlab before using MIN1PIPE so I'm really unfamiliar with...everything, unfortunately. Would converting the .avi videos to .tif stacks be another option?

JinghaoLu commented 3 years ago

You can disregard any warning messages. For the last suggestion: you can disregard that as well, but what I intended to suggest is that you write your own loop for reading in the data based on matlab built-in video read functions, which is much slower but can handle many more video formats.

Yes avi to tiff would be another option, though cumbersome.

But back to the error message, this does look like a video format issue. However, more strange issue might happen, so I would like to either have you set breakpoints and debug it with me, or you can share a small video file so that I can do the debug. Let me know what you think.

Gabrielle-Siemonsmeier commented 3 years ago

Thanks, I'll send you an email!