[FieldTrip] ft_plot_sens Question

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Tue Apr 14 08:47:07 CEST 2020


Dear Jonathon,

What you want to achieve should be possible, but fails in your case probably due to the fact that the ‘chantype’ key only works if the values provided match the entries in (your) electrode_map.chantype field. So, providing channel labels, as I interpret from the description in the e-mail, is not going to work.

You probably need to do something like this (no success guaranteed, but you can use the below snippet of code to get started):

stim_idx = match_str(electrode_map.label, {stimA,stimB});
rec_idx = match_str(electrode_map.label, {RecA,RecB});
if ~isfield(electrode_map, ‘chantype’)
  for k = 1:numel(electrode_map.label)
    electrode_map.chantype{k,1} = ‘unknown’;
  end
end
electrode_map.chantype(stim_idx) = {’stim’};
electrode_map.chantype(rec_idx) = {‘rec’};

ft_plot_sens…
ft_plot_sens(…, ‘chantype’, ’stim’);
ft_plot_sens(…, ‘chantype’, ‘rec’);

Best wishes,
Jan-Mathijs



On 14 Apr 2020, at 03:56, Jonathon James Parker <parkerjo at stanford.edu<mailto:parkerjo at stanford.edu>> wrote:


Hi Fieldtrippers:

I am trying to make a figure where I label sets of two sensors with different colors on the background of all the sensors (SEEG contacts).

For instance I would like to make two contacts red (stimulation contacts) and two contacts blue (recording contacts), with the rest of the contacts black spheres.

I attempted the following:

ft_plot_sens(electrode_map); %plots all contacts without labels in black
ft_plot_sens(electrode_map, 'label', 'on', 'fontcolor', 'b','facecolor',stim_electrode_clr,'chantype',{stimA,stimB});
ft_plot_sens(electrode_map, 'label', 'on', 'fontcolor', 'b','facecolor',rec_electrode_clr,'chantype',{RecA,RecB});

stimA, stimB, RecA, RecB are the strings for the respective channels.

I am getting the following error anytime I try to call ft_plot_sens() with fewer than three sensors….

I receive the following error:


Error using delaunay
At least three input points must be provided to define a triangular mesh.

Error in projecttri (line 83)
    tri = delaunay(prj(:,1), prj(:,2));

Error in ft_plot_sens (line 303)
    tri = projecttri(pos, 'delaunay');

Error in jpPlotElectrodes (line 7)
ft_plot_sens(electrode_map, 'label', 'on', 'fontcolor', 'b','facecolor',stim_electrode_clr,'chantype',{stimA,stimB});


I dug down into the implementation of ft_plot_sens() and see that it relies in the depth on a call to deuaunay(…) which looks like needs three arguments.

I attempted to “trick” the function by putting in a dummy 0,0,0 corner electrode and plotting, however, that messes with the scale of the plot.

Has anyone developed a work around for independently labeling two channels/electrodes at a time a different color?

Kindest regards. Hope everyone is staying healthy out there.

Best,
JP



_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200414/4617250e/attachment.htm>


More information about the fieldtrip mailing list