CaImAn icon indicating copy to clipboard operation
CaImAn copied to clipboard

Suggestion: remove SBX loading code and recommend using sbxreader instead

Open EricThomson opened this issue 3 months ago • 23 comments

Discussed in https://github.com/flatironinstitute/CaImAn/discussions/1298

Originally posted by ethanbb March 14, 2024 Hello,

This is mainly a documentation suggestion. My microscope saves Scanbox files, and I saw CaImAn has support for loading them, so I tried that but got an error because the loading functions are not up-to-date with newer versions of the file format (which has changed several times). The specific error was about inferring the number of channels (my info did not have 'channels', but rather the newer 'chan' field).

Looking into it a little more, I realized that the current function doesn't account for a number of features, including:

  • Volumetric scanning (optotune)
  • Bidirectional scanning
  • "Fold lines" (multiple subframes per frame)
  • Loading channels other than the first one

I took a few days to implement these features, and I was going to submit a pull request. However, towards the end I realized that the package sbxreader exists (which suite2p uses for loading). Besides being actively maintained, it's much better than what I wrote because it memory-maps the file - I realized when trying to test my function that it was not going to happen because my 40-minute recording was too large to fit into memory. It also has another function for loading all metadata, which is probably important to almost everyone who would need to load SBX data.

I could continue to tweak what I wrote to use memmap etc., but I think what makes the most sense is to just recommend Scanbox users to install this package and use it to get an np.memmap of their data, then load it into CaImAn using the movie constructor directly. To encourage this (and because it's out of date), it probably makes sense to remove the current SBX loading code.

EricThomson avatar Mar 14 '24 20:03 EricThomson