Back to the main page.

Bug 2376 - Plotting elec for spherical model fails due to chanpos/elecpos mismatch

Reported 2013-11-13 17:35:00 +0100
Modified 2014-02-24 10:56:36 +0100
Product: FieldTrip
Component: plotting
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Robert Oostenveld
Depends on:
See also:

Vladimir Litvak - 2013-11-13 17:35:20 +0100

When creating the concentric spheres models for EEG I'd like to get a verification plot of the volume and the sensors. When I do ft_prepare_vol_sens the electrodes are projected on the sphere but this only affects elec.elecpos, not elec.chanpos. So if I try to do ft_plot_sens I get spherical volume with non-spherical sensors. Doing elec.chanpos = elec.elecpos does the trick but I think it'd be better to have a principled solution.

Robert Oostenveld - 2013-11-13 18:01:54 +0100

One solution is to have ft_plot_sens plot the electrode position, not the channel position. This is what should happen with coil=yes as extra input argument. But the channel position should also be updated if the coil position (or in this case elec position) changes. This needs to be updated for each volume conductor and projection style. E.g. the first one I encounter is halfspace which deals with elecpos from line 342-359. I think that cleanest would be to have a xxx_project function for each EEG headmodel xxx. That splits the code between channel/electrode selection and projection. Hmm, but for BEM and FEM it is not a simple projection, as tra is updated as well. I am also not yet sure how to deal with positions of bipolar channels. Perhaps better is to do sens.chanpos = nan(size(sens.chanpos)); early in the code and then later do sens.chanpos = channelposition(sens) to update it again. The channelposition function is used elsewhere as well and should therefore have the appropriate intelligence in dealing with electrodes and channels. Agreed?

Vladimir Litvak - 2013-11-13 18:12:53 +0100

(In reply to comment #1) OK, but this should be in your code as channelposition is a privare function

Robert Oostenveld - 2013-11-14 11:34:35 +0100

mac001> svn commit Sending forward/ft_prepare_vol_sens.m Sending plotting/ft_plot_mesh.m Sending plotting/ft_plot_vol.m Adding test/test_bug2376.m Sending test/test_ft_plot_mesh.m Transmitting file data ..... Committed revision 8777. please see test_bug2376 for a demonstration.

Robert Oostenveld - 2014-02-24 10:56:36 +0100

I closed several bugs at once that all have been resolved for some time. If you disagree, please reopen.