Substitute one out of 100 images on a slide

David McFarlane mcfarla9 at msu.edu
Tue Jul 12 15:32:44 UTC 2011


Try something like

Mask_SlideImage.Filename = "mask" & i & ".bmp"

where image file names take the form "mask1.bmp", "mask2.bmp", 
etc.  You get the idea.

BTW, why do you have a Select Case... clause in your code 
excerpt?  Since you have only one case, you could eliminate 
that.  Also, why have a For loop from 1 to 101, and then include an 
If clause for i=1?  Why not instead just do i=1 outside the loop, and 
then loop for i = 2 to 101?  Also, this should make no difference, 
but you could move the Set Mask_SlideImage = New SlideImage and Set 
Mask_SlideImage = Nothing statements outside of the loop.

Regarding an earlier question about the time it takes to Load the 
same image 100 times, most machines already do automatic disk 
caching, so once your program has loaded the file the first time then 
it should just load the image from the memory cache all the other 
times.  We have taken advantage of that behavior ourselves in some 
programs.  So I don't know what takes your computer so long to do 
this.  But I agree with Mich on the other thread that you might get 
maximum performance by judicious use of the Canvas.

-- David McFarlane, Professional Faultfinder


>Hey there,
>
>as you might have read in other posts, I try to save computing time
>for a current experiment in which 100 bitmaps are loaded for one
>slide.
>
>As two slides are exactly identical apart from one single stimulus
>among these 100, I thought maybe it is possible to replace one of the
>100 stimuli with another one. Thus I could save time but not loading
>the other 99 images again.
>
>This is the way I define the images for one the slides:
>
>
>for i = 1 to 101
>'matrix positions
>                 Set Mask_SlideImage = New SlideImage
>                 Mask_SlideImage.Name = "Image" & i
>                 InitSlideImageDefaults Mask_SlideImage
>                 Mask_SlideImage.X = "104 " + ((i-1) mod 10)*48
>                 Mask_SlideImage.Y = "24" + ((i-1) \ 10)*48
>                 Mask_SlideImage.Width = "40"
>                 Mask_SlideImage.Height = "40"
>                 Mask.States.Item("Default").Objects.Add 
> Mask_SlideImage, "Image" & i
>
>Select Case Mask.ActiveState
>Case "Default"
>
>                         Set Mask_SlideImage =
>CSlideImage(Mask.States.Item("Default").Objects(i))
>                         Mask_SlideImage.Filename = "mask.bmp"
>                         if i = 1 then Mask_SlideImage.Filename = 
> "fixation.bmp"
>                         Mask_SlideImage.Load
>                         Set Mask_SlideImage = Nothing
>
>end select
>next i
>
>
>
>My idea is that one of the 100 images will be redefined concerning the
>Filename. I would just have to re-load the SlideImage with a certain
>number "i" (that refers to a position in the matrix).
>
>The problem is: I don't know how to tell the computer WHICH of the
>images should get a new filename. The command
>"Mask_SlideImage.Filename = "mask.bmp"" does not refer to a number
>defining which image of the slide is meant...
>
>I hope you have some more clue than me! :)
>
>Best,
>Tobias

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