Skip to content

ninjaGUI startup flow chart

aortega255 edited this page Jul 27, 2020 · 7 revisions

The following flow chart details the startup procedure for ninjaGUI.

image (3)

ninjaGUI is started by typing the ninjaGUI command. For the current version, the command can be run by itself or adding a single argument in the form of the name of a .cfg file. If no .cfg file is provided as an argument, a browse dialog will appear to request the user to provide a .cfg file. If the user does not provide a .cfg file (by canceling) or if the .cfg file provided as an argument is invalid, a hardware configuration dialog will load instead. Said dialog will prompt the user to introduce the parameters necessary to create a new .cfg file. The program will terminate if the user is unsuccessful in providing or creating a valid .cfg file.

After the .cfg file is created and/or loaded, the setEnv function is called to set the hardware specific environment. setEnv reads the contents of the .cfg file, decides if the .cfg is specifying a compatible device, and based on that sets a series of state variables and functions that will allow the ninjaGUI to communicate with the serial device, and it will also determine the appearance of the GUI (by enabling or disabling certain features compatible with each type of hardware device).

After that, a brief communication test is performed. Basically a command requesting the hardware to return its status. If the device fails to show respond, an error or warning will be displayed indicating that, but the program will continue regardless but it will be unlikely to be able to acquire a signal.

After this brief communication test, another browse dialog will load, this time requesting a .nsd file. The .nsd file specifies the probe design, including the relative location of the sources and detectors and the definition of the fNIRS channels. Do note that the .nsd files are expected to be device-dependent.

If everything is working correctly at this point, then the labstreaming layer (LSL) library will be initialized. If LSL is not found, a warning indicating this will be displayed, but otherwise the program will continue as normal (but no streaming will happen).

At this point, the main GUI form will be drawn on the screen based on all the parameters specified on the files, and main program loop will start, allowing the user to start taking measurements, as long as the communication with the hardware was established successfully. If the user desires to connect to a different type of hardware, it is necessary to stop the program and restart it with a different .cfg file.