Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
MR_Riley

Junior Member
Registered:
Posts: 10
Reply with quote  #1 
Hello to all.

We are trying to implement a task where we display a background image that covers the entire touchscreen monitor while a cue is displayed on the center of the image and a black bar at the bottom of the image. After a delay period, the black bar goes away and two targets are revealed for the monkey to choose one.

When I run this script, only the background image appears on the monitor. All images are pngs (for the transparent background/odd shapes).

if ~exist('eye_','var'), error('This task requires eye signal input. Please set it up or try the simulation mode.'); end
showcursor(false);  % remove the joystick cursor


% give names to the TaskObjects defined in the conditions file:
background = 1;
cue = 2;
monkey1 = 3;
monkey2 = 4;
bgbar = 5;
CorrectSound = 6;
ErrorSound = 7;

% define time intervals (in ms):
wait_for_fix = 5000;
sample_time = 5000;
max_reaction_time = 2000;


% touch window (in degrees):
hold_radius = 2.5;

% toggleobject(background,'Status','on','eventmarker',10);
toggleobject(cue,'Status','on');
toggleobject(bgbar,'Status','on');
idle(sample_time);
toggleobject(bgbar,'Status','off','eventmarker',20);
toggleobject([monkey1 monkey2],'Status','on');
ontarget = eyejoytrack('touchtarget', monkey1, hold_radius, max_reaction_time);
if (ontarget == 1) % if stimulus is touched
    toggleobject([background cue monkey1 monkey2], 'Status', 'off'); % turn off all stimulus
   goodmonkey(100, 'juiceline',1, 'numreward',2, 'pausetime',500, 'eventmarker',50); % 100 ms of juice x 2
    toggleobject(CorrectSound);
    trialerror(0); eventmarker(50) % Correct trial
    toggleobject(Square2, 'Status', 'off'); % take away touched stimulus
end
if (ontarget == 0) % if stimulus is not touched
    toggleobject([background cue monkey1 monkey2], 'Status', 'off'); % turn off initial stimulus
    trialerror(1); eventmarker(60)% monkey did not touch
    toggleobject(ErrorSound);
end

Nothing happens if I change the order of background, cue, and bgbar. The background image remains present on the screen and no other objects are shown. I've tried running it without that image and everything still pops up; it's just appearing under the background image.

If anyone has any idea how to correct this, I would be very appreciative.

Thank you all.
0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #2 
You need to change the order of TaskObjects in the conditions file, not in the timing script. See the online manual of the conditions file in the following link.

http://www.brown.edu/Research/monkeylogic/conditionsfiles.html#arguments

At the bottom of the TaskObjects section, it says, "For visual stimuli, a TaskObject with a lower number (towards the left of the list) will layer atop those to its right. Therefore, most users will want fixation point images, for example, to be the first item listed, so that it will remain visible over any images that might appear at the same location."

So your code should be like this:

background = 5;
cue = 1;
monkey1 = 2;
monkey2 = 3;
bgbar = 4;
CorrectSound = 6;
ErrorSound = 7;

% Do not call toggleobject multiple times. Just one call will do.
toggleobject([background cue bgbar],'eventmarker',10);
idle(sample_time);
% This will turn off bgbar and turn on monkey1 and monkey2 simutaneously
toggleobject([bgbar monkey1 monkey2],'eventmarker',20);
0
MR_Riley

Junior Member
Registered:
Posts: 10
Reply with quote  #3 
Thank you for your help. That solved the problem I was encountering.

On another topic, would you know how best to track two different areas of the touchscreen for presses?

For example, could we run two different eyejoytrack scripts simultaneously to detect which target was touched rather than wait for one to finish the duration?
0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #4 
You can set multiple targets for eyejoytrack. See the manual below.

http://www.brown.edu/Research/monkeylogic/timingscripts.html#eyejoytrack
0
aboharbf

Member
Registered:
Posts: 97
Reply with quote  #5 
How does this logic change for the scene framework?

I am attempting to display a picture with the continued display of the fixation. It seems like in the following:

<p>%scene 2: sample for a duration

rewind_movie(sample, stim_start) % move the stimulus to the right start time
fix2 = MultiTarget(eye_); 
fix2.Target = [fixation_point sample]; 
fix2.Threshold = fix_rectangle; 
lh2 = LooseHold(fix2); 
lh2.BreakTime = break_time
lh2.HoldTime = sample_time; 
stop2 = GetStopStatus(lh2);
fc = FrameCounter(null_); 
fc.Duration = stim_dur;

or = OrAdapter(stop2); 
or.add(fc) 
sample_scene = create_scene(or,[fixation_point sample]);</p>

 

This leads to the fixation point seemingly covering up the sample, despite being much smaller. Of note, in the 'Virtual monitor' where we see what the subject sees, the dot comes on and vanishes, whereas in the panel where simulated eye movements are performed, a single frame of the sample appears at the end of the presentation. 
0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #6 
Your code is not executable and I don't understand what you are asking about. Please explain again what your question is.
0
aboharbf

Member
Registered:
Posts: 97
Reply with quote  #7 
Ah sorry. Basically my question is how does one set up a scene in order to display two TaskObjects at once. In my case, I'd like Scene 1 to be a fixation dot, and Scene 2 to be the same fixation dot with an image behind it. It seems like the fixation dot in my case is completely blocking the image, despite the dot itself being not very large - It fills in the area around it with the background.
0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #8 
I am confused. How can a fixation dot in front of an image not block the image? What is the fixation dot that you use? Is it an image file?
0
aboharbf

Member
Registered:
Posts: 97
Reply with quote  #9 
I use what is produced by the MLConfig panel. the problem I have isn't that the dot covers a spot, its that it covers the whole thing. the picture is a square 10 * 10 DVA, and the fixation dot is a 1 DVA circle. When I present both, you can not see the image behind the dot.
0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #10 
How can a 10 x 10 deg image be covered by a 1 x 1 deg dot? What is the size of the image in pixels and what is your pixels per degree? You are not running this on a different system with one monitor, are you?
0
aboharbf

Member
Registered:
Posts: 97
Reply with quote  #11 
Quote:
Originally Posted by Jaewon
How can a 10 x 10 deg image be covered by a 1 x 1 deg dot? What is the size of the image in pixels and what is your pixels per degree? You are not running this on a different system with one monitor, are you?


Good question - I don't know. All I'm saying is I use a single two item [Target] and then call the create scene command on the same combo in the same order (as the edited code above shows) and this leads to only one or the other I age showing, never both. I figure I must be doing something wrong. What is the correct way to show two TaskObjects at the same time?
0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #12 
What are the coordinates of fixation_point & sample? Are they occupying the same space? Try putting them apart.
0
aboharbf

Member
Registered:
Posts: 97
Reply with quote  #13 
Yes, they are occupying the same space, and the task requires both be centered at the origin.
0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #14 
You didn't show your Scene 1, but it seems that you want to check if a previously acquired eye fixation is maintained. Then you just need SingleTarget and LooseHold in the chain. Everything else is not necessary. Please learn how each adapter works with the examples under the "task\runtime v2" directory. Here is the code I modified.

% scene 2: sample for a duration
rewind_movie(sample, stim_start) % move the stimulus to the right start time
f
ix2 = SingleTarget(eye_);
fix2.Target = sample;
fix2.Threshold = fix_rectangle;
lh2 = LooseHold(fix2);
lh2.BreakTime = break_time;
lh2.HoldTime = sample_time;
sample_scene = create_scene(lh2,[fixation_point sample]);

In your code above, you set multi-target windows at the same location. MultiTarget is to check which one among many targets acquires fixation. Since the eye position is already at the center from Scene 1, both fixation_point and sample think that they captured the eye and turn off the other, which, I guess, is why you saw none of them or only one. The single frame that appeared on the control screen at the end is the trial summary, which you can turn off on the main menu.
https://monkeylogic.nimh.nih.gov/docs_RuntimeFunctions.html#MultiTarget
0
aboharbf

Member
Registered:
Posts: 97
Reply with quote  #15 
Mutlitarget was a last ditch effort after many attempts using SingleTarget (perhaps foolishly believing Multitarget would simply draw the two with overlapping fixation boxes). Using the code you've pasted produces this:
MKL2Post.png  Of note, on the control screen on the red sphere is my cursor simulating eye signal, and the pink dot is my original fixation dot. Oddly though, despite changing the color of the fixation dot to red, and the red dot appearing during the actual fixation scene, this pink dot is basically stuck there and I don't see a way to remove it. 

In my actual task, I put lh2 into an or adapter with a frame counter, and use "sample_scene = create_scene(or, sample)" to generate the scene. changing sample to [fixation_point sample] or [sample fixation_point] does not lead to both being presented.

0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #16 
It is a misbelief, since MultiTarget does not draw any stimulus. You can test it yourself easily.

The pink dot is not your fixation dot. It is the cursor for the 2nd eye.

I don't think the OrAdapter does anything there. Why did you add it?

It is not the order that you add stimuli to the create_scene but the order that you created them (i.e., TaskObject#).

I don't think you gave all necessary information. Please send me all your task files, including the stimuli.

0
aboharbf

Member
Registered:
Posts: 97
Reply with quote  #17 
PM'ed, Thanks a lot.
0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #18 
You created the 'fix' object as the 7th stimulus after all those 'mov' stimuli. It is no wonder that you didn't see the fixation dot. Put it in the first place in the struct array in your stimStruct_.mat.

You could test it easily by making the fixation dot huge, like 10 degees, on the main menu. You should be able to see it on the background behind the movie.
0
aboharbf

Member
Registered:
Posts: 97
Reply with quote  #19 
Why does the management of 'fix' in the userloop affect the Task structure? the timing file is doing everything based on the TaskObjects, and every individual trial sees only 2 TaskObjects, the C vector passed out by the userloop is [fixationDot Stimulus]. Can you share some documentation that might help me understand that better? The 10 degree fixation dot is visible behind the movie.
0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #20 
I see where you got confused. You created all stimuli before the task started. At that moment, their object numbers were already determined. Changing their places in the vector has no effect.

If you wanted to change their order dynamically, you should have not created them beforehand. Instead, you could return the struct array in a different order.

https://monkeylogic.nimh.nih.gov/board/read.php?2,12,12#msg-12
0
aboharbf

Member
Registered:
Posts: 97
Reply with quote  #21 
I see. I had imagined the userloop and timing script behaved in a more isolated way, and the order in which C was constructed and passed out would be enough to change the order. after moving the fixation dot to the first item in the TaskObject vector, when it is on, it is on top. Thanks a lot for the help.
0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #22 
Please read carefully. It is enough to change the order, if your userloop returns the specifications of the stimuli and let ML create them just like the conditions file. However, you are just reusing previously created stimuli of which z-order is already determined. What matters is the order they are created.
0
aboharbf

Member
Registered:
Posts: 97
Reply with quote  #23 
Alright, so in the circumstances of a userloop with the persistent TaskObject, they've been pre-created, and their order is set. 
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.