feat: video acquisition support for pupillometry#5
Open
tabedzki wants to merge 3 commits into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 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: addsvr.preTicandvr.timeElapsedFirstTrialtiming anchors.extras/RigParameters.m.example: commented video-acquisition block.Review fixes applied (commit
410f1d4)syncBehaviorVideo.m: the twofind(..., 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.linspaceover file duration, which assumes a constant frame rate / no dropped frames (FLIR cameras can drop frames). Added an optionallog.frameTimesoverride so callers with true per-frame timestamps can bypass the assumption.setupVideoFile.m: usestrtokso userid is unambiguously "the portion before the first underscore," matching the docstring.Testing
All changed files parse and pass
checkcodeunder 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.