neuroelectromagnetic forward head modeling toolbox · comparison with dipfit the realistic model in...

85
NFT Neuroelectromagnetic Forward Head Modeling Toolbox Zeynep AKALIN ACAR 15th EEGLAB Workshop, Beijing June, 2012

Upload: others

Post on 21-Jun-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

NFTNeuroelectromagnetic Forward Head 

Modeling Toolbox

Zeynep AKALIN ACAR15th EEGLAB Workshop, Beijing

June, 2012

Page 2: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

NFT

A complete framework for accurate forward problem solution.

Easy‐to‐use MATLAB environment with GUI and command‐line functions.

Ability to use available subject information– T1‐weighted 3D MR images–Digitized sensor (electrode) locations

Page 3: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Comparison with Dipfit

The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices.– The forward matrices are pre‐calculated, so there is no need for FP calculations.

NFT generates subject‐specific models.– NFT does model generation and forward problem calculations.

– More accurate.

Page 4: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

T1-weighted

http://sccn.ucsd.edu/nft

Digitizer locations

Page 5: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Head modeling from MR images

T1-weighted

Segmentation BEM mesh

MR image

Electrode Registration

Page 6: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Preparing the MR Image

Using FreeSurfer– Inhomogeneity correction– Convert to 1x1x1 volume– Arrange direction of the image– Save in analyze format

Page 7: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Image Segmentation

Classifies four tissues from T1-weighted imagesScalp, Skull, CSF and Brain

Page 8: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Starting NFT

To start from EEGLAB EEGLAB ‐> Tools ‐> NFT

To start as a standalone toolboxaddpath NFT directoryType ‘NFT’ in Matlab

For demo: go to NFT‐2.4_demo folder

Page 9: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Subject Selection

Select subject folder

Specify subject name

Specify session name

Page 10: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Subject Selection

Select current folder as subject folderEnter “SubjectA” as subject nameEnter “s1” as the session name

Page 11: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Image Segmentation

Page 12: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Image SegmentationLoad image

Page 13: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

SegmentationSelect an image in analyze format

Page 14: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

SegmentationRun filtering

Page 15: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation

Page 16: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

SegmentationView filtered image

Page 17: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

SegmentationClick ‘Next’ for scalp segmentation

Page 18: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

SegmentationClick ‘Run’ for scalp segmentation

Page 19: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Image Segmentation

Page 20: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

SegmentationView scalp mask

Page 21: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

SegmentationClick ‘Next’ for brain segmentation

Page 22: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

SegmentationSelection of cerebellar low point

Page 23: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

SegmentationClick ‘Set’

Page 24: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

SegmentationSelection of a WM point

Page 25: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

SegmentationClick ‘Set’

Page 26: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation Click ‘Run’ for brain segmentation

Page 27: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

SegmentationChange thresholds if there is need

Page 28: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

SegmentationView brain mask

Page 29: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation Click ‘Next’ for skull segmentation

Page 30: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation Select a slice for eyes

Page 31: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation Click ‘Set’

Page 32: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation Click ‘Run’ for skull segmentation

Page 33: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation Click on the eyes

Page 34: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation 

Page 35: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation 

Page 36: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation View skull segmentation

Page 37: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

SegmentationClick ‘Next’ for CSF segmentation

Page 38: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation Click ‘Run’ for CSF segmentation

Page 39: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation 

Page 40: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation View CSF segmentation

Page 41: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation Save filtered image

Page 42: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation 

Page 43: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation Save segmentation

Page 44: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Segmentation 

Page 45: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Image Segmentation

Page 46: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Mesh Generation

Generate Mesh for a 3 or 4 layer head model

Page 47: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Source Space Generation

Generates a simple source space:Regular Grid inside the brain

With a given spacing and distance to the mesh

Page 48: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Source Space Generation

Page 49: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Electrode Co‐registration

Page 50: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Electrode Co‐registration

Page 51: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Electrode Co‐registration

Page 52: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Electrode Co‐registration

Page 53: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Electrode Co‐registration

Page 54: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Electrode Co‐registration

Page 55: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Electrode Co‐registration

Page 56: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The
Page 57: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Head Modeling from Electrode Position Data

Warp a template mesh to electrode positions– When no MR images are available– Non‐rigid thin‐plate spline warping

Digitizer locations Template model Warped model

Page 58: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Template Warping

Page 59: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Template Warping

Page 60: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Template Warping

Page 61: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Template Warping

Page 62: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Forward Problem Solver

MATLAB interface to numerical solvers Boundary Element Method or Finite Element Method– EEG Only (for now) – Interfaces to the Matrix generator executable written in C++

Other computation done in MATLAB Generated matrices are stored on disk for future use.

Page 63: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

http://sccn.ucsd.edu/nft

Page 64: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Forward Problem Solution with BEM

Page 65: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Forward Problem Solution with BEM

Page 66: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Forward Problem Solution with BEM

Page 67: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Forward Problem Solution with BEM

Page 68: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Forward Problem Solution with BEM

Page 69: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Forward Problem Solution with BEM

Page 70: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Forward Problem Solution with BEM

Page 71: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Forward Problem Solution with BEM

Page 72: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Forward Problem Solution with BEM

Page 73: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Forward Problem Solution with BEM

Page 74: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Forward Problem Solution with FEM

Tetgen for mesh generation– Uses BEM meshes as boundaries

METU‐FEM to generate transfer matrix– Compiled from source– Requires PETSc for matrix operations

metufem .mex file for forward solutions in MATLAB

Instructions available under README.FEM file.

Page 75: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Forward Problem Solution with FEM

Page 76: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

http://sccn.ucsd.edu/nft

Page 77: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Dipole Fitting

Requires EEGLAB integration to access Component indices.

Uses FieldTrip in EEGLAB for dipole fitting.

Page 78: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Warping Demo

If the subject does not have an MRI, a template head model (MNI) can be warped to electrode locations:– Go to NFT‐2.4_demo_warping folder– Start NFT– Enter SubjectA as subject name and s1 as session name

– Select the current folder as the subject folder– Click on Warping– After warping, continue with Forward and Inverse modeling.

Page 79: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

Output

Dipole source localization is saved in EEG structure, under EEG.etc.nft.

After source localization with NFT, you can continue using EEGLAB; 

EEG.dipfit.model = EEG.etc.nft.model;

Page 80: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

NFT Matlab Scripts Start EEGLAB and set your parameters:

eeglabEEG = pop_loadset('filename',eeg_file,'filepath',eeg_path);[ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 0 );% set 'of' (output folder), subject_name,%   session_name, and elec_filesubject_name = 'SubjectA';   session_name = 's1';nl = 4;   % number of layersplotting = 1;  comp_index = 1:20; % component index for source localization

Page 81: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

NFT Matlab Scripts   

Realistic modeling from MRI% Do segmentation using the GUInft_mesh_generation(subject_name, of, nl)nft_source_space_generation(subject_name, of)% Do co‐registration using the GUInft_forward_problem_solution(subject_name, session_name, of);

dip1 = nft_inverse_problem_solution(subject_name, session_name, of, EEG, comp_index, plotting, elec_file)

Page 82: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

NFT Matlab Scripts

BEM warping meshnft_warping_mesh(subject_name, session_name, elec_file, nl, of,0,0);

nft_forward_problem_solution(subject_name, session_name, of);

dip1 = nft_inverse_problem_solution(subject_name, session_name, of, EEG, comp_index, plotting, elec_file)

Page 83: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

NFT Matlab Scripts   

FEM warping meshsession_name='s1_fem';nft_warping_mesh(subject_name, session_name, elec_file, nl, of,0,1);

nft_fem_forward_problem_solution(subject_name, session_name, of);

dip1 = nft_inverse_problem_solution(subject_name, session_name, of, EEG, comp_index, plotting, elec_file)

Page 84: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

NFT Matlab Scripts

Set NFT dipole structure to EEGLAB dipole structureeeglab_folder = dirname(which('eeglab'));mri_file = [eeglab_folder'/plugins/dipfit2.2/standard_BEM/standard_mri.mat'];

EEG.dipfit.mrifile =  mri_file;EEG.dipfit.model = EEG.etc.nft.model; 

Page 85: Neuroelectromagnetic Forward Head Modeling Toolbox · Comparison with Dipfit The realistic model in Dipfit is a three‐layer MNI head model represented with 3000 vertices. – The

NFT download and reference

http://www.sccn.ucsd.edu/nft

Akalin Acar Z, Makeig S, NeuroelectromagneticForward Head Modeling Toolbox, J. of Neuroscience Methods, vol 190(2), 258‐270, 2010.