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

Vera vera.donk at googlemail.com
Fri Mar 12 10:47:35 UTC 2010


Grrr, too fast: relevation = revelation ;-)

On Mar 12, 11:46 am, Vera <vera.d... at googlemail.com> wrote:
> 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
>
> ...
>
> read more »

-- 
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