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

import cobibiopacimport csv, atexit,Chart
import osoriginal_cwd = os.getcwd()os.chdir(os.path.abspath(os.path.join(os.path.dirname(__file__), '..','..')))
import viz, vizfx, vizactimport settingsdef setCustomTracking(boolean):    settings.CUSTOM_TRACKING_DATA = booleansetCustomTracking(True)from utils import sightlabimport socketfrom settings import *
TCP_IP = 'localhost'TCP_PORT = 6343
#Code to disable the GUI from showing (set to 1 if you want the GUI)sightlab.is_GUI = 1
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]
import viztaskdef sightLabExperiment(): global logger def get_additional_data(): fnir_data = dev1.getHemoglobinData() if fnir_data: oxy1 = 0 i = 0 channel = 0 # select channel and obtain data from that channel: oxy1 = fnir_data[channel][1] deoxy1 = fnir_data[channel][0] print(deoxy1) print(oxy1) else: print("No data yet") return [oxy1]+ [deoxy1] yield viztask.waitKeyDown(' ') logger = sightlab.DataLogger(sightlab.participant, sightlab.trialNumber + 1, sightlab.use_vive_pro,   additional_columns=['oxy','deoxy']+['FLAG'], start_time=sightlab.startTime) viz.sendEvent(TRIAL_START_EVENT) logger.start_logging(additional_data_func=get_additional_data) yield viztask.waitKeyDown(' ') viz.sendEvent(TRIAL_END_EVENT) logger.stop_logging() viztask.schedule(sightlab.experiment)viztask.schedule(sightLabExperiment)

Adding sending of events on gaze time and gaze end

import cobibiopacimport csv, atexit,Chartimport viz, vizfx, vizactimport settingsdef setCustomTracking(boolean):    settings.CUSTOM_TRACKING_DATA = booleansetCustomTracking(True)from utils import sightlabimport socketfrom settings import *
TCP_IP = 'localhost'TCP_PORT = 6343
#Code to disable the GUI from showing (set to 1 if you want the GUI)sightlab.is_GUI = 1
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]
import viztaskdef sightLabExperiment(): global logger def get_additional_data(): fnir_data = dev1.getHemoglobinData() if fnir_data: oxy1 = 0 i = 0 channel = 0 # select channel and obtain data from that channel: oxy1 = fnir_data[channel][1] deoxy1 = fnir_data[channel][0] print(deoxy1) print(oxy1) else: print("No data yet") return [oxy1]+ [deoxy1] yield viztask.waitKeyDown(' ') logger = sightlab.DataLogger(sightlab.participant, sightlab.trialNumber + 1, sightlab.use_vive_pro,   additional_columns=['oxy','deoxy']+['FLAG'], start_time=sightlab.startTime) viz.sendEvent(TRIAL_START_EVENT) logger.start_logging(additional_data_func=get_additional_data) gazeFixatedmessage = 'gaze fixated: ' + e.name gazeStoppedmessage = 'gaze ended: ' + e.name gazeStartedmessage = 'gaze started: ' + e.name def onGazeFixated(e): global logger conn.sendall(b'/' + gazeFixatedmessage.encode()) if logger is not None: logger.set_flag(flag_text='gaze fixated: ' + e.name) def onGazeStopped(e): global logger conn.sendall(b'/' + gazeStoppedmessage.encode()) if logger is not None: logger.set_flag(flag_text='gaze ended: ' + e.name) def onGazeStarted(e): global logger conn.sendall(b'/' + gazeStartedmessage.encode()) if logger is not None: logger.set_flag(flag_text='gaze started: ' + e.name) viz.callback(sightlab.eye_tracker_utils.GAZE_TIME_EVENT2,onGazeFixated)     viz.callback(sightlab.eye_tracker_utils.GAZE_END_EVENT2,onGazeStopped) viz.callback(sightlab.eye_tracker_utils.GAZE_BEGIN_EVENT2,onGazeStarted) yield viztask.waitKeyDown(' ') viz.sendEvent(TRIAL_END_EVENT) logger.stop_logging() viztask.schedule(sightlab.experiment)viztask.schedule(sightLabExperiment)

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