JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for SPM Archives


SPM Archives

SPM Archives


SPM@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

SPM Home

SPM Home

SPM  April 2011

SPM April 2011

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: Problems with spm_eeg_crop (;atest update)

From:

Vladimir Litvak <[log in to unmask]>

Reply-To:

Vladimir Litvak <[log in to unmask]>

Date:

Thu, 7 Apr 2011 13:49:52 +0100

Content-Type:

multipart/mixed

Parts/Attachments:

Parts/Attachments

text/plain (275 lines) , spm_eeg_crop.m (275 lines)

Dear Panagiotis,

Re the first problem there was indeed a bug in my fix (see attached).
Re the second problem it will stay unfixed as long as I can't
reproduce it so you can't ignore my request to provide an example and
expect that I will somehow fix it anyway.

In general, the functionality you need can be achieved with
spm_eeg_convert where you can re-convert your spm8 dataset (select the
mat file) and ask for a segment of continuous data. That will also
work for very large datasets unlike spm_eeg_crop which was
specifically designed for epoched and TF data.

Vladimir

On Wed, Apr 6, 2011 at 8:43 PM, Panagiotis Tsiatsis
<[log in to unmask]> wrote:
>  Hello Vladimir and dear all,
>
> Apologies in advance for the long e-mail, I am trying to be as clear as
> possible. I updated my spm version today but I am facing some problems with
> spm_eeg_crop when I try to apply it to my data (CTF MEG)
>
>
> Problem A.] As we had discussed in the past, when trying to crop a
> continuous file:
>
> On 2/16/2011 4:57 PM, Vladimir Litvak wrote:
>>
>>> 2.The cropped file (where only a few non-trial seconds from the start and
>>> from the and are missing) contains exactly the same number of events as
>>> the
>>> original continuous file. Why??? It seems that some zombie events are
>>> retained after cropping!
>>>
>>>
>> That's indeed a bug, due to the fact that I wasn't planning this
>> function to be used on continuous data. I now fixed it and it'll be in
>> the next update.
>>
>
> I saw your fix in the code to retain only the correct events in the cropped
> file, but the problem is that when I am trying to use the function on a
> continuous CTF MEG data file, I am getting the following error:
>
> SPM8: spm_eeg_crop (v4202)                         20:05:54 - 06/04/2011
> ========================================================================
> ??? Error using ==> subsindex
> Function 'subsindex' is not defined for values of class 'struct'.
>
> Error in ==> getfield at 46
>        f = f(index{:});
>
> Error in ==> getset at 25
>        res{i} = getfield(this, parent, {ind(i)}, fieldname);
>
> Error in ==> meeg.events at 11
> res = getset(this, 'trials', 'events', varargin{:});
>
> Error in ==> spm_eeg_crop at 103
>   Dnew   = events(Dnew, ev);
>
>
> I could use the function properly before the update. The parameters that I
> pass to the function are the following
>
>
>                S = [];
>                S.D = D; %where this is the origin continuous CTF MEG data
> file
>                S.timewin = [(Time_of_First_Trial_Onset_in_ms -
> Time_Offset_in_ms) (Time_of_Last_Trial_Onset_in_ms + Time_Offset_in_ms)]
>                S.freqwin = [];
>                S.channels = 'all'
>
>                D = spm_eeg_crop(S);
>                D.save;
>
> Any ideas?
>
>
> Problem B.] When using crop in epoched data it seems to work fine. But
> still, as I wrote before, in the case that the trials have been cropped I
> get the following warning later on through the analysis when I am converting
> the trials to images
>
> Warning: Duplicate x-y data points detected: using average of the z values.
>> In griddata at 107
>  In spm_eeg_convert2scalp at 205
>
>
> This only occurs if I crop the data (if you look back in my previous e-mail,
> you will see that this was also happening when I was cropping the continuous
> file.
>
> From our previous communication (e-mail title "Warning in
> spm_eeg_convert2scalp (griddata) & spm_eeg_crop"]
>
> ==============
>
>
> The problem seems to appear in spm_eeg_crop when applied on a continuous
>>
>>  file  to and more specifically somewhere in the creation of the new
>> object:
>>
>>  Dnew = coor2D(Dnew, [], coor2D(D, chanind));
>>
>>  as some channels do indeed have the same coordinates :
>>
>
>>> >>>  size(coor2D(D, chanind)')
>>
>>  ans =
>>
>>    337     2
>>
>
>>> >>>  size(unique(coor2D(D, chanind)','rows'))
>>
>>  ans =
>>
>>    335     2
>>
>>
>>  The above number shows that spm_eeg_crop indeed puts in the coor2D matrix
>>  (or tries to put) the coordinates of all available channels. Up to now
>> (and
>>  correct me if I am wrong) I knew that the coor2D matrix contains the
>>  coordinates of the MEGGRAD channels only. So I modified the code as
>> follows
>>  :
>>
>>  MEG_Channels = (D.meegchannels('MEG'));
>>  Dnew = coor2D(Dnew, [], coor2D(D, MEG_Channels));
>>
>>
>>  *And indeed the conversion to images of subsequent files was executed
>>  without warnings*. So, is this a bug or am I going the wrong direction
>> here?
>>
>
> (Vladimir wrote:)
> I tried this on my CTF dataset and I don't get identical 2D
> coordinates. So this is something that happens for your data and I'm
> not sure why. If you send me an example I can look. In general this
> code should work as it is because 2D coordinates are defined for all
> channels (for non-scalp channels these are just points on a square
> grid).
>
>
> ==============
>
>
>
> So these two problems still remain unresolved for me... Any help would be
> highly appreciated.
>
> Thanks and best
>
> Panagiotis
>
>
>
>
>
>
>>> 3.  Please note that there appears to be one more problem with
>>> spm_eeg_crop
>>> and continuous data :
>>>
>>> The line Dnew = badchannels(Dnew, [], badchannels(D, chanind)); always
>>> results in an error when there are no bad channels, i.e. when
>>> isempty(D.badchannels) == 1. so i have substituted the above line with
>>>
>>> if isempty(D.badchannels) == 0
>>>     Dnew = badchannels(Dnew, [], badchannels(D, chanind));
>>> end
>>>
>> I can't reproduce this problem either. The code should work also for
>> no bad channels because badchannels(D, chanind) always returns a
>> vector of 0/1
>>
>> Best,
>>
>> Vladimir
>>
>>
>>> I suspect I should put an 'else' condition somewhere there, but of course
>>> you are the expert on this  :)
>>>
>>> Thanks again and all the best,
>>> Panagiotis
>>>
>>> On 2/7/2011 8:10 PM, Vladimir Litvak wrote:
>>>>
>>>> Dear Panagiotis,
>>>>
>>>> Try doing:
>>>>
>>>> spm_eeg_load
>>>> D.coor2D(D.meegchannels('MEG'))
>>>>
>>>> and look which of the channels have the same 2D coordinates. In
>>>> principle this should not happen for CTF MEG. You can also look in
>>>> 'Prepare' tool at the 2D channel layout an modify it if necessary or
>>>> load a template layout from EEGtemplates.
>>>>
>>>> Best,
>>>>
>>>> Vladimir
>>>>
>>>> On Sun, Feb 6, 2011 at 5:23 PM, Panagiotis Tsiatsis
>>>> <[log in to unmask]>    wrote:
>>>>>
>>>>>  Dear All,
>>>>>
>>>>> When I am converting my CTF MEG epoched data to images, I am getting
>>>>> the
>>>>> following warning:
>>>>>
>>>>> Warning: Duplicate x-y data points detected: using average of the z
>>>>> values.
>>>>>>
>>>>>> In griddata at 107
>>>>>
>>>>>  In spm_eeg_convert2scalp at 204
>>>>>
>>>>> My settings are:
>>>>>
>>>>>            S = [];
>>>>>            S.n = 32;
>>>>>            S.Fname = Concatenated_File_Name_Time;
>>>>>            S.interpolate_bad = 1;
>>>>>            S.modality = 'MEG';
>>>>>
>>>>> I also have EOG channels whose chantype has been set to 'EEG' during
>>>>> the
>>>>> conversion (this of course should not interfere since I ve selected my
>>>>> modality to be 'MEG').
>>>>>
>>>>> By browsing the Mathwoks forum, I suspect that this happens when nearby
>>>>> values get very similar (as is the case with MEG data).
>>>>>
>>>>> Anybody seen that before? Any intuitions?
>>>>>
>>>>> Thanks and best,
>>>>> Panagiotis
>>>>>
>>>>>
>>>>> --
>>>>> Panagiotis S. Tsiatsis
>>>>> Max Planck Institute for Biological Cybernetics
>>>>> Cognitive NeuroImaging Group
>>>>> Tuebingen, Germany
>>>>>
>>>
>>> --
>>> Panagiotis S. Tsiatsis
>>> Max Planck Institute for Biological Cybernetics
>>> Cognitive NeuroImaging Group
>>> Tuebingen, Germany
>>>
>>>
>
>
> --
> Panagiotis S. Tsiatsis
> Max Planck Institute for Biological Cybernetics
> Cognitive NeuroImaging Group
> Tuebingen, Germany
>
>

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

April 2024
March 2024
February 2024
January 2024
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
2006
2005
2004
2003
2002
2001
2000
1999
1998


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager