I’m trying to present your locally sparse noise stimulus with warping to an animal in a new experiment, as is produced from this line of code from https://alleninstitute.github.io/AllenSDK/_static/examples/nb/brain_observatory_monitor.html:
m = si.BrainObservatoryMonitor()
img_screen = m.lsn_image_to_screen(template)
I’d like to extract this as a video or just raw images I can present, but I cannot see how to export the warped images. Alternatively perhaps there’s a way to use the NWB file itself to present these stimuli to my animal using a script?
From what I understand of your question, your goal is to be able to present warped stimuli during your own experiments. However the stimulus templates provided by the AllenSDK are intended to allow users to view the stimuli that we used to understand the experiment, not for use as visual stimuli directly. I’ll explain why below.
The purpose of stimulus warping is to ensure a constant size and speed of stimuli at points on the monitor that are far away from the mouse’s eye, compared to points that are very close to the mouse’s eye. Thus, the way the stimuli are warped depends critically on the configuration and geometry of your stimulus monitor relative to the mouse’s head and eye position. I would not recommend downloading our warped stimuli, which were generated for our specific rig geometry, and playing them back to a mouse on your setup, which likely has different geometry. Typically the stimuli are warped by stimulus control software using parameters measured for the specific monitor configuration being used.
This paper describes the use of stimulus warping for retinotopic mapping and discusses considerations around the positioning of the monitor relative to the mouse, as is illustrated in Figure 1. I believe it also provides some Matlab code to generate warped stimuli, although it may not include sparse noise stimuli.
There is also python code using the psychopy library to display warped stimuli, which you can find here: GitHub - zhuangjun1981/WarpedVisualStim: For displaying spherically corrected visual stimulus on a flat screen.
I hope this helps.
Hi @marinag, thank you so much for your reply. To add to your suggestions, I eventually found this link: Warper object does not work with warpfile (but does work for other projections) - Coding - PsychoPy, which helped explain the built in warping functions for psychopy for me.