On one slide, show different images, loaded from a list

Vera vera.donk at googlemail.com
Fri Mar 12 10:46:25 UTC 2010


Hello everybody!

Well, here I am, back after a good night of sleep (or almost, somehow
I woke up several times thinking about columns, lines and
trials...). ;-) We might think that E-Prime is actually getting "into
me". Well, as I had started some programming (as I really figured I
had tried every possible solution, looked at the file Susan sent by
the way, it seems VERY complicated to me and I also have a run-time
error (or was it compilation error??)) which makes I can't actually
run the program, but at least I had a look at the structure and I
think I get the point.

So then after yesterday having been programming the whole day (got
some help from a collegue though as I am completely new to programming
in general) and after some kind of "relevation" this morning (I don't
know why I thought of the solution I found, but it worked) I got a
solution, which I am now very happy (and proud! ;-) ) to post here:

In Eprime itself I made 3 slidestates (one with 9, another one with 16
and another one with 25 images). To each image a dummy image needs to
be attributed - in my case I put a simple dummy.png which is simply a
black square (my background is black too). Yep, it's a lot of work
doing that all by hand, especially because you can't change settings
for all images at once.
In my DesignList I created different attributes ("Target" (filled with
1's and 0's), "Image" (empty), "CorrectResponse (filled with 1's and
2's) and "SlideState" filled with one of the possible slidestates for
each condition.

Then, in my Trial Procedure (the one that follows the DesignList), I
created a script (before the slide) as follows:

'Eprime reads out for every line in the column "SlideState" which
'slidestate it needs to take. It replaces the strings in this column
'by z with a dIfferent number (in this case the number of items:
' 9, 16 or 25).

If c.GetAttrib("Slidestate") = "State09" Then
		z = 9
	ElseIf c.GetAttrib("Slidestate") = "State16" Then
		z = 16
	ElseIf c.GetAttrib("Slidestate") = "State25" Then
		z = 25
End If

'E-Prime reads out of the column "Target" if a target is present
'or not (in this case 0 indicates the absence of a target, 1
'indicates the presence of a target. After reading out, it transforms
'those values to an y-value.

If c.getAttrib("Target") = 0 then
		y = 0
	ElseIf c.getAttrib("Target") = 1 then
		y = 1
End If

'For the number 1 until z or 1 until (z-y) n case a target is present
-
'which translates into 1 until 25 or 1 until (25-1) when a target is
'present - a sequence is created with numbers from 1 and 2.

For i = 1 to z - y
	sequence(i) = Random(1,2)
Next

'And after those random numbers have been generated, a target
'(or not) is added.

If y = 1 then
	sequence(z) = 0
End If

'This sequence is then randomized, but only for the array members
'1 until z (take care to do this, because if not, you might possibly
'find 2 or more targets in your trial.

randomizearray sequence, 1, z

'This is done as to get the output of the sequence written into the
'textfile as a string. You don't need to do this for the program to
'work. I just added this so afterwords I could know at which
'position exactly the target had been as well as the position
'of the different distractors. E-Prime just gives out a string
'for exp. 102122111 indicating that there was one target (0)
'on position two and distractors (1) and (2) on the other positions.

s = str(sequence(1))

For i = 2 to z
	s = s + Str(sequence(i))
Next

c.setAttrib "Image", s


'SlidePres here gets the information about which slidestate to
'refer to

SlidePres.ActiveState = c.GetAttrib("SlideState")

'Images are generated

Dim images (1 to z) As SlideImage
For i = 1 to z
	dim num as string
	dim image_name as string
	num = Str(i)
	num = LTrim$(num)
	image_name = "Image" + num
	Set images(i) =
CSlideImage(SlidePres.States(SlidePres.ActiveState).Objects(image_name))
Next

'And filled with the right image according to the sequence we
'generated above. Make sure to write two \\ in the path to the
'filename, as if not Eprime (or Visual Basic) interpretes it as
'some kind of operator.

For i = 1 to z
	If sequence(i) = 0 then
     	images(i).Filename = "D:\\EPrime\\yellow_square.png"
  	ElseIf sequence(i) = 1 then
		images(i).Filename = "D:\\EPrime\\yellow_triangle.png"
	ElseIf sequence(i) = 2 then
		images(i).Filename = "D:\\EPrime\\blue_square.png"
	End If
Next

'Images get loaded

For i = 1 to z
	images(i).Load
Next

'The slide is drawn

SlidePres.Draw


Voilà!!!! :-) I am really happy it works!!! :-) Thanks a lot for your
help to all of you, I will for sure still try to get working some of
the solutions you proposed (I am still convinced that E-Prime should
work without programming - and for me, although I learend something
and it now works, I still don't like the programming part) and
especially your solutions David and Liwenna, because they seem to be
good ones too. I also didn't abandon my "fix images project" (I had a
programmer here generate 300 different pics for me) so I have a backup
in case all this will finally not work like I imagined. :-)

In the meanwhile, have a nice day and thanks again for all your help!

Vera (very relieved)


On Mar 12, 12:47 am, David McFarlane <mcfar... at msu.edu> wrote:
> Vera,
>
> Good.  I just needed better assurance that you had some experience
> with colon syntax, otherwise nothing else I add here will make
> sense.  And let me say first that making a number of pre-arranged
> combinations is a time-honored way of doing things (think back to the
> days of opto-mechanical slide projectors for stimulus presentation),
> so if you get that to work then more power to you.
>
> In the meantime, I also tried the example VisualAttention.es that
> Susan mentioned.  I hope that program does not represent the quality
> of the other STEP offerings (especially since I have referred folks
> to STEP myself) -- First it has a mistake that causes a runtime error
> (though easily fixed), and then the structure seems awfully complex
> for what it needs to do.  It does indeed show a bit of using colon
> syntax to arrange stimuli at random spots in a circle, but then it
> only uses text stimuli, and because of a flaw that remains even in
> EP2 this may crash when you try using pictures in place of text.  Of
> course it may well be that I do not correctly understand the tasks
> here, so let me present the lesson and you tell me where I get it wrong.
>
> Speaking of text vs. pictures, I need you to first work this out with
> text only (no pictures), and then later advance to pictures -- if you
> cannot get the structure to work with plain text, then nothing else
> matters.  Once again, we use the time-honored strategy of "divide and conquer".
>
> So let's simplify this a little more for the sake of
> discussion.  Let's suppose you have only three spots on the screen,
> and you want to randomly assign some text samples to each of those
> three spots.  And to prepare for pictures later, we might as well use
> file names for our example text stimluli (but please, please, do
> *not* use actual picture files yet for this exercise!!).  We start
> with a stimuls Slide in our TrialProc, let's call it StimSlide, with
> three SlideText objects that contain the following (and looking ahead
> to putting our picture files in a subdirectory, as discussed in other threads):
>
> material/[Stim1].png
> material/[Stim2].png
> material/[Stim3].png
>
> Next, in our TrialList, we have a nested List plus three attributes
> (columns) called Stim1, Stim2, and Stim3, each containing a
> colon-syntax reference to the nested List, something like this (this
> may not line up well in your reader):
>
> Weight  Nested    Procedure  Stim1     Stim2     Stim3
>       1  StimList  TrialProc  [Stim:0]  [Stim:1]  [Stim:2]
>
> Almost done.  Now in the nested StimList we add the attribute Stim
> and fill in our actual stimulus items, e.g.,
> Stim
> circle
> square
>
> And we set StimList to Random order.
>
> So how does this all work?  E-Prime shuffles the StimList.  On each
> round, TrialList then picks three new items from StimList, and then
> those go right into the three locations in StimSlide.  See how simple
> that is once you get it all sorted out?  And not a line of code!  You
> just have to grasp the broader underlying concepts and principles of E-Prime.
>
> As I have presented it this should still work for picture files.  If
> you were instead to use only text stimuli then you could leave out
> the extra columns in TrialList and use colon syntax directly in
> StimSlide (but as discussed in the earlier thread, this will fail for
> the special cases of images and sounds in Slides).  Also, you could
> replace "Stim:0" everywhere with simply "Stim", but when I use colon
> syntax I like to leave it in for clarity.
>
> Whew!  You can see why I often have to put people off for awhile,
> because I do have other work to do to.  So give this a whirl if you
> like.  Now it is late here in the U.S. midwest, and I have to get
> home and get ready for tonight's episode of Survivor (US knockoff of
> Expedition Robinson).
>
> -- David McFarlane, Professional Faultfinder
> "You got to test that piece of software, You got to test it for yourself,
> No one else can test it for you, You got to test it for yourself."
> (Apologies to the Fairfield Four)
>
> At 3/11/2010 01:53 PM Thursday, you wrote:
>
> >Hi David,
>
> >well about the "I need you to struggle a bit first so that the later
> >lesson will "take" " I think I definitely have been struggling a lot
> >already and trying every single solution I could think of (including
> >scripts, including nested lists, including nested lists with colon
> >syntax...). :-)
>
> >For the colon syntax by the way, I first thought of this solution too
> >(well after I tried the first solution in which I naively expected E-
> >Prime to read out 9 different images out of one list (out of one
> >column so to say) which is apparently not the case) so I wrote into my
> >list that my images (all with the syntax [Image] as filename (and yes,
> >I created an attribute "Image" too) should go to the attribute
> >[ImageInNestedList:9] in the nested list (which of course also I
> >created with an attribute ImageInNestedList). But the same problem
> >here too: E-Prime only reads out 1 image out of this list (so one line
> >at a time) and then replicates that image 9 times (so yep, I end up
> >with 9 times the same image on the slide).
>
> >So for the moment, the only solutions I see are:
>
> >1. Define a certain number of combinations (let's say 200) and just
> >write them into E-Prime.
> >2. Write some kind of script
> >3. Make let's say 200 different images (fixed with the 9 images).
>
> >The last one is by the way the solution I am going to use for the
> >moment (a collegue has some script to create 200 random images in no-
> >time) as time is running out and we need a "quick and dirty" solution
> >rapidly. However, I will keep on trying to get this right, because
> >after the pilote-study, this whole test is supposed to communicate
> >with our driving simulator (I am not programming this!) so that we can
> >control some driving task with the secondary task.
>
> >So I still need to find a solution!!!
>
> >:-)
>
> >On Mar 11, 3:12 pm, dkmcf <mcfar... at msu.edu> wrote:
> > > Vera,
>
> > > Wow, what a discussion this sparked!  I think E-Prime can do what you
> > > want in a quite straightforward way using nested Lists without any
> > > inline code.  As hinted at the thread that you cited (http://
> > > groups.google.com/group/e-prime/browse_thread/thread/
> > > 58e3ae402de68442 ), the key is "colon syntax".  So if you do not
> > > already have this working, here is another homework assignment for
> > > you:  Go to the index in the User's Guide that came with E-Prime and
> > > look up "colon syntax", then follow that to the appropriate tutorials
> > > and work through all of those.  That might give you enough ideas to
> > > figure it out.  But if you remain stuck after that, then refresh this
> > > thread some time next week and I will post more details on this
> > > approach (I need you to struggle a bit first so that the later lesson
> > > will "take").
>
> > > And don't forget PST Web Support, they like to take these sorts of
> > > questions athttp://support.pstnet.com/e%2Dprime/support/login.aspand
> > > they strive to respond to all requests in 24-48 hours (although
> > > reported response time is currently more like 5 days).  If you do
> > > contact Web Support then please report back here with the results.
>
> > > -- David McFarlane, Professional Faultfinder
>
> > > On Mar 10, 11:45 am, Vera <vera.d... at googlemail.com> wrote:
>
> > > > I sure hope I will get some help here! I am trying to construct a
> > > > visual search task in which participants have to find let's say a
> > > > "yellow triangle" within "blue triangles" and "yellow triangles".
>
> > > > For this, I created a list with different conditions (like number of
> > > > items on the grid, target present or not) and I was actually counting
> > > > on using a slide with (let's say) 9 images, on which I would each of
> > > > the 9 images randomly from a nested list.
>
> > > > So I made my nested list with images (.png's) and I of course made
> > > > sure to have the image-objects on the slide point first to the
> > > > procedure list and then to the nested list (I think I read about all
> > > > the messages concerning this topic, including this
> > onehttp://groups.google.com/group/e-prime/browse_thread/thread/84c742b85...
> > > > (thanks a lot for the work-around, it was a good thing for me to see
> > > > if I did it right, which I did, but it still will not load the right
> > > > pictures).
>
> > > > So the problem is: It seems that the "point to the nested list
> > > > function" is working, but then it seems impossible to load 9 DIFFERENT
> > > > images (it will show me 9 times the same image, at least therewith
> > > > confirming that it points to the correct nested list).
>
> > > > And I tried every option I could think of (like putting the 9 images
> > > > in one line of the nested list, but then I get other errors). :-( I am
> > > > now believing that I should maybe really write to the developers,
> > > > simply because this "functionality" seems to be absent.
>
> > > > Now I will probably have to code it (which is were the real problem
> > > > starts, because I am an absolute no-programmer ;-) ) and the institute
> > > > where I am currently working actually bought E-Prime because it should
> > > > be more or less "programming-free" (well ok, I understand you cannot
> > > > rule it out completely, but the thing I described above should be
> > > > possible in my opinion).
>
> > > > I really hope some of you guys have some creative solution for me!
>
> > > > With kind regards,
>
> > > > Vera
>
> >--
> >You received this message because you are subscribed to the Google
> >Groups "E-Prime" group.
> >To post to this group, send email to e-prime at googlegroups.com.
> >To unsubscribe from this group, send email to
> >e-prime+unsubscribe at googlegroups.com.
> >For more options, visit this group at
> >http://groups.google.com/group/e-prime?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list