Hi Adoney,

you can just get the channel positions of the same sensors in order to compare them.

I am pasting here some code that loads the channel positions from the three different resting state scans in a common order and plots the histogram of the position differences between runs 1-2,1-3 and 2-3.

At first it does this for all the sensors including the reference sensors.

Then it does the same only for the MEG sensors , with the reference sensors removed, because the reference sensors are far from the  head and a small head movement can be translated into larger position differences further away from the head as compared to the MEG sensors which are near the head.

In the code below you need to change the data directory and Fieltrip directory to what you have.

I hope it helps

Best

Giorgos

%---------------------
%fieldtripdir='/home/michalareasg/toolboxes/matlab/fieldtrip/fieldtrip_svn';
fieldtripdir='/home/georgios.michalareas/workspace/toolboxes/matlab/fieldtrip';
addpath(fieldtripdir);
ft_defaults;
%---------------------

datadir='/home/georgios.michalareas/workspace/projects/HCP/data/connectomedb/177746/MEG/Restin/rmegpreproc/';

rsfile1=[datadir,'177746_MEG_3-Restin_rmegpreproc.mat'];
rsfile2=[datadir,'177746_MEG_4-Restin_rmegpreproc.mat'];
rsfile3=[datadir,'177746_MEG_5-Restin_rmegpreproc.mat'];

%=============================
load(rsfile1,'data');
data1=data; clear data;
%----------------
load(rsfile2,'data');
data2=data; clear data;
%----------------
load(rsfile3,'data');
data3=data; clear data;
%=============================

%%


[C12,IA12,IB12]=intersect(data1.grad.label,data2.grad.label);
[C13,IA13,IB13]=intersect(data1.grad.label,data3.grad.label);
if ~isequal(C12,C13)
    error('common grad labels between resting state recordins 1-2 and recordings 1-3 appear to be different')
else
    C=C12;
    IA1=IA12;
    IA2=IB12;
    IA3=IB13;
end

gradlabels=C;
gradpos1=data1.grad.chanpos(IA1,:);
gradpos2=data2.grad.chanpos(IA2,:);
gradpos3=data3.grad.chanpos(IA3,:);

posdif12=sqrt(sum((gradpos1-gradpos2).^2,2));
posdif13=sqrt(sum((gradpos1-gradpos3).^2,2));
posdif23=sqrt(sum((gradpos2-gradpos3).^2,2));

figure;
subplot(1,3,1);
hist(posdif12);
subplot(1,3,2);
hist(posdif13);
subplot(1,3,3);
hist(posdif23);



%% ========================================================================
% Now do the same for only the MEG sensors without the REFERENCE sensors
% because they are too far from the head an a small head movement can be
% translated into bigger position differences of the reference sensors as
% compared to the MEG sensors which are close to the head

[chansMEG] = ft_channelselection('MEG',data1.grad.label );


[C1,IA1,IB1]=intersect(chansMEG, data1.grad.label);
[C2,IA2,IB2]=intersect(chansMEG, data2.grad.label);
[C3,IA3,IB3]=intersect(chansMEG, data3.grad.label);


if (~isequal(C1,C2))|(~isequal(C1,C3))|(~isequal(C2,C3))
    error('common grad labels between resting state recordins 1-2 and recordings 1-3 appear to be different')
else
    C=C1;
end

gradlabels=C;
gradpos1=data1.grad.chanpos(IB1,:);
gradpos2=data2.grad.chanpos(IB2,:);
gradpos3=data3.grad.chanpos(IB3,:);

posdif12=sqrt(sum((gradpos1-gradpos2).^2,2));
posdif13=sqrt(sum((gradpos1-gradpos3).^2,2));
posdif23=sqrt(sum((gradpos2-gradpos3).^2,2));

figure;
subplot(1,3,1);
hist(posdif12);
subplot(1,3,2);
hist(posdif13);
subplot(1,3,3);
hist(posdif23);









On 11/19/2017 9:40 PM, A Nunes wrote:
Hi Giorgos,

Thanks, I did not know about ft_megrealign. Idially I would like to just concatenate the data in the sensor level. I recently realized that between recordings the sensor position varies up to 0.2 meters in data.grad.chanpos. This is because the order of the sensors are different between recordings, I don't know why though. In data.grad.labelorg it shows the right order, however I have the impression that the order of the sensors in the covariance matrix is based in chanpos because separate recording have smaller rank than concatenating which has full rank. When reading the data file FT gives me the warning 'Your data and configuration allow for multiple sensor definitions.' maybe this is related.

Do you know how to approach this? Maybe I should somehow specify that the right order is in data.grad.labelorg rather than data.grad.label?

Thanks
Adonay

On Fri, Nov 17, 2017 at 5:15 AM, Michalareas, Georgios <g...@ae.mpg.de <mailto:g...@ae.mpg.de>> wrote:

    Hi Adoney,
    The released data has been only 7.5 mm maximum movement within scan.
    So the sensor positions should be quite close in all three resting
    state scans.
    ICA was done with all three sessions concatenated together.
    So I believe it should be one to concatenate them for your
    analysis too and assume sensors are more or less on same location.
    If you want to treat each different scan separately then you have
    to follow different strategies like:
    -Perform beamforming for each session separately and project each
    session separately into source space and then concatenate data in
    source space and do further analysis there.
    -Make a virtual gradiometer array as the mean of the three
    gradiometer positions in the three scans and then interpolate the
    data of each session to this virtual MEG sensors using Fieltrip’s
    function ft_megrealign and then combine all data in this virtual
    sensor space. Keep in mind that this projects the data into source
    space and projects it back to the virtual sensor space.

    I hope this helps
    Best
    Giorgos

    From: <hcp-users-boun...@humanconnectome.org
    <mailto:hcp-users-boun...@humanconnectome.org>> on behalf of A
    Nunes <adonay.s.nu...@gmail.com <mailto:adonay.s.nu...@gmail.com>>
    Date: Thursday, 16. November 2017 at 21:56
    To: "hcp-users@humanconnectome.org
    <mailto:hcp-users@humanconnectome.org>"
    <HCP-Users@humanconnectome.org <mailto:HCP-Users@humanconnectome.org>>
    Subject: [HCP-Users] MEG resting state

    Hi,

    The MEG resting state data is split in three sessions, is it
    possible to append the data before computing the covariance matrix?
    I have some doubts because the sensor position might change
    between the recordings and if ICA was done separately, then the
    rank would change between sessions and I don't know how would this
    affect beamforming.

    Any suggestions?

    Thanks
    Adonay

    _______________________________________________
    HCP-Users mailing list
    HCP-Users@humanconnectome.org <mailto:HCP-Users@humanconnectome.org>
    http://lists.humanconnectome.org/mailman/listinfo/hcp-users
    <http://lists.humanconnectome.org/mailman/listinfo/hcp-users>



<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> Virus-free. www.avg.com <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

--
------------------------------------------------
Dr. Georgios Michalareas
Neuroscience Department
Max Planck Institute for Empirical Aesthetics

email: g...@aesthetics.mpg.de
phone: +49 69 8300479-325
------------------------------------------------


_______________________________________________
HCP-Users mailing list
HCP-Users@humanconnectome.org
http://lists.humanconnectome.org/mailman/listinfo/hcp-users

Reply via email to