Beauchamp:CCEPAnalysis

From OpenWetWare

Jump to: navigation, search

To convert Nihon Khoden files into MATLAB see the preceeding Wiki page called Analyzing Nihon Kohden EEG Data with MATLAB

This Wiki page shows how to use MATLAB functions to find onset and offset datapoints and average epochs using these datapoints as the zero y-value.

There is a folder in data8 called CCEP_functions which contains all of the necessary functions for CCEP analysis described in this Wiki page.

Contents

A Note on ASCII Export

When exporting the data into ASCII, I usually adjust the filters on the stimulation channels to obtain very clear stimulation peaks.

These 2 channels are not important to CCEPs and can therefore be sacrificed in order to more easily find the stimulation onsets.

The filters should be set as desired but in general 1Hz (Time constant = 1 second) to the highest high cut possible are good filter settings.

Each set of stimulation runs from the same channel should be grouped together and exported as one ASCII file.

If necessary, it would be possible to make an append function in order to export multiple ASCII files and place together into one file.

Finding Stimulation Channel Peak Onset

In the CCEP_functions folder there is a function called get_onset_stimulation(fname,stim_channel)

The required input parameters for this function are the complete name of the MATLAB file created with the function convert_nkascii2mat(fname,matfname)

This function will add the onset points of the stimulus in the stimulation artifact channel to the nkdata structure and store it as nkdata.onset_stimulation

This function utilizes the second derivative and will store the second derivative as nkdata.diff2 for use later

The second derivative allows us to find major changes in slope associated with stimulus artifacts over a certain threshold based on standard deviation

Special Note: Always be careful about the Trigger channel. If you export the Trigger channel in ASCII, you must take that into account as extra when using nkdata.nchannels

Finding All Channels' Peak Onset

In the CCEP_functions folder there is a function called get_onset_all(fname)

This function takes the name of the MATLAB file with information created with the functions convert_nkascii2mat and get_onset_stimulation

This function will add the onset points of all the stimuli in all the channels and place them in the nkdata structure to be stored as nkdata.onset_all.

This function utilizes the second derivative which allows us to find major changes in slope associated with stimulus artifacts over a certain threshold based on standard deviation.

Special Note: This function could still be tweaked in order to define the offset better. At this point in time the offset is somewhat unclear from the results of the function.

Averaging the Epochs

In the CCEP_functions folder there is a function called get_averages(fname)

This function takes as a parameter the complete name of the MATLAB file with information created with the function convert_nkascii2mat, get_onset_stimulation, and get_offset_all.

If the function is changed slightly to replace get_offset_all with get_onset_all, then you can use onset points instead of offset points.

The y-value is zeroed at the offset (changeable) while the x-value is zeroed at the stimulation onset of the stimulated channel.

Creating Information Text File

In order to ease the analysis of the data, the function get_information(fname) was created.

The parameter necessary is the complete name of the MATLAB file containing the structure variable to load.

This function will output useful channel information in a text file.

This can also be used in the future as a place to store an ordered list of peak latencies and amplitudes.

Displaying Averaged Plots

In order to view one channel at a time, the following code will plot the averaged data vs. the time in milliseconds.

This function is called get_plot(fname,channel)

Simply provide the data filename and channel number to be viewed.

In order to view all channels on 5x5 subplots, the following code will plot the averaged data vs. the time in milliseconds in subplots.

This function is called get_all_plots(fname)

Simply provide the data filename.

Running All Functions

For ease of use, there is a function called get_all(fname,matfname,stim_channel) which will run all of the functions from converting the data into MATLAB to obtaining the epoch average.

The parameters necessary to insert are the ASCII file exported from Nihon Khoden, the matlab filename you want to create without an extension, and the stimulation channel you wish to obtain onset points from.

Analysis History

CCEP analysis is very much a work in progress. Bryan Stierman, the pioneer in this effort tried the following:


1) Tried averaging CCEPs simply by exporting them and taking the average with 0 as the baseline for all of the epochs.

This was the data I presented in my abstract which turned out to be misleading and possibly inaccurate.

This was a problem as some channels experienced substantial drift that did not filter out easily.

2) Tried averaging the CCEPs by averaging the whole sample (all data points) and using the overall average as a baseline for all epochs.

This still did not correct the baseline drift problem.

3) We then decided that it would be necessary to take a baseline for each epoch and average all of the epochs together from that baseline.

However, we then had to decide how to determine the baseline.

One way would be to take each epoch and average it separately to obtain a baseline.

This did not correct the problem either.

4) We ultimately decided that it would be best to take find the offset of the stimulus artifact in each channel and use that y-value as the baseline to average from.

This would allow us to standardize the baseline and this is where we stand at this point in time.

Past functions can be found in data8 in the folder Electrophysiology_Bryan.

Documentation is still necessary for use of these functions.

If necessary contact Bryan to find out more.

Ideas for Future Analysis

1) Create a function to compute covariance for data collected with parametric stimulation parameters (2,4,6,8 mAmps) to determine how CCEP latency and amplitude vary with current.

2) The peak offset function needs to be tweaked to pick out more stimulation artifacts in a more standardized, robust way.

Contact

Questions about any of the CCEP material may be directed to:

Bryan Stierman

bdstierman@mail.utexas.edu

(713) 305-8048

Personal tools