Aharoni-Lab / Miniscope-v4

All things Miniscope v4
GNU General Public License v3.0
132 stars 26 forks source link

Image striping when acquiring data with a commutator - discussion #35

Open GarrettBlair opened 1 year ago

GarrettBlair commented 1 year ago

This is intended to be more of a discussion and spot to organize and document ideas, as the google discussion is a bit dated and long.

Image striping during acquisition During acquisition occasionally the image becomes misaligned due to a buffer issue. Seems to occur more often when using a commutator. I'm aware this issue has be documented and discussed elsewhere (see google groups discussion, I just want to create a more centralized issue to track progress and solutions.

I've been working a decent amount on identifying and fixing them, but haven't come up with a satisfying method. Currently I manually find the beginning and end of each occurrence, then interpolate them out using the bookend frames (so that motion correction and source extraction don't go haywire), and then throw out the activity from those interpolated times. Usually this only results in a handful of lost frames at a time, but when it lasts hundreds of frames it's very detrimental.

I've found it helpful to classify the stripes into two categories - stable and moving (see examples below).

Here's a link to example data showing both issues: https://drive.google.com/drive/folders/1JoomTZ7Ty0XKJo9ZNjIwy6_CUKqlzK_N?usp=sharing

Screenshots

All of the following occurred in sequence:

Normal frame normal_frame Example offset pattern offset_ex1 Another example offset offset_ex2 Example of moving (non-stable) striping 1 roving_ex1 Example of moving (non-stable) striping 2 roving_ex2 Back to normal imaging (after about 135 frames) nomal_frame_return

Additional context Google groups discussion of issue

jonnew commented 1 year ago

Which commutator are you using?

e.g. the Open Ephys commutator is a mil-spec grade RF rotary joint that maintaines 50-ohm transmission line through the commutation point (less chance for data corruption than slip ring with no impedance control) that we have testing for hundreds of hours continuous use without issue.

https://open-ephys.org/commutators/coaxial-commutator https://open-ephys.github.io/commutator-docs/

and that is compatilbe with miniscope v4.

GarrettBlair commented 1 year ago

Currently using a passive slip ring commutator from Moog that uses a 50Ohm coaxial line for the scope.

jonnew commented 1 year ago

OK, yes. That does not maintain 50-ohm transmission line. Introduces discontinuity which results in signal distortion. This is exacerbated by the fact that its right in the middle of the cable (assuming you have a sizable length of coax on either side). This may not be the issue, but it certainly wont help.

GarrettBlair commented 1 year ago

Yeah I agree the occasional discontinuity from the slip ring is the root cause. The OEPS commutator only support 1 scope for purchase (right?), and I'm using two miniscopes through the commutator and keeping the cabling in and out fairly short (1.5-2.0m on animal side, 5-10cm on DAQ side). I see the OEPS design for 2 scopes is available on the dev site, but I don't have the capacity to fabricate one right now.

I was hoping there could be a software solution to detecting and resolving the striping. Perhaps using a real-time template matching or just a user interface to reset the buffer if they notice it occurring to prevent the stable offset situation from persisting too long during a recording.

GarrettBlair commented 7 months ago

I developed a decent fix for the static banding issue - see the demo video and matlab script in my miniscope banding repo

edit - @daharoni fyi, if this helps things