Diff for "EyeTrackingWithEprime" - Meg Wiki
location: Diff for "EyeTrackingWithEprime"
Differences between revisions 3 and 4
Revision 3 as of 2009-06-30 10:07:27
Size: 1955
Comment:
Revision 4 as of 2009-06-30 10:08:34
Size: 1955
Comment:
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
dim strData as string strData = "ET_CLR" & Chr(10) & Chr(13) dim strData as string
strData = "ET_CLR" & Chr(10) & Chr(13)
Line 17: Line 18:
strData = "ET_REC" & Chr(10) & Chr(13) Serial.WriteString strData strData = "ET_REC" & Chr(10) & Chr(13)
Serial.WriteString strData
Line 24: Line 26:
Line 26: Line 27:
Line 37: Line 37:
dim filename as string fileName = str(c.GetAttrib("Subject")) & "_" & str(c.GetAttrib("Session")) & ".idf"
strData = "ET_SAV C:\\" & fileName & Chr(10) & Chr(13) Serial.WriteString strData
dim filename as string
fileName = str(c.GetAttrib("Subject")) & "_" & str(c.GetAttrib("Session")) & ".idf"
strData = "ET_SAV C:\\" & fileName & Chr(10) & Chr(13)
Serial.WriteString strData

When using E-Prime with a SMI eye tracker, E-Prime should communicate with iView X, the eye tracking software, to stop and stop the recording, indicate the start of each trial and save the data. The way SMI prefer to do this is using an ethernet connection and the UDP protocol, but E-Prime cannot handle this. The only way, at the moment, is by using the serial port. To do this you wil have to add the following things to your E-Prime script:

1 - Create a 'Serial' device, by going to 'Experiment object' properties, then selecting the 'Devices' tab, then 'Add' and 'Serial'. The default settings should work.

2 - At the start of your experiment, when you want the eye tracker to start recording, add these lines, in an inline object:

' Flush serial connection and clear eye tracker recording buffer

Serial.FlushOutBuffer

dim strData as string
strData = "ET_CLR" & Chr(10) & Chr(13)
Serial.WriteString strData

' Start eye tracker recording

strData = "ET_REC" & Chr(10) & Chr(13)
Serial.WriteString strData

3 - at the start of each trial, or just before your main stimulus is being presented, add this:

Dim strData As String
strData = "ET_REM " & c.GetAttrib("facestim") & Chr(10) & Chr(13)
Serial.WriteString strData

4 - Finally, at the end of th experiment put these lines in an inline object:

' Stop eye tracking recording

strData = "ET_STP" & Chr(10) & Chr(13)
Serial.WriteString strData

' save eyetracking data in a file with a subject, session, and scan run-dependent filename:
dim filename as string
fileName = str(c.GetAttrib("Subject")) & "_" & str(c.GetAttrib("Session")) & ".idf"
strData = "ET_SAV C:\\" & fileName & Chr(10) & Chr(13)
Serial.WriteString strData

Obviously, the filename can be changed to whatever is best for you. Note that iView X cannot save to a directory that doesn't exist, so make sure to either create the correct directory, or write to root.

CbuMeg: EyeTrackingWithEprime (last edited 2013-04-04 15:33:37 by MaartenVanCasteren)