Skip to content

Generating EEG 10 5 Reference Points in a Standalone Script

jayd1860 edited this page Jan 5, 2022 · 9 revisions

For documentation on generating new EEG reference points using the AtlasViewer GUI please refer to section in the wiki chapter Importing Subject Specific Anatomy

To generate EEG using a standalone script, use the function in AtlasViewer repo

Refpts / calcRefpts1.m

All the supporting functions are also under Refpts folder. The function syntax looks like this

 [eeg_curves, err] = calcRefpts1(mesh, Nz, Iz, RPA, LPA, Czi, stepsizes);

INPUTS:

 mesh                   :    faces and vertices
 Nz, Iz, RPA, LPA, Czi  :    location of 5 landmark positions in mesh.vertices
 stepsizes              :    Known step sizes as percentage of curve lengths for 10-5 points

                             stepsizes(1) = 5;
                             stepsizes(2) = 12.5;
                             stepsizes(3) = 4.5455;

EXAMPLE:

%
% 6-STEP DEMO SHOWING HOW TO USE THE FUNCTION  calcRefpts1() TO
% CALCULATE 10-5 EEG REFERENCE POINTS IN THE ATLASVIEWER
% CONTEXT (THAT IS AFTER RUNNING setpaths)
%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1. Change current folder to AtlasViewer root folder and run 
% setpaths (need to do this only once in a given matlab session)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2. Change current folder to subject folder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 3. Get mesh, first input to calcRefpts1(). NOTE: We get both 
% headvol and headsurf to demonstrate that either can be used. 
% HOWEVER Getting the mesh from volume is better because it 
% generates a denser mesh than headsurf.mesh. A denser mesh 
% is better for calculating 10-5 points
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
headsurf = initHeadsurf();
headsurf = getHeadsurf(headsurf, pwd);

headvol = initHeadvol();
headvol = getHeadvol(headvol, pwd);

if ~isempty(headvol)
    fv = isosurface(headvol.img,.9);
    fv.vertices = [fv.vertices(:,2) fv.vertices(:,1) fv.vertices(:,3)];
else
    fv = headsurf.mesh;
end

surf = fv;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 4. Get landmarks positions in the mesh, inputs 2-5 to 
% calcRefpts1()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
refpts = initRefpts();
refpts = getRefpts(refpts, pwd);
Nz  = refpts.pos(1,:);
Iz  = refpts.pos(2,:);
RPA = refpts.pos(3,:);
LPA = refpts.pos(4,:);
Cz  = refpts.pos(5,:);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 5. Get last input: known step sizes as percentage of curve 
% lengths used for calculating 10-5 points.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
stepsizes(1) = 5;
stepsizes(2) = 12.5;
stepsizes(3) = 4.5455;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 6. Call calcRefpts1()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[eeg_curves, err] = calcRefpts1(surf, Nz, Iz, RPA, LPA, Cz, stepsizes);
Clone this wiki locally