Using Experiment in the MRI (Syncing with mri and recording mri pulses)
Hello everyone!
First of all I would like to say thank you for this nice software and dedicated people of the forum who help others in need :-)
With the help of the tutorials and forum i came already very close to programming my experiment which should be used in an mri scanner (i attached it to the post).
Right now I have two questions:
- Every time the mri starts a new measure it sends the letter "t" via a keyboard input. While the experiment runs i would like to log this measures / "t" to know when the measure started (kind of parrallel to the experiment). How can i do that?
- the trial-sequency of the experiment should start the first time a "t" is send. How is this possible?
Thank you everyone :)
Alex
Comments
Here my experiment :)
Hi Alexander,
the first bit is easy implement with a keyboard item or some inlinescript response collection: Something like that will do:
The experiment will wait on the second line until the trigger appeared and only then continue. So, put that code in the beginning of a block (before the trial loop) and you should be good.
As for the first problem that is quite a bit more complicated, because you essentially need two completely parallel processes during data collection, one to present the experiment and one to sample the triggers. Within limits you can simulate that, but it remains imperfect. The problem is that whenever you wait for a response (which will in the worst case last for 1 TR), the experiment can't do anything else. So, of course you could add code snippets like that one above to several parts of your experiment in which there is a blank screen or something anyway, so it doesn't matter if the experiment sleeps while waiting for the response, but that will only give you spotty coverage of the TRs over the course of the experiment. There are ways to maximize the coverage (primarily with loops, etc), but whether they make sense depends a lot on your paradigm.
Does this help already? Let me know if you need more help
Eduard
Ps, If it helps, you can checkout my own opensesame/fMRI experiment: https://osf.io/jznsc/
However, it is quite messy and convoluted with things as it also included eye tracking and the scheduling of events wasnt trivial.
Hey Eduard;
thanks for answering me. It helped a lot. Actually its really nice that you wrote me since i used some of your code you posted a while ago (for a slider) which helped me implementing the measurement of the mri signal with a "while" and "if" loop. Thanks a loooot ! :-)
Since you mentioned the fact that it is kind of hard to maximize the coverage of measuring all impulses how do you handle this issue with your experiment? Do you just approximate the time the impuls starts everytime?
Oh and another quick question:
I am playing a video in my experiment with the media_player_mpy Plugin. Coroutines are not possible but is it possible to use a while and if loop to somehow safe the impulses while this video plays?
hanks a loooot ! :-)
Glad it helped :)
how do you handle this issue with your experiment?how do you handle this issue with your experiment?
I don't really. My paradigm was not locked to TRs, only the beginning of the block (once every 60ish seconds) was triggered by a TR, all the trials were jittered with respect to the TRs (my paradigm was really fast paced). During analysis I applied a deconvolution approach to still get a reasonable estimate of the BOLD. It seemed to have worked okay. Read the paper if you like to know details ;)
So, in that sense, I have not tried to measure every single TR.
Eduard
I am playing a video in my experiment with the media_player_mpy Plugin. Coroutines are not possible but is it possible to use a while and if loop to somehow safe the impulses while this video plays?
That depends on how the plugin is implemented. If I am not mistaken that is not possible. I haven't used that plugin in a long time (also as it is rather outdated). To present videos, I would rather recommend using OpenCV2. It is actually quite easy to use and a lot more flexible. However, also here, I don't know for sure whether playbacking a video is blocking the experiment. My hunch is that it doesn't happen, but I would need to try to be sure.
Hey :-)
yeah i would like to read into your paper using the deconvolution approach for the bold signal. what i the name of it?
Thanks for your help :-)
Oh sorry, I thought I had put it on OSF. here it is:
https://www.sciencedirect.com/science/article/pii/S1053811919307244
Hi Alexander,
I just saw Sebastiaan had another solution to continuously collecting keypresses while running the experiment that looks very promising. Check out his post:
Might be useful to you!
Eduard
thanks!