LNCD

Table of Contents

  • LNCD Home
  • Administration
  • Notebooks
  • Journal Club Presentations
  • Publications
  • Current Projects
  • Completed Projects
  • Current Grants
  • Datasets by Project
  • Brain ROIs and Measures
  • ️Tools And Methods
  • Big Data
  • RA Homepage
  • Undergrad Resources
  • Recent Changes
  • Maintenance
  • Site Map
  • Random Page
LNCD
Admin » sEEG Data Collection & Analysis

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tools:seeg [2026/11/06 12:36] – sdm63tools:seeg [2026/11/09 14:54] (current) – sdm63
Line 1: Line 1:
-====== sEEG ======+====== sEEG Data Collection & Analysis ======
  
 ===== Data Collection ===== ===== Data Collection =====
Line 27: Line 27:
 ===== Data Analysis ===== ===== Data Analysis =====
   * Taylor's lab has their own github https://github.com/pbe-lab    * Taylor's lab has their own github https://github.com/pbe-lab 
-    * I have pulled (and should continue to update it) there repository, https://github.com/pbe-lab/generalCode which has useful scripts that everyone in the lab uses/ edits. Though they might need to be edited to work for habit. +    * I have pulled (and should continue to update it) their repository, https://github.com/pbe-lab/generalCode which has useful scripts that everyone in the lab uses/ edits. Though they might need to be edited to work for habit. 
     * I have pulled this repo and all the sEEG code in Hera/Projects/7TBrainMech/scripts/eeg/Shane/sEEG     * I have pulled this repo and all the sEEG code in Hera/Projects/7TBrainMech/scripts/eeg/Shane/sEEG
     * The sEEG data is saved out in multiple files      * The sEEG data is saved out in multiple files 
       * The .ns2 is the data at 1k Hz sampling rate       * The .ns2 is the data at 1k Hz sampling rate
-      * The .ns5 is 30k Hz but its usually only used to save out any audio that the participant hears +      * The .ns5 is 30k Hz but its usually only used to save out any audio that the participant hears, also the photodiode in our case 
-      * +    * Preprocessing is pretty simple. The hospital collection system already filters out for 60Hz line noise  
 +\\ 
 +==== Habit Data ====
  
 +    * I wrote a script convertHabitDatatoSetFile.m that takes in the .ns2 from the habit folders within each subjects folder
 +      * Then calls sEEG_ns_to_mat. This is a function from Taylor's lab that I edited. It loads in the ns file and using a function called ns_GetAnalogDataBlock that reads the data and pulls out the 'data block' aka the brain data 
 +        * Returns 3 files
 +          * matFile (array of time x channels)
 +          * info (list of channel names)
 +          * hfile struct
 +            * Entity
 +              * channel info, analog or event (trigger channel), labeled 1-number of channels, units (uV) 
 +            * FileInfo
 +              * info about the different .ns files 
 +            * FilePath 
 +            * Name
 +            * TimeSpan
 +      * Calls function extractAndAlignTriggers.m, giving the function the hfile variable
 +        * Uses ns_GetEventData to extract DAQ triggers 
 +          * Binary signals, either low (0) or high (32767)
 +          * Must alternate between high and low
 +          * The sampling rate of the photodiode is 30k, so it loads in the .ns5 files 
 +        * ns_GetAnalogDataBlock.m
 +          * Pulls out the analog data block (the photodiode)
 +          * Resamples from 30k to 1k
 +        * It then loads in the behavioral data which should hold the trigger values (based on when the task flips to the next epoch, and button box responses) so not like our trigger values that are embedded into the brain data 
 +        * This function is trying to line up the photodiode to the behavioral data values 
 +      * Calls function sEEG_mat_to_set(pt, 'habit' , matFile, info)
 +        * Takes in the subjects data and info
 +        * Flips the array to be channels x time
 +        * newDataFrame_selectChannels = newDataFrame(1:size(chans,1),:); %adjusting for the channels actually on the montage 
 +          * The subjects montage is an excel sheet that has the name of the channels and we remove the extra channels that arent on the montage 
 +          * Like ones that might not actually be in the brain, but like in the layers before it 
 +        * Sets the info for the header 
 +          * Sampling rate: 1000
 +          * nChans: number of channels
 +          * label: names of the channels
 +          * nSamples: length of the array (timepoints)
 +          * nTrials: 1
 +          * nSamplesPre: 0 
 +        * Uses fieldtrip2eeglab to convert the array of data and using the header info into a set file that EEGLAB can load 
 +        * I then reref to the average (EEG = pop_reref( EEG, []);)
 +    * chan2roi.m 
 +      * Function that their lab wrote
 +      * It takes in the patient ID, and a list of their channels and then returns the corresponding ROIs based on the registration of the subjects sEEG and MRIs but that must have alreay been done in brainstorm and saved out and I think Emily does this 
 +
 +
 +\\
 +==== Resting State Data ====
 +  * Basically the same as the habit, except no behavioral data and corresponding triggers
 +  * There is a script Restmat_to_set.m that converts the resting state .ns files into .set files that can be loaded into EEGLAB