Skip to content

Within-session non-rigid motion, coherent regions, clearer option names

Latest

Choose a tag to compare

@vergaloy vergaloy released this 30 Sep 07:52
· 20 commits to main since this release

Download Simulate_Ca_Imaging_video.zip below. It unzips to a single folder; put
that folder on the MATLAB path and Simulate_Ca_video is ready to use. Nothing
else is needed.

For scripted downloads the link never changes:

https://github.com/vergaloy/Simulate_Ca_Imaging_video/releases/latest/download/Simulate_Ca_Imaging_video.zip

Simulate_Ca_Imaging_video_1.3.zip is the same archive under the versioned name
used by earlier releases.

Breaking change: the motion options were renamed

Two separate things move the image, and the old names did not say which was
which. Every name now starts with the timescale it acts on. Old names raise an
error naming their replacement, so nothing fails quietly.

Old New
NR_misalignment across_session_nonrigid
motion_sz across_session_nonrigid_scale
translation_misalignment across_session_translation
session_motion_std within_session_translation_std
session_nonrigid_std within_session_nonrigid_std
nonrigid_grid within_session_nonrigid_grid
session_motion_phi within_session_motion_smoothness
session_motion_max within_session_motion_max
session_motion_seed within_session_motion_seed

across_session_* is one fixed warp per session, which is what an inter-session
alignment stage has to undo. within_session_* is a different shift on every
frame, which is what motion correction has to undo. They are independent, so
a session can be misaligned without shaking, shake without being misaligned, or
both.

Two things the old names hid: across_session_nonrigid_scale is a Gaussian sigma
in pixels, meaning how broad the warp is, not how strong it is. And
across_session_translation is the length of the shift in pixels, not an on/off
flag.

New in this release

  • Within-session non-rigid motion. within_session_nonrigid_std bends each
    frame on top of the whole-frame shake, so a piecewise-rigid corrector has
    something real to find. The control points and their trajectories come back as
    ground truth. 0, the default, keeps the motion purely rigid as before.
  • A different motion amplitude per session. within_session_translation_std
    now takes one value per session. Equal amplitudes give sessions that end up
    within a pixel or two of each other, which never tests a pipeline that crops
    each session to its own valid region.
  • Neurons in regions, with coherent activity. region_areas, region_n,
    region_min_dist and region_corr place neurons in irregular grown regions or
    in 2x2 quadrants, each with its own density and its own activity correlation.
    The correlation that was actually achieved on the calcium traces is measured
    and returned, never assumed.
  • Burst clustering. burst_tau makes spikes cluster in time. Thresholding an
    isolated spike train destroys most of the latent correlation, so this is what
    lets the trace correlation reach useful values.
  • Denser patches of neurons. dense_region and dense_frac raise the neuron
    density inside given rectangles.
  • Fixed: the sign of the simulated non-rigid field. The ground truth was the
    negative of the motion actually applied, which made it anti-correlated with the
    video it described.