# [FieldTrip] Fieldtrip compatibility

saeed zahran saeedzahran at hotmail.com
Wed Jan 13 16:23:22 CET 2016

```Dear Robert,

Thank you to put in our problem from the first question, yes we want to localize the contractions of the uterus, and thank you to provide me with the careful consideration of the inverse model assumptions for this case.

I have looked at http://www.fieldtriptoolbox.org/dataformat, but the data what I have is: 1- a real signal generated from 16 electrodes saved as ".mat", 2- the meshes as ".off"( I seperated the points and faces and I saved each one on ".mat") it is already  segmented, and 3- the simulated potential (99084x201) given from our team who works on the model and I want to convert it to in the  form of signal collected from the 16 electrode (16x201).

The algorithm of my colleague was as below, but I didn't convinced in the computation of the inverse problem using the gain matrix not the lead field, it is possible to use the gain matrix as done below in the bold inverse problem part or in another word what does gain represent?

% Set the radius and conductivities of each of the compartments
% 3 Layers
r = [0 0.936 2.068 2.268];
c = [0.2 0.3 0.04 0.5];
%% Description of the spherical mesh
pnt=point_square(:,2:4);
tri=faces_square(:,3:5);
%% Create a set of electrodes on the outer surface
% sensor = [pnt(10201,:);pnt(17376,:);pnt(24756,:);pnt(31931,:);pnt(10166,:);pnt(17341,:);pnt(24721,:);pnt(31896,:);pnt(10130,:);pnt(17305,:);pnt(24685,:);pnt(31860,:);pnt(10095,:);pnt(17270,:);pnt(24650,:);pnt(31825,:)];
sensor = [pnt(664,:);pnt(1080,:);pnt(1600,:);pnt(2016,:);pnt(656,:);pnt(1072,:);pnt(1592,:);pnt(2008,:);pnt(646,:);pnt(1062,:);pnt(1582,:);pnt(1998,:);pnt(638,:);pnt(1054,:);pnt(1574,:);pnt(1990,:)];
sensor(:,3)=sensor(:,3)+max(r)+0.1;
sens.elecpos = sensor;
sens.label = {};
nsens = size(sens.elecpos,1);
for ii=1:nsens
sens.label{ii} = sprintf('vertex%03d', ii);
end
%% Set the position of the probe dipole
%%Un source
pos = pnt(1326,:);%[5 5 0] maillage complet
pos(:,3) = pos(:,3)+0.1;
%%Deux source
% S1 = pnt(10609,:);%[2.5 2.5 0] maillage complet
% S1(:,3) = S1(:,3)+0.1;
% S2 = pnt(31417,:);%[7.5 7.5 0] maillage complet
% S2(:,3) = S2(:,3)+0.1;
% pos=[S1;S2];
%%All the uterine muscle mesh
%S=pnt(:,:,:);
%S(:,3) = S(:,3)+0.1;
%pos=S;
%% Create a BEM volume conduction model
vol = [];
for ii=1:length(r)
uterus=pnt;
uterus(:,3)=uterus(:,3)+r(ii)+0.1;
vol.bnd(ii).pnt = uterus;
vol.bnd(ii).tri = fliplr(tri); % pointing inwards!!!
end
vol.cond = c;
%% Compute the BEM
cfg=[];
cfg.method = 'bemcp';
vol = ft_prepare_headmodel(cfg, vol);
cfg.vol = vol;
cfg.grid.pos = pos;
cfg.elec = sens;
%% Inverse problem
%data_real=real.XXF2D1;
%MNE
lambda = 1e-1;
%
MNE_1 = inverse_operator_MNE(gain,lambda); % A: Gain matrix
S_MNE_1 = bayesian_inverse_solution(data_simulated',MNE_1); % X: Signal
mean_S_MNE_1=mean(S_MNE_1,2);
%
% MNE_2 = inverse_operator_MNE(gain,lambda); % A: Gain matrix
% S_MNE_2 = bayesian_inverse_solution(data_real',MNE_2); % X: Signal
% mean_S_MNE_2=mean(S_MNE_2,2);

bnd = struct('pnt', pnt, 'tri', tri);
figure;ft_plot_mesh(bnd, 'vertexcolor', mean_S_MNE_1(1:size(pnt,1)));
% figure;ft_plot_mesh(bnd, 'vertexcolor', mean_S_MNE_2(1:size(pnt,1)));

To be more accurate I want to use your algorithm in: http://www.fieldtriptoolbox.org/tutorial/minimumnormestimate?s[]=mne  but my obstacle was cfg.dataset                 = 'Subject01.ds'; I didn't
know in our cases what is the "Subject01.ds", and also the same in: http://www.fieldtriptoolbox.org/tutorial/beamformer,...

Thank you very much for any suggestions

Best regards
Saeed

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160113/fb339e53/attachment-0002.html>
```