Artifact rejection: how to remove noisy channels and intervals from your signals

The function nbt_get_artifacts plots your signals with the same possibilities as the plot function nbt_plot (see The NBT Signal viewer, with the extra feature of selecting noisy channels and intervals in the plot. The noisy intervals and channels are stored in the corresponding Info file. In subsequent analysis, you can omit these artifacts. Once the artifacts are determined, they will be removed in subsequent analysis before the calculation of already implemented biomarkers. In the analysis function template, a few lines are added to remove the artifact intervals, and to set the analysis results of the bad channels to NaNs.

Usage via the GUI: select Pre-processing|Remove artifacts current NBT Signal. Via the command line:

nbt_get_artifacts(Signal,SignalInfo,Save_dir)

Inputs:

Signal = NBT Signal matrix
SignalInfo = NBT Info object
Save_dir = a full path to the folder you want to save the SignalInfo file, at which the results from the artifact rejection will be stored.

Interactive removal of noisy channels and intervals

To select noisy channels, select the arrow in the figure toolbar, and right click on a signal. The following fields can be selected: Channel number, Set as noisy channels, Unset as noisy channel, and Remove channel from plot. Once a channel is selected as noisy, it will occur black in the plot.

To select noisy intervals, unselect the arrow in the figure toolbar (select zoom in for example) and push the button in the low right corner of the plot. Then double click to select one border of the interval, and double click again to select the other border of the interval. Then confirm or cancel by clicking on the corresponding buttons that occur under the plot. The selected noisy intervals will occur grey in the plot. By right clicking on the grey interval and selecting “Unset noisy interval”(be sure you selected the arrow in the figure toolbar), you unset the interval as noisy.

Once you have selected all the artifacts, push the button “click here to finish” above the plot. If you want to inspect or edit the artifacts later on, you can run the same script, the noisy channels will be plotted in black, and the noise intervals in grey. The noisy intervals are stored in the Info object at the location: Info.Interface.noisey_intervals, the noisy channels at Info.BadChannels. In the analysis function template, a few lines are added to remove the artifact intervals, and to set the analysis results of the bad channels to NaNs.

Batch processing: remove artifacts of multiple NBT files

The function nbt_get_artifacts is an analysis function that can also be applied in a batch processing way to a folder with NBT Signals. Usage via the GUI: select Pre-processing|Remove artifacts multiple NBT Signals. Via the command line:

nbt_NBTcompute(@nbt_get_artifacts,SignalName,LoadDirectory)

Inputs:

SignalName= string with the name of the signal you want to use, if you do not have more signals in your signal file choose 'Signal'.
LoadDirectory = string with the name of the directory where your NBT files are.

For example:

nbt_NBTcompute(@nbt_get_artifacts,'Signal','B:/NBT files')

This allows you to subsequently remove artifacts from all the NBT files in LoadDirectory.

!! ADD screen shot figures to explain!