<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Thanks a lot! I will have a try. I greatly appreciate your help!<BR> <BR>
<HR id=stopSpelling>
Date: Fri, 17 Apr 2009 22:09:05 +1000<BR>To: e-prime@googlegroups.com<BR>From: pquain@une.edu.au<BR>Subject: RE: Image display delay<BR><BR><BR><BR>Hi - a previous suggestion was to do away with the image display object and use canvas to remove your reported display delay and also ensure ttl pulse accurately marks stimulus onset.<BR><BR>If it is of any use, here is some example code that preloads the image info into video memory - offScreenCanvas - prior to the time critical parts of the trial .. fixation, and then image display, where the offScreenCanvas is drawn to screen (copied to the display canvas [cnvs]), and a ttl pulse is sent to some NeuroScan equipment. The copy operation takes <1ms (t6-t5), so the image becomes available to subject over the ~11.7 ms @ 85Hz (i.e., half drawn by ~6 ms) as the screen is drawn, and ttl pulse is reliably sent on same screen refresh.<BR><BR>Sequence is: 1) InLine - StimPrep; 2) Fixation (a text object); 3) InLine - DisplayStim<BR><BR>- Key variables are declared in User Script<BR>- TrialList needs attributes 1) Pic = image name; 2) PicType = condition<BR>- 9 conditions in this example, with event codes 1 to 9<BR>- Image display duration is set at the beginning of the experiment with an integer value (intDur) collected by an AskBox. This could be hard coded if you wanted.<BR>- There is a delay (blank screen) of 3 screen refreshes (~35 ms) between Fixation offset and stimulus onset<BR>- Stimulus displayed centred on gray background<BR>- The Attributes t1, t2, ... t9, start, are all timing information used for diagnostics. Fixation onset and offset are grabbed as well .. intervals between these are easily computed later (e.g., in SPSS) and for each trial you can see how long various bits of code execution take (e.g., preload image, t2-t1); stimulus duration (t9-start); whether your machine accurately tracks retraces (t3-fixation.OffsetTime; t4-t3; t5-t4); and the accuracy of your ttl communication.. that is, that the pulse is sent on the screen refresh where the stimulus is drawn to screen (t7-t6), and the duration of the pulse (t8-t7). 7 ms has been OK for us (no missed event markers), recording EEG @ 500Hz.<BR><BR>Some of this code might be a bit rough. If anyone notices any errors in this approach, please post.<BR><BR>'--------------------------------------------------------------------------<BR>' User Script<BR>'--------------------------------------------------------------------------<BR>Public dstim As String<BR>Public hh, gg As Long<BR>Dim cnvs As Canvas<BR>Dim offScreenCnvs As Canvas<BR>Dim intDur As Integer<BR><BR><BR> '''''''''''''''''''''''''''''''''''''''''''''<BR> ' InLine - StimPrep BEGIN<BR> '''''''''''''''''''''''''''''''''''''''''''''<BR> <BR>dstim = c.GetAttrib ("Pic")<BR>hh = Clock.Read<BR>c.SetAttrib "t1", hh <BR><BR>'Define the display canvas for later <BR>Set cnvs = Display.Canvas<BR><BR>cnvs.BackStyle = "transparent"<BR><BR>cnvs.FillColor = CColor("Gray")<BR><BR>'use the CreateCanvas to create an off-screen canvas<BR>Set offScreenCnvs = Display.CreateCanvas <BR>offScreenCnvs.Clear<BR><BR>offScreencnvs.BackStyle = "transparent" <BR><BR>offScreenCnvs.FillColor = CColor("Gray")<BR><BR>offscreenCnvs.LoadImage dstim<BR><BR>hh = Clock.Read<BR>c.SetAttrib "t2", hh <BR><BR>' Image loads in top left corner - all images 512*384<BR>' ..so define region - rectangle - of offScreenCnvs to copy<BR>Dim srcRect As Rect<BR>srcRect.Left = 0<BR>srcRect.Right = 512<BR>srcRect.Top = 0<BR>srcRect.Bottom = 384<BR><BR> '''''''''''''''''''''''''''''''''''''''''''''<BR> ' InLine - StimPrep END<BR> '''''''''''''''''''''''''''''''''''''''''''''<BR> <BR> ' Fxation set to terminate synched with vertical retrace<BR><BR> Fixation.Run<BR> c.SetAttrib "Fixation.OnsetTime", Fixation.OnsetTime<BR> c.SetAttrib "Fixation.OffsetTime", Fixation.OffsetTime<BR> <BR><BR> '''''''''''''''''''''''''''''''''''''''''''''<BR> ' InLine - DisplayStim BEGIN<BR> '''''''''''''''''''''''''''''''''''''''''''''<BR> <BR><BR>' include a delay of 3 vertical retraces...1st is between Fixation Offset and this one<BR>Display.WaitForVerticalBlank<BR><BR>' grab timing info: start 1st of vertical retrace<BR>hh = Clock.Read<BR>c.SetAttrib "t3", hh <BR><BR>' 2nd vertical retrace delay is between 1st WaitForVerticalBlank command and this one<BR>Display.WaitForVerticalBlank<BR><BR>' grab timing info: start of 2nd vertical retrace<BR>hh = Clock.Read<BR>c.SetAttrib "t4", hh <BR><BR>' 3rd delay between 2nd WaitForVerticalBlank command and this one, <BR>' after which stimuli is drawn to screen<BR>Display.WaitForVerticalBlank<BR><BR>' grab timing info: start of 3rd vertical retrace<BR>hh = Clock.Read<BR>c.SetAttrib "t5", hh <BR><BR>' Define destination rectangle for centred display<BR>Dim desRect As Rect<BR>desRect.Left = 256<BR>desRect.Right = 768<BR>desRect.Top = 192<BR>desRect.Bottom = 576<BR><BR>' Copy source rectangle to destination rectangle<BR>cnvs.Copy offScreenCnvs, srcRect, desRect<BR><BR>Dim start As Long<BR>start = Clock.Read<BR>c.SetAttrib "t6", start <BR><BR>Dim dHex As Double<BR><BR>' parse condition and send appropriate trigger code to NuAmps<BR>If c.GetAttrib ("PicType") = 1 then<BR> dHex = Val(&H1)<BR><BR> elseif c.GetAttrib ("PicType") = 2 then<BR> dHex = Val(&H2)<BR><BR> elseif c.GetAttrib ("PicType") = 3 then<BR> dHex = Val(&H3)<BR><BR> elseif c.GetAttrib ("PicType") = 4 then<BR> dHex = Val(&H4)<BR><BR> elseif c.GetAttrib ("PicType") = 5 then<BR> dHex = Val(&H5)<BR><BR> elseif c.GetAttrib ("PicType") = 6 then<BR> dHex = Val(&H6)<BR><BR> elseif c.GetAttrib ("PicType") = 7 then<BR> dHex = Val(&H7)<BR><BR> elseif c.GetAttrib ("PicType") = 8 then<BR> dHex = Val(&H8)<BR><BR> elseif c.GetAttrib ("PicType") = 9 then<BR> dHex = Val(&H9)<BR><BR><BR>End If<BR><BR>' set time trigger code begins execution<BR>gg = Clock.Read<BR>c.SetAttrib "t7", gg <BR><BR>' send pulse for 7ms <BR>Do<BR>WritePort &H378, dHex<BR>hh = Clock.Read<BR>Loop While hh - gg < 7<BR><BR>'toggle all bits low (turn off TTL pulse)<BR>WritePort &H378, &H0<BR><BR>c.SetAttrib "dTrig", dHex<BR><BR>gg = Clock.Read<BR>c.SetAttrib "t8", gg <BR><BR>' Display the stimuli for appropriate duration (set at start of experiment)<BR>Do<BR>gg = Clock.Read<BR>Loop While gg - start < intDur<BR><BR>hh = Clock.Read<BR>c.SetAttrib "t9", gg <BR><BR><BR> '''''''''''''''''''''''''''''''''''''''''''''<BR> ' InLine - DisplayStim END<BR> '''''''''''''''''''''''''''''''''''''''''''''<BR> <BR><BR>At 12:30 PM 15/04/2009, you wrote:<BR><BR>
<BLOCKQUOTE class=cite cite="">get rid of image display object. use canvas to display image. Use inline to preload image to video memory at start of each trial. In inline that draws canvas, have ttl pulse code immediately after write to screen code. Hold high for maybe 7ms, then pull all pins low. Pulse should occur on screen refresh where image is drawn.<BR><BR>At 12:22 PM 15/04/2009, you wrote:<BR>
<BLOCKQUOTE class=cite cite="">Dear David<BR> I have read Chapter 3 of Userguide thoroughly, but still feel a little confusion. In each block of my programme, there was a TextDisplay, a Inline Scripe and a ImageDisplay(stimulous).To synchronize the signal of NeroScan and the stimuli of e-Prime, I have inverted a in-line WritePort command before "ImageDisplay" and set the PreRelease time (100ms) in the TextDisplay. However, the unwanted delay or unsynchronization still existed between the e-Prime and EEG recording system result in anormal delay of N170 component. Thus, I want to ask whether the WritePort command was sent to the recording system at the beginning of Prelease time or at the point when stimulous presents on the screen. In other word, I want to know whether the WritePort command and image were sent at the same time from E-Prime.<BR> Thank you for your concerning.<BR> <BR>> Date: Wed, 8 Apr 2009 11:26:12 -0400<BR>> To: e-prime@googlegroups.com<BR>> From: mcfarla9@msu.edu<BR>> Subject: Re: Image display delay<BR>> <BR>> <BR>> At 4/5/2009 09:35 PM Sunday, maocong wrote:<BR>> >I am a greenhand in programming on e-prime, and I need some help on<BR>> >the fellowing issue:<BR>> ><BR>> >I designed an ERP visual stimulous experiment by using the control of<BR>> >ImageDisplay on e-Prime 2.0v and the EEG recording system is NeroScan<BR>> >4.3v. And I found a 8~14ms delay on image display(shown by the<BR>> >programme running result file), and the help file showed this delay is<BR>> >the difference between orignial onset time and actual display time.<BR>> >This random image display delay greatly effect the accuracy of N170<BR>> >latency recorded, which lead to the unreliablity of the experiment<BR>> >result. Therefore I hope you can give me some advices about how to<BR>> >eliminate/compensate this display delay or how to uniform this display<BR>> >delay<BR>> <BR>> Please read thoroughly chapter 3 ("Critical timing...") of the User's <BR>> Guide that came with E-Prime.<BR>> <BR>> -- David McFarlane, Professional Faultfinder<BR>> <BR>> <BR>> More than mail–Windows Live™ goes way beyond your inbox.ox. <A href="http://www.microsoft.com/windows/windowslive/">More than messages</A></BLOCKQUOTE><BR></BLOCKQUOTE><BR></html<br>
--~--~---------~--~----~------------~-------~--~----~<br>
You received this message because you are subscribed to the Google Groups "E-Prime" group. <br> To post to this group, send email to e-prime@googlegroups.com <br> To unsubscribe from this group, send email to e-prime+unsubscribe@googlegroups.com <br> For more options, visit this group at http://groups.google.com/group/e-prime?hl=en<br>
-~----------~----~----~----~------~----~------~--~---<br>
<br>