Dear Vladimir and Charline,
Having similar problems as Charline, I tried the solution suggested by
Vladimir. I did the ICA in fieldtrip and saved the variable montage. I then
tried to use spm_eeg_montage(D, montage). However, since I calculated the
ICA only for MEG channels, two problems arose: First, montage.labelorg
contained ‘component1’ to ‘component273’. I replaced the montage.labelorg
with the labels of the MEG channels. Since this solved one problem, I guess
it was correct?
Second, I get an error message, when I try to keep all channels that were
not involved in the ICA (i.e. all channels that are not MEG channels):
??? Error using ==> spm_eeg_montage at 140
not all output channels of the montage are unique
I have some intuition on the problem, but since I do not fully understand
the code, I cannot solve it. In line 106-108 all columns are thrown out that
have only zeros. The montage.labelorg is changed accordingly. Yet in line
111-113 the channels are added that are not involved in the montage. In this
case these are all non-MEG channels + the 2 channels that have been thrown
out previously. As montage.labelnew already contains these 2 MEG channels it
has two channels that are not unique. Hence in line 139 there are 2 unique
channels missing. I understand why (in the code) the error occurs, but I am
unsure what it means.
It would be great if you can help me to make the code work. If you cannot
replicate the error I can send you the SPM .mat file and the montage matrix.
Thanks for your help,
Anette
P.S.: If it is not too demanding, it would be great if you can give me an
intuition what kind of information the variable montage.tra contains. This
would help me to understand the code.
-----Original Message-----
From: SPM (Statistical Parametric Mapping) [mailto:[log in to unmask]] On
Behalf Of Vladimir Litvak
Sent: Monday, November 14, 2011 1:49 PM
To: [log in to unmask]
Subject: Re: [SPM] MEEG_ convertion of FieldTrip data into GUI-readable SPM
data.
Dear Charline,
Removing ICA components changes the way your channels relate to your
sensors. One of the consequences is for instance that your data is rank
deficient. The lead field computation should be 'aware' of this to work
correctly and for MEG this updating is done by the montage function. For EEG
the problem is not solved in SPM8 but will be solved in SPM12. In general if
you have a lot of channels and remove just a few components which are not
coming from the brain anyway the problem is not very severe but it's better
to be on the safe side, especially since it also solves your other problems.
Best,
Vladimir
On Mon, Nov 14, 2011 at 12:38 PM, Urbain Charline <[log in to unmask]> wrote:
> Dear Vladimir,
>
> Sorry again for the delay...
>
> According to your advises, we applied the ICA montage on our data.
> Now, we do not have anymore troubles with the GUI. Thank you!
> If it's not to complicated, could you just explain us why without the
> ICA montage our last solution (copied the *.mat file from previous
> steps and pointed his header to the new *.dat file containing the ICA
> analysis) could provokes some problem to do source reconstruction?
>
> Best regards,
>
> Charline
>
>
> 2011/10/26 Vladimir Litvak <[log in to unmask]>
>>
>> Dear Charline,
>>
>> Indeed the problem is with channel types as the BTI system cannot be
>> recognized just based on labels. What you can do (assuming that Dold
>> is the object before ICA and Dnew is the object after) is:
>>
>> Dnew.origchantypes = Dold.origchantypes; save(Dnew); S = []; S.task =
>> 'defaulttype'; S.D = D; S.save = 1; D = spm_eeg_prep(S);
>>
>>
>> That still doesn't solve the problem of updating sensors.
>>
>> Vladimir
>>
>> On Tue, Oct 25, 2011 at 5:27 PM, Urbain Charline <[log in to unmask]>
>> wrote:
>> > Dear Vladimir,
>> >
>> > Thank you very much for your proposition :
>> >
>> > please find in attachment:
>> > -'XI' the mat file with ICA and uncorrected header
>> > - 'I' the mat file with ICA and the corrected header (with the
>> > solution previously describe to indirectly resolve our problem of
>> > function spm_eeg_ft2spm GUI readable)
>> > - 'abe...' the mat file before ICA (in case you need it)
>> >
>> > We plan to do sources reconstruction then we need to find a
>> > solution indeed..
>> > I will read about the montage matrix in the manual because I didn't
>> > now it yet..
>> >
>> > Many thanks,
>> >
>> > Charline
>> >
>> >
>> >
>> >
>> > 2011/10/25 Vladimir Litvak <[log in to unmask]>
>> >>
>> >> Dear Charline,
>> >>
>> >> The fact that this solution works indicates that the problem is
>> >> indeed something in the header, probably channel types as I
>> >> thought. If you want, send me the problematic header and I'll look
>> >> at it. One problem with your solution is that the sensor
>> >> representation is not updated to reflect the fact that you removed
>> >> some dimensions from your data. If you only do sensor-level
>> >> analysis it's not a problem but if you want to do source
>> >> reconstruction or DCM that can be a problem so applying the ICA
montage as I suggested is still a better way to go.
>> >>
>> >> Best,
>> >>
>> >> Vladimir
>> >>
>> >> On Tue, Oct 25, 2011 at 2:56 PM, Urbain Charline
>> >> <[log in to unmask]>
>> >> wrote:
>> >> > Dear Vladimir,
>> >> >
>> >> > sorry for this late answer I was out of the lab for several days..
>> >> > We do not get any error messages when we try to open the GUI. We
>> >> > also looked in other MEG tab but didn't find the data.
>> >> > Fortunatly, we found a way to solve the problem:
>> >> > we copied the *.mat file from previous steps and pointed his
>> >> > header to the new *.dat file (containing the ICA analysis) using
>> >> > this command:
>> >> >
>> >> > % Correct the header
>> >> >
>> >> > disp('UPDATING THE HEADER...')
>> >> >
>> >> > D.fname=[outspm '.mat'];
>> >> > D.data.fnamedat=[outspm '.dat'];
>> >> > D.data.y.fname=fullfile(path,D.data.fnamedat);
>> >> >
>> >> > then the function spm_eeg_ft2spm was used and the data could be
>> >> > read in the GUI!
>> >> >
>> >> >
>> >> > Thank you very much for help,
>> >> >
>> >> > Charline
>> >> >
>> >> > UR2NF - Neuropsychology and Functional Neuroimaging Research
>> >> > Unit, Université Libre de Bruxelles LCFC - Laboratoire de
>> >> > Cartographie Fonctionnelle du Cerveau, Hôpital Érasme
>> >> >
>> >> > Campus du Solbosch CP191avenue F.D. Roosevelt 50 B-1050
>> >> > Bruxelles Belgium Tel. +32 (0)2 650 45 49 Fax +32 (0)2 650 22
>> >> > 09
>> >> >
>> >> >
>> >> >
>> >> > 2011/10/12 Vladimir Litvak <[log in to unmask]>:
>> >> >> These are not errors, these messages always appear. When you
>> >> >> are saying that you cannot view the dataset in the reviewing
>> >> >> tool, what exactly happens? Do you get any error messages when
>> >> >> you try to open it or do you just not see the data in the 'MEG'
>> >> >> tab? Have you tried looking in the 'Other' tab?
>> >> >>
>> >> >> Vladimir
>> >> >>
>> >> >> On Wed, Oct 12, 2011 at 3:44 PM, Urbain Charline
>> >> >> <[log in to unmask]>
>> >> >> wrote:
>> >> >>> Yes, here are the details:
>> >> >>>
>> >> >>> spmdat=spm_eeg_load('spmdataname');
>> >> >>> data=ftraw(spmdat,0);
>> >> >>> D=spm_eeg_ft2spm(data,'newspmdataname');
>> >> >>>
>> >> >>> The errors we get are:
>> >> >>>
>> >> >>> checkmeeg: no channel type, assigning default
>> >> >>> checkmeeg: no units, assigning default
>> >> >>> checkmeeg: transform type missing, assigning default
>> >> >>> checkmeeg: data scale missing, assigning default
>> >> >>> checkmeeg: data type is missing or incorrect, assigning
>> >> >>> default
>> >> >>>
>> >> >>> Best,
>> >> >>> Charline
>> >> >>>
>> >> >>>
>> >> >>> 2011/10/12 Vladimir Litvak <[log in to unmask]>
>> >> >>>>
>> >> >>>> Are you getting any error messages when trying to display the
>> >> >>>> dataset?
>> >> >>>> The problem with channel types is not related to ICA so can
>> >> >>>> also happen just with converting back and forth, but if you
>> >> >>>> apply the montage as I suggested it shouldn't happen.
>> >> >>>>
>> >> >>>> Best,
>> >> >>>>
>> >> >>>> Vladimir
>> >> >>>>
>> >> >>>> On Wed, Oct 12, 2011 at 2:54 PM, Urbain Charline
>> >> >>>> <[log in to unmask]>
>> >> >>>> wrote:
>> >> >>>> > Dear Vladimir,
>> >> >>>> >
>> >> >>>> > Just to let you know, I just tried the following: I
>> >> >>>> > converted as before SPM data into a Fieldtrip data
>> >> >>>> > structure using the function ftraw, and then directly
>> >> >>>> > applied the opposite conversion spm_eeg_ft2spm (so without
>> >> >>>> > ICA artifact rejection) and the problem is still present.
>> >> >>>> > It is therefore not likely related to my ICA procedures,
>> >> >>>> > but more probably to some sort of compatibily problem
>> >> >>>> > between the two functions I mentionned.
>> >> >>>> >
>> >> >>>> > Do you know if other poeple used this procedure (ftraw and
>> >> >>>> > spm_eeg_ft2spm)
>> >> >>>> > and reported that it worked correctly?
>> >> >>>> >
>> >> >>>> > Best,
>> >> >>>> > Charline
>> >> >>>> >
>> >> >>>> >
>> >> >>>> > 2011/10/12 Vladimir Litvak <[log in to unmask]>
>> >> >>>> >>
>> >> >>>> >> The montage I mentioned is generated around line 150 of
>> >> >>>> >> ft_rejectcomponent. So you can just put a breakpoint
>> >> >>>> >> there or add your bit of code saving it to a .mat file and
>> >> >>>> >> then use that file for SPM montage function.
>> >> >>>> >>
>> >> >>>> >> Vladimir
>> >> >>>> >>
>> >> >>>> >> On Wed, Oct 12, 2011 at 2:39 PM, Vladimir Litvak
>> >> >>>> >> <[log in to unmask]> wrote:
>> >> >>>> >> > Dear Charline,
>> >> >>>> >> >
>> >> >>>> >> > I don't know for sure but one possibility is that your
>> >> >>>> >> > channel types are not set correctly any more and all the
>> >> >>>> >> > channels appear in the 'Other' tab. In general I would
>> >> >>>> >> > suggest you instead of converting your clean data back
>> >> >>>> >> > to SPM to get from FT the montage matrix representing
>> >> >>>> >> > ICA component removal and apply it to your SPM dataset
>> >> >>>> >> > using spm_eeg_montage.
>> >> >>>> >> >
>> >> >>>> >> > Best,
>> >> >>>> >> >
>> >> >>>> >> > Vladimir
>> >> >>>> >> >
>> >> >>>> >> > On Wed, Oct 12, 2011 at 2:20 PM, Urbain Charline
>> >> >>>> >> > <[log in to unmask]>
>> >> >>>> >> > wrote:
>> >> >>>> >> >> Dear Vladimir,Dear SPMers,
>> >> >>>> >> >>
>> >> >>>> >> >> I have a problem concerning the convertion of FieldTrip
>> >> >>>> >> >> data into GUI-readable SPM data.
>> >> >>>> >> >>
>> >> >>>> >> >> Specifically, the problem is the following: I
>> >> >>>> >> >> successfully converted SPM data (preprocessed with SPM
>> >> >>>> >> >> *.beffspm.mat)
>> >> >>>> >> >>
>> >> >>>> >> >>
>> >> >>>> >> >>
>> >> >>>> >> >> into Fieldtrip data to perform an ICA analysis. After
>> >> >>>> >> >> removing the artifactual ICs from the data, I converted
>> >> >>>> >> >> the resulting Fieldtrip data structure into SPM
>> >> >>>> >> >> structures .dat and .mat using the function
>> >> >>>> >> >> spm_eeg_ft2spm, which seems to work.
>> >> >>>> >> >>
>> >> >>>> >> >>
>> >> >>>> >> >>
>> >> >>>> >> >>
>> >> >>>> >> >> However, I am now unable to display the data into the GUI.
>> >> >>>> >> >> Do
>> >> >>>> >> >> you
>> >> >>>> >> >> know
>> >> >>>> >> >> why?
>> >> >>>> >> >>
>> >> >>>> >> >> Thank you very much for help!
>> >> >>>> >> >>
>> >> >>>> >> >> Charline
>> >> >>>> >> >>
>> >> >>>> >> >>
>> >> >>>> >> >>
>> >> >>>> >> >>
>> >> >>>> >> >>
>> >> >>>> >> >
>> >> >>>> >
>> >> >>>> >
>> >> >>>
>> >> >>>
>> >> >>
>> >> >
>> >> >
>> >
>> >
>
>
|