Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Index exceeds the number of array elements (750350538) #44

Open
carlottarpt opened this issue Nov 19, 2020 · 1 comment
Open

Comments

@carlottarpt
Copy link

Hello,

Thanks for your code!
I get the following error message: Index exceeds the number of array elements (750350538). I've seen that this issue has been committed before #19 #41 , but I think my data might be slightly different and therefore the issue. My data is stored in an hdf5 file. I managed to transfer this data to an .avi file format but get the following error message (see below). I noticed that my .avi movie has a bit depth of 24 even though it is grayscale and should be 8. Might this be causing the problem?

Do you expect your code to work for data aquired with other cameras? If not, is it possible to change the code such that it is usable with .avi files from different cameras or is it very specific to the Miniscope?

If I understand correctly you are trying to extract the frames out of the bit stream. What I don't understand is why you cast to uint 32 in this line: ndframe = double(typecast(dlen, 'uint32'));

Index exceeds the number of array elements (750350538).

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);

Thanks in advance!

@JinghaoLu
Copy link
Owner

Hi, thanks for your question. The issue is totally related to the video format, and currently MIN1PIPE only supports most popular formats, such as tiff/tif, raw unconstrained avi with grayscale and .mat. A more general reading interface could be used but it may not be optimized for reading speed or memory management in matlab.

The code should work for all compatible video format as long as the camera produces one of such. You are welcome to change the code to adapt it to other video formats, but that covers a wide range and from the developing perspective, it is impossible to add interface for any format (also due to my limited time and knowledge on the related topic).

To use it alternatively, you can consider converting your data into .mat format: assign a variable "frame_all" with the size of your video (height X width X # frame). This will remove all complexity working with video format.

For the last question, uint32 is the way .avi header file encoded, so to parse the header correctly, you have to convert the info into a block of 4 characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants