Howdy, Stranger!

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

Supported by

Circular ROIs for mouse responses (inline JavaScript)

Hi,

I'm new to OpenSesame and I'm currently setting up an online experiment where participants are instructed to click on circles of different sizes located at specific coordinates (which change during the course of the experiment). Since I need information about whether participants successfully clicked on each circle or missed it (using the mouse), I would like to define regions of interest in the form of a circle.

As far as I know, it is only possible to define rectangular regions of interest using inline JavaScript if I want to run my experiment online via OSWeb. Is there any way or workaround to define circular ROIs (e.g., using inline_HTML)?

Thanks in advance!

Best,

Carla

Comments

  • Hi @CarlaC,

    I'm not sure how you display your circles, whether you somehow draw then using coding or whether you're using pictures (most probably you're doing the latter). Regions of interest are indeed related to the objects and pictures are rectangular.

    Let's assume that you're using a picture containign a circle with a radius of 100 pixels.

    If you want to restrict responses to mouse clicks that are within a circle, you'll need to do some programming in Javascript to implement the following logic:

    (1) Establish the (x,y) coordinate of your picture's center. In Open Sesame, that would simply be the x and y of your picture as pasted on your sketchpad.

    (2) read out the (x,y) coordinates of the mouse click (cursor_x, cursor_y, whihc in Javascript gets accessed using vars.cursor_x, vars.cursos_y).

    (3) dig into your memories from school to apply the Pythagorean theorem in order to establish whether the distance between the mouse click and the center of the circle is smaller or equal to the radius (in whihc case the subject clicked within the circle) or greater than the radius (in which case the subject clicked outside the circle).

    Let's imagine that the subject clicked where you see the yellow dot here.

    You know the radius of the circle (100 pixels), you know the coordinates of the center of your picture (x,y), and you can get the coordinates of the mouse click (cursor_x, cursor_y).

    You want to know whether how c compares the radius.

    All you have to do now is to apply the Pythagorean theorem:

    You can calculate a by taking the absolute value of the difference between y and cursos_y (I say absolute valoue because that way you get a measure that is not dependent upon whether the subject clicks above or below the circle's center.

    a = | y - cursos_y |

    Apply a similar logic to b:

    b = | x - cursos_x |

    Now you just have to calculate the square root of (a2 + b2) to get c:

    Then you'll just have to compare c to the radius.

    You'll need to implement this in a loop that goes on for many cycles and use the "break if" parameter to interrupt it when a valid response has been registered (without doing this, your task will just take one mouse click and move on to the next bit of your task irrespective of whether the subject actually clicked on the circle).

    Hope this helps,

    Fabrice.

    Buy Me A Coffee

  • Hi Fabrice, 

    thank you very much for your thorough response, that was very helpful!

    Best,

    Carla

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 http://45.77.173.118/ 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