From e4e27887d98b40fa26454d96e6d9c508324129ba Mon Sep 17 00:00:00 2001 From: Takfarinas MEDANI <37831900+tmedani@users.noreply.github.com> Date: Mon, 21 Aug 2023 11:07:55 -0700 Subject: [PATCH] Update: MEG sensors display correct location (#637) * update the MEG sensors display, this PR allow the discpaly the correct postion of the sensor and not the intergation points * Remove old code and add comment --- toolbox/gui/view_leadfield_vectors.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/toolbox/gui/view_leadfield_vectors.m b/toolbox/gui/view_leadfield_vectors.m index 9586a7f9f..79357d916 100644 --- a/toolbox/gui/view_leadfield_vectors.m +++ b/toolbox/gui/view_leadfield_vectors.m @@ -407,7 +407,8 @@ function DrawArrows() delete(findobj(hAxes, '-depth', 1, 'Tag', 'SelChannel')); % Plot selected sensor if ~isempty(Channels(iChannel).Loc) && ~ismember(Channels(iChannel).Name, {'EEG','MEG','MEG MAG', 'MEG GRAD'}) - line(Channels(iChannel).Loc(1,1), Channels(iChannel).Loc(2,1), Channels(iChannel).Loc(3,1), ... + % Center of mass of all coordinates + line(mean(Channels(iChannel).Loc(1,:),2), mean(Channels(iChannel).Loc(2,:),2), mean(Channels(iChannel).Loc(3,:),2), ... 'Parent', hAxes, ... 'LineWidth', 2, ... 'LineStyle', 'none', ... @@ -477,7 +478,8 @@ function DrawArrows() Channels = ChannelMat.Channel(iChannels); % Get channels locations if length(Channels) > 10 - markersLocs = cell2mat(cellfun(@(c)c(:,1), {Channels.Loc}, 'UniformOutput', 0))'; + % Center of mass of all coordinates for each sensor + markersLocs = cell2mat(cellfun(@(c) mean(c,2), {Channels.Loc}, 'UniformOutput', 0))'; end % Ask to select reference isOk = SelectReference();