Back to the main page.

Bug 981 - ft_headmodelplot doesn't work with a multisphere volume conduction model in the input

Reported 2011-09-22 14:06:00 +0200
Modified 2011-11-11 11:19:54 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P1 major
Assigned to: Jan-Mathijs Schoffelen
Depends on:
See also:

Jan-Mathijs Schoffelen - 2011-09-22 14:06:25 +0200

this is likely caused by the vol.label getting lost along the way

Jan-Mathijs Schoffelen - 2011-10-21 12:24:48 +0200

John suggested this: ==== git diff git-svn...HEAD -- forward/ft_prepare_vol_sens.m diff --git a/forward/ft_prepare_vol_sens.m b/forward/ft_prepare_vol_sens.m @@ -165,7 +165,8 @@ elseif ismeg % use the original sensor array instead of the one with a subset of % channels, because we need the complete mapping of coils to channels - sens = sens_orig; + %sens = sens_orig; %***JRI*** this breaks using to fit a + %subset of channels % remove the coils that do not contribute to any channel output % since these do not have a corresponding sphere @@ -189,7 +190,10 @@ elseif ismeg % the coil-specific spheres in the volume conductor should not have a label % because the label is already specified for the coils in the % sensor array - vol = rmfield(vol, 'label'); + % *** JRI ***: vol.label is used below, so don't remove it! + % FIXME something's wrong with the logic: should below + % use sens.label, since they are identical? + %vol = rmfield(vol, 'label'); end return end @@ -235,9 +239,16 @@ elseif ismeg chanindex = strmatch(coillabel, vol.label, 'exact'); % what is the index of this channel in the list of local spheres multisphere.r(i,:) = vol.r(chanindex); multisphere.o(i,:) = vol.o(chanindex,:); + multisphere.label{i} = vol.label{chanindex}; % *** JRI *** end - vol = multisphere; + %vol = multisphere; % *** JRI *** wrong, this clobbers other necessary fields of vol, + % so use original and only replace what has changed + vol.r = multisphere.r; + vol.o = multisphere.o; + vol.label = multisphere.label; + % *** JRI *** + % finally do the selection of channels and coils % order them according to the users specification [selchan, selsens] = match_str(channel, sens.label); @@ -253,6 +264,7 @@ elseif ismeg % make the same selection of coils in the multisphere model vol.r = vol.r(selcoil); vol.o = vol.o(selcoil,:); + vol.label = vol.label(selcoil); % *** JRI *** case 'nolte' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Jan-Mathijs Schoffelen - 2011-11-10 10:39:01 +0100

Hi John, We intend to deprecate ft_headmodelplot, because we think that most functionality of this function is covered by other (and newer) (and less ugly) plotting functions. Those are in fieldtrip/plotting, e.g. ft_plot_sens, and ft_plot_vol. This would mean that we will most likely remove this function altogether. Could you live with that? @Robert: moving to the compat-directory is not straightforward due to the function's dependencies. There are quite a few private functions on which ft_headmodelplot depends, which themselves also rely on private functions etc. First I thought just to include the relevant private code as subfunctions, but it will be quite a lot. Would you agree not to svn move it as it is, but to really deprecate it (and throw an error if it is called?)

Robert Oostenveld - 2011-11-10 10:45:38 +0100

(In reply to comment #2) > @Robert: moving to the compat-directory is not straightforward due to the ... Or move it anyway and then add a warning line to the function like warning('The ft_headmodelplot function is deprecated and is not supported any more by the FieldTrip team. Please look at this FAQ (insert wiki page) for the suggested alternative approach. If you still want to use this function and get errors like ... (insert the first dependency error that they would get), you can manually move this function from its present location into the fieldtrip main directory, where it still may work') It is a long warning, but should get the message across. A key ingredient is the FAQ that should explain how to plot the different geometrical objects that are involved in source modeling.

Jan-Mathijs Schoffelen - 2011-11-10 10:50:18 +0100

thanks for the suggestions. Will do.

Jan-Mathijs Schoffelen - 2011-11-10 11:46:10 +0100

Created FAQ: and svn moved ft_headmodelplot

Jan-Mathijs Schoffelen - 2011-11-11 09:36:14 +0100

setting this one to wontfix -> ft_headmodelplot is now deprecated

Robert Oostenveld - 2011-11-11 11:19:54 +0100

I closed all bugs that were recently resolved.