Connecting with the Cobi Modern fNIR Imaging Software
Cobi Modern Software for use with Biopac fNIR Systems
Cognitive Optical Brain Imaging (COBI) Studio is a hardware integrated software platform designed for functional Near Infrared (fNIR) Spectroscopy imaging systems.
https://www.biopac.com/upgrade/cobi-fnir-imager-software/
See list of FNIRs systems here:
https://www.biopac.com/product-category/research/fnir-optical-brain-imaging/fnir-systems/
Note: connecting SightLab to Cobi Modern Software requires the cobibiopac module
This example will save the oxy and deoxy values to the experiment_summary.csv file as well as send event markers to Cobi Modern that can be used to synchronize SightLab data with the FNIR signal in Cobi Modern.
See also this tutorial on setting up Cobi Modern to connect with SightLab and Vizard.
https://www.worldviz.com/post/tech-tip-connecting-fnir-to-vizard
Simple Script example to print and save oxy and deoxy values
TCP_IP = 'localhost'TCP_PORT = 6343
sightlab = sl.SightLab()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Create FNIR device objectdev1 = cobibiopac.fNIR()
# Connect to device (defaults to localhost)# Run this only once COBI is ready to broadcast:dev1.connect(port=TCP_PORT,timeout=2.0) # make sure the port matches COBI
fnir_data = dev1.getHemoglobinData()
if fnir_data: oxy1 = 0 i = 0 channel = 0 # select which channel to graph and then obtain data from that channel: oxy1 = fnir_data[channel][1] deoxy1 = fnir_data[channel][0]
for data_column in ["oxy", "deoxy"]: sightlab.addCustomTrialDataColumn(data_column)
def sightLabExperiment(): while True: yield viztask.waitKeyDown(' ') def get_additional_data(): fnir_data = dev1.getHemoglobinData() if fnir_data: oxy1 = 0 i = 0 channel = 0 # select which channel to graph and then obtain data from that channel: oxy1 = fnir_data[channel][1] deoxy1 = fnir_data[channel][0] print(deoxy1) print(oxy1) else: print("No data yet") sightlab.setCustomTrialData(str(oxy1), 'oxy1') sightlab.setCustomTrialData(str(deoxy1), 'deoxy1')
update_action = vizact.onupdate(0, get_additional_data) yield sightlab.startTrial() yield viztask.waitKeyDown(' ') yield sightlab.endTrial() viztask.schedule(sightlab.runExperiment)viztask.schedule(sightLabExperiment)viz.callback(viz.getEventID('ResetPosition'), sightlab.resetViewPoint)
Adding sending of events on gaze time and gaze end
TCP_IP = 'localhost'TCP_PORT = 6343
sightlab = sl.SightLab()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)s.bind((TCP_IP, TCP_PORT))s.listen(1)conn, addr = s.accept()conn.sendall(b'1')
# Create FNIR device objectdev1 = cobibiopac.fNIR()
# Connect to device (defaults to localhost)# Run this only once COBI is ready to broadcast:dev1.connect(port=TCP_PORT,timeout=2.0) # make sure the port matches COBI
fnir_data = dev1.getHemoglobinData()
if fnir_data: oxy1 = 0 i = 0 channel = 0 # select which channel to graph and then obtain data from that channel: oxy1 = fnir_data[channel][1] deoxy1 = fnir_data[channel][0]
for data_column in ["oxy", "deoxy", "cobi_flag"]: sightlab.addCustomTrialDataColumn(data_column)
def sightLabExperiment(): while True: yield viztask.waitKeyDown(' ') def get_additional_data(): fnir_data = dev1.getHemoglobinData() if fnir_data: oxy1 = 0 i = 0 channel = 0 # select which channel to graph and then obtain data from that channel: oxy1 = fnir_data[channel][1] deoxy1 = fnir_data[channel][0] print(deoxy1) print(oxy1) else: print("No data yet") sightlab.setCustomTrialData(str(oxy1), 'oxy1') sightlab.setCustomTrialData(str(deoxy1), 'deoxy1')
update_action = vizact.onupdate(0, get_additional_data) yield sightlab.startTrial() gazeFixatedmessage = 'gaze fixated: ' + e.name gazeStoppedmessage = 'gaze ended: ' + e.name gazeStartedmessage = 'gaze started: ' + e.name def onGazeFixated(e): sightlab.setCustomTrialData(conn.sendall(b'/' + gazeFixatedmessage.encode()), 'cobi_flag') def onGazeStopped(e): sightlab.setCustomTrialData(conn.sendall(b'/' + gazeStoppedmessage.encode()), 'cobi_flag') def onGazeStarted(e): sightlab.setCustomTrialData(conn.sendall(b'/' + gazeStartedmessage.encode()), 'cobi_flag') vizact.addCallback(sightlab.GAZE_TIME_EVENT, onGazeFixated) vizact.addCallback(sightlab.GAZE_END_EVENT, onGazeStopped) vizact.addCallback(sightlab.GAZE_BEGIN_EVENT, onGazeStarted) yield viztask.waitKeyDown(' ') yield sightlab.endTrial() viztask.schedule(sightlab.runExperiment)viztask.schedule(sightLabExperiment)viz.callback(viz.getEventID('ResetPosition'), sightlab.resetViewPoint)
Additional Instructions on sending markers from Vizard to Cobi
Inquire with sales@worldviz.com to see how Sightlab VR can be combined with FNIR data