Getting mouse click response on an image

714 views
Skip to first unread message

Tan

unread,
Jun 15, 2017, 6:21:06 PM6/15/17
to E-Prime
Hi All,

I had a question and would appreciate any help in this regard.

I have a task in e-prime wherein I have images. The task is to find a particular "feature" on the image displayed on computer screen. I want participants to clearly tell me where exactly in the image do they see the "feature", by clicking with mouse on the region where the "feature" is present.
Also, I would like to record this clicking response of mouse, so that I can know where exactly on the image did the participant click.

How do I go about?

Thanks,
Tan

Michiel S-Spape

unread,
Jun 16, 2017, 5:14:10 AM6/16/17
to e-p...@googlegroups.com

Hi,

In E-Prime 2: add mouse device, use “show cursor” in its properties. In the image, collect mouse clicks. After the image, try an inline:

debug.print "Pressed @ X: " & Mouse.CursorX & " Y: " & Mouse.CursorY & "."

 

Debug should now give you the coordinates. I would go from there.

I know people like this “hittest” thing, there’s an example (somewhere out there, perhaps in the example experiments? Certainly on this list) that is commonly used. Personally, I find it a lot of code for very little gain.

 

In E-Prime 3, you could perhaps use buttons (perhaps hidden buttons) to describe the features?

Best,

Michiel

--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+u...@googlegroups.com.
To post to this group, send email to e-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/2cc06d8a-6df2-400d-b87a-13892f9592c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Tan

unread,
Jun 16, 2017, 7:43:30 PM6/16/17
to E-Prime
Hi Michiel,

Thanks for your reply. I added an inline as you suggested. The experiment ran fine. But how do I get the coordinates of mouse-click response? It's not there in the edat file.

Another question: In this task, I am collecting a response by pressing 1, 2 or 3. The mouse-click would be an extra response in addition to clicking 1, 2 or 3 on keyboard. I want the slide to move to next stimulus only after a keyboard press and a mouse click has happened. How do I do that?

Thanks!
Tan

Michiel S-Spape

unread,
Jun 17, 2017, 4:06:57 PM6/17/17
to e-p...@googlegroups.com

Hi Tan,

Just log it in an attribute –

c.setattrib “CursorX”, Mouse.CursorX

c.setattrib “CursorY”, Mouse.CursorY

As for the collection of both keyboard and mouse click – perhaps you could just double the slide? Otherwise, you could use two slides, one after the other (with lengthy time limit, though not duration), one mouse, one keyboard, and keep checking whether both have responses; otherwise returning to a label just before the two slides.

Image removed by sender.

--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+u...@googlegroups.com.
To post to this group, send email to e-p...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.


~WRD000.jpg

Tan

unread,
Jun 21, 2017, 7:38:11 PM6/21/17
to E-Prime
Hi Michiel,

Thank you for your message. I did as you suggested and now I have attributes Cursor X and Cursor Y, that are giving me coordinates where the mouse was clicked. Is there a way to map the whole slide or image in a coordinate system, so that I know the coordinates that contain the feature of interest where the mouse click needs to be done.
A follow-up question: After I have the coordinates of the image, how can I tell e prime a radius (containing coordinates) so that any mouse clicks within that radius would be correct and any mouse clicks outside of that would be incorrect.

Thanks again!
Tan

Michiel S-Spape

unread,
Jun 23, 2017, 7:53:23 AM6/23/17
to e-p...@googlegroups.com

Hi Tan,

Well, the whole coordinate system is there: it is the Windows resolution. It’s a bit of a headache to figure out, but not too difficult. Mind that pixel 0 at Y is the top, not the bottom. So, let’s say the experiment runs at a resolution of 640 x 480. You have an imagedisplay, with both image width/height and actual image as a 100x100 pixels image. Let’s say it is centred.

Now, if CursorX = 0, it’s at the left of the image (border of display)

If CursorX = 320, it’s at the centre of the image

If CursorX = 270, it’s at the left side of the image.

If CursorY would be …. (480 / 2) + 50 = 290 … then the cursor is at the bottom edge of the image.

 

SO:

If CursorX >= 270 and CursorX < 370 then

                If CursorY >= 190 and CursorY < 290 then  debug.print “Hit”

End If

 

There you go. You can also do this region of interest thing with the HitTest trick, but personally I don’t really see the point. It’s more important that you know your stimulus material so well that you can figure out the regions. Of course, you could always do this sort of thing after the experiment as well.

Image removed by sender. Image removed by sender.

--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+u...@googlegroups.com.
To post to this group, send email to e-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/fe0883fb-37da-4b8d-a47a-05f956e15686%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

Image removed by sender.

--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+u...@googlegroups.com.
To post to this group, send email to e-p...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.


~WRD000.jpg
Reply all
Reply to author
Forward
0 new messages