psychopy.org | Reference | Downloads | Github

Can I use psychojs in fMRI?

I know that maybe PsychoPy is one of the best options for delivering stimuli in fMRI experiments. However, I am needed to use some third-party javascript tools in my experiment (to make it more game-like) and it is working beautifully in my web experiments.

Now, besides the technical issues, we think it would be equally good in the scanner. However, I am aware that there may be some difficulties and issues especially with respect to timing.

My question is whether it is possible at all to run an fmri experiment using my web-based script?

What kind if issues that I have to be aware of, and are there any studies that took such approach? (for example, I know many people used Unity in fMRI).

Yes, there may be. But it might also work fine, given your constraints. The only way to know is to test the study exhaustively, given the requirements you need to achieve.

Most of that can be done outside the scanner environment. One question is whether you need access to triggering hardware (e.g. a serial or parallel port). But if your scanner sends trigger pulses by emulating a key press, that shouldn’t be an issue.

Some evidence on general online performance is given here:

https://psyarxiv.com/d6nu5/

1 Like

Thanks a lot! that was a great read.

I am not going to need any serial or parallel port as the scanner sends trigger pulses.

I am now testing my code with timing and this paper gave me lots of ideas to test my code like latency and variability (in ms). I was wondering if there are any other tests that are relevant to the scanner.

There is isn’t much specific to the scanner per se to worry about in terms of performance. One issue is that most fMRI designs need to run continuously for quite a few minutes, with a total duration of the experiment presentation that is exactly equal to the duration of the scanner acquisition sequence. So any small inaccuracies in timing can accumulate, leading to loss of synchronisation. In essence, you need to check that your experiment lasts exactly as long as the planned sequence duration. You might also need to take account of the first few volumes of the sequence not being valid, but just allowing things to stabilise. So the very beginning of the experiment might not be at the start of the first trigger pulse, but need to be delayed until a couple of volumes later.