Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

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:

  1. 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?
  2. the trial-sequency of the experiment should start the first time a "t" is send. How is this possible?

Thank you everyone :)



  • Hi Alexander,

    the first bit is easy implement with a keyboard item or some inlinescript response collection: Something like that will do:

    kb_t = keyboard(keylist=['t'])
    FmriTriggerKey,var.FmriTriggerTime  = kb_t.get_key()

    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


    Ps, If it helps, you can checkout my own opensesame/fMRI experiment:

    However, it is quite messy and convoluted with things as it also included eye tracking and the scheduling of events wasnt trivial.

    Buy Me A Coffee

  • 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.


    Buy Me A Coffee

  • 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.

    Buy Me A Coffee

  • 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:

    Buy Me A Coffee

  • 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!


    Buy Me A Coffee

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games