Skip to content

About

Experiment scripts and stimuli for running Toonotopy in MATLAB.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Toonotopy experiment

Adapted from the Stanford VISTA lab's vistadisp/toon_ret retinotopy code.

Questions/comments: sakbiyik@stanford.edu

Retinotopy stimulus for pRF mapping: a bar sweeps through 8 directions across the visual field, filled with randomly-selected colorful cartoons.

Subject's task: fixate and press a button when the fixation dot changes color. The visual angle covered isn't fixed, since it depends on stimSize together with each display's calibration (see "Display setup" below), so the same code can present a small or wide aperture depending on what the screen/distance can actually support.

Running a scan

  1. In MATLAB: cd into this folder, run ret.
  2. A parameter window opens, pre-filled with defaults. The only thing you normally need to set is Display calibration (pick the display you're actually using, e.g. CNIProjector). Click Go.
  3. Enter Subject ID and Run number at the MATLAB prompt.
  4. A list of input devices prints, then you're asked which device number is the subject's button box. This matters: trigger detection listens on every device (safe, since the trigger is a specific keycode), but button responses only come from whatever device you pick here. If you skip this and the experimenter types on the laptop mid-run, that keystroke would otherwise be recorded as a subject response.
  5. Screen opens and shows a welcome message. Press space when you and the subject are ready. This step exists because hitting scan on our scanner starts a prescan period that sends its own trigger pulses; the code only starts listening for the real trigger after you press space, so those prescan pulses can't accidentally start the experiment early. If your scanner doesn't send trigger pulses during its own prescan, you likely don't need this particular safeguard. Once space is pressed, matlab waits for the actual scanner trigger (or a keypress, if "No trigger" was selected) to begin. Press q at any time to abort early; data collected so far is still saved.

What's presented

  • 8 bars with blanks: a bar sweeps across the screen in 8 directions (with a blank/rest period after every 2 sweeps)
  • Aperture: 24° diameter (12° radius) by default, set by stimSize in experiment/retCreateDefaultGUIParams.m and capped by how much of that a given screen can physically show at its calibrated distance.
  • One run = 204 s (3.4 min): 12 s prescan/baseline plus 192 s of bar sweeps, at TR = 2 s (102 TRs total). This must match your actual scanner acquisition length. The default version of this script has a dummy countdown period of 8 seconds on top of this.

Display setup (per computer/screen)

Each display needs a folder in displays/<Name>/displayParams.m with values measured directly, not estimated:

  • numPixels: the real drawable canvas (confirm via an actual Screen('OpenWindow'))
  • dimensions: physical screen width × height in cm, measured with a ruler at the display surface.
  • distance: eye-to-screen distance in cm. For a mirror/projector setup, measure the full eye→mirror→screen path.

Get any of these wrong and the stimulus is the wrong size or shape on screen. There's no way to detect this from the data afterward, so it's worth double-checking before a real session.

Output

Each run saves to data/<subjectID>_<timestamp>_run<NN>.mat, including:

  • params, stimulus, t0, scanTiming, timing, quitProg
  • response: per-frame button presses (keyCode/secs) and actual flip timestamps (flip/missed), from the button box only (see device selection above)
  • score: overall fixation-task percentage
  • fixationEvents: one entry per fixation-color change (either direction), with whether it was detected and the response latency if so. Use this instead of re-deriving change events from stimulus.fixSeq by hand for any custom scoring/analysis.
  • stimulus.imageNames: which picNN.jpg (or 'blank') was shown at each image slot; combine with stimulus.seq (imageNames{seq(t)}) to get what the subject saw at frame t. Cartoons are chosen randomly per run with no fixed seed.

For analysis

toon_prfRun.m needs a matching pair of files for the actual display/session used:

  • stimuli/8bars_images_<Display>.mat and stimuli/8bars_params_<Display>.mat (generate offline via makeImages.m, or regenerate to match whatever stimSize/display was actually used).
  • params.fliprotate (in toon_prfRun.m) must match how that specific images/params pair was generated:
    • Up/down (2nd element): our generator saves images "right side up" for on-screen display, which vistasoft's analysis grid reads upside-down unless fliprotate(2) = 1.
    • Left/right (1st element): only relevant if there's a mirror in the optical path (e.g. CNIProjector) that isn't compensated for in real time (displayParams.m's flipLR). makeImages.m already bakes the flip into 8bars_images_CNIProjector.mat for this reason, so fliprotate(1) should stay 0 for that display.
    • In short: fliprotate = [0, 1, 0] for anything generated by this codebase's CNIProjector files as they currently stand.
  • toon_init.m's clip/keep must match your real acquisition (frames to drop from the start / frames to keep). For 102 volumes at TR=2s with a 12s prescan, that's clip=6, keep=96.

About

Experiment scripts and stimuli for running Toonotopy in MATLAB.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages