Correct Response Dependent Images
 
 
 
PST User Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Correct Response Dependent Images Expand / Collapse
Author
Message
Posted 7/16/2008 9:02:51 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 9/8/2008 2:27:00 PM
Posts: 14, Visits: 39
Next problem:
I want to display images on the slides that also display the stimuli. These images should be shown near the target word. When such an image is correctly responded to, it should be shown in the lower left corner on the next trial. It should stay there in the following trials until another picture is correctly responded to. Then that image takes its place. There is a default starting image.
The problem is that I cannot find the SlideImage object in the program text, it isnt referenced by its name-attribute I think. If I could find that object and set its filename to the imagefile that was correctly categorized last trial at the start of the procedure, then I guess it would give the correct results. Am I rite, folks!?

This is the code ive added in an inline object after the trialslide but before the feedbackslide (the four lines of code after 'PersistentImageCont are copied from the script):
If TrainSelf.ACC = 1 Then
'PersistentImageCont <- name of imagedisplay
Set FeedbackSlide_SlideImage= CSlideImage(FeedbackSlide.States(FeedbackSlide.ActiveState).Objects(1))
FeedbackSlide_SlideImage.Filename = c.GetAttrib("ImageFile")
FeedbackSlide_SlideImage.Load
Set FeedbackSlide_SlideImage = Nothing
Else
Set FeedbackSlide_SlideImage = CSlideImage(FeedbackSlide.States(FeedbackSlide.ActiveState).Objects(1))
FeedbackSlide_SlideImage.Filename = c.GetAttrib("EmptyImage")
FeedbackSlide_SlideImage.Load
Set FeedbackSlide_SlideImage = Nothing
End If
Ive tried adding this script in an inline object, but there is a run-time error that the filename on imagedisplay has not been set.

Ive attached the last version of the experiment and the txt-files to do the first personality domain. The SlideImages arent on it yet, they should be placed on any of the first slides in the trial procedures.

PS: Eventually I want three images to display on each stimulus-slide, so I would need to know how to access the properties on multiple imagedisplay objects
Post #1801
Posted 7/16/2008 10:11:44 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 9/8/2008 2:27:00 PM
Posts: 14, Visits: 39
Oh and the Text and Image stimuli should not be displayed at the same time but they should interchange (across trials). This can be done by having two rows in the text column, one for the textdisplay and the other for the image, and then always have one of the columns 'empty' like an empty string or a white/transparant imagefile, right?
Post #1802
Posted 7/22/2008 9:00:52 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 9/8/2008 2:27:00 PM
Posts: 14, Visits: 39
To recap: How do I approach an image display container on a slide?
Please Help.
Post #1851
Posted 7/23/2008 8:21:17 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 9/8/2008 2:27:00 PM
Posts: 14, Visits: 39
Could I use the canvas.loadimage method that is mentioned in the reference guide? But I do not see a location property...Is this included in the method definition for loadimage and if so what are all the input variables for this method?
Post #1859
Posted 7/23/2008 8:59:21 AM
Forum MVP

Forum MVPForum MVPForum MVPForum MVPForum MVPForum MVPForum MVPForum MVP

Group: Administrators
Last Login: Yesterday @ 9:26:59 AM
Posts: 576, Visits: 1,254
I could be missing what you are asking, but you can vary just about any property of a Slide or its sub componentes with [attrib] references.  For this image you want to switch, if you set its filename to [Image1Filename] then E-Studio will automatically generate code to look for the "Image1Filename" attribute, which must either be a column in your List or set via a c.SetAttrib InLine command.

For most designs you know these properties ahead of time so you can populate your List object with the values.  In the case of a state machine or dynamic values based on responses or other conditions, you can use global script variables to store them and set the Attrib at the top of the procedure to assign it.  The attached example is a modification to BasicRT that should be dropped into the PictureRT sample folder so it finds the .bmp files.  When run it shows the BlueCar if you respond correctly and the RedCar on the next trial if you do not.  This is handled by setting the filename in an InLine to the global variable and assigning the attribute in an InLine as well.

If you wanted to vary the position depending on the condition, you could set up the Width/Height/X/Y properties with [attrib] references to perform similar dynamic movement.

As a programmer, my first instinct is to go right to script, but E-Studio provides a number of facilities that either require no script or ability to accomplish the task with limited script like in the attached example.  If you do find a complex design that requires accessing the objects via script, then you can do this in E-Basic.  For most objects this is as simple as assigning the properties via an InLine (i.e. TextDisplay.Text = "MyText").  For the Slide, this is only a little more complex to get the object you wish and assign/cast it to the type that you expect.  For example, if you had a SlideImage called Image1 on a Slide called Stimulus, you can get it via...

Dim theSlideImage As SlideImage
Set theSlideImage = CSlideImage(Stimulus.States(Stimulus.ActiveState).Object("Image1"))

From there, you can access, the Filename, MirrorLeftRight, etc. properties.  The E-Basic help has all of the props/methods each type of object supports.  In addition, Sample: Response Areas for Mouse Input and I would imagine some other samples show some ways to access and manipulate objects via script.

  Post Attachments 
BasicRTWithPicture.es (5 views, 26.57 KB)

Post #1863
Posted 7/25/2008 11:02:27 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 9/8/2008 2:27:00 PM
Posts: 14, Visits: 39
Ok, I'm getting closer but it still doesnt work.
I get an error that and imagedisplay (at the line with the command trainSelf.loadProperties) is not set when I use the following code:
Dim theTargetSlideImage As SlideImage
Set theTargetSlideImage = CSlideImage(TrainSelf.States(TrainSelf.ActiveState).Objects(4))
theTargetSlideImage.Filename = NoImageFilename
NoImage = True

if c.GetAttrib("Target") = "" then
theTargetSlideImage.Filename = c.GetAttrib("ImageFile")
NoImage = False
else
theTargetSlideImage.Filename = NoImageFilename
NoImage = True
end if
theTargetSlideImage.Load
Set theTargetSlideImage = Nothing

It is the same when I use the name of the control in the objects function like:
Set theTargetSlideImage = CSlideImage(TrainSelf.States(TrainSelf.ActiveState).Objects("TargetImage"))

I used objects(4) because thats what it said when i looked at the script when I set the filename property of the Targetimagedisplay to an [attribute].

What to do?
Ive attached the project, you only have to look at the code of anything up to and including TrialSelfProc

Post #1880
Posted 7/28/2008 11:23:16 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 9/8/2008 2:27:00 PM
Posts: 14, Visits: 39