Skip to content

ninjaGUI acquisition loop

aortega255 edited this page Aug 8, 2020 · 5 revisions

The bulk of the program happens inside the 'acquisitionFunction' callback (fNIRSapp.mlapp). This function is normally called when the "Start" button is pressed. The following image is the flowchart of the 'acquisitionFunction' callback.

acqfuncflow

The app has a flag (app.active) to determine if the acquisition is currently active. When the button is pressed, this flag is checked to see if the acquisition is currently running or not (incidentally, while the acquisition is running, the label of the "Start" button changes to "Stop"). If the acquisition was not currently running, then it calculates the maximum number of samples to acquire (right now, up to 2 hours of data) and performs variable initialization. Then, the acquisition loops starts, after verifying that the acquisition is still active and that the number of samples acquired is less than the maximum number of samples to acquire. The serial data ACQ and plot will be described on a separate page.

When the acquisition becomes inactive due to exceeding the number of samples or the user pressing the Stop button, the data is autosaved (by default) to a SNIRF file on the folder autosave, under a subfolder named with the current date. After cleanup and stop, the data remains in memory so the user can save it their preferred location, as long as the Start button is not pressed again.