Patent Publication Number: US-2023136433-A1

Title: Accurate control method of visual stimuli for brain-computer interface

Description:
BACKGROUND OF THE INVENTION 
     1. Technical Field 
     The invention relates to an accurate control method of visual stimuli for a brain-computer interface. 
     2. Description of Related Art 
     It is a common approach for brain-computer interfaces to evoke specific electroencephalogram (EEG) signal patterns by visual stimuli and recognize the EEG signal patterns in real time. However, due to the influence of process scheduling, the process showing the visual stimuli may sometimes be dispatched out of the CPU, leading to the difficulty of guaranteeing the accuracy of the visual stimuli. In view of this, the invention designs a control method to support accurate visual stimuli of brain-computer interfaces. 
     BRIEF SUMMARY OF THE INVENTION 
     The objective of the invention is to overcome the defects of the prior art by providing an accurate control method of visual stimuli for a brain-computer interface. 
     The technical solution adopted by the invention to fulfill the above objective is an accurate control method of visual stimuli for a brain-computer interface, which is implemented by a software system consisting of a generator, an actuator and a controller. The functions of the generator, actuator and controller and their correlations are as follows. 
     The generator, a module running on a CPU, interacts with an experimenter to receive accurate visual stimuli parameters, and automatically generates an image sequence as required by the parameters according to the refresh rate of a display. The actuator, a module running on a GPU, has two interfaces “start” and “stop” that both support asynchronous calls. When the interface “start” is called, the actuator starts running to show the image sequence, generated by the generator, on a screen frame by frame. When the interface “stop” is called, the actuator stops running. The controller, a module running on the CPU, asynchronously calls the interface “start” of the actuator at the beginning of a trial to start showing accurate visual stimuli, then accesses a hardware interface connected with an electroencephalograph instrument to write a marker into electroencephalogram signals, and asynchronously calls the interface “stop” of the actuator at the end of the trial to stop showing the accurate visual stimuli. 
     In one embodiment of the invention, the implementation points of the generator include: 
     At run time, the generator is a separate process. The generator has an interactive interface, by which the experimenter is allowed to describe showing patterns of the accurate visual stimuli. The showing patterns include a background image, the location and shape of a stimuli area, and flicker patterns of stimuli. The flicker patterns include random sequence patterns and sine wave patterns. Regarding the random sequence patterns, 0 represents “dark”, 1 represents “bright”, and a random sequence consisting of 0 and 1 is used to control the stimuli area to be bright or dark on each frame. Regarding the sine wave patterns, a designated sine function is used to determine the brightness of the stimuli area on each frame. In the random sequence patterns, the experimenter needs to specify the random sequence, and in the sine wave patterns, the experimenter needs to specify the amplitude, frequency and phase of the sine function. An algorithm implemented in the generator automatically generates the image sequence according to the refresh rate of the display after the parameters are input by the experimenter. 
     In one embodiment of the invention, the implementation points of the actuator include: 
     The actuator, a module running on the GPU, will not be influenced by process scheduling of the operating system at run time, and is able to accurately refresh the screen using the image sequence generated by the generator according to the refresh rate of the screen. The interfaces “start” and “stop” allow a caller to start or stop showing the visual stimuli. The interfaces “start” and “stop” both support asynchronous calls and will return immediately after being successfully called by the caller. 
     In one embodiment of the invention, the implementation points of the controller include: 
     At run time, the controller is a separate process. An asynchronous call mechanism between the controller and the actuator ensures that the controller will not be blocked by calls, and the controller returns immediately after successfully calling the interfaces “start” and “stop” of the actuator. The controller calls the interface “start” at a specific moment as required by the experimenter to start the trial and calls the interface “stop” to stop the trial. The controller has a function of accessing the hardware interface connected to the electroencephalograph instrument and immediately writes the marker into the electroencephalograph signals using this function after calling the interface “start” of the actuator. The controller also has a function of acquiring the electroencephalograph signals in real time. The controller acquires the electroencephalograph signals in real time by sharing a memory block with a process of collecting the electroencephalograph signals. The process of collecting the electroencephalograph signals stores new electroencephalograph signal data blocks in the shared memory block, and the controller acquires tire new electroencephalograph signal data blocks from the memory block. To ensure that the electroencephalograph signal data blocks are correctly transmitted between the process of collecting the electroencephalograph signals and the controller, the two processes need to be kept in a synchronous relationship, which is referred to as a producer-consumer model and implemented by a semaphore mechanism. In addition, the controller also has a function of processing the electroencephalograph signals in real time by a preset algorithm. Every time obtaining one electroencephalograph signal data block, the controller processes the corresponding signals, generates a feedback according to a processing result, and shows the feedback to the user at the end of the trial. 
     Compared with the prior art, the invention has the following beneficial effects: 
     In the prior art, it is hard to guarantee the accuracy of visual stimuli and the recognition effect of electroencephalogram signal patterns. The accurate control method of visual stimuli for a brain-computer interface overcomes the defects. 
    
    
     
       BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS 
         FIG.  1    is a component diagram of a software system implementing the invention. 
     
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     The technical solution of the invention will be specifically described below in conjunction with the accompanying drawing. 
     The invention provides an accurate control method of visual stimuli for a brain-computer interface. As shown in  FIG.  1   , a software system implementing the method consists of a generator, an actuator and a controller, the functions and correlations of which are as follows: 
     The generator, a module running on a CPU, interacts with an experimenter to receive accurate visual stimuli parameters, and automatically generates an image sequence as required by the parameters according to the refresh rate of a display (in this embodiment, the refresh rate of the display is 60 frames per second); 
     The actuator, a module running on a GPU, has two interfaces “start” and “stop” that both support asynchronous calls. When the interface “start” is called, the actuator starts showing the image sequence, generated by the generator, on a screen frame by frame. When the interface “stop” is called, the actuator stops running; 
     The controller, a module running on the CPU, asynchronously calls the interface “start” of the actuator at the beginning of a trial to start showing accurate visual stimuli, then accesses a hardware interface connected with an electroencephalograph instrument to write a marker into electroencephalogram signals, and asynchronously calls the interface “stop” of the actuator at the end of the trial to stop showing the accurate visual stimuli. 
     In this embodiment, the generator further has the following characteristics: 
     At run time, the generator is a separate process. The generator has an interactive interface, by which the experimenter is allowed to describe showing patterns of the accurate visual stimuli. The showing patterns include a background image, the location and shape of a stimuli area, and flicker patterns of stimuli. The flicker patterns include random sequence patterns and sine wave patterns. Regarding the random sequence patterns, 0 represents “dark”, 1 represents “bright”, and a random sequence consisting of 0 and 1 is used to control the stimuli area to be bright or dark on each frame. Regarding the sine wave patterns, a designated sine function is used to determine the brightness of the stimuli area on each frame. In the random sequence patterns, the experimenter needs to specify the random sequence, and in the sine wave patterns, the experimenter needs to specify the amplitude, frequency and phase of the sine function. An algorithm implemented in the generator automatically generates the image sequence according to the refresh rate of the display after the parameters are input by the experimenter. 
     In this embodiment, the actuator further has the following characteristics: 
     The actuator, a module running on the GPU, will not be influenced by process scheduling of an operating system at run time, and is able to accurately refresh the screen using the image sequence generated by the generator according to the refresh rate of the screen (in this embodiment, the refresh rate of the display is 60 frames per second). The interfaces “start” and “stop” of the actuator allow a caller to start or stop showing the visual stimuli. The interfaces “start” and “stop” of the actuator both support asynchronous calls and will return immediately after being successfully called by the caller. 
     In this embodiment, the controller further has the following characteristics: 
     At run time, the controller is a separate process. An asynchronous call mechanism between the controller and the actuator ensures that the controller will not be blocked by calls, and the controller returns immediately after successfully calling the interfaces “start” and “stop” of the actuator. The controller calls the interface “start” of the actuator at a specific moment as required by the experimenter to start the trail and calls the interface “stop” of the actuator to stop the trail. The controller has a function of accessing the hardware interface connected to the electroencephalograph instrument and immediately writes the marker into the electroencephalograph signals using this function after calling the interface “start” of the actuator; the controller also has a function of acquiring the electroencephalograph signals in real time. The controller acquires the electroencephalograph signals in real time by sharing a memory block with a process of collecting the electroencephalograph signals. The process of collecting the electroencephalograph signals stores collected new electroencephalograph signal data blocks in the shared memory block, and the controller acquires the new electroencephalograph signal data blocks from the memory block. To ensure that the electroencephalograph signal data blocks are correctly transmitted between the process of collecting the electroencephalograph signals and the controller, the two processes need to be kept in a synchronous relationship, which is referred to as a producer-consumer model and implemented by a semaphore mechanism. In addition, the controller also has a function of processing the electroencephalograph signals in real time using a preset algorithm. Every time obtaining one electroencephalograph signal data block, the controller processes corresponding signals, generates a feedback according to a processing result, and shows the feedback to users at the end of the trail. 
     The above embodiments are preferred ones of the invention. All functions fulfilled by variations made based on the technical solution of the invention without departing from the scope of the technical solution should also fall within the protection scope of the invention.