Configuring Epilepsy Analysis

From MEG Core
Jump to navigation Jump to search

UNDER CONSTRUCTION***



After installing and configuring the analysis machine: https://megcore.nih.gov/index.php/Configuring_analysis_machine

Download Code for Epilepsy Analysis

 git clone  $USER@$GIT_SERVER:epilepsy
 #Once installed, go into the code folder and to update
 git pull 

Add Path

 Use gedit/emacs/vim to add the following lines to the shells path (Either user or system folder)
 #/home/$USER/.bashrc  (User folder)
 #/etc/profile.d/meg.sh  (System Folder - requires sudo - may need to create file meg.sh)
 export epil_code_path=$path_to_code  #This is used in the python code to determine the location of config files in the data

Launching Review Software

 startup_epilepsy_review.sh
 Initializes BASH shell >> activates conda environment >> cd to Notebook Dir >> launches Jupyter Lab
 #Bash is not default on the review computer
 #Conda maintains non-conflicting python environments  (can be reinitialized using environment.yml file in code folder)

Configuration Files

 #Automatically Copied to Analysis folder - Located in $epil_code_path/resources
 default.dip : used as input to the dipoleFit and dfit programs as the default starting options for dipole fit
 processing.cfg : used to preprocess the data for viewing
 channelset.cfg : Montage Creation (ordering channels is done through virtual channels)
 default.vc : Virtual Channel Creation

Configuring Data Editor Layout

Configurations are stored in the ChannelSet.cfg file. Current Montages Include:

  • MEG_LCR_22
  • MEG_LCR_22_EEG_LCR_21
  • EEG_

Creating a View Montage

The data editor layout orders the channels by acquisition order and may not be preferred
To create ordered channels, a virtual channel dataset will need to be created

 DataEditor >> Edit >> Virtual Channels
 Select a virtual channel and add to Plus Box >> Name the new channel (it must be different from acquisition names - choose lowercase or uppercase as a workaround)
 Save the virtual channel .vg file to $HOME/.meg/resources/default.vg
 

Head Model

Preferred Method - Multisphere model from inner skull approximation

 orthohull  #Realigns the MRI to match the MEG subject head space (origin is midpoint between LPA/RPA and other axis runs through the nasion)
 #Also creates an inner skull approximation using the inflated/smoothed brain surface
 localSperes -d $Dataset -s multisphere.shape 

Manual Method - Single Shell based on scalp

 MRIConvert   >> imports mri into ctf format
 MRIViewer -mri CTF.mri >> creates headshape and headmodel >> save to default.hdm
 Dipolefit -hdm default.hdm

Dipole Fit

 Set the time, epoch, and duration of dipole fit
 Commandline dipole fit
 dfit -a -z -b -0.010 -e 0.010 -h $ds_Filename/default.hdm -f default.dip -m $MarkerName $ds_Filename  Output


Processing Pipeline

check tags >> cat anat+ortho.HEAD | grep TAGSET_LABELS 3dtagalign << avghc.py << creates an average head position changeHeadPos << rewrites the head position