| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Electrode Visualization

This version was saved 5 years, 2 months ago View current version     Page history
Saved by David Groppe
on January 23, 2019 at 12:51:42 pm
 

The main MATLAB function for visualizing the cortical surface is plotPialSurf.m. Below are some examples of how to use it for electrode visualization. plotPialSurf.m is a very flexible function and for brevity, we will not cover all the options it supports here. To see all options, enter:

>>help plotPialSurf.m

 

Tutorial Data:

You can download the data used in the tutorial below from here. These data consists of a FreeSurfer folder for PT001. Place the PT001 folder in your FreeSurfer subjects directory and you should be able to run the commands below after you've run the localization tutorial commands.

 

 

1. Viewing the anatomical location of electrodes

To simply view ECoG electrode locations on the pial surface, you can do something like this:

>>cfg=[];
>>cfg.view='l';
>>cfg.overlayParcellation='DK';

>>cfg.showLabels='y';
>>cfg.title='PT001: DK Atlas'; 

>>cfgOut=plotPialSurf('PT001',cfg);

 

which colors the pial surface according to FreeSurfer's Desikan-Killiany anatomical atlas to produce this image:

 

Note that you can click on an electrode to see its label. If you click on the label it should disappear.

 

You can view the brain from other angles or plot multiple views at once. In addition, you can use a somewhat more complex set of anatomical labels from FreeSurfer's Destrieux atlas:

>>cfg=[];
>>cfg.view='omni';
>>cfg.overlayParcellation='D';
>>cfg.showLabels='y';
>>cfg.title='PT001: Destrieux Atlas';
>>cfgOut=plotPialSurf('PT001',cfg);

 

which produces the image below:

 

 

2. View the location of depth electrodes with semi-transparent pial surface:

Visualizing the location of depth electrodes in 3D is tricky. Currently, plotPialSurf you can make the pial surface transparent to provide some sense of this:

 

>>cfg=[];
>>cfg.view='li';
>>cfg.ignoreDepthElec='n';
>>cfg.opaqueness=0.5;
>>cfg.elecNames={'Dp1','Dp2','Dp3','Dp4','Dp5','Dp6','Dp7','Dp8','Da1','Da2','Da3','Da4','Da5','Da6','Da7','Da8'};
>>cfg.title='PT001';
>>cfgOut=plotPialSurf('PT001',cfg);

 

 

 

3. Coloring electrodes to reflect iEEG values

You can color the electrodes to reflect iEEG data by using the elecColors and elecNames arguments of plotPialSurf. elecNames is a n-length cell array of electrode names can either be a n-length vector of data values or a nx3 matrix of RGB values. When elecColors contains a vector of values, it is converted to a color map according to the elecColorScale argument. For example:

 >>elecNames=cell(8,1);
>>for a=1:8,
>>    elecNames{a}=sprintf('LGd%d',a+16);
>>end

>>cfg=[];
>>cfg.view='l';
>>cfg.figId=1;
>>cfg.elecShape='sphere';
>>cfg.elecColors=linspace(0,1,8)';
>>cfg.elecColorScale='minmax';
>>cfg.showLabels='n';
>>cfg.elecUnits='r';
>>cfg.elecNames=elecNames;
>>cfg.elecSize=2;
>>cfg.title='PT001: Stimulus Correlations';
>>cfgOut=plotPialSurf('PT001',cfg);

 

produces a figure that looks something like this:

Note the use of the cfg.elecShape to render the electrodes as spheres. This can produce somewhat nicer electrode plots.

 

 

4. Drawing bars between electrodes to reflect bipolar iEEG values

To visualize bipolar referenced data, plotPialSurf can draw colored lines by using the pairs argument. pairs is a cell array. The first two elements of each row indicate electrode names and the third is the RGB color of the line that will join the electrodes. The fourth element indicates the hemisphere that the pair resides in. Additional optional columns can provide a label that will appear when the line is clicked on or individually specify the thickness of the line.

 

For example:

 >>pairs=[];
>>ct=0;
>>for a=1:7,
>>  ct=ct+1;
>>  pairs{ct,1}=sprintf('LGd%d',a+8);
>>  pairs{ct,2}=sprintf('LGd%d',a+1+8);
>>  pairs{ct,3}=rand(1,3); % RGB val
>>  pairs{ct,4}='L';
>>end
>>cfg=[];
>>cfg.view='l';
>>cfg.figId=2;
>>cfg.pairs=pairs;
>>cfg.showLabels='n';
>>cfg.elecUnits='r';
>>cfg.title='PT001: Stimulus Correlations';
>>cfg_out=plotPialSurf('PT001',cfg);

 

will produce an image that looks something like this:

Note that sometimes the bars between electrodes will disappear into the pial surface. When this happens, you can use the pullOut option of plotPialSurf to fix this by moving the electrodes away from the pial surface towards the viewer.

 

 

5. Plotting both hemispheres on the same axis

For bilateral implants, if you want to visualized both hemispheres on the same axis you can call plotPialSurf twice with the cfg.axis option set to the same axis:

 

>>figure(1); clf;
>>% Plot left hem
>>cfg=[];
>>cfg.view='l';
>>cfg.figId=1;
>>cfg.clearFig=0;
>>cfg.axis=gca(); % axis handle (in this case the current axis)
>>cfg.showLabels='n';
>>cfg.elecCoord='n';
>>cfg.title=[];
>>cfgOut=plotPialSurf('PT001',cfg);
>>
>>% Plot right hem
>>cfg.view='r';
>>cfgOutL=plotPialSurf('PT001',cfg);

You can then rotate the resulting plot to a desired view:

 

Comments (0)

You don't have permission to comment on this page.