Skip to content

feat: video acquisition support for pupillometry#5

Open
tabedzki wants to merge 3 commits into
masterfrom
feature/video-acquisition
Open

feat: video acquisition support for pupillometry#5
tabedzki wants to merge 3 commits into
masterfrom
feature/video-acquisition

Conversation

@tabedzki

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖

Ports DataJoint-free camera recording into PureVirmen for synchronized eye/pupil video capture, plus review fixes.

What's here

  • sensors/camera/: FLIR GenTL camera setup + VideoWriter (Motion JPEG 2000) disk logger, start/stop, U19-compatible file naming, and a post-hoc frame↔iteration sync utility.
  • bin/engine/virmenEngine.m: adds vr.preTic and vr.timeElapsedFirstTrial timing anchors.
  • extras/RigParameters.m.example: commented video-acquisition block.

Review fixes applied (commit 410f1d4)

  • syncBehaviorVideo.m: the two find(..., 1, 'last') loops were O(nFrames × nIter) — replaced with single binned monotonic searches (discretize), so a 30-min @30fps session no longer does tens of millions of scans.
  • Documented that frame times are reconstructed via linspace over file duration, which assumes a constant frame rate / no dropped frames (FLIR cameras can drop frames). Added an optional log.frameTimes override so callers with true per-frame timestamps can bypass the assumption.
  • setupVideoFile.m: use strtok so userid is unambiguously "the portion before the first underscore," matching the docstring.

Testing

All changed files parse and pass checkcode under MATLAB R2023b. The live camera path requires Image Acquisition Toolbox + FLIR Spinnaker on a Windows rig (not available on the dev machine), so the hardware path is untested here.

tabedzki added 2 commits June 18, 2026 14:00
Ports camera recording infrastructure from the internal BrainCOGS ViRMEn
fork into PureVirmen, enabling synchronized eye/pupil video capture without
any DataJoint or database dependencies.

Changes:
- bin/engine/virmenEngine.m: add vr.preTic (before initialization) and
  vr.timeElapsedFirstTrial (before main loop) as stable timing anchors
- extras/RigParameters.m.example: add commented video-acquisition block
- sensors/camera/configureSingleCamera.m: FLIR GenTL camera setup +
  VideoWriter (Motion JPEG 2000) disk logger
- sensors/camera/startVideoAcquisition.m: configure camera, capture
  vr.timeElapsedVideoStart sync timestamp, start acquisition
- sensors/camera/stopVideoAcquisition.m: stop and release camera cleanly
- sensors/camera/setupVideoFile.m: build output path with userid/subject/
  YYYYMMDD_g# naming convention (U19-compatible)
- sensors/camera/checkCameraRigParameters.m: validate required RigParameters
  before camera init
- sensors/camera/syncBehaviorVideo.m: post-hoc frame-to-iteration alignment
  utility (DataJoint-free equivalent of U19 sync script)

Closes #1

Assisted-by: ClaudeCode:claude-sonnet-4-6
- syncBehaviorVideo.m: replace the two O(nFrames*nIter) find loops with
  single binned monotonic searches (discretize), and document the
  constant-frame-rate assumption of the linspace frame-time reconstruction.
  Add optional log.frameTimes override for true per-frame timestamps.
- setupVideoFile.m: use strtok to take the userid as the portion before the
  FIRST underscore, matching the documented convention (strsplit{1} did the
  same for the common case but the intent is now explicit).

Assisted-by: ClaudeCode:claude-opus-4.8
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

Successfully merging this pull request may close these issues.

1 participant