RAVE:Tutorial Preprocessing

From OpenWetWare
Jump to navigationJump to search
RAVE logo R Analysis and Visualization of iEEG

Preprocessing Tutorial

To begin, launch the RAVE Preprocessing Module from RStudio with the following command:


The Preprocessing Module will launch in a browser window or tab, if the browser is already opened. The initial page should be the Overview page. Select the “Step 1. Notch Filter” panel from the black menu at the far left. This page has three panels: “Notch Filter,” “Inspection,” and “Notch – inspect signals.” Each of these panels has a minimize icon at the top right and a help icon beside it. Click the “help” icon at any time to open in a new browser tab the RAVE wiki page associated with this panel.

The Notch Filter is a form of band-stop filter that attenuates signals in one or a few narrow bandwidths to minimal levels while leaving signals outside the bandwidth(s) unaltered. Many iEEG setups that include an amplifier introduce harmonics at certain frequencies to the signal data. This filter removes these as a calculation of multiples of a base frequency. This panel, as well as some others seen throughout RAVE’s modules, will be autofilled with a default set of parameters; these parameters represent common settings found in iEEG and are fully customizable when encountered. The panel loads with default settings for the Notch Filter that will remove commonly-found harmonics of 60Hz introduced by most amplifiers.

First, look at the Notch Filter panel. The first text box is for the base frequency, in Hertz, of the filter. Enter here the base frequency for the notch filter. In the second text box, choose the multiplier(s) of the base frequency to be filtered out as well. The default settings are “1,2,3” and will create stopbands at 60Hz, 120Hz, and 180Hz. More multipliers can be added to cover the data’s entire frequency range if needed or, alternatively, fewer multipliers for fewer or a single stopband. The third textbox is used to set the width, in Hertz, of each stopband. One value should be entered for each harmonic, separated by commas. The default settings of “1,2,2” refer to, respectively, the 60, 120, and 180Hz bands, and refer to the +/- for each. Using the default settings, this sets the first harmonic stopband to 59-61Hz, the second to 118-122Hz, and the third to 178-182Hz. The information at the bottom of this panel will describe the number of stopbands and the ranges of each; this information will update automatically as the settings are adjusted.

Look at the Inspection panel. This panel controls the settings of the Notch – Inspect Signals panel to the immediate right which displays the raw and, after calculation, the filtered signal of each channel loaded, so these panels will be discussed together. There are two droplists side-by-side at the top of the Inspection panel. The first, to the left, controls the currently-displayed block and the second, to the right, controls the currently-displayed channel. Setting either of these will automatically update the Notch – Inspect Signals panel to display the selected recording. If it does not update automatically, click the refresh button at the top of the Notch – Inspect Signals panel. Refreshing the browser page will reset the panels to their default settings.

The “Previous” and “Next” buttons below these droplists on the Inspection panel are used to navigate between channels; pressing “Previous” will set the Notch – Inspect Signals panel to display the numerical channel immediately below the current selection, and pressing “Next” will display the channel immediately above it.

At the bottom of the Notch – Inspect Signals panel, there are two Welch periodograms and a histogram of the selected channel. Welch periodograms display the estimated power of a signal across frequencies. The rightmost plot is a standard periodogram. The middle plot is a transformation of that periodogram with a logarithmic x-axis. This makes viewing the signals at lower frequencies easier. The leftmost plot is a histogram of the voltage samples making up the displayed signal. To alter these panels, look at the three sliders at the bottom of the Inspection panel. The top slider sets the width of the Welch periodograms within the page. This will not alter the data, solely the display size of the plots within the Notch – Inspect Signals panel. The middle slider sets the frequency range of the periodograms. Frequencies outside of this range are not excluded from analysis, only from the display; the maximum frequency of the data itself is set by the recording parameters of the iEEG setting. The bottom slider controls the number of bins in the histogram. Each of these sliders can be adjusted by channel to best fit the display settings to the current signal.

Select the “Step 2. Wavelet” panel from the black menu at left. First look at the General Settings panel on the upper left. This panel has three textboxes. In the uppermost textbox labeled “Electrodes,” enter the range of the electrodes to be transformed. It’s recommended to run the wavelet across all electrodes at the same time for both consistency and best performance, so the value entered here should be “1-max” up to the largest numerical electrode value.

The wavelet is run at a native sample rate, by default 100Hz, before being down-sampled. For a different target sample rate, enter the desired value in Hertz into the second textbox. The third textbox does not affect the mathematical calculation of the wavelet but rather the systems on which it runs. Because the transformation requires a large amount of RAM, it must be run in parallel across multiple cores to avoid a memory shortage. The maximum number of cores and the RAM per core available to RAVE are set in the RAVE options menu, accessible by the command:


However, being one of the most demanding processes RAVE can perform, the wavelet includes the option to alter the number of cores used to access more RAM for faster performance or less RAM to allow other processes and programs to run alongside RAVE. At least 64GB of RAM is recommended across eight threads (further details can be found in RAVE’s installation guide, under prerequisites).

Now look at the second panel, Wavelet Settings. The settings of every wavelet run are stored as a CSV file within each subject’s folder within the project. The droplist here can be used to select a previously-run wavelet setting file to repeat the transformation with the same parameters. If the desired file isn’t listed automatically in the droplist, click the “Browse” button to open a directory navigator and select the appropriate file. At the bottom of the panel is the “Run Wavelet” button that will begin the wavelet transformation. Because this process is so demanding, a dialogue box will pop up to confirm this choice. Click “Yes” if the computer is ready to run the transformation or “No” to close the dialogue box and continue editing the settings.

The Details panel does not alter the settings of the wavelet but rather displays them as a table for review. This panel will update automatically if information in the General Settings panel is changed or if a CSV file is loaded through the Wavelet Settings panel. At the top of the panel is a small blue link, “Download Current Setting.” Clicking this will download the table as a CSV to the local computer. This file is also saved automatically upon completion of the wavelet to the subject’s /meta/ folder within a project in the RAVE directory.

Tables in RAVE, regardless of module, have the same navigational structure. There is a droplist at the top, above the column labels, to select the number of entries displayed per page within the panel. Next to this is a search box; a value, category, subject, or variable name can be entered here to filter the entries of the table, sorted by relevancy. The table itself is sorted by columns, each with a header or label at the top line with entries listed numerically below. At the bottom of the page, there is a line describing the displayed entries and total number of entries (i.e., “Showing 1 to 10 of 30 entries”). If the currently-displayed number of entries is less than the total number of entries, the table will be sorted into pages. These pages are navigable by the “Previous” or “Next” buttons to move between individual pages or by clicking the button for the desired page between them.

The Wavelet Kernels panel is the largest panel of the Wavelet page and displays graphically the details of the wavelet transformation that will be run.

This concludes the preprocessing tutorial. The next tutorial describes how to import FreeSurfer surface files to RAVE's 3D Viewer.