Welcome! Log In Create A New Profile

Advanced

ImageChanger

Posted by daddaoua1978 
ImageChanger
March 03, 2022 12:51PM
Hi Jaewon,
Just started to use version2, sorry for my ignorance.
I just wanted to flash 2 pictures (back and forth) as long as the monkey is fixating. ImageChanger seems a good start, however the stop condition is when the pictures are all shown. On the other hand ImageGraphics have the good stop condition: When the child adapter stops.
I tried to understand where that stop condition is implemented in ImageGraphics so I can use it in ImageChanger without luck.
Any help, tip is really appreciated.
Thank you

Nabil
Re: ImageChanger
March 03, 2022 02:31PM
The idea behind the scene framework is to assemble something with existing components, if possible. Think harder to avoid modifying built-in adapters or writing a new one. It will make your life easier.

Please take a look at this document, if you did not do so yet: How to create adapter chains. Your starting point is to determine which adapter should be the topmost adapter of the scene.

It is usually not the stimulus but the behavior that terminates a scene. From what you said, I guess your scene should stop when the fixation is broken. So the topmost should be SingleTarget.
fix = SingleTarget(eye_);
fix.Target = [0 0];
fix.Threshold = 3;
scene = create_scene(fix);
run_scene(scene);

You want to show multiple pictures while the scene continues. You can do it with either ImageChanger or MovieGraphic. Since ImageChanger does not repeat the image sequence, you need to make it long enough to cover the entire fixation period. If the fixation duration is indefinite, MovieGraphic with looping may be a better solution.

Since the images has nothing to do with the scene termination, you can add the image component to the scene with Concurrent.
fix = SingleTarget(eye_);
fix.Target = [0 0];
fix.Threshold = 3;

img = ImageChanger(null_);
img.List = { 'A.bmp', [0,0], 10;  % for 10 frames
    'B.bmp', [0,0], 10 };

con = Concurrent(fix);
con.add(img);

scene = create_scene(con);
run_scene(scene);

Concurrent stops the scene when the first added component ('fix' in this case) stops. Image presentation will stop as well, when the scene ends, but that is just a result of the fixation break.
Re: ImageChanger
March 04, 2022 10:10AM
Hi Jaewon,
Thanks for your quick reply and thanks again for accommodating my ignorance.
Your detailed answer was extremely helpful.
Thanks

Nabil
Re: ImageChanger
March 04, 2022 05:37PM
Actually there is no reason that ImageChanger cannot repeat the image list. Please update your NIMH ML. Now you can make it repeat as many times as you want, including Inf, with the Repetition property.
https://monkeylogic.nimh.nih.gov/docs_RuntimeFunctions.html#ImageChanger
Re: ImageChanger
March 08, 2022 03:19PM
Thanks Jaewon,
That's all what I needed, for now smiling smiley
Best,

Nabil

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.