From t.montez at VUMC.NL Mon May 2 09:20:31 2005 From: t.montez at VUMC.NL (Montez, T.) Date: Mon, 2 May 2005 09:20:31 +0200 Subject: Grand Averages Message-ID: Hi, I would like to make two multiplots of power spectrum: one for controls and one for patients. I wrote a code to compute the planar gradiometers, the average over trials for each subject and the power spectrum (see attachment). I want to run it through the two groups and grand average within the groups to have a first glance at the differences between them.   The database is structured like:   E:\Data\AD_Project\Patients\A001 ... E:\Data\AD_Project\Patients\A017   And E:\Data\AD_Project\Controls\C001 ... E:\Data\AD_Project\Controls\C018   Inside each folder there is a "data" Matlab file (*).   - How are your databases organized and how do you compute Grand Averages?   Thanks, Teresa     (*) Example of how the data was read from CTF.   cfg = []; cfg.dataset = 'E:\Data\AD-EC\A001-ED_20020719_02.ds' cfg.trl= [[ones(1,37)]', [4096*ones(1,37)]', [zeros(1,37)]'] cfg.channel='all' data = preprocessing(cfg)   It is just no-task eyes closed data acquired with 37 trials of 4096 samples. So I want to apply the filters later as if it is continuous data. - How is it handled in the last 0.9.6 version? -------------- next part -------------- A non-text attachment was scrubbed... Name: script_home_database.m Type: application/octet-stream Size: 4075 bytes Desc: not available URL: From tnt at PHYSIOL.OX.AC.UK Tue May 3 23:05:47 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Tue, 3 May 2005 23:05:47 +0200 Subject: importing CTF data Message-ID: Dear Robert and Ole, I am trying to import data from a 151 channel CTF system into FieldTrip format. I tried following the instructions in preprocessing.m and definetrial.m but got the error message that the markerfile can't be read. I think that importing raw data wasn't covered during the last workshop (which was extremely helpful by the way!), so I am not sure if I did the right thing at all and probably have overlooked something. I have put an example dataset here: http://www.physiol.ox.ac.uk/~tnt/fieldtrip/ There is one trigger in this dataset (C1_A1). Would it be possible for you to have a look and suggest some Matlab code that will allow me to import the data so that I can use it with preprocessing.m, etc? Thank you very much for your help. Best wishes, Thomas --------------------------------------------------- Thomas Thesen University Laboratory of Physiology & Centre for Functional MRI of the Brain University of Oxford Oxford, OX1 3PT United Kingdom Phone: +44(0)1865-272 434 Mobile: +44(0)781-355 6528 Fax: +44(0)1865-272 469 e-mail: thomas.thesen at physiol.oxford.ac.uk http://www.fmrib.ox.ac.uk/~tnt/ --------------------------------------------------- From ole.jensen at FCDONDERS.RU.NL Wed May 4 01:01:48 2005 From: ole.jensen at FCDONDERS.RU.NL (Ole Jensen) Date: Wed, 4 May 2005 01:01:48 +0200 Subject: importing CTF data In-Reply-To: Message-ID: Dear Thomas, First try to have a look at the appendix in of the tutorial 'Event Related Fields'. There is an example on reading 'continues' data (this includes AUX files). There is also a definetrial.m example function - you can use this to check the stimulus channel etc - hopefully this will help you get going. Good luck, Ole Thomas Thesen wrote: >Dear Robert and Ole, > >I am trying to import data from a 151 channel CTF system into FieldTrip >format. I tried following the instructions in preprocessing.m and >definetrial.m but got the error message that the markerfile can't be read. I >think that importing raw data wasn't covered during the last workshop (which >was extremely helpful by the way!), so I am not sure if I did the right >thing at all and probably have overlooked something. > >I have put an example dataset here: >http://www.physiol.ox.ac.uk/~tnt/fieldtrip/ >There is one trigger in this dataset (C1_A1). Would it be possible for you >to have a look and suggest some Matlab code that will allow me to import the >data so that I can use it with preprocessing.m, etc? > >Thank you very much for your help. > >Best wishes, > >Thomas > >--------------------------------------------------- >Thomas Thesen >University Laboratory of Physiology >& Centre for Functional MRI of the Brain >University of Oxford >Oxford, OX1 3PT >United Kingdom > >Phone: +44(0)1865-272 434 >Mobile: +44(0)781-355 6528 >Fax: +44(0)1865-272 469 >e-mail: thomas.thesen at physiol.oxford.ac.uk >http://www.fmrib.ox.ac.uk/~tnt/ > >--------------------------------------------------- > > > -- Ole Jensen Principal Investigator F.C. Donders Centre for Cognitive Neuroimaging P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Office : +31 24 36 10884 MEG lab : +31 24 36 10988 Fax : +31 24 36 10989 e-mail : ole.jensen at fcdonders.ru.nl URL : http://oase.uci.ru.nl/~olejen From r.oostenveld at FCDONDERS.RU.NL Wed May 4 09:02:17 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 4 May 2005 09:02:17 +0200 Subject: importing CTF data In-Reply-To: <427802DC.40900@fcdonders.ru.nl> Message-ID: Hi Thomas, Your data is pretty standard, the following snippet of code should get you started. cfg = []; cfg.dataset = 'sub12_SAM_a_C1_A1.ds'; cfg.trialdef.eventtype = '?' % see which eventtypes and values are present in the dataset % dum = definetrial(cfg); cfg.trialdef.eventtype = 'C1_A1' cfg.trialdef.prestim = 0; % trial starts at time t=0 at the marker cfg.trialdef.poststim = 0.5; % trial ends at t=0.5 sec cfg = definetrial(cfg); raw = preprocessing(cfg); cfg = []; avg = timelockanalysis(cfg, raw); plot(avg.time, avg.avg(31:180,:)) If you want to do conditional definition of trials (e.g. exclude bad trials), you should have a look at the example that Ole mentioned. best, Robert On 4 May 2005, at 1:01, Ole Jensen wrote: > Dear Thomas, > > First try to have a look at the appendix in of the tutorial 'Event > Related Fields'. There is an example on reading 'continues' data (this > includes AUX files). There is also a definetrial.m example function - > you can use this to check the stimulus channel etc - hopefully this > will help you get going. > > Good luck, > > Ole > > Thomas Thesen wrote: > >> Dear Robert and Ole, >> >> I am trying to import data from a 151 channel CTF system into >> FieldTrip >> format. I tried following the instructions in preprocessing.m and >> definetrial.m but got the error message that the markerfile can't be >> read. I >> think that importing raw data wasn't covered during the last workshop >> (which >> was extremely helpful by the way!), so I am not sure if I did the >> right >> thing at all and probably have overlooked something. >> >> I have put an example dataset here: >> http://www.physiol.ox.ac.uk/~tnt/fieldtrip/ >> There is one trigger in this dataset (C1_A1). Would it be possible >> for you >> to have a look and suggest some Matlab code that will allow me to >> import the >> data so that I can use it with preprocessing.m, etc? >> >> Thank you very much for your help. >> >> Best wishes, >> >> Thomas >> >> --------------------------------------------------- >> Thomas Thesen >> University Laboratory of Physiology >> & Centre for Functional MRI of the Brain >> University of Oxford >> Oxford, OX1 3PT >> United Kingdom >> >> Phone: +44(0)1865-272 434 >> Mobile: +44(0)781-355 6528 >> Fax: +44(0)1865-272 469 >> e-mail: thomas.thesen at physiol.oxford.ac.uk >> http://www.fmrib.ox.ac.uk/~tnt/ >> >> --------------------------------------------------- >> >> > > > -- > Ole Jensen > Principal Investigator > F.C. Donders Centre for Cognitive Neuroimaging > P.O. Box 9101 > NL-6500 HB Nijmegen > The Netherlands > > Office : +31 24 36 10884 > MEG lab : +31 24 36 10988 > > Fax : +31 24 36 10989 > > e-mail : ole.jensen at fcdonders.ru.nl > URL : http://oase.uci.ru.nl/~olejen > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From r.oostenveld at FCDONDERS.RU.NL Wed May 4 09:16:46 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 4 May 2005 09:16:46 +0200 Subject: Grand Averages In-Reply-To: <05May2.092319cest.334208@nucleus.azvu.nl> Message-ID: Hi Theresa We do not work with "databases", structuring the analysis of a larger group of subject is something that you have to do yourself in your own scripts. My preferred way of doing this is something like subj = { 'A001' 'A002' 'A003' 'A004' }; Nsubj = 4; for s=1:Nsubj dataset = ['E:\Data\AD_Project\Patients\' subj{i} '.ds']; matfile = ['E:\Data\AD_Project\Matlab\' subj{i} '.mat']; cfg = []; cfg.dataset = subj{s}; cfg.otheroption = ... cfg.otheroption = ... cfg.otheroption = ... raw = preprocessing(cfg) save(matfile, raw); clear raw end This ensures that you are using the same analysis options for each subject. Then in the next step (e.g. timelockanalysis or ferqanalysis), you can repeat the for-loop over the subjects, read the raw data and perform the nest step. Grand averaging is done using the TIMELOCKGRANDAVERAGE function or the FERQGRANDAVERAGE function. For MEG data, it is preferable to spatially realign them prior to averaging, since the helmet location is different for each subject. best, Robert On 2 May 2005, at 9:20, Montez, T. wrote: > Hi, > > I would like to make two multiplots of power spectrum: one for > controls and one for patients. > I wrote a code to compute the planar gradiometers, the average over > trials for each subject and the power spectrum (see attachment). > I want to run it through the two groups and grand average within the > groups to have a first glance at the differences between them. >   > The database is structured like: >   > E:\Data\AD_Project\Patients\A001 ... E:\Data\AD_Project\Patients\A017 >   > And E:\Data\AD_Project\Controls\C001 ... > E:\Data\AD_Project\Controls\C018 >   > Inside each folder there is a "data" Matlab file (*). >   > - How are your databases organized and how do you compute Grand > Averages? >   > Thanks, > Teresa >   >   > (*) Example of how the data was read from CTF. >   > cfg = []; > cfg.dataset = 'E:\Data\AD-EC\A001-ED_20020719_02.ds' > cfg.trl= [[ones(1,37)]', [4096*ones(1,37)]', [zeros(1,37)]'] > cfg.channel='all' > data = preprocessing(cfg) >   > It is just no-task eyes closed data acquired with 37 trials of 4096 > samples. > So I want to apply the filters later as if it is continuous data. > - How is it handled in the last 0.9.6 version? > > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From r.oostenveld at FCDONDERS.RU.NL Fri May 6 09:21:48 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 6 May 2005 09:21:48 +0200 Subject: 275ch CTF stimulus channel In-Reply-To: Message-ID: Hi Sanja, <--let's move our email exchange over towards the discussion list--> On 5 May 2005, at 22:50, Sanja Kovacevic wrote: > Thank you for helping me with this. I changed the filetype and > read_ctf_res.m files as you suggested, and I was able to read in the > data, however now I got problem with definetrial.m. Actually, I think > the problem is with read_ctf_trigger as the 275 CTF dataset does not > have a channel named 'STIM' but 'UPPT001' (line 63 in > read_ctf_trigger). That was easy to fix by replacing STIM with > UPPT001. > > However, I don't understand why you use (line 70 and 71 in > read_ctf_trigger.m) > > bpstim = fix(stim / 2^16); > fpstim = double(bitand(uint32(stim), 2^16-1)); WHen I started at the donders and implemented this, I was told that our 151 ch system has a "frontpanel" and a "backpanel". I never looked very acurately at the electronics cabinet and all the cables that go into it, but I guess that they refer to the way in which the cabinet is placed in our lab. Somehow, the CTF system's own triggers are put on the frontpanel, and the triggers that are generated on the stimulus PC are put on the backpanel. Since people write their stimulus programs on the presentations pc, and define/write trigger values in the 16 bit-range on that computer. They appear in the higher 16 bits of the 32 bit STIM channel, which is confusing since then the values don't match the ones on the presentation computer. Therefore the 16 lowest and 16 highest bits are separated and treated separately. On line 70, the highest 16 bits are shifted downward by 16 bits (i.e. divide by 2^16). On line 71, the highest 16 bits are masked away, keeping only the lowest 16 bits. > The trigger values on our CTF system use lower 8 bits, i.e. possible > values of the triggers are from 0 to 255. I am now quite confused with > what happens to my trigger values. The bottom line is that I have all > zeroes for backpanel and frontpanel. I think that you should look at the so called "frontpanel" triggers (whose bits are not shifted). > BTW, could you give me or point to an example of a user specified > trialfun that would include trials where trigger with value of 10 ir > trigger with value of 138 occurs? You mean either a 10 or a 138? Just from my head: function [trl] = trigger138(cfg) hdr = read_fcdc_header(cfg.dataset); event = read_fcdc_event(cfg.dataset); trl = []; prestim = 0.1; poststim = 0.5; for i=1:length(event) if strcmp(event(i).type, 'frontpannel trigger') if (event(i).value==10) | (event(i).value==138) % found trigger of interest trl(end+1,1) = event(i).sample - prestim*hds.Fs; trl(end ,2) = event(i).sample + poststim*hds.Fs; trl(end ,3) = - prestim*hds.Fs; end end end You could put prestim and poststim (time in seconds) in the cfg structure, to keep the function more flexible. From this example, you caneasily to make a conditional function, i.e. find the sample at which a trigger 138 occurred and which was preceded by a trigger 10. Alternatively, you can also use the standard code, i.e. without a custom trialfunction, to achieve the same. Try this: cfg = []; cfg.dataset = 'something.ds'; cfg.trialdef.eventtype = 'frontpannel trigger'; cfg.trialdef.eventvalue = [10 138]; cfg.trialdef.prestim = 0.1; cfg.trialdef.poststim = 0.5; cfg = definetrial(cfg); best regards, Robert From r.oostenveld at FCDONDERS.RU.NL Fri May 6 09:29:38 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 6 May 2005 09:29:38 +0200 Subject: importing CTF data In-Reply-To: <6.2.0.14.0.20050505113258.01ea7300@mail.physiol.ox.ac.uk> Message-ID: Hi Thomas, On 5 May 2005, at 12:38, Thomas Thesen wrote: > Thank you for your help! I have run the first lines of code: > > cfg = []; > cfg.dataset = 'sub12_SAM_a_C1_A1.ds'; > cfg.trialdef.eventtype = '?' > cfg.trialdef.eventtype = 'C1_A1' > cfg.trialdef.prestim = 0; % trial starts at time t=0 at the marker > cfg.trialdef.poststim = 0.5; % trial ends at t=0.5 sec > cfg = definetrial(cfg); > > and it has been running for over 12 hours now on a 2 GHz machine using > Matlab version 6.5. Is that normal? No, reading a stimulus channel and making a trial definition does not take that long. If I do the same on the dataset that you gave me, it takes about 2 seconds and shows me the following on screen found 92 events created 38 trials >> cfg cfg = dataset: 'sub12_SAM_a_C1_A1.ds' trialdef: [1x1 struct] datafile: 'sub12_SAM_a_C1_A1.ds/sub12_SAM_a_C1_A1.meg4' headerfile: 'sub12_SAM_a_C1_A1.ds/sub12_SAM_a_C1_A1.res4' event: [1x92 struct] trl: [38x3 double] version: [1x1 struct] Try whether these two commands work for you: hdr = read_fcdc_header(cfg.dataset) event = read_fcdc_event(cfg.dataset) Robert From tnt at PHYSIOL.OX.AC.UK Fri May 6 11:16:41 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Fri, 6 May 2005 11:16:41 +0200 Subject: importing CTF data Message-ID: Hi Robert, Thank you for your help! I have run the first lines of code: cfg = []; cfg.dataset = 'sub12_SAM_a_C1_A1.ds'; cfg.trialdef.eventtype = '?' cfg.trialdef.eventtype = 'C1_A1' cfg.trialdef.prestim = 0; % trial starts at time t=0 at the marker cfg.trialdef.poststim = 0.5; % trial ends at t=0.5 sec cfg = definetrial(cfg); and it has been running for over 36 hours now on a 2 GHz machine using Matlab version 6.5 and 7.0.1. I have tried both CTF datasets containing epochs and continuos data. thanks, Thomas From matsuham at NINDS.NIH.GOV Fri May 6 20:34:08 2005 From: matsuham at NINDS.NIH.GOV (Matsuhashi, Masao (NIH/NINDS)) Date: Fri, 6 May 2005 14:34:08 -0400 Subject: sourcestatistics Message-ID: Hi, It is nice to see more and more people start using FieldTrip and join the discussion here. Just reading through the posted messages gives me lots of ideas. I have questions about statistical measures using random re-sampling and permutation. i) Where can I find the sourcestatistics.m? According to the tutorials or documents, this script seems essential but I couldn't find it in recent distributions of FieldTrip. ii) In the sourceanalysis.m, re-sampling or permutation uses lots of memory and the computation ends up with OUT OF MEMORY. (e.g. rnd_aCf and rnd_bCf use 2 conditions * 500 trials * 274 channels * 274 channels * 16 bytes/complex = 1.2GBytes) Is there any way to go around this problem, such as repeating 100 trial random re-sampling for 10 times, or must I switch to Opteron? iii) As expected, this is very time-consuming process. Can I somehow use the Beowulf support feature, and if yes, how? We have Beowulf cluster available, but the number of Matlab license is limited to 8.... Thanks, Masao Matsuhashi HMCS/NINDS From t.montez at VUMC.NL Mon May 9 00:17:23 2005 From: t.montez at VUMC.NL (Teresa Montez) Date: Sun, 8 May 2005 22:17:23 -0000 Subject: megrealign, head models In-Reply-To: <0f4160725545991ee60d373838469b0e@fcdonders.ru.nl> Message-ID: Dear Robert, Thanks for your help. > For MEG data, it is preferable to spatially realign them prior to averaging, since the helmet location is different for each subject. Using: cd (['E:\Data\AD_Project\Patients\' subj{i}]) load data cfg=[]; cfg.channel = {'all','-MLT21','-MLT22' , '-MLC42', '-MLO43', '-MZO02' , '-MLT41' , '-MZP01' , '-MRT35'}; cfg.repair = 'yes' cfg.realign = 'yes' cfg.hdmfile='E:\Backup_Compaq\Matlab\DIPOLE\singleSphere.hdm'; cfg.planar = 'yes' data_planar_nobad=meginterpolate(cfg,data); I get the error message: ??? Error using ==> svd NaN or Inf prevents convergence. Error in ==> megrealign>prunedinv at 361 [u, s, v] = svd(lf); Error in ==> megrealign at 260 bkalign = lfold * prunedinv(lfnew, cfg.pruneratio) * realign; Error in ==> meginterpolate at 116 data = megrealign(cfg, data); Error in ==> script_home_database_rob at 66 data_planar_nobad=meginterpolate(cfg,data); - Should I use a local spheres head model? Best regards, Teresa From r.oostenveld at FCDONDERS.RU.NL Mon May 9 08:36:34 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 May 2005 08:36:34 +0200 Subject: importing CTF data In-Reply-To: Message-ID: Hi Thomas On 6 May 2005, at 11:16, Thomas Thesen wrote: > I have tried both CTF datasets containing > epochs and continuos data. Did you try the dataset that you sent me? Please be more specific, otherwise I cannot help you. And try whether these two commands work for you: hdr = read_fcdc_header(cfg.dataset) event = read_fcdc_event(cfg.dataset) Robert From r.oostenveld at FCDONDERS.RU.NL Mon May 9 08:56:45 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 May 2005 08:56:45 +0200 Subject: sourcestatistics In-Reply-To: <6EF659D3CB8D724BBA76CF97214D8DAC1122F111@nihexchange17.nih.gov> Message-ID: Hi Masao, On 6 May 2005, at 20:34, Matsuhashi, Masao (NIH/NINDS) wrote: > I have questions about statistical measures using random re-sampling > and > permutation. > > i) Where can I find the sourcestatistics.m? According to the tutorials > or documents, this script seems essential but I couldn't find it in > recent > distributions of FieldTrip. I thought that it was included in the 0.9.6 version, but it seems not to. I'll send it to you in a separate mail. We are about to release 1.0, which will include it. > ii) In the sourceanalysis.m, re-sampling or permutation uses lots of > memory and the computation ends up with OUT OF MEMORY. (e.g. rnd_aCf > and > rnd_bCf use 2 conditions * 500 trials * 274 channels * 274 channels * > 16 > bytes/complex = 1.2GBytes) > Is there any way to go around this problem, such as repeating 100 trial > random re-sampling for 10 times, or must I switch to Opteron? There are two memory consuming aspects: first, each randomization takes uses two cross-spectral density matrices (one for each condition). The second memory consuming aspect is the source reconstruction volumes, in your case that would consist of (500+1)*2 volumes. Each volume contains of several parameters (depending on what you are beaming: pow, noise, coh), increasing the number of volumes with a factor of 2 or 3. The size in bytes of a volume depends on the resolution that you choose, but I suggest that you also try to estimate whether that would fit into memory prior to starting the computation. Btw. 500 is quite a lot, we typically find that the probabilities don't change that much after 200-300. You can indeed run multiple randomizations separately. If you do that in separate matlab sessions (on different machines), make sure that you use the matlab seed() function to prevent the random number generator from creating the same random sequence in every matlab session. Afterwards, you have to concatenate the contents of the source.trialA and trialB fields. > iii) As expected, this is very time-consuming process. Can I somehow > use > the Beowulf support feature, and if yes, how? We have Beowulf cluster > available, but the number of Matlab license is limited to 8.... It is very timeconsuming indeed. Are you using precomputed leadfields? And a decent grid resolution (not too high)? I have been trying around with different paralellization algorithms, and also found that the number of Matlab licenses was more of a problem than the number of machines. The paralellizationis still in an experimental stage. The latest and most promising implementation of the parallellization (the "mentat" version) code can be fuond as a separate toolbox on http://oase.uci.kun.nl/~roberto/mentat/. It uses only one matlab license on the head node and creates standalone binaries for the slave nodes using the matlab compiler. If you want, you can give it a try and see whether you can get it to work on your cluster. best regards, Robert ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From r.oostenveld at FCDONDERS.RU.NL Mon May 9 09:09:33 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 May 2005 09:09:33 +0200 Subject: megrealign, head models In-Reply-To: <20050508202118.7706.qmail@smtp2.versatel.nl> Message-ID: On 9 May 2005, at 0:17, Teresa Montez wrote: > I get the error message: > > ??? Error using ==> svd > NaN or Inf prevents convergence. There seems to be a problem with your head model, the forward model has a nan or an inf. > - Should I use a local spheres head model? In general you should not use a local spheres model for realignment. I have no idea what is causing the problem. Could you send me a matlab file with an averaged ERF that you want to align and the headmodel file? Please use ftp://ftp.fcdonders.nl and put the files in the directory /pub/inccoming (the directory is one-way-traffic: you cannot see them there after copying, but I can pich them up from there). Robert From tnt at PHYSIOL.OX.AC.UK Mon May 9 12:18:41 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Mon, 9 May 2005 12:18:41 +0200 Subject: importing CTF data Message-ID: Hi Robert, < Did you try the dataset that you sent me? Please be more specific, > event = read_fcdc_event(cfg.dataset) Error in ==> read_fcdc_event at 148 mrk = readmarkerfile(filename); >> I installed FieldTrip only 2 weeks ago. So assuming we both have the same version installed the only difference might to be the matlab version. Which version are you using? Thanks a lot. Thomas From r.oostenveld at FCDONDERS.RU.NL Mon May 9 12:28:13 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 May 2005 12:28:13 +0200 Subject: importing CTF data In-Reply-To: Message-ID: Hi Thomas > Error in ==> read_fcdc_event at 148 > mrk = readmarkerfile(filename); The error which is causing the infinite loop seems to be in the private/readmarkerfile function. I did not write that function myself (Tom Holroyd gave it to me). We are not using the CTF markerfiles in Nijmegen, and it would not surprise me that there is an undetected bug in it. Could you try out the readmarkerfile function itself on the dataset? > I installed FieldTrip only 2 weeks ago. So assuming we both have the > same > version installed the only difference might to be the matlab version. > Which > version are you using? I am using Matlab 7.01 on Mac OS X and Matlab 7.01 on Linux. Are you running it on windows? Maybe there is a problem with the different way in which linux and windows are treating the text files. Robert From tnt at PHYSIOL.OX.AC.UK Mon May 9 12:50:59 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Mon, 9 May 2005 12:50:59 +0200 Subject: importing CTF data Message-ID: Dear Robert, Thank you for your suggestion. I think I found out now what the problem is. >The error which is causing the infinite loop seems to be in the >private/readmarkerfile function. In my installation (version 0.9.6) there is no private/readmarkerfile.m file. And the reason why it did not crash immediately was that I had another function (from Aston) with the same name in my path. Do you have another copy of your version of readmarkerfile.m? Thanks a lot for your help. cheers, Thomas From r.oostenveld at FCDONDERS.RU.NL Mon May 9 13:42:16 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 May 2005 13:42:16 +0200 Subject: importing CTF data In-Reply-To: Message-ID: Hi Thomas, Please find the function attached. Robert -------------- next part -------------- A non-text attachment was scrubbed... Name: readmarkerfile.m Type: application/octet-stream Size: 2114 bytes Desc: not available URL: -------------- next part -------------- On 9 May 2005, at 12:50, Thomas Thesen wrote: > Dear Robert, > > Thank you for your suggestion. I think I found out now what the > problem is. > >> The error which is causing the infinite loop seems to be in the >> private/readmarkerfile function. > > In my installation (version 0.9.6) there is no private/readmarkerfile.m > file. And the reason why it did not crash immediately was that I had > another > function (from Aston) with the same name in my path. > > Do you have another copy of your version of readmarkerfile.m? > > Thanks a lot for your help. > > cheers, > Thomas > > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From tnt at PHYSIOL.OX.AC.UK Mon May 9 14:39:42 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Mon, 9 May 2005 14:39:42 +0200 Subject: importing CTF data Message-ID: That worked! Thanks a lot for your help!! Thomas r.oostenveld at FCDONDERS.RU.NL> wrote: >Hi Thomas, > >Please find the function attached. > >Robert > > > >On 9 May 2005, at 12:50, Thomas Thesen wrote: > >> Dear Robert, >> >> Thank you for your suggestion. I think I found out now what the >> problem is. >> >>> The error which is causing the infinite loop seems to be in the >>> private/readmarkerfile function. >> >> In my installation (version 0.9.6) there is no private/readmarkerfile.m >> file. And the reason why it did not crash immediately was that I had >> another >> function (from Aston) with the same name in my path. >> >> Do you have another copy of your version of readmarkerfile.m? >> >> Thanks a lot for your help. >> >> cheers, >> Thomas >> >> >---------------------------------------------------------------------- >Robert Oostenveld, PhD >F.C. Donders Centre for Cognitive Neuroimaging >Radboud University Nijmegen >phone: +31-24-3619695 >http://www.ru.nl/fcdonders/ >---------------------------------------------------------------------- >N.B. Starting from 1 September 2004, the University of Nijmegen has >changed its name to Radboud University Nijmegen. All web- and >email-addresses ending in ".kun.nl" should therefore be changed into >".ru.nl". Please update your address book and links. > From matsuham at NINDS.NIH.GOV Tue May 10 05:22:42 2005 From: matsuham at NINDS.NIH.GOV (Matsuhashi, Masao (NIH/NINDS)) Date: Mon, 9 May 2005 23:22:42 -0400 Subject: sourcestatistics Message-ID: Dear Robert, Thank you for the response. i) Great. Freqstatistics and timelockedstatistics are included in 0.9.6 but not sourcestatistics. I am very much looking forward to the ver 1.0!! ii) I see. I thought the random re-sampling method requires very large number of samplings, but it seems not necessarily to be true, then. Thank you for the idea of concatenating the re-sampled sources. I will try. iii) Precomputed leadfield and very low resolution actually shortened the time pretty much. Thank you. The higher resolution (I want 1 cm pitch) will be necessary only in limited condition... The mentat toolbox sounds very nice. We do not have the Matlab compiler in our system but I'll ask them. Regards, Masao From tnt at PHYSIOL.OX.AC.UK Tue May 10 11:57:54 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Tue, 10 May 2005 11:57:54 +0200 Subject: importing CTF data Message-ID: Dear Robert, When trying to use definetrial.m/preprocessing.m to load in the dataset cfg = []; cfg.dataset = 'sub12_SAM_a_C1_A1.ds'; cfg.trialdef.eventtype = '?' cfg.trialdef.eventtype = 'C1_A1' cfg.trialdef.prestim = 0; % trial starts at time t=0 at the marker cfg.trialdef.poststim = 0.5; % trial ends at t=0.5 sec and adding the line: cfg.trialdef.excludeConditions = {'BAD'}; and running: cfg = definetrial(cfg); raw = preprocessing(cfg); the trials marked 'BAD' are not excluded. However, when doing the same procedure on the FieldTrip workshop data set for example, where the trials are defined through a trigger, the marked trials are removed. Do you have any suggestions on how to exclude 'BAD' trials before they are loaded? Or is my only option to remove these 'BAD' trials after they have been loaded into FieldTrip format? In that case would you advise to remove the appropriate columns (trials) by hand or rather use the artifact rejection option? Thanks a lot. Thomas From r.oostenveld at FCDONDERS.RU.NL Wed May 11 17:54:34 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 11 May 2005 17:54:34 +0200 Subject: importing CTF data In-Reply-To: Message-ID: Hi Thomas On 10 May 2005, at 11:57, Thomas Thesen wrote: > When trying to use definetrial.m/preprocessing.m to load in the dataset > > cfg = []; > cfg.dataset = 'sub12_SAM_a_C1_A1.ds'; > cfg.trialdef.eventtype = '?' > cfg.trialdef.eventtype = 'C1_A1' > cfg.trialdef.prestim = 0; % trial starts at time t=0 at the marker > cfg.trialdef.poststim = 0.5; % trial ends at t=0.5 sec > > and adding the line: > > cfg.trialdef.excludeConditions = {'BAD'}; > > and running: > cfg = definetrial(cfg); > raw = preprocessing(cfg); > > the trials marked 'BAD' are not excluded. However, when doing the same > procedure on the FieldTrip workshop data set for example, where the > trials > are defined through a trigger, the marked trials are removed. The fieldtrip tutorial that you refer to uses an old CTF-format specific trialfunction that is not in the release version. This type of "combinatorial" definition of events (include the trials with marker C1_A1 and exclude the trials with classification BAD) is not supported any more. Furthermore, the underlying code of that tutorial section only worked for a trial-based file format without markers... As you can see, it is quite difficult to combine all the different types of information (trials, triggers, classifications, markers) and especially sinc e every file format has it's own way of dealing with them. Therefore I decided not to support all of them. There is a common way of handling them all, and that is through using the read_fcdc_event function, which results in a well-defined collection of all information which you can to cut up your data into pieces of interest. Using the event structure (i.e. the output from read_fcdc_event), you can create your own trialfunction. Please read the documentaion on read_fcdc_event, try it out on your data, and then read the documentation in definetrial about the custom trialfunction. A short example of a custom trialfunction was given in the clusterstatistics tutorial. > Do you have any suggestions on how to exclude 'BAD' trials before they > are > loaded? Or is my only option to remove these 'BAD' trials after they > have > been loaded into FieldTrip format? In that case would you advise to > remove > the appropriate columns (trials) by hand or rather use the artifact > rejection option? No, you should not remove them afterwards, but you should use the custom trialfunction to prevent them from being read in the beginning. Robert From t.montez at VUMC.NL Thu May 12 15:58:53 2005 From: t.montez at VUMC.NL (Montez, T.) Date: Thu, 12 May 2005 15:58:53 +0200 Subject: megrealign, head models Message-ID: Dear Robert, I can not access the ftp://ftp.fcdonders.nl. I can access ftp://eegmeg2005 at m50-336.azn.nl/ but I do not have permission to copy things there. Can you please tell me another place to put the files? (The average file is just around 6 MB.) I also tried to define the head model manually by: cfg.vol.r = 7.5 cfg.vol.o = [0, 0, 5] and it still does not work, so it seems to not be related to the headmodel file. Meanwhile I got errors with the grandaverages functions (applied to the non aligned files): ??? Index exceeds matrix dimensions. Error in ==> timelockgrandaverage at 85 varargin{i}.avg = varargin{i}.avg(chansel,:); (It works for a reduced number of subjects.) And I run out of memory when I have to load 18 subject, so maybe I have to do the grand average in steps for a higher number of subjects? Thanks for your help, Teresa -----Original Message----- From: Robert Oostenveld [mailto:r.oostenveld at FCDONDERS.RU.NL] Sent: Monday, May 09, 2005 9:10 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] megrealign, head models On 9 May 2005, at 0:17, Teresa Montez wrote: > I get the error message: > > ??? Error using ==> svd > NaN or Inf prevents convergence. There seems to be a problem with your head model, the forward model has a nan or an inf. > - Should I use a local spheres head model? In general you should not use a local spheres model for realignment. I have no idea what is causing the problem. Could you send me a matlab file with an averaged ERF that you want to align and the headmodel file? Please use ftp://ftp.fcdonders.nl and put the files in the directory /pub/inccoming (the directory is one-way-traffic: you cannot see them there after copying, but I can pich them up from there). Robert From darja.osipova at CBRU.HELSINKI.FI Mon May 16 15:46:38 2005 From: darja.osipova at CBRU.HELSINKI.FI (Daria Osipova) Date: Mon, 16 May 2005 16:46:38 +0300 Subject: detrend/partial artefact rejection In-Reply-To: <2955bdedbc3931e9ef4c994bbcf55ddb@fcdonders.ru.nl> Message-ID: Hi, We have a question on detrend in preprocessing.m in relation to partial artifact rejection. As we understand detrend is first applied and then the partical rejection is performed. This results in some subtrials in which for instance a DC offset is present. Would it not be more optimal to perform another detrend prior to the calculation of the wavelet/fourier transforms to avoid boundary effects? Dasha and Ole From Jan.Schoffelen at FCDONDERS.RU.NL Tue May 17 09:38:06 2005 From: Jan.Schoffelen at FCDONDERS.RU.NL (J.M. Schoffelen) Date: Tue, 17 May 2005 09:38:06 +0200 Subject: detrend/partial artefact rejection In-Reply-To: <1116251198.4288a43e5f8db@www.cbru.helsinki.fi> Message-ID: Dear Dasha and Ole, Thanks a lot for this question. Indeed it is very true that in theory detrending prior to the partial rejection of artifacts could lead to little subtrials having a DC-offset. It is also very true that a detrend-operation after the identification of artifacts is helpful to get rid of these potential confounds for your further frequency analysis. This is exactly what is done in preprocessing! The artifact-rejection routines that are provided by fieldtrip, read in the data and does a lot of fancy stuff with it, one of the things is detrending. However, once the data has been read in in one of these routines and the artifacts are detected, the data itself is discarded again. The real reading in of the data takes place after the artifact-detection, and the cfg.detrend = 'yes' option takes proper care that all the separate subtrials will be detrended. At least, that is what it should do... Yours, Jan-M -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Daria Osipova Sent: Monday, May 16, 2005 3:47 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] detrend/partial artefact rejection Hi, We have a question on detrend in preprocessing.m in relation to partial artifact rejection. As we understand detrend is first applied and then the partical rejection is performed. This results in some subtrials in which for instance a DC offset is present. Would it not be more optimal to perform another detrend prior to the calculation of the wavelet/fourier transforms to avoid boundary effects? Dasha and Ole From r.oostenveld at FCDONDERS.RU.NL Tue May 17 14:21:57 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Tue, 17 May 2005 14:21:57 +0200 Subject: megrealign, head models In-Reply-To: <05May12.160201cest.334247@nucleus.azvu.nl> Message-ID: On 12 May 2005, at 15:58, Montez, T. wrote: > Dear Robert, > > I can not access the ftp://ftp.fcdonders.nl. > I can access ftp://eegmeg2005 at m50-336.azn.nl/ but I do not have > permission > to copy things there. No, please read my original mail below. Log in as anonymous and put the stuff in /pub/incoming. You should not use the eegmeg2005 account, that is only for the write protected course pfd material. > ??? Index exceeds matrix dimensions. > > Error in ==> timelockgrandaverage at 85 > varargin{i}.avg = varargin{i}.avg(chansel,:); > > (It works for a reduced number of subjects.) Do some subjects have fewer channels than other subjects? If so, please download the latest fieldtrip release from teh ftp server. > And I run out of memory when I have to load 18 subject, so maybe I > have to > do the grand average in steps for a higher number of subjects? In timelockanalysis you should do keeptrials=no prior to timelockgrandaverage. best, Robert > -----Original Message----- > From: Robert Oostenveld [mailto:r.oostenveld at FCDONDERS.RU.NL] > Sent: Monday, May 09, 2005 9:10 AM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: Re: [FIELDTRIP] megrealign, head models > > > On 9 May 2005, at 0:17, Teresa Montez wrote: > >> I get the error message: >> >> ??? Error using ==> svd >> NaN or Inf prevents convergence. > > There seems to be a problem with your head model, the forward model has > a nan or an inf. > >> - Should I use a local spheres head model? > > In general you should not use a local spheres model for realignment. > > I have no idea what is causing the problem. Could you send me a matlab > file with an averaged ERF that you want to align and the headmodel > file? Please > use ftp://ftp.fcdonders.nl and put the files in the directory > /pub/inccoming (the directory is one-way-traffic: you cannot see them > there after copying, but I can pich them up from there). > > Robert > > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From r.oostenveld at FCDONDERS.RU.NL Wed May 18 10:14:24 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 18 May 2005 10:14:24 +0200 Subject: detrend/partial artefact rejection In-Reply-To: <1116251198.4288a43e5f8db@www.cbru.helsinki.fi> Message-ID: Hi Dasha and Ole You might also want to take a look at the documentation. On http://www2.ru.nl/fcdonders/fieldtrip/, click on "ERP/ERF analysis" or "Frequency analysis", and you will recognise the individual steps that are taken. REJECTARTIFACT doew not work on the preprocessed data (although it looks at the data from the file and applies its own filters, baselinecorrection, etc.), but it only detects the pieces of data which should not be read into Matlab memory and preprocessed by the PREPROCESSING function. Robert On 16 May 2005, at 15:46, Daria Osipova wrote: > Hi, > > We have a question on detrend in preprocessing.m in relation to > partial artifact > rejection. As we understand detrend is first applied and then the > partical > rejection is performed. This results in some subtrials in which for > instance a > DC offset is present. Would it not be more optimal to perform another > detrend > prior to the calculation of the wavelet/fourier transforms to avoid > boundary > effects? > > Dasha and Ole > > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From laura at GBT.TFO.UPM.ES Wed May 18 14:09:54 2005 From: laura at GBT.TFO.UPM.ES (Laura Espino) Date: Wed, 18 May 2005 14:09:54 +0200 Subject: BTI MEG In-Reply-To: <1afbdbf7c342f63b8bf586adccaedb95@fcdonders.ru.nl> Message-ID: Hello, I am working with data obtained from a BTI MEG, 148 channels I want to make some time-frequency analysis. Is it possible to make it through fieldtrip? thanks Laura From stephan.moratti at UNI-KONSTANZ.DE Wed May 18 15:24:06 2005 From: stephan.moratti at UNI-KONSTANZ.DE (Stephan Moratti) Date: Wed, 18 May 2005 15:24:06 +0200 Subject: BTI MEG In-Reply-To: <5.2.0.9.0.20050518140732.00be33e8@pop3.gbt.tfo.upm.es> Message-ID: Hi Laura At 14:09 18.05.2005 +0200, you wrote: >Hello, >I am working with data obtained from a BTI MEG, 148 channels I want to make >some time-frequency analysis. Is it possible to make it through fieldtrip? > >thanks >Laura > I am just working on it and try to get BTI MEG 148 channel data in the field trip data structure. As soon as it works I will let you know. Stephan ----------------------------- Dipl. Psych. Stephan Moratti Dept. of Psychology University of Konstanz P.O Box D25 Phone: +40 (0)7531 882385 Fax: +49 (0)7531 884601 D-78457 Konstanz, Germany e-mail: Stephan.Moratti at uni-konstanz.de http://www.clinical-psychology.uni-konstanz.de/ From D.Talsma at PSY.VU.NL Wed May 18 15:49:08 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Wed, 18 May 2005 15:49:08 +0200 Subject: No subject Message-ID: Hi Everybody, I'm trying to read a ctf, which was collected at the VUMC MEG center in Amsterdam, using fieldtrip. I've tried tried reading the data with as well as without Darren Weber's ctf code. Anyways, I'm following the fieldtrip example code pretty closely (see below) and both attempts have resulted in the error messages attached below stating that a function or variable named coil2_pos is missing. Any help would be appreciated. Cheers, Durk p.s., Since this is my first post to this list, I would like to thank everybody involved in making this stuff work. [matlab script] cfg = []; cfg.dataset = 'PP01_20040716_Eriksen.ds'; cfg.channel = {'MEG' 'STIM'}; cfg.trialdef.excludeConditions = {'BAD'}; cfg.trialdef.includeTrigger = []; cfg.trialdef.excludeTrigger = []; cfg.trialdef.prestim = 0.1; cfg.traildef.poststim = 0.1; dataFIC = preprocessing(cfg); [error messages] Warning: Divide by zero. > In C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p>read_ctf_r es4 at 194 In fieldtrip\private\read_ctf_trigger at 56 In read_fcdc_event at 99 In definetrial at 196 In preprocessing at 239 In tfanalysis at 10 Warning: not adding event information to the output configuration structure > In definetrial at 205 In preprocessing at 239 In tfanalysis at 10 >> >> >> >> >> >> >> >> >> >> Warning: Divide by zero. > In C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p>read_ctf_r es4 at 194 In fieldtrip\private\read_ctf_trigger at 56 In definetrial at 403 In preprocessing at 239 In tfanalysis at 10 ??? Undefined function or variable "coil2_pos". Error in ==> C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p>read_ctf_r es4 at 226 Error in ==> fieldtrip\private\read_ctf_trigger at 56 hdr = read_ctf_res4(headerfile); Error in ==> definetrial at 403 triggerChan = read_ctf_trigger(cfg.dataset); Error in ==> preprocessing at 239 [cfg] = definetrial(cfg); Error in ==> tfanalysis at 10 dataFIC = preprocessing(cfg); From r.oostenveld at FCDONDERS.RU.NL Wed May 18 18:39:32 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 18 May 2005 18:39:32 +0200 Subject: No subject In-Reply-To: Message-ID: Hi Durk, The VUMC MEG system is known to generate a CTF file format that is slightly different from the format that we have in Nijmegen. However, I have succesfully read in data from Amsterdam using Darren's functions, so that should work, except that the sensor position information that originates from Darrens function is not trasferred into Fieldtrip. It would not be difficult to implement that as well, but it is only needed if you want to do source analysis (or MEG realignment). But I also I notice that your Matlab error log refers to some closed-source p-files which are open source by now. Please download the latest version of fieldtrip, maybe that already solves part of your problem. See ftp://m50-336.azn.nl/pub/fieldtrip and fetch version 0.9.6 or the latest daily release. Robert On 18 May 2005, at 15:49, Talsma D wrote: > Hi Everybody, > > I'm trying to read a ctf, which was collected at the VUMC MEG center in > Amsterdam, using fieldtrip. I've tried tried reading the data with as > well as without Darren Weber's ctf code. Anyways, I'm following the > fieldtrip example code pretty closely (see below) and both attempts > have > resulted in the error messages attached below stating that a function > or > variable named coil2_pos is missing. ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From D.Talsma at PSY.VU.NL Thu May 19 13:01:01 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Thu, 19 May 2005 13:01:01 +0200 Subject: No subject Message-ID: Hi Robert, Thanks for your reply. I guess your suggestion of upgrading fieldtrip helped a lot. Using pretty much the same preprocessing script as I used yesterday, it looks like I'm getting through CTF_READ_RES4 twice, but then the script bombs with a message that the function private\read_ctf_res4.p is inaccessible. Could this be something in my setup? I've tried version 0.9.6 as well as the latest snapshot, both giving the same results. Cheers, Durk CTF_READ_RES4 [v 1.15] ...done ( 0.85 sec) CTF_READ_RES4 [v 1.15] ...done ( 0.72 sec) ??? Previously accessible file "C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p" is now inaccessible. Error in ==> fieldtrip\private\read_ctf_trigger at 56 hdr = read_ctf_res4(headerfile); Error in ==> definetrial at 411 triggerChan = read_ctf_trigger(cfg.dataset); Error in ==> preprocessing at 250 [cfg] = definetrial(cfg); Error in ==> tfanalysis at 12 dataFIC = preprocessing(cfg); -----Oorspronkelijk bericht----- Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens Robert Oostenveld Verzonden: woensdag 18 mei 2005 18:40 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: Re: [FIELDTRIP] Hi Durk, The VUMC MEG system is known to generate a CTF file format that is slightly different from the format that we have in Nijmegen. However, I have succesfully read in data from Amsterdam using Darren's functions, so that should work, except that the sensor position information that originates from Darrens function is not trasferred into Fieldtrip. It would not be difficult to implement that as well, but it is only needed if you want to do source analysis (or MEG realignment). But I also I notice that your Matlab error log refers to some closed-source p-files which are open source by now. Please download the latest version of fieldtrip, maybe that already solves part of your problem. See ftp://m50-336.azn.nl/pub/fieldtrip and fetch version 0.9.6 or the latest daily release. Robert On 18 May 2005, at 15:49, Talsma D wrote: > Hi Everybody, > > I'm trying to read a ctf, which was collected at the VUMC MEG center > in Amsterdam, using fieldtrip. I've tried tried reading the data with > as well as without Darren Weber's ctf code. Anyways, I'm following the > fieldtrip example code pretty closely (see below) and both attempts > have resulted in the error messages attached below stating that a > function or > variable named coil2_pos is missing. ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From r.oostenveld at FCDONDERS.RU.NL Thu May 19 19:17:16 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 19 May 2005 19:17:16 +0200 Subject: megrealign, head models In-Reply-To: <001501c55c70$b32b5060$0d00000a@vulcan> Message-ID: Hi Teresa Realignment of MEG data means that you interpolate the data from the helmet location at which it was measured to a template location of the helmet. You have not specified the template location: cfg.template should contain one or multiple CTF datasets. The average helmet location will be computed from those datasets, and that will be used as the template on which the interpolated value is computed. Typically, the average of all subjects in your study is used as the template (i.e. all subjects are aligned to the mean of all subjects). Realigning to an empty template gave this error. I will add an extra check with an easier to understand error message to make this error in teh configuration more clear. Robert Robert >> For MEG data, it is preferable to spatially realign them prior to >> averaging, since the helmet location is different for each subject. > > Using: > > cd (['E:\Data\AD_Project\Patients\' subj{i}]) > load data > cfg=[]; > cfg.channel = {'all','-MLT21','-MLT22' , '-MLC42', '-MLO43', '-MZO02' , > '-MLT41' , '-MZP01' , '-MRT35'}; > cfg.repair = 'yes' > cfg.realign = 'yes' > cfg.hdmfile='E:\Backup_Compaq\Matlab\DIPOLE\singleSphere.hdm'; > cfg.planar = 'yes' > data_planar_nobad=meginterpolate(cfg,data); > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From matsuham at NINDS.NIH.GOV Thu May 19 20:14:35 2005 From: matsuham at NINDS.NIH.GOV (Matsuhashi, Masao (NIH/NINDS)) Date: Thu, 19 May 2005 14:14:35 -0400 Subject: Source coherence Message-ID: Hi Robert, I am posting this message to the mailing list, with the original message added to the bottom. Thank you for your response. 1. Actually, the two frequencies are very close to each other. One is 5 Hz and the other is 4.6 (60/13) Hz. Sampling is 600/sec. I used 6000 trial length so the frequency resolution should be 0.1 Hz, but I am not sure because MTM decreases the frequency resolution in terms of W. The two reference signals are not independent, as they share the common carrier frequency of 60Hz, but when we calculated the coherence sensor-wise, they were separated relatively nicely. 2. I pushed the data to your ftp site. I hope it's working ok. The filename is DICS_Matsuhashi_20050519.zip, containing 4 files. Freq_01_050 and Source_01_050 are from condition 1, foi=5.0 Hz. Freq_01_046 and Source_01_046 are from condition 2, foi=4.6 Hz. Regards, Masao ------------------------------------------------ Masao Matsuhashi, MD, PhD NINDS, NIH Tel: 1-301-594-9139 E-mail: MatsuhaM at ninds.nih.gov ------------------------------------------------ > -----Original Message----- > From: Robert Oostenveld [mailto:r.oostenveld at fcdonders.ru.nl] > Sent: Thursday, May 19, 2005 7:08 AM > To: Matsuhashi, Masao (NIH/NINDS) > Subject: Re: [FIELDTRIP] sourcestatistics > > Hi Masao > > > signal. There are two reference signals simultaneously throughout the > > recording, say, REF1 and REF2, with slightly different center > > frequency, f1 > > and f2. I want to compare the coherence of cortical activity to > > reference > > Just a question of general relevance. How well are the two frequencies > separated, i.e. how far are they apart and what is your frequency > resolution? > > > Is it quite common to see this kind of discrepancy in the result of > > sensor > > level coherence and source level coherence? > > No, I would not expect a very large difference between them. If the > frequencies are far apart, the csd matrix for either f1 or f2 might > contain more noise, affecting the filter (and hence the localization) > more in one frequency than the other. But as I read your mail, I see no > reason to assume that that is the case. > > > If you want to see the data, I will send them to you (frequency data > > were > > about 75M each, source 9M each). > > That would be nice, so that I can see it with my own eyes. Could you > send both to ftp://m50-336.azn.nl/pub/incoming (login as anonymous) and > send me a mail when they are there? The "incoming" directory is a > drop-box, you cannot see what is in there (so you cannot read, but you > can write) which might be a little confusing. > > > PS. If you think it is more appropriate to discuss this in the Mailing > > List, > > I can post this message to the list myself. I didn't do it, because the > > update for DICS may not be available for public access. > > I think that it is interesting to have this discussion on the mailing > list. Then also Jan-Mathijs and Pascal can think along. > > Robert ======================================================================= > -----Original Message----- > From: Matsuhashi, Masao (NIH/NINDS) > Sent: Wednesday, May 18, 2005 3:59 PM > To: 'Robert Oostenveld' > Subject: RE: [FIELDTRIP] sourcestatistics > > Hello Robert, > > I am now using your new DICS code with FieldTrip 0.9.6, and found a > strange phenomenon. I've not yet checked into detail, but would like to > have your idea. > > As you know, I am trying to calculate source coherence to external > reference signal. There are two reference signals simultaneously > throughout the recording, say, REF1 and REF2, with slightly different > center frequency, f1 and f2. I want to compare the coherence of cortical > activity to reference signal REF1 at frequency f1 (condition 1) and the > coherence of cortical activity to REF2 at f2 (condition 2). > The result of freqanalysis showed that coherence at sensor level (such as > MRT31 x REF1) was much larger in condition 1 (up to 0.3) than in condition > 2 (up to 0.05). However, when I calculate the source coherence from the > above result using sourceanalysis, contrary to the above result, condition > 2 showed larger source coherence. Actually, the maximum coherence was > almost the same in both condition (about 0.02), but their distribution > were quite different. The median value of the coherence in condition1 was > 0.001, while in condition 2 it was 0.003. > > Is it quite common to see this kind of discrepancy in the result of sensor > level coherence and source level coherence? > > If you want to see the data, I will send them to you (frequency data were > about 75M each, source 9M each). > > Thanks, > Masao > > > PS. If you think it is more appropriate to discuss this in the Mailing > List, I can post this message to the list myself. I didn't do it, because > the update for DICS may not be available for public access. > From r.oostenveld at FCDONDERS.RU.NL Thu May 19 20:46:24 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 19 May 2005 20:46:24 +0200 Subject: No subject In-Reply-To: Message-ID: Hi Durk, On 19 May 2005, at 13:01, Talsma D wrote: > ??? Previously accessible file > "C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p" is now > inaccessible. > > Error in ==> fieldtrip\private\read_ctf_trigger at 56 > hdr = read_ctf_res4(headerfile); I guess that you did not restart Matlab in between, since in that case Matlab would not have known anything about that p-file. Matlab remembers the location and filename of functions in its cache, and it seems that it got confused by the file disappearing. A "rehash path" command sometimes helps. Or just a restart of Matlab. Robert From D.Talsma at PSY.VU.NL Fri May 20 11:25:12 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Fri, 20 May 2005 11:25:12 +0200 Subject: No subject Message-ID: Hi Robert, Well, I tried a again this morning: Fresh login and restart of matlab, but still no luck. Are there any specific path definition requirements that I should be aware of? I am running this off a 24/7 NT multi-user server. Could that be related to the problem? Again, thanks for your reply. Durk -----Oorspronkelijk bericht----- Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens Robert Oostenveld Verzonden: donderdag 19 mei 2005 20:46 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: Re: [FIELDTRIP] Hi Durk, On 19 May 2005, at 13:01, Talsma D wrote: > ??? Previously accessible file > "C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p" is now > inaccessible. > > Error in ==> fieldtrip\private\read_ctf_trigger at 56 > hdr = read_ctf_res4(headerfile); I guess that you did not restart Matlab in between, since in that case Matlab would not have known anything about that p-file. Matlab remembers the location and filename of functions in its cache, and it seems that it got confused by the file disappearing. A "rehash path" command sometimes helps. Or just a restart of Matlab. Robert From r.oostenveld at FCDONDERS.RU.NL Fri May 20 15:18:00 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 20 May 2005 15:18:00 +0200 Subject: No subject In-Reply-To: Message-ID: Hi Durk, > Well, I tried a again this morning: Fresh login and restart of matlab, > but still no luck. Are there any specific path definition requirements > that I should be aware of? I am running this off a 24/7 NT multi-user > server. Could that be related to the problem? But in your mail you mentioned that the problem was with the p-file, which is not included in the latest FT distrubution any more. If you installed that distribution, and completely removed the previous version, how can the p-file problem then still exist? Could you do a search from within explorer on the file "read_ctf_res4.p"? What is a "24/7 NT multi-user server"? A computer running windows NT on which you are logged in remotely? Which version of NT is running on it, and which Matlab version are you using? Robert > > Again, thanks for your reply. > > Durk > > -----Oorspronkelijk bericht----- > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > Robert Oostenveld > Verzonden: donderdag 19 mei 2005 20:46 > Aan: FIELDTRIP at NIC.SURFNET.NL > Onderwerp: Re: [FIELDTRIP] > > > Hi Durk, > > > On 19 May 2005, at 13:01, Talsma D wrote: > >> ??? Previously accessible file >> "C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p" is now > >> inaccessible. >> >> Error in ==> fieldtrip\private\read_ctf_trigger at 56 >> hdr = read_ctf_res4(headerfile); > > I guess that you did not restart Matlab in between, since in that case > Matlab would not have known anything about that p-file. Matlab > remembers the location and filename of functions in its cache, and it > seems that it got confused by the file disappearing. A "rehash path" > command sometimes helps. Or just a restart of Matlab. > > Robert > > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From D.Talsma at PSY.VU.NL Mon May 23 09:15:20 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Mon, 23 May 2005 09:15:20 +0200 Subject: Path problem fixed Message-ID: Hi Robert, I found the solution to the Matlab path problem. What I needed to do after upgrading the fieltrip version was the following: 1) Remove the Fieldtrip directory from the matlab search path, restart matlab, 2) add the fieldtrip path again. 3) Restart matlab. 4) Et Voila. It works. We've installed fieldtrip in a directory called Fieldtrip, under c:\Matlab704\toolbox\shared and I upgraded fieldtrip by just deleting the old files and and copying the new ones into the old directory. Apparently, I needed to remove and add the path to trigger a rehash of the file cache. This is indeed from a remote server. I'm running it off MS Windows Server 2003, standard edition, using matlab 7.0.4. Right now, I'm back at the "unknown variable" error message again (see below):. At least the error is coming from a human-readable .m file now, so I'll see if I can track down what is happening here. Cheers, Durk ??? Undefined function or variable "coil2_pos". Error in ==> FieldTrip\private\read_ctf_res4 at 233 tmp = coil2_pos - coil1_pos; -----Oorspronkelijk bericht----- Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens Robert Oostenveld Verzonden: vrijdag 20 mei 2005 15:18 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: Re: [FIELDTRIP] Hi Durk, > Well, I tried a again this morning: Fresh login and restart of matlab, > but still no luck. Are there any specific path definition requirements > that I should be aware of? I am running this off a 24/7 NT multi-user > server. Could that be related to the problem? But in your mail you mentioned that the problem was with the p-file, which is not included in the latest FT distrubution any more. If you installed that distribution, and completely removed the previous version, how can the p-file problem then still exist? Could you do a search from within explorer on the file "read_ctf_res4.p"? What is a "24/7 NT multi-user server"? A computer running windows NT on which you are logged in remotely? Which version of NT is running on it, and which Matlab version are you using? Robert From D.Talsma at PSY.VU.NL Mon May 23 10:00:16 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Mon, 23 May 2005 10:00:16 +0200 Subject: Path problem fixed Message-ID: Replying to my own message :-) I think I have a tracked down the cause of the coil2_pos error: It appears the code doesn't iterate through the MEG sensor list, because it does not find any channel names starting with 'M', return 0 valid MEG sensors. In our setup, it appears, there are some leading NULL characters preceding each MEG sensor name. Because of this, the code in read_ctf_res4, around line 119 chops off the channel name altogether. I'm working on a fix. Cheers, Durk -----Oorspronkelijk bericht----- Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens Talsma D Verzonden: maandag 23 mei 2005 9:15 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: [FIELDTRIP] Path problem fixed Hi Robert, I found the solution to the Matlab path problem. What I needed to do after upgrading the fieltrip version was the following: 1) Remove the Fieldtrip directory from the matlab search path, restart matlab, 2) add the fieldtrip path again. 3) Restart matlab. 4) Et Voila. It works. We've installed fieldtrip in a directory called Fieldtrip, under c:\Matlab704\toolbox\shared and I upgraded fieldtrip by just deleting the old files and and copying the new ones into the old directory. Apparently, I needed to remove and add the path to trigger a rehash of the file cache. This is indeed from a remote server. I'm running it off MS Windows Server 2003, standard edition, using matlab 7.0.4. Right now, I'm back at the "unknown variable" error message again (see below):. At least the error is coming from a human-readable .m file now, so I'll see if I can track down what is happening here. Cheers, Durk ??? Undefined function or variable "coil2_pos". Error in ==> FieldTrip\private\read_ctf_res4 at 233 tmp = coil2_pos - coil1_pos; -----Oorspronkelijk bericht----- Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens Robert Oostenveld Verzonden: vrijdag 20 mei 2005 15:18 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: Re: [FIELDTRIP] Hi Durk, > Well, I tried a again this morning: Fresh login and restart of matlab, > but still no luck. Are there any specific path definition requirements > that I should be aware of? I am running this off a 24/7 NT multi-user > server. Could that be related to the problem? But in your mail you mentioned that the problem was with the p-file, which is not included in the latest FT distrubution any more. If you installed that distribution, and completely removed the previous version, how can the p-file problem then still exist? Could you do a search from within explorer on the file "read_ctf_res4.p"? What is a "24/7 NT multi-user server"? A computer running windows NT on which you are logged in remotely? Which version of NT is running on it, and which Matlab version are you using? Robert From D.Talsma at PSY.VU.NL Mon May 23 12:41:37 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Mon, 23 May 2005 12:41:37 +0200 Subject: CTF res4 File format Message-ID: Hi Everybody, Looking through the matlab code, I traced the coil-error back to a res4 file read error somewhat earlier: On line 100, of read_ctf_res4.m, the file pointer is set to position 1839, and only a single byte of data is read from this position. As far as I know, this read should start immediately after the preceding one, and the field is defined as an 32-byte integer. So changig the code to the snippet below fixed the problem. IFAICT, the old code would work, as long as you had run descriptor fields that were shorter than 256 characters. In our case we had a descriptor length of 572 chars. % 2005-05-23: The following statement needed to be commented out % In order to make this file work with the VUMC data (Durk) %fseek(fid,1839,'bof'); % Read in the run description length rd_len=fread(fid,1,'uint32'); % Go to the run description and read it in fseek(fid,1844,'bof'); run_desc=setstr(fread(fid,rd_len,'char')'); Next, changing the above byte read also eliminates the additional requirement of reading one extra short int before reading the filter parameters. In addition, as far as I can tell, reading in the filter definition as 18 8-byte integers is not correct either: Each filter definition should consist of the following fields: frequency (double) class (int) type (int) num_params (short int) Therefore, the real value of num_fparams is stored in the last two byte (17, and 18). Again, the original code would work, as long as you have 255 or less parameters. % read in the filter information % Filter read code modified dd; 2005-05-23 Durk) num_filt=fread(fid,1,'uint16'); %num_filt=temp(1); for fi=0:(num_filt-1), %filt_info=fread(fid,18,'uint8'); filt_freq =fread(fid,1, 'double'); filt_class=fread(fid,1, 'uint32'); filt_type =fread(fid,1, 'uint32'); num_fparm=fread(fid, 1, 'uint16'); %num_fparm=filt_info(18); if num_fparm ~= 0, filt_parm=fread(fid,8*num_fparm,'uint8'); end % if end % for fi Any comments? Cheers Durk From r.oostenveld at FCDONDERS.RU.NL Mon May 23 13:18:18 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 23 May 2005 13:18:18 +0200 Subject: CTF res4 File format In-Reply-To: Message-ID: Hi Durk, On 23 May 2005, at 12:41, Talsma D wrote: > Looking through the matlab code, I traced the coil-error back to a res4 > file read error somewhat earlier: > > On line 100, of read_ctf_res4.m, the file pointer is set to position > 1839, and only a single byte of data is read from this position. As far ... > Any comments? The read_ctf_res4 is legacy code and already has passed through the hands of multiple people. Personally I don't know all the details of the file format. Your suggestions make sense from a technical point of view, and also work fine for our own data. Therefore I will incorporate your suggestions in the code. Thanks for the contribution. Robert PS this evening the change will be in the daily release version, which you can get from the ftp server. From tnt at PHYSIOL.OX.AC.UK Mon May 23 14:58:12 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Mon, 23 May 2005 14:58:12 +0200 Subject: tokenize.m Message-ID: Hi, I attempted to run clusterrandanalysis.m, but it seems that the most current version of FieldTrip (Fieldtrip-20050522) is missing the file tokenize.m which is called by prepare_time_frequ_data.m. Thanks a lot. Thomas --------------------------------------------------- Thomas Thesen University Laboratory of Physiology & Centre for Functional MRI of the Brain University of Oxford Oxford, OX1 3PT United Kingdom Phone: +44(0)1865-272 434 Mobile: +44(0)781-355 6528 Fax: +44(0)1865-272 469 e-mail: thomas.thesen at physiol.oxford.ac.uk http://www.fmrib.ox.ac.uk/~tnt/ --------------------------------------------------- From G.vanElswijk at NEURO.UMCN.NL Mon May 23 15:01:28 2005 From: G.vanElswijk at NEURO.UMCN.NL (Gijs van Elswijk) Date: Mon, 23 May 2005 15:01:28 +0200 Subject: tokenize.m Message-ID: I had the same problem with FREQSTATISTICS in FieldTrip 0.9.6. Copying TOKENIZE.M from the private directory of FieldTrip 0.9.5 solved the problem in my case. Gijs > -----Original Message----- > From: FieldTrip discussion list > [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Thomas Thesen > Sent: maandag 23 mei 2005 14:58 > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] tokenize.m > > Hi, > > I attempted to run clusterrandanalysis.m, but it seems that > the most current version of FieldTrip (Fieldtrip-20050522) is > missing the file tokenize.m which is called by > prepare_time_frequ_data.m. > > Thanks a lot. > > Thomas > > > --------------------------------------------------- > Thomas Thesen > University Laboratory of Physiology > & Centre for Functional MRI of the Brain University of Oxford > Oxford, OX1 3PT United Kingdom > > Phone: +44(0)1865-272 434 > Mobile: +44(0)781-355 6528 > Fax: +44(0)1865-272 469 > e-mail: thomas.thesen at physiol.oxford.ac.uk > http://www.fmrib.ox.ac.uk/~tnt/ > > --------------------------------------------------- > > From r.oostenveld at FCDONDERS.RU.NL Mon May 23 15:45:37 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 23 May 2005 15:45:37 +0200 Subject: tokenize.m In-Reply-To: <4CD85D348E46984983185B911CBF3ED11B6F66@umcnet13.umcn.nl> Message-ID: Hi Thomas and Gijs, It seems that I forgot to put that function into the daily release version. Gijs' workaround will help you out for the moment, and I will make sure that it will be included in the upcoming release versions. Robert On 23 May 2005, at 15:01, Gijs van Elswijk wrote: > I had the same problem with FREQSTATISTICS in FieldTrip 0.9.6. Copying > TOKENIZE.M from the private directory of FieldTrip 0.9.5 solved the > problem in my case. > > Gijs > >> -----Original Message----- >> From: FieldTrip discussion list >> [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Thomas Thesen >> Sent: maandag 23 mei 2005 14:58 >> To: FIELDTRIP at NIC.SURFNET.NL >> Subject: [FIELDTRIP] tokenize.m >> >> Hi, >> >> I attempted to run clusterrandanalysis.m, but it seems that >> the most current version of FieldTrip (Fieldtrip-20050522) is >> missing the file tokenize.m which is called by >> prepare_time_frequ_data.m. >> >> Thanks a lot. >> >> Thomas From r.oostenveld at FCDONDERS.RU.NL Mon May 23 17:03:20 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 23 May 2005 17:03:20 +0200 Subject: Source coherence In-Reply-To: <6B5952376E0A164C81F2F18BF77B3FAB2128B3@NIHCESMLBX.nih.gov> Message-ID: Hi Masao, I had a look at your data, and at the computations that you perfomed for the analysis. Your frequencies of interest are 4.6 and 5Hz, and your time windows are 10 seconds long (right?). That means that you have an intrinsic frequency resolution of 0.1 Hz, which is enough to separate the two frequencies. But looking at your configuration, you seem to be using multitapering with a frequency smoothing of 0.5 Hz. That means that you are using ~5 tapers and that the two frequencies of interest will be smeared into each other. If you want to use multitapering, you should decrease the cfg.tapsmofrq to less than 0.4 (e.g. 0.2). But I doubt whether you should use frequency smoothing here at all, since the frequencies are so low and only separated by a small amount. Better not use multitapering: in freqanalysis do cfg.taper='hanning' instead of the default 'dpss'. Furthermore, I suggest that you also look at the coherence between all MEG channels and the REF21 for the 46Hz and the REF11 for the 50Hz (i.e. the reference channel with which there probably should not be any coherence). You did not include those in your crsspctrm channel combinations. I started by looking at power. There seems to be quite some temporal and low-occipital (neck?) power in both conditions, which might be indicative of artifacts (although EMG typically peaks at much higher frequencies). That is something that you might want to check. -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic5.tiff Type: image/tiff Size: 17310 bytes Desc: not available URL: -------------- next part -------------- The topography of channel level coherence with REF22 looks nicely dipolar for the 46Hz, but with REF21 it does not look so clear for the 50Hz. AT 50Hz, there seems to be a bilateral blob that also extends into the right hemisphere. -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic1.tiff Type: image/tiff Size: 26772 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic2.tiff Type: image/tiff Size: 25120 bytes Desc: not available URL: -------------- next part -------------- I have recomputed the dics source reconstructions (just to be sure that they are done with the latest version). If I look at the 4.6 Hz, it looks nice. If I look at the 5 Hz, there is a relatively high and very sharp blob in the occipital midline, very close to the surface of the scanned volume. Given it's spatial sharpness, I don't trust it too much. But given the bilateral distribution of the coherence with REF21 in that condition, it also does not surprise me that a source at that location could be relatively highly coherent. -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic3.tiff Type: image/tiff Size: 44228 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic4.tiff Type: image/tiff Size: 42180 bytes Desc: not available URL: -------------- next part -------------- So, to me the outcome of the analysis looks more or less like I would expect from this data. I hope that you can further improve your analysis with the hints that I have given. best regards, Robert P.S. I executed the following lines of matlab code: load Freq_01_046 load Freq_01_050 load Source_01_046 load Source_01_050 frqdes46 = freqdescriptives([], freqDICS01_046); frqdes50 = freqdescriptives([], freqDICS01_050); cfg = []; cfg.xparam = 'foi'; cfg.zparam = 'powspctrm'; figure; topoplotER(cfg, frqdes46); figure; topoplotER(cfg, frqdes50); cfg.zparam = 'cohspctrm'; cfg.cohrefchannel = 'REF22' figure; topoplotER(cfg, frqdes46); cfg.cohrefchannel = 'REF21' figure; topoplotER(cfg, frqdes50); cfg = []; cfg = source01_046.cfg; cfg = rmfield(cfg, 'hdmfile'); cfg.vol = source01_046.vol; cfg.method = 'dics'; cfg.refchan = 'REF22'; source46 = sourceanalysis(cfg, freqDICS01_046); cfg.refchan = 'REF21'; source50 = sourceanalysis(cfg, freqDICS01_050); cfg = []; cfg.funparameter = 'avg.coh'; figure; sourceplot(cfg, source46) figure; sourceplot(cfg, source50) On 19 May 2005, at 20:14, Matsuhashi, Masao (NIH/NINDS) wrote: > Hi Robert, > > I am posting this message to the mailing list, with the original > message > added to the bottom. > > Thank you for your response. > > 1. Actually, the two frequencies are very close to each other. One is > 5 Hz > and the other is 4.6 (60/13) Hz. Sampling is 600/sec. I used 6000 trial > length so the frequency resolution should be 0.1 Hz, but I am not sure > because MTM decreases the frequency resolution in terms of W. > The two reference signals are not independent, as they share the common > carrier frequency of 60Hz, but when we calculated the coherence > sensor-wise, > they were separated relatively nicely. > > 2. I pushed the data to your ftp site. I hope it's working ok. > The filename is DICS_Matsuhashi_20050519.zip, containing 4 files. > Freq_01_050 and Source_01_050 are from condition 1, foi=5.0 Hz. > Freq_01_046 > and Source_01_046 are from condition 2, foi=4.6 Hz. > > Regards, > Masao From rajamoni at CCS.FAU.EDU Mon May 23 17:14:42 2005 From: rajamoni at CCS.FAU.EDU (R. Sreenivasan) Date: Mon, 23 May 2005 11:14:42 -0400 Subject: Anatomical names and coordiante system Message-ID: Hi I wish to study DICS with reference to some antomical location (s) - say Fusiform Gyrus Posterior - Right hemisphere. Now, How do I get the cooridate system for this location in order to compute DICS? Thanks, Vasan From tomh at KURAGE.NIMH.NIH.GOV Mon May 23 18:04:25 2005 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Mon, 23 May 2005 12:04:25 -0400 Subject: Anatomical names and coordiante system In-Reply-To: <003201c55faa$25a0ee70$061e5b83@vasan> Message-ID: R. Sreenivasan wrote: > I wish to study DICS with reference to some antomical location (s) - say > Fusiform Gyrus Posterior - Right hemisphere. Now, How do I get the > cooridate system for this location in order to compute DICS? You could use AFNI to look at your anatomical dataset, and it'll tell you the coordinates in either original or Talairach space. If you have a Talairached anatomical volume, you can display the fusiform using the Talairach Atlas (turn on atlas colors with a right click), and then you can convert to original coordinates. CTF datasets use PRI coordinates. -- Dr. Tom Holroyd "A man of genius makes no mistakes. His errors are volitional and are the portals of discovery." -- James Joyce From tomh at KURAGE.NIMH.NIH.GOV Mon May 23 21:26:25 2005 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Mon, 23 May 2005 15:26:25 -0400 Subject: CTF res4 File format In-Reply-To: Message-ID: > Looking through the matlab code, I traced the coil-error back to a res4 > file read error somewhat earlier: > > Any comments? Hmm, I just got the error: `coil2_pos' undefined near line 233 column 7 myself, but in my case it's much more easily explained: I had created a dataset using newDs2 that does not have _any_ MEG channels! It only contains virtual channels. So there are no gradiometers.... By the way, the ctf2matlab package from our website: http://kurage.nimh.nih.gov/meglab/Meg/Ctf2matlab reads this dataset properly, and I noticed that recent versions of Fieldtrip can use it (that's the ctf_read_res4 function). Right now it only uses the ctf2matlab verions if the read_ctf_res4 function fails and haseegsf is set (see the try code in read_fcdc_header.m). But you could switch it around to try the other one first. -- Dr. Tom Holroyd "A man of genius makes no mistakes. His errors are volitional and are the portals of discovery." -- James Joyce From tnt at PHYSIOL.OX.AC.UK Wed May 25 10:52:59 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Wed, 25 May 2005 10:52:59 +0200 Subject: data conversion Message-ID: Hi. I have 3-D spectrograms (time x frequency x amplitude) for different conditions and multiple subjects which were generated outside FieldTrip. I would like to compare them statistically using the paired t-test in CLUSTERRANDANALYS with correction for multiple comparisons. I have attempted to transfer these data into a format which FieldTrip should be able to read. However, it doesn't seem to work correctly. Below are the steps I have made during the transformation including a link to the files that were used or were generated in the process. Examples of the input and output data of various steps can be found here: http://www.physiol.ox.ac.uk/~tnt/specs/ Step 1: (converting data structure of individual subjects into FieldTrip format, one .mat file per condition per subject) %%%%%%%%%%%%%%%%%%%%%%%%%%%%% subj = { 'C1_A1/Average_L_A1_sub01_a_C1_A1' % example: 'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web 'C1_A1/Average_L_A1_sub02_a_C1_A1' 'C1_A1/Average_L_A1_sub04_a_C1_A1' 'C1_A1/Average_L_A1_sub05_a_C1_A1' 'C1_A1/Average_L_A1_sub07_a_C1_A1' 'C1_A1/Average_L_A1_sub07_b_C1_A1' 'C1_A1/Average_L_A1_sub09_a_C1_A1' 'C1_A1/Average_L_A1_sub10_a_C1_A1' 'C1_A1/Average_L_A1_sub10_b_C1_A1' 'C1_A1/Average_L_A1_sub11_a_C1_A1' 'C1_A1/Average_L_A1_sub11_b_C1_A1' 'C1_A1/Average_L_A1_sub12_a_C1_A1' 'C1_A1/Average_L_A1_sub12_b_C1_A1'; }; load fieldtrip_example1 % load template of data structure used by FieldTrip (example: 'fieldtrip_example1.mat' on the web ) Nsubj = 13; for i=1:Nsubj dataset = ['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/Spectrograms/' subj{i} '.mat']; outputname = ['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/fieldtrip_analysis/specs/' subj{i} '.mat']; load (dataset); % a sample dataset: 'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web tfr = oldtfr; %tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2)); % if htis line is used, 151 channels are created tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); % if this line is used 1 channel is created tfr.powspctrm(1,:,:) = data.specgr.data; % 3D put spectogram data into channel 1 of FieldTrip structure tfr.foi = data.F; % frequency information for y-axis tfr.toi= data.T; % time information for x-axis save (outputname, 'tfr'); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% This produces 'output_example_Step1_sub12_a_C1_A1.mat' on the web. In the next step I tried to convert all spectrograms from individual subjects into one data structure carrying the data for all subjects within one structure (this was done separately for two conditions): Step 2: (moving all subject data into a group structure, one for each condition) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% load fieldtrip_example1.mat; % example: 'fieldtrip_example1.mat' on the web group = oldtfr; group.sgn = oldtfr.label; group.powspctrm = []; files = dir('Average_L_A1_sub*mat'); % all the files created in step 1 above, e.g. 'output_example_Step1_sub12_a_C1_A1.mat' for i = 1:length(files) load (files(i).name); group.powspctrm(i,:,:,:) = tfr.powspctrm; % load subject data end group.toi=tfr.toi; group.foi=tfr.foi; group.dimord = 'rpt_sgn_frq_tim'; save ('group_Spec_L_A1.mat', 'group') %%%%%%%%%%%%%%%%%%%%%%%%%% creates 'output_Step2_group_Spec_L_A1.mat' on the web. When a matrix with 151 channels is created in step 1 by: tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2) the files become too large for the machine to handle at the group level (~500Mb each x 13 sets). Therefore, I proceed to the next step with a matrix of one channel tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); Step 3: (comparing two conditions from 13 subjects) %%%%%%%%%%%%%%%%%%%%%%%%% cfg = []; cfg.statistic = 'depsamplesT'; cfg.alphathresh = 0.05; cfg.makeclusters = 'yes'; cfg.minnbchan = 2; cfg.clusterteststat = 'maxsum'; cfg.onetwo = 'twosided'; cfg.alpha = 0.05; cfg.nranddraws = 100; cfg.channel = {'MEG'}; cfg.latency = [0 1]; [clusrand] = clusterrandanalysis (cfg, group_A, group_B); %%%%%%%%%%%%%%%%%%%%%%%%%% Then the following error message appears: >> [clusrand] = clusterrandanalysis (cfg, group_C1, group_C4); Selecting and formatting the data. selected 151 channels selected 626 time bins selected 159 frequency bins ??? Index exceeds matrix dimensions. Error in ==> /home/magnum/tnt//Fieldtrip/fieldtrip-20050522/private/prepare_timefreq_data.m On line 360 ==> dat{c} = avgoverdim(varargin{c}.dat(:, chansel, freqsel, timesel), avgdim); Error in ==> /home/magnum/tnt//Fieldtrip/fieldtrip-20050522/clusterrandanalysis.m On line 267 ==> [cfg,data]=prepare_timefreq_data(cfg, varargin{1:Nvarargin}); >> %%%%%%%%%%%%%% Thanks a lot in advance for your help. Thomas From tnt at PHYSIOL.OX.AC.UK Wed May 25 10:54:08 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Wed, 25 May 2005 10:54:08 +0200 Subject: data conversion Message-ID: Hi Thomas I did not look in full detail at the mail, but just browsed over it and noticed something that may be the cause: It states "selected 151 channels", but you mentioned that you have only one channel. In selecting a single channel to reduce the amount of data, did you also make the corresponding change in freq.label? Robert On Wed, 25 May 2005 10:52:59 +0200, Thomas Thesen wrote: >Hi. > >I have 3-D spectrograms (time x frequency x amplitude) for different >conditions and multiple subjects which were generated outside FieldTrip. I >would like to compare them statistically using the paired t-test in >CLUSTERRANDANALYS with correction for multiple comparisons. I have attempted >to transfer these data into a format which FieldTrip should be able to read. >However, it doesn't seem to work correctly. >Below are the steps I have made during the transformation including a link >to the files that were used or were generated in the process. > >Examples of the input and output data of various steps can be found here: >http://www.physiol.ox.ac.uk/~tnt/specs/ > > >Step 1: >(converting data structure of individual subjects into FieldTrip format, one >.mat file per condition per subject) >%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >subj = { >'C1_A1/Average_L_A1_sub01_a_C1_A1' % example: >'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web >'C1_A1/Average_L_A1_sub02_a_C1_A1' >'C1_A1/Average_L_A1_sub04_a_C1_A1' >'C1_A1/Average_L_A1_sub05_a_C1_A1' >'C1_A1/Average_L_A1_sub07_a_C1_A1' >'C1_A1/Average_L_A1_sub07_b_C1_A1' >'C1_A1/Average_L_A1_sub09_a_C1_A1' >'C1_A1/Average_L_A1_sub10_a_C1_A1' >'C1_A1/Average_L_A1_sub10_b_C1_A1' >'C1_A1/Average_L_A1_sub11_a_C1_A1' >'C1_A1/Average_L_A1_sub11_b_C1_A1' >'C1_A1/Average_L_A1_sub12_a_C1_A1' >'C1_A1/Average_L_A1_sub12_b_C1_A1'; >}; >load fieldtrip_example1 % load template of data structure used by >FieldTrip (example: 'fieldtrip_example1.mat' on the web ) > >Nsubj = 13; >for i=1:Nsubj > dataset = >['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/Spectrograms/' >subj{i} '.mat']; > outputname = >['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/fieldtrip_analysis/specs/' >subj{i} '.mat']; > load (dataset); % a sample dataset: >'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web > tfr = oldtfr; > %tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2)); % if htis >line is used, 151 channels are created > tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); % if this line is >used 1 channel is created > tfr.powspctrm(1,:,:) = data.specgr.data; % 3D >put spectogram data into channel 1 of FieldTrip structure > tfr.foi = data.F; % frequency information for y-axis > tfr.toi= data.T; % time information for x-axis > save (outputname, 'tfr'); >end > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >This produces 'output_example_Step1_sub12_a_C1_A1.mat' on the web. > >In the next step I tried to convert all spectrograms from individual >subjects into one data structure carrying the data for all subjects within >one structure (this was done separately for two conditions): > > >Step 2: >(moving all subject data into a group structure, one for each condition) >%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > >load fieldtrip_example1.mat; % example: 'fieldtrip_example1.mat' on the web >group = oldtfr; >group.sgn = oldtfr.label; >group.powspctrm = []; > >files = dir('Average_L_A1_sub*mat'); % all the files created in step 1 >above, e.g. 'output_example_Step1_sub12_a_C1_A1.mat' > >for i = 1:length(files) > load (files(i).name); > group.powspctrm(i,:,:,:) = tfr.powspctrm; % load subject data >end >group.toi=tfr.toi; >group.foi=tfr.foi; >group.dimord = 'rpt_sgn_frq_tim'; >save ('group_Spec_L_A1.mat', 'group') >%%%%%%%%%%%%%%%%%%%%%%%%%% > >creates 'output_Step2_group_Spec_L_A1.mat' on the web. > >When a matrix with 151 channels is created in step 1 by: >tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2) > > the files become too large for the machine to handle at the group level >(~500Mb each x 13 sets). > >Therefore, I proceed to the next step with a matrix of one channel >tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); > > > >Step 3: >(comparing two conditions from 13 subjects) >%%%%%%%%%%%%%%%%%%%%%%%%% >cfg = []; >cfg.statistic = 'depsamplesT'; >cfg.alphathresh = 0.05; >cfg.makeclusters = 'yes'; >cfg.minnbchan = 2; >cfg.clusterteststat = 'maxsum'; >cfg.onetwo = 'twosided'; >cfg.alpha = 0.05; >cfg.nranddraws = 100; >cfg.channel = {'MEG'}; >cfg.latency = [0 1]; > >[clusrand] = clusterrandanalysis (cfg, group_A, group_B); > >%%%%%%%%%%%%%%%%%%%%%%%%%% > >Then the following error message appears: > >>> [clusrand] = clusterrandanalysis (cfg, group_C1, group_C4); >Selecting and formatting the data. >selected 151 channels >selected 626 time bins >selected 159 frequency bins >??? Index exceeds matrix dimensions. > >Error in ==> >/home/magnum/tnt//Fieldtrip/fieldtrip-20050522/private/prepare_timefreq_data.m >On line 360 ==> dat{c} = avgoverdim(varargin{c}.dat(:, chansel, >freqsel, timesel), avgdim); > >Error in ==> >/home/magnum/tnt//Fieldtrip/fieldtrip-20050522/clusterrandanalysis.m >On line 267 ==> [cfg,data]=prepare_timefreq_data(cfg, >varargin{1:Nvarargin}); > >> > >%%%%%%%%%%%%%% > > >Thanks a lot in advance for your help. > >Thomas From tnt at PHYSIOL.OX.AC.UK Wed May 25 11:18:05 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Wed, 25 May 2005 11:18:05 +0200 Subject: data conversion Message-ID: Dear Robert, Thank you for your comment. When running CLUSTERRANDANALYSIS I have the following data structures that feed into the statistical analysis: group_C1 = label: {151x1 cell} dimord: 'rpt_sgn_frq_tim' powspctrm: [4-D double] foi: [1x159 double] toi: [1x2187 double] cfg: [1x1 struct] grad: [1x1 struct] sgn: {151x1 cell} As you said "group_C4.sgn" and "group_C4.label" indicate 151 channels, whereas the data in fact has only 1. I've tried the following: group_C4.sgn = ['spec'] group_C4.label = ['spec'] and group_C4.sgn={'spec'} group_C4.label={'spec'} but no success. Do you have any suggestion? Thanks a lot, Thomas On Wed, 25 May 2005 10:54:08 +0200, Thomas Thesen wrote: >Hi Thomas > > >I did not look in full detail at the mail, but just browsed over it and >noticed something that may be the cause: It states "selected 151 >channels", but you mentioned that you have only one channel. In >selecting a single channel to reduce the amount of data, did you also >make the corresponding change in freq.label? > > >Robert > >On Wed, 25 May 2005 10:52:59 +0200, Thomas Thesen wrote: > >>Hi. >> >>I have 3-D spectrograms (time x frequency x amplitude) for different >>conditions and multiple subjects which were generated outside FieldTrip. I >>would like to compare them statistically using the paired t-test in >>CLUSTERRANDANALYS with correction for multiple comparisons. I have attempted >>to transfer these data into a format which FieldTrip should be able to read. >>However, it doesn't seem to work correctly. >>Below are the steps I have made during the transformation including a link >>to the files that were used or were generated in the process. >> >>Examples of the input and output data of various steps can be found here: >>http://www.physiol.ox.ac.uk/~tnt/specs/ >> >> >>Step 1: >>(converting data structure of individual subjects into FieldTrip format, one >>.mat file per condition per subject) >>%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>subj = { >>'C1_A1/Average_L_A1_sub01_a_C1_A1' % example: >>'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web >>'C1_A1/Average_L_A1_sub02_a_C1_A1' >>'C1_A1/Average_L_A1_sub04_a_C1_A1' >>'C1_A1/Average_L_A1_sub05_a_C1_A1' >>'C1_A1/Average_L_A1_sub07_a_C1_A1' >>'C1_A1/Average_L_A1_sub07_b_C1_A1' >>'C1_A1/Average_L_A1_sub09_a_C1_A1' >>'C1_A1/Average_L_A1_sub10_a_C1_A1' >>'C1_A1/Average_L_A1_sub10_b_C1_A1' >>'C1_A1/Average_L_A1_sub11_a_C1_A1' >>'C1_A1/Average_L_A1_sub11_b_C1_A1' >>'C1_A1/Average_L_A1_sub12_a_C1_A1' >>'C1_A1/Average_L_A1_sub12_b_C1_A1'; >>}; >>load fieldtrip_example1 % load template of data structure used by >>FieldTrip (example: 'fieldtrip_example1.mat' on the web ) >> >>Nsubj = 13; >>for i=1:Nsubj >> dataset = >>['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/Spectrograms/' >>subj{i} '.mat']; >> outputname = >>['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/fieldtrip_analysis/specs/' >>subj{i} '.mat']; >> load (dataset); % a sample dataset: >>'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web >> tfr = oldtfr; >> %tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2)); % if htis >>line is used, 151 channels are created >> tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); % if this line is >>used 1 channel is created >> tfr.powspctrm(1,:,:) = data.specgr.data; % 3D >>put spectogram data into channel 1 of FieldTrip structure >> tfr.foi = data.F; % frequency information for y-axis >> tfr.toi= data.T; % time information for x-axis >> save (outputname, 'tfr'); >>end >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>This produces 'output_example_Step1_sub12_a_C1_A1.mat' on the web. >> >>In the next step I tried to convert all spectrograms from individual >>subjects into one data structure carrying the data for all subjects within >>one structure (this was done separately for two conditions): >> >> >>Step 2: >>(moving all subject data into a group structure, one for each condition) >>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >>load fieldtrip_example1.mat; % example: 'fieldtrip_example1.mat' on the web >>group = oldtfr; >>group.sgn = oldtfr.label; >>group.powspctrm = []; >> >>files = dir('Average_L_A1_sub*mat'); % all the files created in step 1 >>above, e.g. 'output_example_Step1_sub12_a_C1_A1.mat' >> >>for i = 1:length(files) >> load (files(i).name); >> group.powspctrm(i,:,:,:) = tfr.powspctrm; % load subject data >>end >>group.toi=tfr.toi; >>group.foi=tfr.foi; >>group.dimord = 'rpt_sgn_frq_tim'; >>save ('group_Spec_L_A1.mat', 'group') >>%%%%%%%%%%%%%%%%%%%%%%%%%% >> >>creates 'output_Step2_group_Spec_L_A1.mat' on the web. >> >>When a matrix with 151 channels is created in step 1 by: >>tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2) >> >> the files become too large for the machine to handle at the group level >>(~500Mb each x 13 sets). >> >>Therefore, I proceed to the next step with a matrix of one channel >>tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); >> >> >> >>Step 3: >>(comparing two conditions from 13 subjects) >>%%%%%%%%%%%%%%%%%%%%%%%%% >>cfg = []; >>cfg.statistic = 'depsamplesT'; >>cfg.alphathresh = 0.05; >>cfg.makeclusters = 'yes'; >>cfg.minnbchan = 2; >>cfg.clusterteststat = 'maxsum'; >>cfg.onetwo = 'twosided'; >>cfg.alpha = 0.05; >>cfg.nranddraws = 100; >>cfg.channel = {'MEG'}; >>cfg.latency = [0 1]; >> >>[clusrand] = clusterrandanalysis (cfg, group_A, group_B); >> >>%%%%%%%%%%%%%%%%%%%%%%%%%% >> >>Then the following error message appears: >> >>>> [clusrand] = clusterrandanalysis (cfg, group_C1, group_C4); >>Selecting and formatting the data. >>selected 151 channels >>selected 626 time bins >>selected 159 frequency bins >>??? Index exceeds matrix dimensions. >> >>Error in ==> >>/home/magnum/tnt//Fieldtrip/fieldtrip-20050522/private/prepare_timefreq_data.m >>On line 360 ==> dat{c} = avgoverdim(varargin{c}.dat(:, chansel, >>freqsel, timesel), avgdim); >> >>Error in ==> >>/home/magnum/tnt//Fieldtrip/fieldtrip-20050522/clusterrandanalysis.m >>On line 267 ==> [cfg,data]=prepare_timefreq_data(cfg, >>varargin{1:Nvarargin}); >> >> >> >>%%%%%%%%%%%%%% >> >> >>Thanks a lot in advance for your help. >> >>Thomas From r.oostenveld at FCDONDERS.RU.NL Wed May 25 22:25:40 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 25 May 2005 22:25:40 +0200 Subject: data conversion In-Reply-To: Message-ID: On 25 May 2005, at 11:18, Thomas Thesen wrote: > group_C4.sgn={'spec'} > group_C4.label={'spec'} > > but no success. Do you have any suggestion? Could you be more specific? Robert From matsuham at NINDS.NIH.GOV Wed May 25 23:35:09 2005 From: matsuham at NINDS.NIH.GOV (Matsuhashi, Masao (NIH/NINDS)) Date: Wed, 25 May 2005 17:35:09 -0400 Subject: Source coherence Message-ID: Hi Robert, Thank you for your precious advice. I am still working to check the points you indicated. (At this moment, the topoplotER stopped working with reshaped freqdescriptive-ed data, but I will figure it out...) As regards the low-occipital low frequency noise, I thought that as long as such activity was not correlated with the reference signal it would not affect the coherence analysis very much (only that it might lower the coherence value in some channels). How do you think it will affect the source coherence? Masao ------------------------------------------------ Masao Matsuhashi, MD, PhD NINDS, NIH Tel: 1-301-594-9139 E-mail: MatsuhaM at ninds.nih.gov ------------------------------------------------ From sanja at UNM.EDU Thu May 26 03:13:18 2005 From: sanja at UNM.EDU (Sanja Kovacevic) Date: Thu, 26 May 2005 03:13:18 +0200 Subject: 275ch CTF stimulus channel and new CTF data format Message-ID: Hi Robert, Your answer helped a lot but there was also another problem. My stimulus channel “on” states were not 9, but 5 or 6 samples long. That's why I was getting all zeros for both frontpanel and backpanel. I adjusted trigshift (line 60) to 0 as the trigger values were either 0 or the predetermined on values. For all of my datasets I've looked at so far, there is no rising time for the stimulus channel. So, I guess this is another (nice) change in the new CTF 275 acquisition program... On another note, I ran some timefrequency analyses on the sensor level and I wanted to plot the data using multiplotTFR. I'd like to use the information from the header when plotting the sensors. However, if I use the gradiometer structure created with read_ctf_res4, i.e. cfg.layout = hdr.grad, I get an error message ??? Undefined command/function 'dist'. Error in ==> createlayout at 93 d = dist(prj'); You mentioned in one of your previous replies that sensor position and information is not being read correctly for the new CTF 275 datasets. (BTW, what tells you that read_fcdc_header does not read it correctly?) If I use ctf_read_res4 (ctf2matlab toolbox as mentioned by Tom Holroyd) I should be getting correct gradiometer information (right?).Well. I tried it both ways and I get identical position information with read_ctf_res4 (fcdc) and ctf_read_res4 (nimh). Orientation information differs in that that nimh code stores only first coil orientation, whereas the fcdc code stores both coil orientations. Both codes adjust for the possibility that sometimes coil orientations stored in res4 file may be pointing toward center. It is still not clear to me what happens later with orientation information and what effect of using only first coil orientation would be... What I would ultimately like to do is to run time frequency analysis (on the sensor level first, but also on the virtual sensor level) for each subject in the group and be able to compare the results using some statistical approach. However, first I need to establish whether the data is correctly read. I appreciate your and any other fieldtriper help, Sanja On Fri, 6 May 2005 09:21:48 +0200, Robert Oostenveld wrote: >Hi Sanja, > ><--let's move our email exchange over towards the discussion list--> > >On 5 May 2005, at 22:50, Sanja Kovacevic wrote: > >> Thank you for helping me with this. I changed the filetype and >> read_ctf_res.m files as you suggested, and I was able to read in the >> data, however now I got problem with definetrial.m. Actually, I think >> the problem is with read_ctf_trigger as the 275 CTF dataset does not >> have a channel named 'STIM' but 'UPPT001' (line 63 in >> read_ctf_trigger). That was easy to fix by replacing STIM with >> UPPT001. >> >> However, I don't understand why you use (line 70 and 71 in >> read_ctf_trigger.m) >> >> bpstim = fix(stim / 2^16); >> fpstim = double(bitand(uint32(stim), 2^16-1)); > >WHen I started at the donders and implemented this, I was told that our >151 ch system has a "frontpanel" and a "backpanel". I never looked very >acurately at the electronics cabinet and all the cables that go into >it, but I guess that they refer to the way in which the cabinet is >placed in our lab. Somehow, the CTF system's own triggers are put on >the frontpanel, and the triggers that are generated on the stimulus PC >are put on the backpanel. Since people write their stimulus programs on >the presentations pc, and define/write trigger values in the 16 >bit-range on that computer. They appear in the higher 16 bits of the 32 >bit STIM channel, which is confusing since then the values don't match >the ones on the presentation computer. Therefore the 16 lowest and 16 >highest bits are separated and treated separately. On line 70, the >highest 16 bits are shifted downward by 16 bits (i.e. divide by 2^16). >On line 71, the highest 16 bits are masked away, keeping only the >lowest 16 bits. > >> The trigger values on our CTF system use lower 8 bits, i.e. possible >> values of the triggers are from 0 to 255. I am now quite confused with >> what happens to my trigger values. The bottom line is that I have all >> zeroes for backpanel and frontpanel. > >I think that you should look at the so called "frontpanel" triggers >(whose bits are not shifted). > >> BTW, could you give me or point to an example of a user specified >> trialfun that would include trials where trigger with value of 10 ir >> trigger with value of 138 occurs? > >You mean either a 10 or a 138? Just from my head: > >function [trl] = trigger138(cfg) >hdr = read_fcdc_header(cfg.dataset); >event = read_fcdc_event(cfg.dataset); >trl = []; >prestim = 0.1; >poststim = 0.5; >for i=1:length(event) > if strcmp(event(i).type, 'frontpannel trigger') > if (event(i).value==10) | (event(i).value==138) > % found trigger of interest > trl(end+1,1) = event(i).sample - prestim*hds.Fs; > trl(end ,2) = event(i).sample + poststim*hds.Fs; > trl(end ,3) = - prestim*hds.Fs; > end > end >end > >You could put prestim and poststim (time in seconds) in the cfg >structure, to keep the function more flexible. From this example, you >caneasily to make a conditional function, i.e. find the sample at >which a trigger 138 occurred and which was preceded by a trigger 10. > >Alternatively, you can also use the standard code, i.e. without a >custom trialfunction, to achieve the same. Try this: > >cfg = []; >cfg.dataset = 'something.ds'; >cfg.trialdef.eventtype = 'frontpannel trigger'; >cfg.trialdef.eventvalue = [10 138]; >cfg.trialdef.prestim = 0.1; >cfg.trialdef.poststim = 0.5; >cfg = definetrial(cfg); > >best regards, >Robert From r.oostenveld at FCDONDERS.RU.NL Thu May 26 09:54:05 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 26 May 2005 09:54:05 +0200 Subject: 275ch CTF stimulus channel and new CTF data format In-Reply-To: Message-ID: Hi Sanja, On 26 May 2005, at 3:13, Sanja Kovacevic wrote: > Your answer helped a lot but there was also another problem. My > stimulus > channel “on” states were not 9, but 5 or 6 samples long. That's why I > was > getting all zeros for both frontpanel and backpanel. I adjusted > trigshift > (line 60) to 0 as the trigger values were either 0 or the > predetermined on This is something that was noted by Tom Holroyd as well. Furthermore, according to him the 275ch systems can have trigger channels that are not called 'STIM' (which is what our read_ctf_trigger assumes). The latest version of fieldtrip has an addition to read_fcdc_event, which automatically detects and reads all stimulus channels, does a flank detection and returns the value with no timeshift. The events will have the name 'STIM', 'UTGR001' etc. Thhe 'bakckpanel' and 'frontpanel' trigger with a 9 sample shift at 1200 Hz will remain to be supported for Donders people. I suggest that you have a look at the new code (which again only works sofar for the fcdc importer, but that should be easy to fix). > values. For all of my datasets I've looked at so far, there is no > rising > time for the stimulus channel. So, I guess this is another (nice) > change in > the new CTF 275 acquisition program... The slow rising trigger value might be due to our presentation computer and not to the CTF hardware itself. I am not sure though, I just knows that it is a feature of our MEG setup. > On another note, I ran some timefrequency analyses on the sensor level > and I > wanted to plot the data using multiplotTFR. I'd like to use the > information > from the header when plotting the sensors. However, if I use the > gradiometer structure created with read_ctf_res4, i.e. cfg.layout = > hdr.grad, I get an error message > ??? Undefined command/function 'dist'. > Error in ==> createlayout at 93 > d = dist(prj'); I just checked, dist turns out to be a function from the neural networks toolbox. >> which dist /opt/matlab-7.0.1/toolbox/nnet/nnet/dist.m There is no reason to use it, I will add my own implementation of dist which replaces the NN functionality. See attached file. -------------- next part -------------- A non-text attachment was scrubbed... Name: dist.m Type: application/octet-stream Size: 609 bytes Desc: not available URL: -------------- next part -------------- > You mentioned in one of your previous replies that sensor position and > information is not being read correctly for the new CTF 275 datasets. > (BTW, > what tells you that read_fcdc_header does not read it correctly?) I don't know actually. The header information from the nimh and the fcdc res4 importers are structured differently. The read_fcdc_wrapper around it does not shape all elements of the nimh hearer into the same format, and in particular the grad information is not assigned. SO I guess that "incorrect" only means incomplete. > If I use > ctf_read_res4 (ctf2matlab toolbox as mentioned by Tom Holroyd) I > should be > getting correct gradiometer information (right?). yes, I have no reason to assume that it is not correct. It is just shaped into a different structure. B.t.w. I recall that the ctf header contains the informatino twice, once in dewar coordinates and once in head coordinates. > It is still not clear to me what happens later with orientation > information > and what effect of using only first coil orientation would be... MEG data is the magnetic flux through the coil. If the coil is oriented in the opposite way but the field is the same, the flux is the opposite. However, somewhere in the reading routine there is a flag being used to indicate that the field has to be inverted, i.e. the MEG data is always represented as outgoing flux. That means that the forward computation also has to compute the outward flux for a given coil, and that in turn means that teh coil has to be oriented outwards (using the right hand rule) > What I > would ultimately like to do is to run time frequency analysis (on the > sensor > level first, but also on the virtual sensor level) for each subject in > the > group and be able to compare the results using some statistical > approach. For sensor level analysis you do'nt have to worry about the gradiometer orientations. If you compute virtual channels with SAM, you also don't have to worry. If you want to use the fieldtrip beamformer, the grad-structure should be correct. Robert From r.oostenveld at FCDONDERS.RU.NL Thu May 26 09:57:48 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 26 May 2005 09:57:48 +0200 Subject: Source coherence In-Reply-To: <6B5952376E0A164C81F2F18BF77B3FAB2ECDD3@NIHCESMLBX.nih.gov> Message-ID: Hi Masao, On 25 May 2005, at 23:35, Matsuhashi, Masao (NIH/NINDS) wrote: > As regards the low-occipital low frequency noise, I thought that as > long as > such activity was not correlated with the reference signal it would not > affect the coherence analysis very much (only that it might lower the > coherence value in some channels). How do you think it will affect the > source coherence? If present in the spatial structure of the cross-spectral density matrix, it affects the spatial filters. And hence it will affect the estimate of the source cross-spectral density. Since coherence is source CSD normalised by power, ideally it would not affect the source coherence. But I still would not be too confident about it, since the influence of artifacts on the filter can be difficult to predict. Robert From tnt at PHYSIOL.OX.AC.UK Thu May 26 10:52:09 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Thu, 26 May 2005 10:52:09 +0200 Subject: data conversion Message-ID: Hi Robert, You said: >It states "selected 151 >channels", but you mentioned that you have only one channel. In >selecting a single channel to reduce the amount of data, did you also >make the corresponding change in freq.label? How exactly do make the corresponding change to tell CLUSTERRANDANALYSIS that there is only one frequency channel to be analyzed? I assume I change something in the data structure, not in the cfg. setup, right? I tried to change group_C4.sgn={'spec'} group_C4.label={'spec'} to have single channel name entries, but that didn't do the job. Thanks a lot, Thomas On Wed, 25 May 2005 22:25:40 +0200, Robert Oostenveld wrote: >On 25 May 2005, at 11:18, Thomas Thesen wrote: > >> group_C4.sgn={'spec'} >> group_C4.label={'spec'} >> >> but no success. Do you have any suggestion? > >Could you be more specific? > >Robert> From maris at NICI.RU.NL Thu May 26 11:03:16 2005 From: maris at NICI.RU.NL (Eric Maris) Date: Thu, 26 May 2005 11:03:16 +0200 Subject: data conversion Message-ID: Hi Thomas, > Hi Robert, > You said: >>It states "selected 151 >>channels", but you mentioned that you have only one channel. In >>selecting a single channel to reduce the amount of data, did you also >>make the corresponding change in freq.label? > > How exactly do make the corresponding change to tell CLUSTERRANDANALYSIS > that there is only one frequency channel to be analyzed? I assume I > change > something in the data structure, not in the cfg. setup, right? I tried to > change group_C4.sgn={'spec'} group_C4.label={'spec'} to have single > channel > name entries, but that didn't do the job. > > Thanks a lot, > Thomas If your data structure (containing the TFR) has a single frequency only (e.g., group_C4.sgn={'chan1'}), then you have to do nothing. If the data structure contains multiple channels (e.g., group_C4.sgn={'chan1','chan2'}), then you have to specify cfg.channel={'chan1'} if you want to analyze this channel only. Good luck, Eric Maris > > > On Wed, 25 May 2005 22:25:40 +0200, Robert Oostenveld > wrote: > >>On 25 May 2005, at 11:18, Thomas Thesen wrote: >> >>> group_C4.sgn={'spec'} >>> group_C4.label={'spec'} >>> >>> but no success. Do you have any suggestion? >> >>Could you be more specific? >> >>Robert> From tnt at PHYSIOL.OX.AC.UK Thu May 26 12:11:18 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Thu, 26 May 2005 12:11:18 +0200 Subject: data conversion Message-ID: Thank you Eric. Where did you get the NAN_SUM function from? A specific toolbox other than the Stats toolbox? In April you made revision 1.5 to CLUSTERRANDSTATISTICS and included NAN_SUM. I'm running matlab6 & 7 with the Stats toolbox and don't have this function. Looking online I couldn't find anything about NAN_SUM either. However, there is NANSUM, but replacing it in CLUSTERRANDSTATISTIC produces an error. Do you have any suggestions? cheers, Thomas On Thu, 26 May 2005 11:03:16 +0200, Eric Maris wrote: >Hi Thomas, > > >> Hi Robert, >> You said: >>>It states "selected 151 >>>channels", but you mentioned that you have only one channel. In >>>selecting a single channel to reduce the amount of data, did you also >>>make the corresponding change in freq.label? >> >> How exactly do make the corresponding change to tell CLUSTERRANDANALYSIS >> that there is only one frequency channel to be analyzed? I assume I >> change >> something in the data structure, not in the cfg. setup, right? I tried to >> change group_C4.sgn={'spec'} group_C4.label={'spec'} to have single >> channel >> name entries, but that didn't do the job. >> >> Thanks a lot, >> Thomas > >If your data structure (containing the TFR) has a single frequency only >(e.g., group_C4.sgn={'chan1'}), then you have to do nothing. If the data >structure contains multiple channels (e.g., group_C4.sgn={'chan1','chan2'}), >then you have to specify cfg.channel={'chan1'} if you want to analyze this >channel only. > > > >Good luck, > >Eric Maris > > > > >> >> >> On Wed, 25 May 2005 22:25:40 +0200, Robert Oostenveld >> wrote: >> >>>On 25 May 2005, at 11:18, Thomas Thesen wrote: >>> >>>> group_C4.sgn={'spec'} >>>> group_C4.label={'spec'} >>>> >>>> but no success. Do you have any suggestion? >>> >>>Could you be more specific? >>> >>>Robert> From r.oostenveld at FCDONDERS.RU.NL Thu May 26 16:30:47 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 26 May 2005 16:30:47 +0200 Subject: data conversion In-Reply-To: Message-ID: It is a different implementation than the nansum from teh Matlab statistics toolbox that you ar ereferring to. lease find it attached. It will be included in the next release. Robert -------------- next part -------------- A non-text attachment was scrubbed... Name: nan_sum.m Type: application/octet-stream Size: 1339 bytes Desc: not available URL: -------------- next part -------------- On 26 May 2005, at 12:11, Thomas Thesen wrote: > Thank you Eric. > > Where did you get the NAN_SUM function from? A specific toolbox other > than > the Stats toolbox? In April you made revision 1.5 to > CLUSTERRANDSTATISTICS > and included NAN_SUM. > I'm running matlab6 & 7 with the Stats toolbox and don't have this > function. > Looking online I couldn't find anything about NAN_SUM either. However, > there > is NANSUM, but replacing it in CLUSTERRANDSTATISTIC produces an error. > Do > you have any suggestions? From stephan.moratti at UNI-KONSTANZ.DE Fri May 27 09:48:29 2005 From: stephan.moratti at UNI-KONSTANZ.DE (Stephan Moratti) Date: Fri, 27 May 2005 09:48:29 +0200 Subject: 275ch CTF stimulus channel and new CTF data format In-Reply-To: Message-ID: Hi Sanja, I had the same problem and I just created this kind of m-file: function [d] = dist(A); d = sum((A).^2).^0.5; At least it works, I hope I didn't something wrong, Best, Stephan At 03:13 26.05.2005 +0200, you wrote: >Hi Robert, > >Your answer helped a lot but there was also another problem. My stimulus >channel �on� states were not 9, but 5 or 6 samples long. That's why I was >getting all zeros for both frontpanel and backpanel. I adjusted trigshift >(line 60) to 0 as the trigger values were either 0 or the predetermined on >values. For all of my datasets I've looked at so far, there is no rising >time for the stimulus channel. So, I guess this is another (nice) change in >the new CTF 275 acquisition program... > >On another note, I ran some timefrequency analyses on the sensor level and I >wanted to plot the data using multiplotTFR. I'd like to use the information >from the header when plotting the sensors. However, if I use the >gradiometer structure created with read_ctf_res4, i.e. cfg.layout = >hdr.grad, I get an error message >??? Undefined command/function 'dist'. >Error in ==> createlayout at 93 > d = dist(prj'); > >You mentioned in one of your previous replies that sensor position and >information is not being read correctly for the new CTF 275 datasets. (BTW, >what tells you that read_fcdc_header does not read it correctly?) If I use >ctf_read_res4 (ctf2matlab toolbox as mentioned by Tom Holroyd) I should be >getting correct gradiometer information (right?).Well. I tried it both ways >and I get identical position information with read_ctf_res4 (fcdc) and >ctf_read_res4 (nimh). Orientation information differs in that that nimh code >stores only first coil orientation, whereas the fcdc code stores both coil >orientations. Both codes adjust for the possibility that sometimes coil >orientations stored in res4 file may be pointing toward center. > > It is still not clear to me what happens later with orientation information >and what effect of using only first coil orientation would be... What I >would ultimately like to do is to run time frequency analysis (on the sensor >level first, but also on the virtual sensor level) for each subject in the >group and be able to compare the results using some statistical approach. >However, first I need to establish whether the data is correctly read. > >I appreciate your and any other fieldtriper help, > >Sanja > > >On Fri, 6 May 2005 09:21:48 +0200, Robert Oostenveld > wrote: > >>Hi Sanja, >> >><--let's move our email exchange over towards the discussion list--> >> >>On 5 May 2005, at 22:50, Sanja Kovacevic wrote: >> >>> Thank you for helping me with this. I changed the filetype and >>> read_ctf_res.m files as you suggested, and I was able to read in the >>> data, however now I got problem with definetrial.m. Actually, I think >>> the problem is with read_ctf_trigger as the 275 CTF dataset does not >>> have a channel named 'STIM' but 'UPPT001' (line 63 in >>> read_ctf_trigger). That was easy to fix by replacing STIM with >>> UPPT001. >>> >>> However, I don't understand why you use (line 70 and 71 in >>> read_ctf_trigger.m) >>> >>> bpstim = fix(stim / 2^16); >>> fpstim = double(bitand(uint32(stim), 2^16-1)); >> >>WHen I started at the donders and implemented this, I was told that our >>151 ch system has a "frontpanel" and a "backpanel". I never looked very >>acurately at the electronics cabinet and all the cables that go into >>it, but I guess that they refer to the way in which the cabinet is >>placed in our lab. Somehow, the CTF system's own triggers are put on >>the frontpanel, and the triggers that are generated on the stimulus PC >>are put on the backpanel. Since people write their stimulus programs on >>the presentations pc, and define/write trigger values in the 16 >>bit-range on that computer. They appear in the higher 16 bits of the 32 >>bit STIM channel, which is confusing since then the values don't match >>the ones on the presentation computer. Therefore the 16 lowest and 16 >>highest bits are separated and treated separately. On line 70, the >>highest 16 bits are shifted downward by 16 bits (i.e. divide by 2^16). >>On line 71, the highest 16 bits are masked away, keeping only the >>lowest 16 bits. >> >>> The trigger values on our CTF system use lower 8 bits, i.e. possible >>> values of the triggers are from 0 to 255. I am now quite confused with >>> what happens to my trigger values. The bottom line is that I have all >>> zeroes for backpanel and frontpanel. >> >>I think that you should look at the so called "frontpanel" triggers >>(whose bits are not shifted). >> >>> BTW, could you give me or point to an example of a user specified >>> trialfun that would include trials where trigger with value of 10 ir >>> trigger with value of 138 occurs? >> >>You mean either a 10 or a 138? Just from my head: >> >>function [trl] = trigger138(cfg) >>hdr = read_fcdc_header(cfg.dataset); >>event = read_fcdc_event(cfg.dataset); >>trl = []; >>prestim = 0.1; >>poststim = 0.5; >>for i=1:length(event) >> if strcmp(event(i).type, 'frontpannel trigger') >> if (event(i).value==10) | (event(i).value==138) >> % found trigger of interest >> trl(end+1,1) = event(i).sample - prestim*hds.Fs; >> trl(end ,2) = event(i).sample + poststim*hds.Fs; >> trl(end ,3) = - prestim*hds.Fs; >> end >> end >>end >> >>You could put prestim and poststim (time in seconds) in the cfg >>structure, to keep the function more flexible. From this example, you >>caneasily to make a conditional function, i.e. find the sample at >>which a trigger 138 occurred and which was preceded by a trigger 10. >> >>Alternatively, you can also use the standard code, i.e. without a >>custom trialfunction, to achieve the same. Try this: >> >>cfg = []; >>cfg.dataset = 'something.ds'; >>cfg.trialdef.eventtype = 'frontpannel trigger'; >>cfg.trialdef.eventvalue = [10 138]; >>cfg.trialdef.prestim = 0.1; >>cfg.trialdef.poststim = 0.5; >>cfg = definetrial(cfg); >> >>best regards, >>Robert > ----------------------------- Dipl. Psych. Stephan Moratti Dept. of Psychology University of Konstanz P.O Box D25 Phone: +40 (0)7531 882385 Fax: +49 (0)7531 884601 D-78457 Konstanz, Germany e-mail: Stephan.Moratti at uni-konstanz.de http://www.clinical-psychology.uni-konstanz.de/ From stephan.moratti at UNI-KONSTANZ.DE Fri May 27 10:24:45 2005 From: stephan.moratti at UNI-KONSTANZ.DE (Stephan Moratti) Date: Fri, 27 May 2005 10:24:45 +0200 Subject: 275ch CTF stimulus channel and new CTF data format In-Reply-To: <3.0.5.32.20050527094829.00bce6e0@popserver.uni-konstanz.de > Message-ID: Hi Sanja, Please use Roberts m-file. The one I suggested doesn't produce the same results regarding dimensionalty (explaining some error I had :-) I replaced my dist.m with Robert's one. Sorry, if I produced confusion, Stephan At 09:48 27.05.2005 +0200, you wrote: >Hi Sanja, > >I had the same problem and I just created this kind of m-file: > >function [d] = dist(A); >d = sum((A).^2).^0.5; > >At least it works, I hope I didn't something wrong, > >Best, > >Stephan > > >At 03:13 26.05.2005 +0200, you wrote: >>Hi Robert, >> >>Your answer helped a lot but there was also another problem. My stimulus >>channel �on� states were not 9, but 5 or 6 samples long. That's why I was >>getting all zeros for both frontpanel and backpanel. I adjusted trigshift >>(line 60) to 0 as the trigger values were either 0 or the predetermined on >>values. For all of my datasets I've looked at so far, there is no rising >>time for the stimulus channel. So, I guess this is another (nice) change in >>the new CTF 275 acquisition program... >> >>On another note, I ran some timefrequency analyses on the sensor level and I >>wanted to plot the data using multiplotTFR. I'd like to use the information >>from the header when plotting the sensors. However, if I use the >>gradiometer structure created with read_ctf_res4, i.e. cfg.layout = >>hdr.grad, I get an error message >>??? Undefined command/function 'dist'. >>Error in ==> createlayout at 93 >> d = dist(prj'); >> >>You mentioned in one of your previous replies that sensor position and >>information is not being read correctly for the new CTF 275 datasets. (BTW, >>what tells you that read_fcdc_header does not read it correctly?) If I use >>ctf_read_res4 (ctf2matlab toolbox as mentioned by Tom Holroyd) I should be >>getting correct gradiometer information (right?).Well. I tried it both ways >>and I get identical position information with read_ctf_res4 (fcdc) and >>ctf_read_res4 (nimh). Orientation information differs in that that nimh code >>stores only first coil orientation, whereas the fcdc code stores both coil >>orientations. Both codes adjust for the possibility that sometimes coil >>orientations stored in res4 file may be pointing toward center. >> >> It is still not clear to me what happens later with orientation information >>and what effect of using only first coil orientation would be... What I >>would ultimately like to do is to run time frequency analysis (on the sensor >>level first, but also on the virtual sensor level) for each subject in the >>group and be able to compare the results using some statistical approach. >>However, first I need to establish whether the data is correctly read. >> >>I appreciate your and any other fieldtriper help, >> >>Sanja >> >> >>On Fri, 6 May 2005 09:21:48 +0200, Robert Oostenveld >> wrote: >> >>>Hi Sanja, >>> >>><--let's move our email exchange over towards the discussion list--> >>> >>>On 5 May 2005, at 22:50, Sanja Kovacevic wrote: >>> >>>> Thank you for helping me with this. I changed the filetype and >>>> read_ctf_res.m files as you suggested, and I was able to read in the >>>> data, however now I got problem with definetrial.m. Actually, I think >>>> the problem is with read_ctf_trigger as the 275 CTF dataset does not >>>> have a channel named 'STIM' but 'UPPT001' (line 63 in >>>> read_ctf_trigger). That was easy to fix by replacing STIM with >>>> UPPT001. >>>> >>>> However, I don't understand why you use (line 70 and 71 in >>>> read_ctf_trigger.m) >>>> >>>> bpstim = fix(stim / 2^16); >>>> fpstim = double(bitand(uint32(stim), 2^16-1)); >>> >>>WHen I started at the donders and implemented this, I was told that our >>>151 ch system has a "frontpanel" and a "backpanel". I never looked very >>>acurately at the electronics cabinet and all the cables that go into >>>it, but I guess that they refer to the way in which the cabinet is >>>placed in our lab. Somehow, the CTF system's own triggers are put on >>>the frontpanel, and the triggers that are generated on the stimulus PC >>>are put on the backpanel. Since people write their stimulus programs on >>>the presentations pc, and define/write trigger values in the 16 >>>bit-range on that computer. They appear in the higher 16 bits of the 32 >>>bit STIM channel, which is confusing since then the values don't match >>>the ones on the presentation computer. Therefore the 16 lowest and 16 >>>highest bits are separated and treated separately. On line 70, the >>>highest 16 bits are shifted downward by 16 bits (i.e. divide by 2^16). >>>On line 71, the highest 16 bits are masked away, keeping only the >>>lowest 16 bits. >>> >>>> The trigger values on our CTF system use lower 8 bits, i.e. possible >>>> values of the triggers are from 0 to 255. I am now quite confused with >>>> what happens to my trigger values. The bottom line is that I have all >>>> zeroes for backpanel and frontpanel. >>> >>>I think that you should look at the so called "frontpanel" triggers >>>(whose bits are not shifted). >>> >>>> BTW, could you give me or point to an example of a user specified >>>> trialfun that would include trials where trigger with value of 10 ir >>>> trigger with value of 138 occurs? >>> >>>You mean either a 10 or a 138? Just from my head: >>> >>>function [trl] = trigger138(cfg) >>>hdr = read_fcdc_header(cfg.dataset); >>>event = read_fcdc_event(cfg.dataset); >>>trl = []; >>>prestim = 0.1; >>>poststim = 0.5; >>>for i=1:length(event) >>> if strcmp(event(i).type, 'frontpannel trigger') >>> if (event(i).value==10) | (event(i).value==138) >>> % found trigger of interest >>> trl(end+1,1) = event(i).sample - prestim*hds.Fs; >>> trl(end ,2) = event(i).sample + poststim*hds.Fs; >>> trl(end ,3) = - prestim*hds.Fs; >>> end >>> end >>>end >>> >>>You could put prestim and poststim (time in seconds) in the cfg >>>structure, to keep the function more flexible. From this example, you >>>caneasily to make a conditional function, i.e. find the sample at >>>which a trigger 138 occurred and which was preceded by a trigger 10. >>> >>>Alternatively, you can also use the standard code, i.e. without a >>>custom trialfunction, to achieve the same. Try this: >>> >>>cfg = []; >>>cfg.dataset = 'something.ds'; >>>cfg.trialdef.eventtype = 'frontpannel trigger'; >>>cfg.trialdef.eventvalue = [10 138]; >>>cfg.trialdef.prestim = 0.1; >>>cfg.trialdef.poststim = 0.5; >>>cfg = definetrial(cfg); >>> >>>best regards, >>>Robert >> > > >----------------------------- >Dipl. Psych. Stephan Moratti >Dept. of Psychology >University of Konstanz >P.O Box D25 >Phone: +40 (0)7531 882385 >Fax: +49 (0)7531 884601 >D-78457 Konstanz, Germany >e-mail: Stephan.Moratti at uni-konstanz.de > > >http://www.clinical-psychology.uni-konstanz.de/ > ----------------------------- Dipl. Psych. Stephan Moratti Dept. of Psychology University of Konstanz P.O Box D25 Phone: +40 (0)7531 882385 Fax: +49 (0)7531 884601 D-78457 Konstanz, Germany e-mail: Stephan.Moratti at uni-konstanz.de http://www.clinical-psychology.uni-konstanz.de/ From tomh at KURAGE.NIMH.NIH.GOV Sun May 29 19:21:50 2005 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Sun, 29 May 2005 13:21:50 -0400 Subject: time shift in mtmconvol? Message-ID: I've been working with time-frequency plots made with mtmconvol. I'm using adapted t-f windows as shown below, and I've noticed that my peak ERD and ERS appear to be moving in time depending on the time window width. Here's part of the script, after preprocessing: cfg = []; cfg.output = 'pow'; cfg.method = 'mtmconvol'; N = 6; # number of cycles per time window K = 4; # number of tapers (amount of smoothing) cfg.foi = 2:.25:20; n = length(cfg.foi); cfg.t_ftimwin = zeros(1, n); cfg.t_ftimwin(:) = N ./ cfg.foi; cfg.tapsmofrq = zeros(1, n); cfg.tapsmofrq(:) = cfg.foi .* ((K + 1) / (2 * N)); cfg.keeptrials = 'no'; [freq] = freqanalysis(cfg, data); cfg = []; cfg.baseline = [-.4 .4]; cfg.baselinetype = 'relative'; fr = freqbaseline(cfg, freq); The plots show fr.powspctrm(1,:,:), that is, just one channel. There are 116 trials in each average, and time 0 is peak flexion of a thumb movement. In the first figure, the array of 4, the N parameter above is the only thing that changes, starting with a value of 2 in the upper left, and taking on values of 3, 4, and 5 for the upper right, lower left, and lower right, resp. The second figure is for N = 6. Since the t-f windows are functions of frequency, they also get narrower in bandwidth as the time width is stretched. The (K+1)/(2*N) factor ensures that the W parameter to dpss is always a multiple of 1/2. I'm not sure why that is a requirement in general, but I should also note that I'm doing all these computations using Octave, not Matlab, and the dpss.m file I'm using fails to converge properly if W is not a multiple of 1/2. Anyway, there's a very obvious shift in the positions of the peaks, as a function of N. Is there some problem with the way the padding is being done? I thought that the toi specified the centers of the time windows, so I didn't expect any shifts of this kind. Or are N = 2, 3, simply too small? The apparent shift might be a result of too much smoothing when N is small, perhaps. Thanks in advance for any insights you could give me. P.S. The latest CVS of Octave (2.9.3) will run fieldtrip, at least for CTF datasets and t-f plots. I haven't tested all of it, and there are some extra functions you need. I'll make them available on my website soon; email me if you can't wait. -- Dr. Tom Holroyd "A man of genius makes no mistakes. His errors are volitional and are the portals of discovery." -- James Joyce -------------- next part -------------- A non-text attachment was scrubbed... Name: mlc11b.png Type: image/png Size: 548248 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mlc11c.png Type: image/png Size: 152220 bytes Desc: not available URL: From tomh at KURAGE.NIMH.NIH.GOV Sun May 29 21:19:04 2005 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Sun, 29 May 2005 15:19:04 -0400 Subject: time shift in mtmconvol? In-Reply-To: <4299FA2E.7090005@kurage.nimh.nih.gov> Message-ID: Oh, the toi was missing from that message, sorry. cfg.toi = -.4:.02:.4; Dr. Tom Holroyd "A man of genius makes no mistakes. His errors are volitional and are the portals of discovery." -- James Joyce From t.montez at VUMC.NL Mon May 2 09:20:31 2005 From: t.montez at VUMC.NL (Montez, T.) Date: Mon, 2 May 2005 09:20:31 +0200 Subject: Grand Averages Message-ID: Hi, I would like to make two multiplots of power spectrum: one for controls and one for patients. I wrote a code to compute the planar gradiometers, the average over trials for each subject and the power spectrum (see attachment). I want to run it through the two groups and grand average within the groups to have a first glance at the differences between them.   The database is structured like:   E:\Data\AD_Project\Patients\A001 ... E:\Data\AD_Project\Patients\A017   And E:\Data\AD_Project\Controls\C001 ... E:\Data\AD_Project\Controls\C018   Inside each folder there is a "data" Matlab file (*).   - How are your databases organized and how do you compute Grand Averages?   Thanks, Teresa     (*) Example of how the data was read from CTF.   cfg = []; cfg.dataset = 'E:\Data\AD-EC\A001-ED_20020719_02.ds' cfg.trl= [[ones(1,37)]', [4096*ones(1,37)]', [zeros(1,37)]'] cfg.channel='all' data = preprocessing(cfg)   It is just no-task eyes closed data acquired with 37 trials of 4096 samples. So I want to apply the filters later as if it is continuous data. - How is it handled in the last 0.9.6 version? -------------- next part -------------- A non-text attachment was scrubbed... Name: script_home_database.m Type: application/octet-stream Size: 4075 bytes Desc: not available URL: From tnt at PHYSIOL.OX.AC.UK Tue May 3 23:05:47 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Tue, 3 May 2005 23:05:47 +0200 Subject: importing CTF data Message-ID: Dear Robert and Ole, I am trying to import data from a 151 channel CTF system into FieldTrip format. I tried following the instructions in preprocessing.m and definetrial.m but got the error message that the markerfile can't be read. I think that importing raw data wasn't covered during the last workshop (which was extremely helpful by the way!), so I am not sure if I did the right thing at all and probably have overlooked something. I have put an example dataset here: http://www.physiol.ox.ac.uk/~tnt/fieldtrip/ There is one trigger in this dataset (C1_A1). Would it be possible for you to have a look and suggest some Matlab code that will allow me to import the data so that I can use it with preprocessing.m, etc? Thank you very much for your help. Best wishes, Thomas --------------------------------------------------- Thomas Thesen University Laboratory of Physiology & Centre for Functional MRI of the Brain University of Oxford Oxford, OX1 3PT United Kingdom Phone: +44(0)1865-272 434 Mobile: +44(0)781-355 6528 Fax: +44(0)1865-272 469 e-mail: thomas.thesen at physiol.oxford.ac.uk http://www.fmrib.ox.ac.uk/~tnt/ --------------------------------------------------- From ole.jensen at FCDONDERS.RU.NL Wed May 4 01:01:48 2005 From: ole.jensen at FCDONDERS.RU.NL (Ole Jensen) Date: Wed, 4 May 2005 01:01:48 +0200 Subject: importing CTF data In-Reply-To: Message-ID: Dear Thomas, First try to have a look at the appendix in of the tutorial 'Event Related Fields'. There is an example on reading 'continues' data (this includes AUX files). There is also a definetrial.m example function - you can use this to check the stimulus channel etc - hopefully this will help you get going. Good luck, Ole Thomas Thesen wrote: >Dear Robert and Ole, > >I am trying to import data from a 151 channel CTF system into FieldTrip >format. I tried following the instructions in preprocessing.m and >definetrial.m but got the error message that the markerfile can't be read. I >think that importing raw data wasn't covered during the last workshop (which >was extremely helpful by the way!), so I am not sure if I did the right >thing at all and probably have overlooked something. > >I have put an example dataset here: >http://www.physiol.ox.ac.uk/~tnt/fieldtrip/ >There is one trigger in this dataset (C1_A1). Would it be possible for you >to have a look and suggest some Matlab code that will allow me to import the >data so that I can use it with preprocessing.m, etc? > >Thank you very much for your help. > >Best wishes, > >Thomas > >--------------------------------------------------- >Thomas Thesen >University Laboratory of Physiology >& Centre for Functional MRI of the Brain >University of Oxford >Oxford, OX1 3PT >United Kingdom > >Phone: +44(0)1865-272 434 >Mobile: +44(0)781-355 6528 >Fax: +44(0)1865-272 469 >e-mail: thomas.thesen at physiol.oxford.ac.uk >http://www.fmrib.ox.ac.uk/~tnt/ > >--------------------------------------------------- > > > -- Ole Jensen Principal Investigator F.C. Donders Centre for Cognitive Neuroimaging P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Office : +31 24 36 10884 MEG lab : +31 24 36 10988 Fax : +31 24 36 10989 e-mail : ole.jensen at fcdonders.ru.nl URL : http://oase.uci.ru.nl/~olejen From r.oostenveld at FCDONDERS.RU.NL Wed May 4 09:02:17 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 4 May 2005 09:02:17 +0200 Subject: importing CTF data In-Reply-To: <427802DC.40900@fcdonders.ru.nl> Message-ID: Hi Thomas, Your data is pretty standard, the following snippet of code should get you started. cfg = []; cfg.dataset = 'sub12_SAM_a_C1_A1.ds'; cfg.trialdef.eventtype = '?' % see which eventtypes and values are present in the dataset % dum = definetrial(cfg); cfg.trialdef.eventtype = 'C1_A1' cfg.trialdef.prestim = 0; % trial starts at time t=0 at the marker cfg.trialdef.poststim = 0.5; % trial ends at t=0.5 sec cfg = definetrial(cfg); raw = preprocessing(cfg); cfg = []; avg = timelockanalysis(cfg, raw); plot(avg.time, avg.avg(31:180,:)) If you want to do conditional definition of trials (e.g. exclude bad trials), you should have a look at the example that Ole mentioned. best, Robert On 4 May 2005, at 1:01, Ole Jensen wrote: > Dear Thomas, > > First try to have a look at the appendix in of the tutorial 'Event > Related Fields'. There is an example on reading 'continues' data (this > includes AUX files). There is also a definetrial.m example function - > you can use this to check the stimulus channel etc - hopefully this > will help you get going. > > Good luck, > > Ole > > Thomas Thesen wrote: > >> Dear Robert and Ole, >> >> I am trying to import data from a 151 channel CTF system into >> FieldTrip >> format. I tried following the instructions in preprocessing.m and >> definetrial.m but got the error message that the markerfile can't be >> read. I >> think that importing raw data wasn't covered during the last workshop >> (which >> was extremely helpful by the way!), so I am not sure if I did the >> right >> thing at all and probably have overlooked something. >> >> I have put an example dataset here: >> http://www.physiol.ox.ac.uk/~tnt/fieldtrip/ >> There is one trigger in this dataset (C1_A1). Would it be possible >> for you >> to have a look and suggest some Matlab code that will allow me to >> import the >> data so that I can use it with preprocessing.m, etc? >> >> Thank you very much for your help. >> >> Best wishes, >> >> Thomas >> >> --------------------------------------------------- >> Thomas Thesen >> University Laboratory of Physiology >> & Centre for Functional MRI of the Brain >> University of Oxford >> Oxford, OX1 3PT >> United Kingdom >> >> Phone: +44(0)1865-272 434 >> Mobile: +44(0)781-355 6528 >> Fax: +44(0)1865-272 469 >> e-mail: thomas.thesen at physiol.oxford.ac.uk >> http://www.fmrib.ox.ac.uk/~tnt/ >> >> --------------------------------------------------- >> >> > > > -- > Ole Jensen > Principal Investigator > F.C. Donders Centre for Cognitive Neuroimaging > P.O. Box 9101 > NL-6500 HB Nijmegen > The Netherlands > > Office : +31 24 36 10884 > MEG lab : +31 24 36 10988 > > Fax : +31 24 36 10989 > > e-mail : ole.jensen at fcdonders.ru.nl > URL : http://oase.uci.ru.nl/~olejen > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From r.oostenveld at FCDONDERS.RU.NL Wed May 4 09:16:46 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 4 May 2005 09:16:46 +0200 Subject: Grand Averages In-Reply-To: <05May2.092319cest.334208@nucleus.azvu.nl> Message-ID: Hi Theresa We do not work with "databases", structuring the analysis of a larger group of subject is something that you have to do yourself in your own scripts. My preferred way of doing this is something like subj = { 'A001' 'A002' 'A003' 'A004' }; Nsubj = 4; for s=1:Nsubj dataset = ['E:\Data\AD_Project\Patients\' subj{i} '.ds']; matfile = ['E:\Data\AD_Project\Matlab\' subj{i} '.mat']; cfg = []; cfg.dataset = subj{s}; cfg.otheroption = ... cfg.otheroption = ... cfg.otheroption = ... raw = preprocessing(cfg) save(matfile, raw); clear raw end This ensures that you are using the same analysis options for each subject. Then in the next step (e.g. timelockanalysis or ferqanalysis), you can repeat the for-loop over the subjects, read the raw data and perform the nest step. Grand averaging is done using the TIMELOCKGRANDAVERAGE function or the FERQGRANDAVERAGE function. For MEG data, it is preferable to spatially realign them prior to averaging, since the helmet location is different for each subject. best, Robert On 2 May 2005, at 9:20, Montez, T. wrote: > Hi, > > I would like to make two multiplots of power spectrum: one for > controls and one for patients. > I wrote a code to compute the planar gradiometers, the average over > trials for each subject and the power spectrum (see attachment). > I want to run it through the two groups and grand average within the > groups to have a first glance at the differences between them. >   > The database is structured like: >   > E:\Data\AD_Project\Patients\A001 ... E:\Data\AD_Project\Patients\A017 >   > And E:\Data\AD_Project\Controls\C001 ... > E:\Data\AD_Project\Controls\C018 >   > Inside each folder there is a "data" Matlab file (*). >   > - How are your databases organized and how do you compute Grand > Averages? >   > Thanks, > Teresa >   >   > (*) Example of how the data was read from CTF. >   > cfg = []; > cfg.dataset = 'E:\Data\AD-EC\A001-ED_20020719_02.ds' > cfg.trl= [[ones(1,37)]', [4096*ones(1,37)]', [zeros(1,37)]'] > cfg.channel='all' > data = preprocessing(cfg) >   > It is just no-task eyes closed data acquired with 37 trials of 4096 > samples. > So I want to apply the filters later as if it is continuous data. > - How is it handled in the last 0.9.6 version? > > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From r.oostenveld at FCDONDERS.RU.NL Fri May 6 09:21:48 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 6 May 2005 09:21:48 +0200 Subject: 275ch CTF stimulus channel In-Reply-To: Message-ID: Hi Sanja, <--let's move our email exchange over towards the discussion list--> On 5 May 2005, at 22:50, Sanja Kovacevic wrote: > Thank you for helping me with this. I changed the filetype and > read_ctf_res.m files as you suggested, and I was able to read in the > data, however now I got problem with definetrial.m. Actually, I think > the problem is with read_ctf_trigger as the 275 CTF dataset does not > have a channel named 'STIM' but 'UPPT001' (line 63 in > read_ctf_trigger). That was easy to fix by replacing STIM with > UPPT001. > > However, I don't understand why you use (line 70 and 71 in > read_ctf_trigger.m) > > bpstim = fix(stim / 2^16); > fpstim = double(bitand(uint32(stim), 2^16-1)); WHen I started at the donders and implemented this, I was told that our 151 ch system has a "frontpanel" and a "backpanel". I never looked very acurately at the electronics cabinet and all the cables that go into it, but I guess that they refer to the way in which the cabinet is placed in our lab. Somehow, the CTF system's own triggers are put on the frontpanel, and the triggers that are generated on the stimulus PC are put on the backpanel. Since people write their stimulus programs on the presentations pc, and define/write trigger values in the 16 bit-range on that computer. They appear in the higher 16 bits of the 32 bit STIM channel, which is confusing since then the values don't match the ones on the presentation computer. Therefore the 16 lowest and 16 highest bits are separated and treated separately. On line 70, the highest 16 bits are shifted downward by 16 bits (i.e. divide by 2^16). On line 71, the highest 16 bits are masked away, keeping only the lowest 16 bits. > The trigger values on our CTF system use lower 8 bits, i.e. possible > values of the triggers are from 0 to 255. I am now quite confused with > what happens to my trigger values. The bottom line is that I have all > zeroes for backpanel and frontpanel. I think that you should look at the so called "frontpanel" triggers (whose bits are not shifted). > BTW, could you give me or point to an example of a user specified > trialfun that would include trials where trigger with value of 10 ir > trigger with value of 138 occurs? You mean either a 10 or a 138? Just from my head: function [trl] = trigger138(cfg) hdr = read_fcdc_header(cfg.dataset); event = read_fcdc_event(cfg.dataset); trl = []; prestim = 0.1; poststim = 0.5; for i=1:length(event) if strcmp(event(i).type, 'frontpannel trigger') if (event(i).value==10) | (event(i).value==138) % found trigger of interest trl(end+1,1) = event(i).sample - prestim*hds.Fs; trl(end ,2) = event(i).sample + poststim*hds.Fs; trl(end ,3) = - prestim*hds.Fs; end end end You could put prestim and poststim (time in seconds) in the cfg structure, to keep the function more flexible. From this example, you caneasily to make a conditional function, i.e. find the sample at which a trigger 138 occurred and which was preceded by a trigger 10. Alternatively, you can also use the standard code, i.e. without a custom trialfunction, to achieve the same. Try this: cfg = []; cfg.dataset = 'something.ds'; cfg.trialdef.eventtype = 'frontpannel trigger'; cfg.trialdef.eventvalue = [10 138]; cfg.trialdef.prestim = 0.1; cfg.trialdef.poststim = 0.5; cfg = definetrial(cfg); best regards, Robert From r.oostenveld at FCDONDERS.RU.NL Fri May 6 09:29:38 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 6 May 2005 09:29:38 +0200 Subject: importing CTF data In-Reply-To: <6.2.0.14.0.20050505113258.01ea7300@mail.physiol.ox.ac.uk> Message-ID: Hi Thomas, On 5 May 2005, at 12:38, Thomas Thesen wrote: > Thank you for your help! I have run the first lines of code: > > cfg = []; > cfg.dataset = 'sub12_SAM_a_C1_A1.ds'; > cfg.trialdef.eventtype = '?' > cfg.trialdef.eventtype = 'C1_A1' > cfg.trialdef.prestim = 0; % trial starts at time t=0 at the marker > cfg.trialdef.poststim = 0.5; % trial ends at t=0.5 sec > cfg = definetrial(cfg); > > and it has been running for over 12 hours now on a 2 GHz machine using > Matlab version 6.5. Is that normal? No, reading a stimulus channel and making a trial definition does not take that long. If I do the same on the dataset that you gave me, it takes about 2 seconds and shows me the following on screen found 92 events created 38 trials >> cfg cfg = dataset: 'sub12_SAM_a_C1_A1.ds' trialdef: [1x1 struct] datafile: 'sub12_SAM_a_C1_A1.ds/sub12_SAM_a_C1_A1.meg4' headerfile: 'sub12_SAM_a_C1_A1.ds/sub12_SAM_a_C1_A1.res4' event: [1x92 struct] trl: [38x3 double] version: [1x1 struct] Try whether these two commands work for you: hdr = read_fcdc_header(cfg.dataset) event = read_fcdc_event(cfg.dataset) Robert From tnt at PHYSIOL.OX.AC.UK Fri May 6 11:16:41 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Fri, 6 May 2005 11:16:41 +0200 Subject: importing CTF data Message-ID: Hi Robert, Thank you for your help! I have run the first lines of code: cfg = []; cfg.dataset = 'sub12_SAM_a_C1_A1.ds'; cfg.trialdef.eventtype = '?' cfg.trialdef.eventtype = 'C1_A1' cfg.trialdef.prestim = 0; % trial starts at time t=0 at the marker cfg.trialdef.poststim = 0.5; % trial ends at t=0.5 sec cfg = definetrial(cfg); and it has been running for over 36 hours now on a 2 GHz machine using Matlab version 6.5 and 7.0.1. I have tried both CTF datasets containing epochs and continuos data. thanks, Thomas From matsuham at NINDS.NIH.GOV Fri May 6 20:34:08 2005 From: matsuham at NINDS.NIH.GOV (Matsuhashi, Masao (NIH/NINDS)) Date: Fri, 6 May 2005 14:34:08 -0400 Subject: sourcestatistics Message-ID: Hi, It is nice to see more and more people start using FieldTrip and join the discussion here. Just reading through the posted messages gives me lots of ideas. I have questions about statistical measures using random re-sampling and permutation. i) Where can I find the sourcestatistics.m? According to the tutorials or documents, this script seems essential but I couldn't find it in recent distributions of FieldTrip. ii) In the sourceanalysis.m, re-sampling or permutation uses lots of memory and the computation ends up with OUT OF MEMORY. (e.g. rnd_aCf and rnd_bCf use 2 conditions * 500 trials * 274 channels * 274 channels * 16 bytes/complex = 1.2GBytes) Is there any way to go around this problem, such as repeating 100 trial random re-sampling for 10 times, or must I switch to Opteron? iii) As expected, this is very time-consuming process. Can I somehow use the Beowulf support feature, and if yes, how? We have Beowulf cluster available, but the number of Matlab license is limited to 8.... Thanks, Masao Matsuhashi HMCS/NINDS From t.montez at VUMC.NL Mon May 9 00:17:23 2005 From: t.montez at VUMC.NL (Teresa Montez) Date: Sun, 8 May 2005 22:17:23 -0000 Subject: megrealign, head models In-Reply-To: <0f4160725545991ee60d373838469b0e@fcdonders.ru.nl> Message-ID: Dear Robert, Thanks for your help. > For MEG data, it is preferable to spatially realign them prior to averaging, since the helmet location is different for each subject. Using: cd (['E:\Data\AD_Project\Patients\' subj{i}]) load data cfg=[]; cfg.channel = {'all','-MLT21','-MLT22' , '-MLC42', '-MLO43', '-MZO02' , '-MLT41' , '-MZP01' , '-MRT35'}; cfg.repair = 'yes' cfg.realign = 'yes' cfg.hdmfile='E:\Backup_Compaq\Matlab\DIPOLE\singleSphere.hdm'; cfg.planar = 'yes' data_planar_nobad=meginterpolate(cfg,data); I get the error message: ??? Error using ==> svd NaN or Inf prevents convergence. Error in ==> megrealign>prunedinv at 361 [u, s, v] = svd(lf); Error in ==> megrealign at 260 bkalign = lfold * prunedinv(lfnew, cfg.pruneratio) * realign; Error in ==> meginterpolate at 116 data = megrealign(cfg, data); Error in ==> script_home_database_rob at 66 data_planar_nobad=meginterpolate(cfg,data); - Should I use a local spheres head model? Best regards, Teresa From r.oostenveld at FCDONDERS.RU.NL Mon May 9 08:36:34 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 May 2005 08:36:34 +0200 Subject: importing CTF data In-Reply-To: Message-ID: Hi Thomas On 6 May 2005, at 11:16, Thomas Thesen wrote: > I have tried both CTF datasets containing > epochs and continuos data. Did you try the dataset that you sent me? Please be more specific, otherwise I cannot help you. And try whether these two commands work for you: hdr = read_fcdc_header(cfg.dataset) event = read_fcdc_event(cfg.dataset) Robert From r.oostenveld at FCDONDERS.RU.NL Mon May 9 08:56:45 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 May 2005 08:56:45 +0200 Subject: sourcestatistics In-Reply-To: <6EF659D3CB8D724BBA76CF97214D8DAC1122F111@nihexchange17.nih.gov> Message-ID: Hi Masao, On 6 May 2005, at 20:34, Matsuhashi, Masao (NIH/NINDS) wrote: > I have questions about statistical measures using random re-sampling > and > permutation. > > i) Where can I find the sourcestatistics.m? According to the tutorials > or documents, this script seems essential but I couldn't find it in > recent > distributions of FieldTrip. I thought that it was included in the 0.9.6 version, but it seems not to. I'll send it to you in a separate mail. We are about to release 1.0, which will include it. > ii) In the sourceanalysis.m, re-sampling or permutation uses lots of > memory and the computation ends up with OUT OF MEMORY. (e.g. rnd_aCf > and > rnd_bCf use 2 conditions * 500 trials * 274 channels * 274 channels * > 16 > bytes/complex = 1.2GBytes) > Is there any way to go around this problem, such as repeating 100 trial > random re-sampling for 10 times, or must I switch to Opteron? There are two memory consuming aspects: first, each randomization takes uses two cross-spectral density matrices (one for each condition). The second memory consuming aspect is the source reconstruction volumes, in your case that would consist of (500+1)*2 volumes. Each volume contains of several parameters (depending on what you are beaming: pow, noise, coh), increasing the number of volumes with a factor of 2 or 3. The size in bytes of a volume depends on the resolution that you choose, but I suggest that you also try to estimate whether that would fit into memory prior to starting the computation. Btw. 500 is quite a lot, we typically find that the probabilities don't change that much after 200-300. You can indeed run multiple randomizations separately. If you do that in separate matlab sessions (on different machines), make sure that you use the matlab seed() function to prevent the random number generator from creating the same random sequence in every matlab session. Afterwards, you have to concatenate the contents of the source.trialA and trialB fields. > iii) As expected, this is very time-consuming process. Can I somehow > use > the Beowulf support feature, and if yes, how? We have Beowulf cluster > available, but the number of Matlab license is limited to 8.... It is very timeconsuming indeed. Are you using precomputed leadfields? And a decent grid resolution (not too high)? I have been trying around with different paralellization algorithms, and also found that the number of Matlab licenses was more of a problem than the number of machines. The paralellizationis still in an experimental stage. The latest and most promising implementation of the parallellization (the "mentat" version) code can be fuond as a separate toolbox on http://oase.uci.kun.nl/~roberto/mentat/. It uses only one matlab license on the head node and creates standalone binaries for the slave nodes using the matlab compiler. If you want, you can give it a try and see whether you can get it to work on your cluster. best regards, Robert ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From r.oostenveld at FCDONDERS.RU.NL Mon May 9 09:09:33 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 May 2005 09:09:33 +0200 Subject: megrealign, head models In-Reply-To: <20050508202118.7706.qmail@smtp2.versatel.nl> Message-ID: On 9 May 2005, at 0:17, Teresa Montez wrote: > I get the error message: > > ??? Error using ==> svd > NaN or Inf prevents convergence. There seems to be a problem with your head model, the forward model has a nan or an inf. > - Should I use a local spheres head model? In general you should not use a local spheres model for realignment. I have no idea what is causing the problem. Could you send me a matlab file with an averaged ERF that you want to align and the headmodel file? Please use ftp://ftp.fcdonders.nl and put the files in the directory /pub/inccoming (the directory is one-way-traffic: you cannot see them there after copying, but I can pich them up from there). Robert From tnt at PHYSIOL.OX.AC.UK Mon May 9 12:18:41 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Mon, 9 May 2005 12:18:41 +0200 Subject: importing CTF data Message-ID: Hi Robert, < Did you try the dataset that you sent me? Please be more specific, > event = read_fcdc_event(cfg.dataset) Error in ==> read_fcdc_event at 148 mrk = readmarkerfile(filename); >> I installed FieldTrip only 2 weeks ago. So assuming we both have the same version installed the only difference might to be the matlab version. Which version are you using? Thanks a lot. Thomas From r.oostenveld at FCDONDERS.RU.NL Mon May 9 12:28:13 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 May 2005 12:28:13 +0200 Subject: importing CTF data In-Reply-To: Message-ID: Hi Thomas > Error in ==> read_fcdc_event at 148 > mrk = readmarkerfile(filename); The error which is causing the infinite loop seems to be in the private/readmarkerfile function. I did not write that function myself (Tom Holroyd gave it to me). We are not using the CTF markerfiles in Nijmegen, and it would not surprise me that there is an undetected bug in it. Could you try out the readmarkerfile function itself on the dataset? > I installed FieldTrip only 2 weeks ago. So assuming we both have the > same > version installed the only difference might to be the matlab version. > Which > version are you using? I am using Matlab 7.01 on Mac OS X and Matlab 7.01 on Linux. Are you running it on windows? Maybe there is a problem with the different way in which linux and windows are treating the text files. Robert From tnt at PHYSIOL.OX.AC.UK Mon May 9 12:50:59 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Mon, 9 May 2005 12:50:59 +0200 Subject: importing CTF data Message-ID: Dear Robert, Thank you for your suggestion. I think I found out now what the problem is. >The error which is causing the infinite loop seems to be in the >private/readmarkerfile function. In my installation (version 0.9.6) there is no private/readmarkerfile.m file. And the reason why it did not crash immediately was that I had another function (from Aston) with the same name in my path. Do you have another copy of your version of readmarkerfile.m? Thanks a lot for your help. cheers, Thomas From r.oostenveld at FCDONDERS.RU.NL Mon May 9 13:42:16 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 May 2005 13:42:16 +0200 Subject: importing CTF data In-Reply-To: Message-ID: Hi Thomas, Please find the function attached. Robert -------------- next part -------------- A non-text attachment was scrubbed... Name: readmarkerfile.m Type: application/octet-stream Size: 2114 bytes Desc: not available URL: -------------- next part -------------- On 9 May 2005, at 12:50, Thomas Thesen wrote: > Dear Robert, > > Thank you for your suggestion. I think I found out now what the > problem is. > >> The error which is causing the infinite loop seems to be in the >> private/readmarkerfile function. > > In my installation (version 0.9.6) there is no private/readmarkerfile.m > file. And the reason why it did not crash immediately was that I had > another > function (from Aston) with the same name in my path. > > Do you have another copy of your version of readmarkerfile.m? > > Thanks a lot for your help. > > cheers, > Thomas > > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From tnt at PHYSIOL.OX.AC.UK Mon May 9 14:39:42 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Mon, 9 May 2005 14:39:42 +0200 Subject: importing CTF data Message-ID: That worked! Thanks a lot for your help!! Thomas r.oostenveld at FCDONDERS.RU.NL> wrote: >Hi Thomas, > >Please find the function attached. > >Robert > > > >On 9 May 2005, at 12:50, Thomas Thesen wrote: > >> Dear Robert, >> >> Thank you for your suggestion. I think I found out now what the >> problem is. >> >>> The error which is causing the infinite loop seems to be in the >>> private/readmarkerfile function. >> >> In my installation (version 0.9.6) there is no private/readmarkerfile.m >> file. And the reason why it did not crash immediately was that I had >> another >> function (from Aston) with the same name in my path. >> >> Do you have another copy of your version of readmarkerfile.m? >> >> Thanks a lot for your help. >> >> cheers, >> Thomas >> >> >---------------------------------------------------------------------- >Robert Oostenveld, PhD >F.C. Donders Centre for Cognitive Neuroimaging >Radboud University Nijmegen >phone: +31-24-3619695 >http://www.ru.nl/fcdonders/ >---------------------------------------------------------------------- >N.B. Starting from 1 September 2004, the University of Nijmegen has >changed its name to Radboud University Nijmegen. All web- and >email-addresses ending in ".kun.nl" should therefore be changed into >".ru.nl". Please update your address book and links. > From matsuham at NINDS.NIH.GOV Tue May 10 05:22:42 2005 From: matsuham at NINDS.NIH.GOV (Matsuhashi, Masao (NIH/NINDS)) Date: Mon, 9 May 2005 23:22:42 -0400 Subject: sourcestatistics Message-ID: Dear Robert, Thank you for the response. i) Great. Freqstatistics and timelockedstatistics are included in 0.9.6 but not sourcestatistics. I am very much looking forward to the ver 1.0!! ii) I see. I thought the random re-sampling method requires very large number of samplings, but it seems not necessarily to be true, then. Thank you for the idea of concatenating the re-sampled sources. I will try. iii) Precomputed leadfield and very low resolution actually shortened the time pretty much. Thank you. The higher resolution (I want 1 cm pitch) will be necessary only in limited condition... The mentat toolbox sounds very nice. We do not have the Matlab compiler in our system but I'll ask them. Regards, Masao From tnt at PHYSIOL.OX.AC.UK Tue May 10 11:57:54 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Tue, 10 May 2005 11:57:54 +0200 Subject: importing CTF data Message-ID: Dear Robert, When trying to use definetrial.m/preprocessing.m to load in the dataset cfg = []; cfg.dataset = 'sub12_SAM_a_C1_A1.ds'; cfg.trialdef.eventtype = '?' cfg.trialdef.eventtype = 'C1_A1' cfg.trialdef.prestim = 0; % trial starts at time t=0 at the marker cfg.trialdef.poststim = 0.5; % trial ends at t=0.5 sec and adding the line: cfg.trialdef.excludeConditions = {'BAD'}; and running: cfg = definetrial(cfg); raw = preprocessing(cfg); the trials marked 'BAD' are not excluded. However, when doing the same procedure on the FieldTrip workshop data set for example, where the trials are defined through a trigger, the marked trials are removed. Do you have any suggestions on how to exclude 'BAD' trials before they are loaded? Or is my only option to remove these 'BAD' trials after they have been loaded into FieldTrip format? In that case would you advise to remove the appropriate columns (trials) by hand or rather use the artifact rejection option? Thanks a lot. Thomas From r.oostenveld at FCDONDERS.RU.NL Wed May 11 17:54:34 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 11 May 2005 17:54:34 +0200 Subject: importing CTF data In-Reply-To: Message-ID: Hi Thomas On 10 May 2005, at 11:57, Thomas Thesen wrote: > When trying to use definetrial.m/preprocessing.m to load in the dataset > > cfg = []; > cfg.dataset = 'sub12_SAM_a_C1_A1.ds'; > cfg.trialdef.eventtype = '?' > cfg.trialdef.eventtype = 'C1_A1' > cfg.trialdef.prestim = 0; % trial starts at time t=0 at the marker > cfg.trialdef.poststim = 0.5; % trial ends at t=0.5 sec > > and adding the line: > > cfg.trialdef.excludeConditions = {'BAD'}; > > and running: > cfg = definetrial(cfg); > raw = preprocessing(cfg); > > the trials marked 'BAD' are not excluded. However, when doing the same > procedure on the FieldTrip workshop data set for example, where the > trials > are defined through a trigger, the marked trials are removed. The fieldtrip tutorial that you refer to uses an old CTF-format specific trialfunction that is not in the release version. This type of "combinatorial" definition of events (include the trials with marker C1_A1 and exclude the trials with classification BAD) is not supported any more. Furthermore, the underlying code of that tutorial section only worked for a trial-based file format without markers... As you can see, it is quite difficult to combine all the different types of information (trials, triggers, classifications, markers) and especially sinc e every file format has it's own way of dealing with them. Therefore I decided not to support all of them. There is a common way of handling them all, and that is through using the read_fcdc_event function, which results in a well-defined collection of all information which you can to cut up your data into pieces of interest. Using the event structure (i.e. the output from read_fcdc_event), you can create your own trialfunction. Please read the documentaion on read_fcdc_event, try it out on your data, and then read the documentation in definetrial about the custom trialfunction. A short example of a custom trialfunction was given in the clusterstatistics tutorial. > Do you have any suggestions on how to exclude 'BAD' trials before they > are > loaded? Or is my only option to remove these 'BAD' trials after they > have > been loaded into FieldTrip format? In that case would you advise to > remove > the appropriate columns (trials) by hand or rather use the artifact > rejection option? No, you should not remove them afterwards, but you should use the custom trialfunction to prevent them from being read in the beginning. Robert From t.montez at VUMC.NL Thu May 12 15:58:53 2005 From: t.montez at VUMC.NL (Montez, T.) Date: Thu, 12 May 2005 15:58:53 +0200 Subject: megrealign, head models Message-ID: Dear Robert, I can not access the ftp://ftp.fcdonders.nl. I can access ftp://eegmeg2005 at m50-336.azn.nl/ but I do not have permission to copy things there. Can you please tell me another place to put the files? (The average file is just around 6 MB.) I also tried to define the head model manually by: cfg.vol.r = 7.5 cfg.vol.o = [0, 0, 5] and it still does not work, so it seems to not be related to the headmodel file. Meanwhile I got errors with the grandaverages functions (applied to the non aligned files): ??? Index exceeds matrix dimensions. Error in ==> timelockgrandaverage at 85 varargin{i}.avg = varargin{i}.avg(chansel,:); (It works for a reduced number of subjects.) And I run out of memory when I have to load 18 subject, so maybe I have to do the grand average in steps for a higher number of subjects? Thanks for your help, Teresa -----Original Message----- From: Robert Oostenveld [mailto:r.oostenveld at FCDONDERS.RU.NL] Sent: Monday, May 09, 2005 9:10 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] megrealign, head models On 9 May 2005, at 0:17, Teresa Montez wrote: > I get the error message: > > ??? Error using ==> svd > NaN or Inf prevents convergence. There seems to be a problem with your head model, the forward model has a nan or an inf. > - Should I use a local spheres head model? In general you should not use a local spheres model for realignment. I have no idea what is causing the problem. Could you send me a matlab file with an averaged ERF that you want to align and the headmodel file? Please use ftp://ftp.fcdonders.nl and put the files in the directory /pub/inccoming (the directory is one-way-traffic: you cannot see them there after copying, but I can pich them up from there). Robert From darja.osipova at CBRU.HELSINKI.FI Mon May 16 15:46:38 2005 From: darja.osipova at CBRU.HELSINKI.FI (Daria Osipova) Date: Mon, 16 May 2005 16:46:38 +0300 Subject: detrend/partial artefact rejection In-Reply-To: <2955bdedbc3931e9ef4c994bbcf55ddb@fcdonders.ru.nl> Message-ID: Hi, We have a question on detrend in preprocessing.m in relation to partial artifact rejection. As we understand detrend is first applied and then the partical rejection is performed. This results in some subtrials in which for instance a DC offset is present. Would it not be more optimal to perform another detrend prior to the calculation of the wavelet/fourier transforms to avoid boundary effects? Dasha and Ole From Jan.Schoffelen at FCDONDERS.RU.NL Tue May 17 09:38:06 2005 From: Jan.Schoffelen at FCDONDERS.RU.NL (J.M. Schoffelen) Date: Tue, 17 May 2005 09:38:06 +0200 Subject: detrend/partial artefact rejection In-Reply-To: <1116251198.4288a43e5f8db@www.cbru.helsinki.fi> Message-ID: Dear Dasha and Ole, Thanks a lot for this question. Indeed it is very true that in theory detrending prior to the partial rejection of artifacts could lead to little subtrials having a DC-offset. It is also very true that a detrend-operation after the identification of artifacts is helpful to get rid of these potential confounds for your further frequency analysis. This is exactly what is done in preprocessing! The artifact-rejection routines that are provided by fieldtrip, read in the data and does a lot of fancy stuff with it, one of the things is detrending. However, once the data has been read in in one of these routines and the artifacts are detected, the data itself is discarded again. The real reading in of the data takes place after the artifact-detection, and the cfg.detrend = 'yes' option takes proper care that all the separate subtrials will be detrended. At least, that is what it should do... Yours, Jan-M -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Daria Osipova Sent: Monday, May 16, 2005 3:47 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] detrend/partial artefact rejection Hi, We have a question on detrend in preprocessing.m in relation to partial artifact rejection. As we understand detrend is first applied and then the partical rejection is performed. This results in some subtrials in which for instance a DC offset is present. Would it not be more optimal to perform another detrend prior to the calculation of the wavelet/fourier transforms to avoid boundary effects? Dasha and Ole From r.oostenveld at FCDONDERS.RU.NL Tue May 17 14:21:57 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Tue, 17 May 2005 14:21:57 +0200 Subject: megrealign, head models In-Reply-To: <05May12.160201cest.334247@nucleus.azvu.nl> Message-ID: On 12 May 2005, at 15:58, Montez, T. wrote: > Dear Robert, > > I can not access the ftp://ftp.fcdonders.nl. > I can access ftp://eegmeg2005 at m50-336.azn.nl/ but I do not have > permission > to copy things there. No, please read my original mail below. Log in as anonymous and put the stuff in /pub/incoming. You should not use the eegmeg2005 account, that is only for the write protected course pfd material. > ??? Index exceeds matrix dimensions. > > Error in ==> timelockgrandaverage at 85 > varargin{i}.avg = varargin{i}.avg(chansel,:); > > (It works for a reduced number of subjects.) Do some subjects have fewer channels than other subjects? If so, please download the latest fieldtrip release from teh ftp server. > And I run out of memory when I have to load 18 subject, so maybe I > have to > do the grand average in steps for a higher number of subjects? In timelockanalysis you should do keeptrials=no prior to timelockgrandaverage. best, Robert > -----Original Message----- > From: Robert Oostenveld [mailto:r.oostenveld at FCDONDERS.RU.NL] > Sent: Monday, May 09, 2005 9:10 AM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: Re: [FIELDTRIP] megrealign, head models > > > On 9 May 2005, at 0:17, Teresa Montez wrote: > >> I get the error message: >> >> ??? Error using ==> svd >> NaN or Inf prevents convergence. > > There seems to be a problem with your head model, the forward model has > a nan or an inf. > >> - Should I use a local spheres head model? > > In general you should not use a local spheres model for realignment. > > I have no idea what is causing the problem. Could you send me a matlab > file with an averaged ERF that you want to align and the headmodel > file? Please > use ftp://ftp.fcdonders.nl and put the files in the directory > /pub/inccoming (the directory is one-way-traffic: you cannot see them > there after copying, but I can pich them up from there). > > Robert > > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From r.oostenveld at FCDONDERS.RU.NL Wed May 18 10:14:24 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 18 May 2005 10:14:24 +0200 Subject: detrend/partial artefact rejection In-Reply-To: <1116251198.4288a43e5f8db@www.cbru.helsinki.fi> Message-ID: Hi Dasha and Ole You might also want to take a look at the documentation. On http://www2.ru.nl/fcdonders/fieldtrip/, click on "ERP/ERF analysis" or "Frequency analysis", and you will recognise the individual steps that are taken. REJECTARTIFACT doew not work on the preprocessed data (although it looks at the data from the file and applies its own filters, baselinecorrection, etc.), but it only detects the pieces of data which should not be read into Matlab memory and preprocessed by the PREPROCESSING function. Robert On 16 May 2005, at 15:46, Daria Osipova wrote: > Hi, > > We have a question on detrend in preprocessing.m in relation to > partial artifact > rejection. As we understand detrend is first applied and then the > partical > rejection is performed. This results in some subtrials in which for > instance a > DC offset is present. Would it not be more optimal to perform another > detrend > prior to the calculation of the wavelet/fourier transforms to avoid > boundary > effects? > > Dasha and Ole > > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From laura at GBT.TFO.UPM.ES Wed May 18 14:09:54 2005 From: laura at GBT.TFO.UPM.ES (Laura Espino) Date: Wed, 18 May 2005 14:09:54 +0200 Subject: BTI MEG In-Reply-To: <1afbdbf7c342f63b8bf586adccaedb95@fcdonders.ru.nl> Message-ID: Hello, I am working with data obtained from a BTI MEG, 148 channels I want to make some time-frequency analysis. Is it possible to make it through fieldtrip? thanks Laura From stephan.moratti at UNI-KONSTANZ.DE Wed May 18 15:24:06 2005 From: stephan.moratti at UNI-KONSTANZ.DE (Stephan Moratti) Date: Wed, 18 May 2005 15:24:06 +0200 Subject: BTI MEG In-Reply-To: <5.2.0.9.0.20050518140732.00be33e8@pop3.gbt.tfo.upm.es> Message-ID: Hi Laura At 14:09 18.05.2005 +0200, you wrote: >Hello, >I am working with data obtained from a BTI MEG, 148 channels I want to make >some time-frequency analysis. Is it possible to make it through fieldtrip? > >thanks >Laura > I am just working on it and try to get BTI MEG 148 channel data in the field trip data structure. As soon as it works I will let you know. Stephan ----------------------------- Dipl. Psych. Stephan Moratti Dept. of Psychology University of Konstanz P.O Box D25 Phone: +40 (0)7531 882385 Fax: +49 (0)7531 884601 D-78457 Konstanz, Germany e-mail: Stephan.Moratti at uni-konstanz.de http://www.clinical-psychology.uni-konstanz.de/ From D.Talsma at PSY.VU.NL Wed May 18 15:49:08 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Wed, 18 May 2005 15:49:08 +0200 Subject: No subject Message-ID: Hi Everybody, I'm trying to read a ctf, which was collected at the VUMC MEG center in Amsterdam, using fieldtrip. I've tried tried reading the data with as well as without Darren Weber's ctf code. Anyways, I'm following the fieldtrip example code pretty closely (see below) and both attempts have resulted in the error messages attached below stating that a function or variable named coil2_pos is missing. Any help would be appreciated. Cheers, Durk p.s., Since this is my first post to this list, I would like to thank everybody involved in making this stuff work. [matlab script] cfg = []; cfg.dataset = 'PP01_20040716_Eriksen.ds'; cfg.channel = {'MEG' 'STIM'}; cfg.trialdef.excludeConditions = {'BAD'}; cfg.trialdef.includeTrigger = []; cfg.trialdef.excludeTrigger = []; cfg.trialdef.prestim = 0.1; cfg.traildef.poststim = 0.1; dataFIC = preprocessing(cfg); [error messages] Warning: Divide by zero. > In C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p>read_ctf_r es4 at 194 In fieldtrip\private\read_ctf_trigger at 56 In read_fcdc_event at 99 In definetrial at 196 In preprocessing at 239 In tfanalysis at 10 Warning: not adding event information to the output configuration structure > In definetrial at 205 In preprocessing at 239 In tfanalysis at 10 >> >> >> >> >> >> >> >> >> >> Warning: Divide by zero. > In C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p>read_ctf_r es4 at 194 In fieldtrip\private\read_ctf_trigger at 56 In definetrial at 403 In preprocessing at 239 In tfanalysis at 10 ??? Undefined function or variable "coil2_pos". Error in ==> C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p>read_ctf_r es4 at 226 Error in ==> fieldtrip\private\read_ctf_trigger at 56 hdr = read_ctf_res4(headerfile); Error in ==> definetrial at 403 triggerChan = read_ctf_trigger(cfg.dataset); Error in ==> preprocessing at 239 [cfg] = definetrial(cfg); Error in ==> tfanalysis at 10 dataFIC = preprocessing(cfg); From r.oostenveld at FCDONDERS.RU.NL Wed May 18 18:39:32 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 18 May 2005 18:39:32 +0200 Subject: No subject In-Reply-To: Message-ID: Hi Durk, The VUMC MEG system is known to generate a CTF file format that is slightly different from the format that we have in Nijmegen. However, I have succesfully read in data from Amsterdam using Darren's functions, so that should work, except that the sensor position information that originates from Darrens function is not trasferred into Fieldtrip. It would not be difficult to implement that as well, but it is only needed if you want to do source analysis (or MEG realignment). But I also I notice that your Matlab error log refers to some closed-source p-files which are open source by now. Please download the latest version of fieldtrip, maybe that already solves part of your problem. See ftp://m50-336.azn.nl/pub/fieldtrip and fetch version 0.9.6 or the latest daily release. Robert On 18 May 2005, at 15:49, Talsma D wrote: > Hi Everybody, > > I'm trying to read a ctf, which was collected at the VUMC MEG center in > Amsterdam, using fieldtrip. I've tried tried reading the data with as > well as without Darren Weber's ctf code. Anyways, I'm following the > fieldtrip example code pretty closely (see below) and both attempts > have > resulted in the error messages attached below stating that a function > or > variable named coil2_pos is missing. ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From D.Talsma at PSY.VU.NL Thu May 19 13:01:01 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Thu, 19 May 2005 13:01:01 +0200 Subject: No subject Message-ID: Hi Robert, Thanks for your reply. I guess your suggestion of upgrading fieldtrip helped a lot. Using pretty much the same preprocessing script as I used yesterday, it looks like I'm getting through CTF_READ_RES4 twice, but then the script bombs with a message that the function private\read_ctf_res4.p is inaccessible. Could this be something in my setup? I've tried version 0.9.6 as well as the latest snapshot, both giving the same results. Cheers, Durk CTF_READ_RES4 [v 1.15] ...done ( 0.85 sec) CTF_READ_RES4 [v 1.15] ...done ( 0.72 sec) ??? Previously accessible file "C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p" is now inaccessible. Error in ==> fieldtrip\private\read_ctf_trigger at 56 hdr = read_ctf_res4(headerfile); Error in ==> definetrial at 411 triggerChan = read_ctf_trigger(cfg.dataset); Error in ==> preprocessing at 250 [cfg] = definetrial(cfg); Error in ==> tfanalysis at 12 dataFIC = preprocessing(cfg); -----Oorspronkelijk bericht----- Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens Robert Oostenveld Verzonden: woensdag 18 mei 2005 18:40 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: Re: [FIELDTRIP] Hi Durk, The VUMC MEG system is known to generate a CTF file format that is slightly different from the format that we have in Nijmegen. However, I have succesfully read in data from Amsterdam using Darren's functions, so that should work, except that the sensor position information that originates from Darrens function is not trasferred into Fieldtrip. It would not be difficult to implement that as well, but it is only needed if you want to do source analysis (or MEG realignment). But I also I notice that your Matlab error log refers to some closed-source p-files which are open source by now. Please download the latest version of fieldtrip, maybe that already solves part of your problem. See ftp://m50-336.azn.nl/pub/fieldtrip and fetch version 0.9.6 or the latest daily release. Robert On 18 May 2005, at 15:49, Talsma D wrote: > Hi Everybody, > > I'm trying to read a ctf, which was collected at the VUMC MEG center > in Amsterdam, using fieldtrip. I've tried tried reading the data with > as well as without Darren Weber's ctf code. Anyways, I'm following the > fieldtrip example code pretty closely (see below) and both attempts > have resulted in the error messages attached below stating that a > function or > variable named coil2_pos is missing. ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From r.oostenveld at FCDONDERS.RU.NL Thu May 19 19:17:16 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 19 May 2005 19:17:16 +0200 Subject: megrealign, head models In-Reply-To: <001501c55c70$b32b5060$0d00000a@vulcan> Message-ID: Hi Teresa Realignment of MEG data means that you interpolate the data from the helmet location at which it was measured to a template location of the helmet. You have not specified the template location: cfg.template should contain one or multiple CTF datasets. The average helmet location will be computed from those datasets, and that will be used as the template on which the interpolated value is computed. Typically, the average of all subjects in your study is used as the template (i.e. all subjects are aligned to the mean of all subjects). Realigning to an empty template gave this error. I will add an extra check with an easier to understand error message to make this error in teh configuration more clear. Robert Robert >> For MEG data, it is preferable to spatially realign them prior to >> averaging, since the helmet location is different for each subject. > > Using: > > cd (['E:\Data\AD_Project\Patients\' subj{i}]) > load data > cfg=[]; > cfg.channel = {'all','-MLT21','-MLT22' , '-MLC42', '-MLO43', '-MZO02' , > '-MLT41' , '-MZP01' , '-MRT35'}; > cfg.repair = 'yes' > cfg.realign = 'yes' > cfg.hdmfile='E:\Backup_Compaq\Matlab\DIPOLE\singleSphere.hdm'; > cfg.planar = 'yes' > data_planar_nobad=meginterpolate(cfg,data); > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From matsuham at NINDS.NIH.GOV Thu May 19 20:14:35 2005 From: matsuham at NINDS.NIH.GOV (Matsuhashi, Masao (NIH/NINDS)) Date: Thu, 19 May 2005 14:14:35 -0400 Subject: Source coherence Message-ID: Hi Robert, I am posting this message to the mailing list, with the original message added to the bottom. Thank you for your response. 1. Actually, the two frequencies are very close to each other. One is 5 Hz and the other is 4.6 (60/13) Hz. Sampling is 600/sec. I used 6000 trial length so the frequency resolution should be 0.1 Hz, but I am not sure because MTM decreases the frequency resolution in terms of W. The two reference signals are not independent, as they share the common carrier frequency of 60Hz, but when we calculated the coherence sensor-wise, they were separated relatively nicely. 2. I pushed the data to your ftp site. I hope it's working ok. The filename is DICS_Matsuhashi_20050519.zip, containing 4 files. Freq_01_050 and Source_01_050 are from condition 1, foi=5.0 Hz. Freq_01_046 and Source_01_046 are from condition 2, foi=4.6 Hz. Regards, Masao ------------------------------------------------ Masao Matsuhashi, MD, PhD NINDS, NIH Tel: 1-301-594-9139 E-mail: MatsuhaM at ninds.nih.gov ------------------------------------------------ > -----Original Message----- > From: Robert Oostenveld [mailto:r.oostenveld at fcdonders.ru.nl] > Sent: Thursday, May 19, 2005 7:08 AM > To: Matsuhashi, Masao (NIH/NINDS) > Subject: Re: [FIELDTRIP] sourcestatistics > > Hi Masao > > > signal. There are two reference signals simultaneously throughout the > > recording, say, REF1 and REF2, with slightly different center > > frequency, f1 > > and f2. I want to compare the coherence of cortical activity to > > reference > > Just a question of general relevance. How well are the two frequencies > separated, i.e. how far are they apart and what is your frequency > resolution? > > > Is it quite common to see this kind of discrepancy in the result of > > sensor > > level coherence and source level coherence? > > No, I would not expect a very large difference between them. If the > frequencies are far apart, the csd matrix for either f1 or f2 might > contain more noise, affecting the filter (and hence the localization) > more in one frequency than the other. But as I read your mail, I see no > reason to assume that that is the case. > > > If you want to see the data, I will send them to you (frequency data > > were > > about 75M each, source 9M each). > > That would be nice, so that I can see it with my own eyes. Could you > send both to ftp://m50-336.azn.nl/pub/incoming (login as anonymous) and > send me a mail when they are there? The "incoming" directory is a > drop-box, you cannot see what is in there (so you cannot read, but you > can write) which might be a little confusing. > > > PS. If you think it is more appropriate to discuss this in the Mailing > > List, > > I can post this message to the list myself. I didn't do it, because the > > update for DICS may not be available for public access. > > I think that it is interesting to have this discussion on the mailing > list. Then also Jan-Mathijs and Pascal can think along. > > Robert ======================================================================= > -----Original Message----- > From: Matsuhashi, Masao (NIH/NINDS) > Sent: Wednesday, May 18, 2005 3:59 PM > To: 'Robert Oostenveld' > Subject: RE: [FIELDTRIP] sourcestatistics > > Hello Robert, > > I am now using your new DICS code with FieldTrip 0.9.6, and found a > strange phenomenon. I've not yet checked into detail, but would like to > have your idea. > > As you know, I am trying to calculate source coherence to external > reference signal. There are two reference signals simultaneously > throughout the recording, say, REF1 and REF2, with slightly different > center frequency, f1 and f2. I want to compare the coherence of cortical > activity to reference signal REF1 at frequency f1 (condition 1) and the > coherence of cortical activity to REF2 at f2 (condition 2). > The result of freqanalysis showed that coherence at sensor level (such as > MRT31 x REF1) was much larger in condition 1 (up to 0.3) than in condition > 2 (up to 0.05). However, when I calculate the source coherence from the > above result using sourceanalysis, contrary to the above result, condition > 2 showed larger source coherence. Actually, the maximum coherence was > almost the same in both condition (about 0.02), but their distribution > were quite different. The median value of the coherence in condition1 was > 0.001, while in condition 2 it was 0.003. > > Is it quite common to see this kind of discrepancy in the result of sensor > level coherence and source level coherence? > > If you want to see the data, I will send them to you (frequency data were > about 75M each, source 9M each). > > Thanks, > Masao > > > PS. If you think it is more appropriate to discuss this in the Mailing > List, I can post this message to the list myself. I didn't do it, because > the update for DICS may not be available for public access. > From r.oostenveld at FCDONDERS.RU.NL Thu May 19 20:46:24 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 19 May 2005 20:46:24 +0200 Subject: No subject In-Reply-To: Message-ID: Hi Durk, On 19 May 2005, at 13:01, Talsma D wrote: > ??? Previously accessible file > "C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p" is now > inaccessible. > > Error in ==> fieldtrip\private\read_ctf_trigger at 56 > hdr = read_ctf_res4(headerfile); I guess that you did not restart Matlab in between, since in that case Matlab would not have known anything about that p-file. Matlab remembers the location and filename of functions in its cache, and it seems that it got confused by the file disappearing. A "rehash path" command sometimes helps. Or just a restart of Matlab. Robert From D.Talsma at PSY.VU.NL Fri May 20 11:25:12 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Fri, 20 May 2005 11:25:12 +0200 Subject: No subject Message-ID: Hi Robert, Well, I tried a again this morning: Fresh login and restart of matlab, but still no luck. Are there any specific path definition requirements that I should be aware of? I am running this off a 24/7 NT multi-user server. Could that be related to the problem? Again, thanks for your reply. Durk -----Oorspronkelijk bericht----- Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens Robert Oostenveld Verzonden: donderdag 19 mei 2005 20:46 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: Re: [FIELDTRIP] Hi Durk, On 19 May 2005, at 13:01, Talsma D wrote: > ??? Previously accessible file > "C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p" is now > inaccessible. > > Error in ==> fieldtrip\private\read_ctf_trigger at 56 > hdr = read_ctf_res4(headerfile); I guess that you did not restart Matlab in between, since in that case Matlab would not have known anything about that p-file. Matlab remembers the location and filename of functions in its cache, and it seems that it got confused by the file disappearing. A "rehash path" command sometimes helps. Or just a restart of Matlab. Robert From r.oostenveld at FCDONDERS.RU.NL Fri May 20 15:18:00 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 20 May 2005 15:18:00 +0200 Subject: No subject In-Reply-To: Message-ID: Hi Durk, > Well, I tried a again this morning: Fresh login and restart of matlab, > but still no luck. Are there any specific path definition requirements > that I should be aware of? I am running this off a 24/7 NT multi-user > server. Could that be related to the problem? But in your mail you mentioned that the problem was with the p-file, which is not included in the latest FT distrubution any more. If you installed that distribution, and completely removed the previous version, how can the p-file problem then still exist? Could you do a search from within explorer on the file "read_ctf_res4.p"? What is a "24/7 NT multi-user server"? A computer running windows NT on which you are logged in remotely? Which version of NT is running on it, and which Matlab version are you using? Robert > > Again, thanks for your reply. > > Durk > > -----Oorspronkelijk bericht----- > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > Robert Oostenveld > Verzonden: donderdag 19 mei 2005 20:46 > Aan: FIELDTRIP at NIC.SURFNET.NL > Onderwerp: Re: [FIELDTRIP] > > > Hi Durk, > > > On 19 May 2005, at 13:01, Talsma D wrote: > >> ??? Previously accessible file >> "C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p" is now > >> inaccessible. >> >> Error in ==> fieldtrip\private\read_ctf_trigger at 56 >> hdr = read_ctf_res4(headerfile); > > I guess that you did not restart Matlab in between, since in that case > Matlab would not have known anything about that p-file. Matlab > remembers the location and filename of functions in its cache, and it > seems that it got confused by the file disappearing. A "rehash path" > command sometimes helps. Or just a restart of Matlab. > > Robert > > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From D.Talsma at PSY.VU.NL Mon May 23 09:15:20 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Mon, 23 May 2005 09:15:20 +0200 Subject: Path problem fixed Message-ID: Hi Robert, I found the solution to the Matlab path problem. What I needed to do after upgrading the fieltrip version was the following: 1) Remove the Fieldtrip directory from the matlab search path, restart matlab, 2) add the fieldtrip path again. 3) Restart matlab. 4) Et Voila. It works. We've installed fieldtrip in a directory called Fieldtrip, under c:\Matlab704\toolbox\shared and I upgraded fieldtrip by just deleting the old files and and copying the new ones into the old directory. Apparently, I needed to remove and add the path to trigger a rehash of the file cache. This is indeed from a remote server. I'm running it off MS Windows Server 2003, standard edition, using matlab 7.0.4. Right now, I'm back at the "unknown variable" error message again (see below):. At least the error is coming from a human-readable .m file now, so I'll see if I can track down what is happening here. Cheers, Durk ??? Undefined function or variable "coil2_pos". Error in ==> FieldTrip\private\read_ctf_res4 at 233 tmp = coil2_pos - coil1_pos; -----Oorspronkelijk bericht----- Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens Robert Oostenveld Verzonden: vrijdag 20 mei 2005 15:18 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: Re: [FIELDTRIP] Hi Durk, > Well, I tried a again this morning: Fresh login and restart of matlab, > but still no luck. Are there any specific path definition requirements > that I should be aware of? I am running this off a 24/7 NT multi-user > server. Could that be related to the problem? But in your mail you mentioned that the problem was with the p-file, which is not included in the latest FT distrubution any more. If you installed that distribution, and completely removed the previous version, how can the p-file problem then still exist? Could you do a search from within explorer on the file "read_ctf_res4.p"? What is a "24/7 NT multi-user server"? A computer running windows NT on which you are logged in remotely? Which version of NT is running on it, and which Matlab version are you using? Robert From D.Talsma at PSY.VU.NL Mon May 23 10:00:16 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Mon, 23 May 2005 10:00:16 +0200 Subject: Path problem fixed Message-ID: Replying to my own message :-) I think I have a tracked down the cause of the coil2_pos error: It appears the code doesn't iterate through the MEG sensor list, because it does not find any channel names starting with 'M', return 0 valid MEG sensors. In our setup, it appears, there are some leading NULL characters preceding each MEG sensor name. Because of this, the code in read_ctf_res4, around line 119 chops off the channel name altogether. I'm working on a fix. Cheers, Durk -----Oorspronkelijk bericht----- Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens Talsma D Verzonden: maandag 23 mei 2005 9:15 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: [FIELDTRIP] Path problem fixed Hi Robert, I found the solution to the Matlab path problem. What I needed to do after upgrading the fieltrip version was the following: 1) Remove the Fieldtrip directory from the matlab search path, restart matlab, 2) add the fieldtrip path again. 3) Restart matlab. 4) Et Voila. It works. We've installed fieldtrip in a directory called Fieldtrip, under c:\Matlab704\toolbox\shared and I upgraded fieldtrip by just deleting the old files and and copying the new ones into the old directory. Apparently, I needed to remove and add the path to trigger a rehash of the file cache. This is indeed from a remote server. I'm running it off MS Windows Server 2003, standard edition, using matlab 7.0.4. Right now, I'm back at the "unknown variable" error message again (see below):. At least the error is coming from a human-readable .m file now, so I'll see if I can track down what is happening here. Cheers, Durk ??? Undefined function or variable "coil2_pos". Error in ==> FieldTrip\private\read_ctf_res4 at 233 tmp = coil2_pos - coil1_pos; -----Oorspronkelijk bericht----- Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens Robert Oostenveld Verzonden: vrijdag 20 mei 2005 15:18 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: Re: [FIELDTRIP] Hi Durk, > Well, I tried a again this morning: Fresh login and restart of matlab, > but still no luck. Are there any specific path definition requirements > that I should be aware of? I am running this off a 24/7 NT multi-user > server. Could that be related to the problem? But in your mail you mentioned that the problem was with the p-file, which is not included in the latest FT distrubution any more. If you installed that distribution, and completely removed the previous version, how can the p-file problem then still exist? Could you do a search from within explorer on the file "read_ctf_res4.p"? What is a "24/7 NT multi-user server"? A computer running windows NT on which you are logged in remotely? Which version of NT is running on it, and which Matlab version are you using? Robert From D.Talsma at PSY.VU.NL Mon May 23 12:41:37 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Mon, 23 May 2005 12:41:37 +0200 Subject: CTF res4 File format Message-ID: Hi Everybody, Looking through the matlab code, I traced the coil-error back to a res4 file read error somewhat earlier: On line 100, of read_ctf_res4.m, the file pointer is set to position 1839, and only a single byte of data is read from this position. As far as I know, this read should start immediately after the preceding one, and the field is defined as an 32-byte integer. So changig the code to the snippet below fixed the problem. IFAICT, the old code would work, as long as you had run descriptor fields that were shorter than 256 characters. In our case we had a descriptor length of 572 chars. % 2005-05-23: The following statement needed to be commented out % In order to make this file work with the VUMC data (Durk) %fseek(fid,1839,'bof'); % Read in the run description length rd_len=fread(fid,1,'uint32'); % Go to the run description and read it in fseek(fid,1844,'bof'); run_desc=setstr(fread(fid,rd_len,'char')'); Next, changing the above byte read also eliminates the additional requirement of reading one extra short int before reading the filter parameters. In addition, as far as I can tell, reading in the filter definition as 18 8-byte integers is not correct either: Each filter definition should consist of the following fields: frequency (double) class (int) type (int) num_params (short int) Therefore, the real value of num_fparams is stored in the last two byte (17, and 18). Again, the original code would work, as long as you have 255 or less parameters. % read in the filter information % Filter read code modified dd; 2005-05-23 Durk) num_filt=fread(fid,1,'uint16'); %num_filt=temp(1); for fi=0:(num_filt-1), %filt_info=fread(fid,18,'uint8'); filt_freq =fread(fid,1, 'double'); filt_class=fread(fid,1, 'uint32'); filt_type =fread(fid,1, 'uint32'); num_fparm=fread(fid, 1, 'uint16'); %num_fparm=filt_info(18); if num_fparm ~= 0, filt_parm=fread(fid,8*num_fparm,'uint8'); end % if end % for fi Any comments? Cheers Durk From r.oostenveld at FCDONDERS.RU.NL Mon May 23 13:18:18 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 23 May 2005 13:18:18 +0200 Subject: CTF res4 File format In-Reply-To: Message-ID: Hi Durk, On 23 May 2005, at 12:41, Talsma D wrote: > Looking through the matlab code, I traced the coil-error back to a res4 > file read error somewhat earlier: > > On line 100, of read_ctf_res4.m, the file pointer is set to position > 1839, and only a single byte of data is read from this position. As far ... > Any comments? The read_ctf_res4 is legacy code and already has passed through the hands of multiple people. Personally I don't know all the details of the file format. Your suggestions make sense from a technical point of view, and also work fine for our own data. Therefore I will incorporate your suggestions in the code. Thanks for the contribution. Robert PS this evening the change will be in the daily release version, which you can get from the ftp server. From tnt at PHYSIOL.OX.AC.UK Mon May 23 14:58:12 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Mon, 23 May 2005 14:58:12 +0200 Subject: tokenize.m Message-ID: Hi, I attempted to run clusterrandanalysis.m, but it seems that the most current version of FieldTrip (Fieldtrip-20050522) is missing the file tokenize.m which is called by prepare_time_frequ_data.m. Thanks a lot. Thomas --------------------------------------------------- Thomas Thesen University Laboratory of Physiology & Centre for Functional MRI of the Brain University of Oxford Oxford, OX1 3PT United Kingdom Phone: +44(0)1865-272 434 Mobile: +44(0)781-355 6528 Fax: +44(0)1865-272 469 e-mail: thomas.thesen at physiol.oxford.ac.uk http://www.fmrib.ox.ac.uk/~tnt/ --------------------------------------------------- From G.vanElswijk at NEURO.UMCN.NL Mon May 23 15:01:28 2005 From: G.vanElswijk at NEURO.UMCN.NL (Gijs van Elswijk) Date: Mon, 23 May 2005 15:01:28 +0200 Subject: tokenize.m Message-ID: I had the same problem with FREQSTATISTICS in FieldTrip 0.9.6. Copying TOKENIZE.M from the private directory of FieldTrip 0.9.5 solved the problem in my case. Gijs > -----Original Message----- > From: FieldTrip discussion list > [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Thomas Thesen > Sent: maandag 23 mei 2005 14:58 > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] tokenize.m > > Hi, > > I attempted to run clusterrandanalysis.m, but it seems that > the most current version of FieldTrip (Fieldtrip-20050522) is > missing the file tokenize.m which is called by > prepare_time_frequ_data.m. > > Thanks a lot. > > Thomas > > > --------------------------------------------------- > Thomas Thesen > University Laboratory of Physiology > & Centre for Functional MRI of the Brain University of Oxford > Oxford, OX1 3PT United Kingdom > > Phone: +44(0)1865-272 434 > Mobile: +44(0)781-355 6528 > Fax: +44(0)1865-272 469 > e-mail: thomas.thesen at physiol.oxford.ac.uk > http://www.fmrib.ox.ac.uk/~tnt/ > > --------------------------------------------------- > > From r.oostenveld at FCDONDERS.RU.NL Mon May 23 15:45:37 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 23 May 2005 15:45:37 +0200 Subject: tokenize.m In-Reply-To: <4CD85D348E46984983185B911CBF3ED11B6F66@umcnet13.umcn.nl> Message-ID: Hi Thomas and Gijs, It seems that I forgot to put that function into the daily release version. Gijs' workaround will help you out for the moment, and I will make sure that it will be included in the upcoming release versions. Robert On 23 May 2005, at 15:01, Gijs van Elswijk wrote: > I had the same problem with FREQSTATISTICS in FieldTrip 0.9.6. Copying > TOKENIZE.M from the private directory of FieldTrip 0.9.5 solved the > problem in my case. > > Gijs > >> -----Original Message----- >> From: FieldTrip discussion list >> [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Thomas Thesen >> Sent: maandag 23 mei 2005 14:58 >> To: FIELDTRIP at NIC.SURFNET.NL >> Subject: [FIELDTRIP] tokenize.m >> >> Hi, >> >> I attempted to run clusterrandanalysis.m, but it seems that >> the most current version of FieldTrip (Fieldtrip-20050522) is >> missing the file tokenize.m which is called by >> prepare_time_frequ_data.m. >> >> Thanks a lot. >> >> Thomas From r.oostenveld at FCDONDERS.RU.NL Mon May 23 17:03:20 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 23 May 2005 17:03:20 +0200 Subject: Source coherence In-Reply-To: <6B5952376E0A164C81F2F18BF77B3FAB2128B3@NIHCESMLBX.nih.gov> Message-ID: Hi Masao, I had a look at your data, and at the computations that you perfomed for the analysis. Your frequencies of interest are 4.6 and 5Hz, and your time windows are 10 seconds long (right?). That means that you have an intrinsic frequency resolution of 0.1 Hz, which is enough to separate the two frequencies. But looking at your configuration, you seem to be using multitapering with a frequency smoothing of 0.5 Hz. That means that you are using ~5 tapers and that the two frequencies of interest will be smeared into each other. If you want to use multitapering, you should decrease the cfg.tapsmofrq to less than 0.4 (e.g. 0.2). But I doubt whether you should use frequency smoothing here at all, since the frequencies are so low and only separated by a small amount. Better not use multitapering: in freqanalysis do cfg.taper='hanning' instead of the default 'dpss'. Furthermore, I suggest that you also look at the coherence between all MEG channels and the REF21 for the 46Hz and the REF11 for the 50Hz (i.e. the reference channel with which there probably should not be any coherence). You did not include those in your crsspctrm channel combinations. I started by looking at power. There seems to be quite some temporal and low-occipital (neck?) power in both conditions, which might be indicative of artifacts (although EMG typically peaks at much higher frequencies). That is something that you might want to check. -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic5.tiff Type: image/tiff Size: 17310 bytes Desc: not available URL: -------------- next part -------------- The topography of channel level coherence with REF22 looks nicely dipolar for the 46Hz, but with REF21 it does not look so clear for the 50Hz. AT 50Hz, there seems to be a bilateral blob that also extends into the right hemisphere. -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic1.tiff Type: image/tiff Size: 26772 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic2.tiff Type: image/tiff Size: 25120 bytes Desc: not available URL: -------------- next part -------------- I have recomputed the dics source reconstructions (just to be sure that they are done with the latest version). If I look at the 4.6 Hz, it looks nice. If I look at the 5 Hz, there is a relatively high and very sharp blob in the occipital midline, very close to the surface of the scanned volume. Given it's spatial sharpness, I don't trust it too much. But given the bilateral distribution of the coherence with REF21 in that condition, it also does not surprise me that a source at that location could be relatively highly coherent. -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic3.tiff Type: image/tiff Size: 44228 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic4.tiff Type: image/tiff Size: 42180 bytes Desc: not available URL: -------------- next part -------------- So, to me the outcome of the analysis looks more or less like I would expect from this data. I hope that you can further improve your analysis with the hints that I have given. best regards, Robert P.S. I executed the following lines of matlab code: load Freq_01_046 load Freq_01_050 load Source_01_046 load Source_01_050 frqdes46 = freqdescriptives([], freqDICS01_046); frqdes50 = freqdescriptives([], freqDICS01_050); cfg = []; cfg.xparam = 'foi'; cfg.zparam = 'powspctrm'; figure; topoplotER(cfg, frqdes46); figure; topoplotER(cfg, frqdes50); cfg.zparam = 'cohspctrm'; cfg.cohrefchannel = 'REF22' figure; topoplotER(cfg, frqdes46); cfg.cohrefchannel = 'REF21' figure; topoplotER(cfg, frqdes50); cfg = []; cfg = source01_046.cfg; cfg = rmfield(cfg, 'hdmfile'); cfg.vol = source01_046.vol; cfg.method = 'dics'; cfg.refchan = 'REF22'; source46 = sourceanalysis(cfg, freqDICS01_046); cfg.refchan = 'REF21'; source50 = sourceanalysis(cfg, freqDICS01_050); cfg = []; cfg.funparameter = 'avg.coh'; figure; sourceplot(cfg, source46) figure; sourceplot(cfg, source50) On 19 May 2005, at 20:14, Matsuhashi, Masao (NIH/NINDS) wrote: > Hi Robert, > > I am posting this message to the mailing list, with the original > message > added to the bottom. > > Thank you for your response. > > 1. Actually, the two frequencies are very close to each other. One is > 5 Hz > and the other is 4.6 (60/13) Hz. Sampling is 600/sec. I used 6000 trial > length so the frequency resolution should be 0.1 Hz, but I am not sure > because MTM decreases the frequency resolution in terms of W. > The two reference signals are not independent, as they share the common > carrier frequency of 60Hz, but when we calculated the coherence > sensor-wise, > they were separated relatively nicely. > > 2. I pushed the data to your ftp site. I hope it's working ok. > The filename is DICS_Matsuhashi_20050519.zip, containing 4 files. > Freq_01_050 and Source_01_050 are from condition 1, foi=5.0 Hz. > Freq_01_046 > and Source_01_046 are from condition 2, foi=4.6 Hz. > > Regards, > Masao From rajamoni at CCS.FAU.EDU Mon May 23 17:14:42 2005 From: rajamoni at CCS.FAU.EDU (R. Sreenivasan) Date: Mon, 23 May 2005 11:14:42 -0400 Subject: Anatomical names and coordiante system Message-ID: Hi I wish to study DICS with reference to some antomical location (s) - say Fusiform Gyrus Posterior - Right hemisphere. Now, How do I get the cooridate system for this location in order to compute DICS? Thanks, Vasan From tomh at KURAGE.NIMH.NIH.GOV Mon May 23 18:04:25 2005 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Mon, 23 May 2005 12:04:25 -0400 Subject: Anatomical names and coordiante system In-Reply-To: <003201c55faa$25a0ee70$061e5b83@vasan> Message-ID: R. Sreenivasan wrote: > I wish to study DICS with reference to some antomical location (s) - say > Fusiform Gyrus Posterior - Right hemisphere. Now, How do I get the > cooridate system for this location in order to compute DICS? You could use AFNI to look at your anatomical dataset, and it'll tell you the coordinates in either original or Talairach space. If you have a Talairached anatomical volume, you can display the fusiform using the Talairach Atlas (turn on atlas colors with a right click), and then you can convert to original coordinates. CTF datasets use PRI coordinates. -- Dr. Tom Holroyd "A man of genius makes no mistakes. His errors are volitional and are the portals of discovery." -- James Joyce From tomh at KURAGE.NIMH.NIH.GOV Mon May 23 21:26:25 2005 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Mon, 23 May 2005 15:26:25 -0400 Subject: CTF res4 File format In-Reply-To: Message-ID: > Looking through the matlab code, I traced the coil-error back to a res4 > file read error somewhat earlier: > > Any comments? Hmm, I just got the error: `coil2_pos' undefined near line 233 column 7 myself, but in my case it's much more easily explained: I had created a dataset using newDs2 that does not have _any_ MEG channels! It only contains virtual channels. So there are no gradiometers.... By the way, the ctf2matlab package from our website: http://kurage.nimh.nih.gov/meglab/Meg/Ctf2matlab reads this dataset properly, and I noticed that recent versions of Fieldtrip can use it (that's the ctf_read_res4 function). Right now it only uses the ctf2matlab verions if the read_ctf_res4 function fails and haseegsf is set (see the try code in read_fcdc_header.m). But you could switch it around to try the other one first. -- Dr. Tom Holroyd "A man of genius makes no mistakes. His errors are volitional and are the portals of discovery." -- James Joyce From tnt at PHYSIOL.OX.AC.UK Wed May 25 10:52:59 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Wed, 25 May 2005 10:52:59 +0200 Subject: data conversion Message-ID: Hi. I have 3-D spectrograms (time x frequency x amplitude) for different conditions and multiple subjects which were generated outside FieldTrip. I would like to compare them statistically using the paired t-test in CLUSTERRANDANALYS with correction for multiple comparisons. I have attempted to transfer these data into a format which FieldTrip should be able to read. However, it doesn't seem to work correctly. Below are the steps I have made during the transformation including a link to the files that were used or were generated in the process. Examples of the input and output data of various steps can be found here: http://www.physiol.ox.ac.uk/~tnt/specs/ Step 1: (converting data structure of individual subjects into FieldTrip format, one .mat file per condition per subject) %%%%%%%%%%%%%%%%%%%%%%%%%%%%% subj = { 'C1_A1/Average_L_A1_sub01_a_C1_A1' % example: 'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web 'C1_A1/Average_L_A1_sub02_a_C1_A1' 'C1_A1/Average_L_A1_sub04_a_C1_A1' 'C1_A1/Average_L_A1_sub05_a_C1_A1' 'C1_A1/Average_L_A1_sub07_a_C1_A1' 'C1_A1/Average_L_A1_sub07_b_C1_A1' 'C1_A1/Average_L_A1_sub09_a_C1_A1' 'C1_A1/Average_L_A1_sub10_a_C1_A1' 'C1_A1/Average_L_A1_sub10_b_C1_A1' 'C1_A1/Average_L_A1_sub11_a_C1_A1' 'C1_A1/Average_L_A1_sub11_b_C1_A1' 'C1_A1/Average_L_A1_sub12_a_C1_A1' 'C1_A1/Average_L_A1_sub12_b_C1_A1'; }; load fieldtrip_example1 % load template of data structure used by FieldTrip (example: 'fieldtrip_example1.mat' on the web ) Nsubj = 13; for i=1:Nsubj dataset = ['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/Spectrograms/' subj{i} '.mat']; outputname = ['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/fieldtrip_analysis/specs/' subj{i} '.mat']; load (dataset); % a sample dataset: 'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web tfr = oldtfr; %tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2)); % if htis line is used, 151 channels are created tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); % if this line is used 1 channel is created tfr.powspctrm(1,:,:) = data.specgr.data; % 3D put spectogram data into channel 1 of FieldTrip structure tfr.foi = data.F; % frequency information for y-axis tfr.toi= data.T; % time information for x-axis save (outputname, 'tfr'); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% This produces 'output_example_Step1_sub12_a_C1_A1.mat' on the web. In the next step I tried to convert all spectrograms from individual subjects into one data structure carrying the data for all subjects within one structure (this was done separately for two conditions): Step 2: (moving all subject data into a group structure, one for each condition) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% load fieldtrip_example1.mat; % example: 'fieldtrip_example1.mat' on the web group = oldtfr; group.sgn = oldtfr.label; group.powspctrm = []; files = dir('Average_L_A1_sub*mat'); % all the files created in step 1 above, e.g. 'output_example_Step1_sub12_a_C1_A1.mat' for i = 1:length(files) load (files(i).name); group.powspctrm(i,:,:,:) = tfr.powspctrm; % load subject data end group.toi=tfr.toi; group.foi=tfr.foi; group.dimord = 'rpt_sgn_frq_tim'; save ('group_Spec_L_A1.mat', 'group') %%%%%%%%%%%%%%%%%%%%%%%%%% creates 'output_Step2_group_Spec_L_A1.mat' on the web. When a matrix with 151 channels is created in step 1 by: tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2) the files become too large for the machine to handle at the group level (~500Mb each x 13 sets). Therefore, I proceed to the next step with a matrix of one channel tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); Step 3: (comparing two conditions from 13 subjects) %%%%%%%%%%%%%%%%%%%%%%%%% cfg = []; cfg.statistic = 'depsamplesT'; cfg.alphathresh = 0.05; cfg.makeclusters = 'yes'; cfg.minnbchan = 2; cfg.clusterteststat = 'maxsum'; cfg.onetwo = 'twosided'; cfg.alpha = 0.05; cfg.nranddraws = 100; cfg.channel = {'MEG'}; cfg.latency = [0 1]; [clusrand] = clusterrandanalysis (cfg, group_A, group_B); %%%%%%%%%%%%%%%%%%%%%%%%%% Then the following error message appears: >> [clusrand] = clusterrandanalysis (cfg, group_C1, group_C4); Selecting and formatting the data. selected 151 channels selected 626 time bins selected 159 frequency bins ??? Index exceeds matrix dimensions. Error in ==> /home/magnum/tnt//Fieldtrip/fieldtrip-20050522/private/prepare_timefreq_data.m On line 360 ==> dat{c} = avgoverdim(varargin{c}.dat(:, chansel, freqsel, timesel), avgdim); Error in ==> /home/magnum/tnt//Fieldtrip/fieldtrip-20050522/clusterrandanalysis.m On line 267 ==> [cfg,data]=prepare_timefreq_data(cfg, varargin{1:Nvarargin}); >> %%%%%%%%%%%%%% Thanks a lot in advance for your help. Thomas From tnt at PHYSIOL.OX.AC.UK Wed May 25 10:54:08 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Wed, 25 May 2005 10:54:08 +0200 Subject: data conversion Message-ID: Hi Thomas I did not look in full detail at the mail, but just browsed over it and noticed something that may be the cause: It states "selected 151 channels", but you mentioned that you have only one channel. In selecting a single channel to reduce the amount of data, did you also make the corresponding change in freq.label? Robert On Wed, 25 May 2005 10:52:59 +0200, Thomas Thesen wrote: >Hi. > >I have 3-D spectrograms (time x frequency x amplitude) for different >conditions and multiple subjects which were generated outside FieldTrip. I >would like to compare them statistically using the paired t-test in >CLUSTERRANDANALYS with correction for multiple comparisons. I have attempted >to transfer these data into a format which FieldTrip should be able to read. >However, it doesn't seem to work correctly. >Below are the steps I have made during the transformation including a link >to the files that were used or were generated in the process. > >Examples of the input and output data of various steps can be found here: >http://www.physiol.ox.ac.uk/~tnt/specs/ > > >Step 1: >(converting data structure of individual subjects into FieldTrip format, one >.mat file per condition per subject) >%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >subj = { >'C1_A1/Average_L_A1_sub01_a_C1_A1' % example: >'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web >'C1_A1/Average_L_A1_sub02_a_C1_A1' >'C1_A1/Average_L_A1_sub04_a_C1_A1' >'C1_A1/Average_L_A1_sub05_a_C1_A1' >'C1_A1/Average_L_A1_sub07_a_C1_A1' >'C1_A1/Average_L_A1_sub07_b_C1_A1' >'C1_A1/Average_L_A1_sub09_a_C1_A1' >'C1_A1/Average_L_A1_sub10_a_C1_A1' >'C1_A1/Average_L_A1_sub10_b_C1_A1' >'C1_A1/Average_L_A1_sub11_a_C1_A1' >'C1_A1/Average_L_A1_sub11_b_C1_A1' >'C1_A1/Average_L_A1_sub12_a_C1_A1' >'C1_A1/Average_L_A1_sub12_b_C1_A1'; >}; >load fieldtrip_example1 % load template of data structure used by >FieldTrip (example: 'fieldtrip_example1.mat' on the web ) > >Nsubj = 13; >for i=1:Nsubj > dataset = >['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/Spectrograms/' >subj{i} '.mat']; > outputname = >['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/fieldtrip_analysis/specs/' >subj{i} '.mat']; > load (dataset); % a sample dataset: >'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web > tfr = oldtfr; > %tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2)); % if htis >line is used, 151 channels are created > tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); % if this line is >used 1 channel is created > tfr.powspctrm(1,:,:) = data.specgr.data; % 3D >put spectogram data into channel 1 of FieldTrip structure > tfr.foi = data.F; % frequency information for y-axis > tfr.toi= data.T; % time information for x-axis > save (outputname, 'tfr'); >end > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >This produces 'output_example_Step1_sub12_a_C1_A1.mat' on the web. > >In the next step I tried to convert all spectrograms from individual >subjects into one data structure carrying the data for all subjects within >one structure (this was done separately for two conditions): > > >Step 2: >(moving all subject data into a group structure, one for each condition) >%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > >load fieldtrip_example1.mat; % example: 'fieldtrip_example1.mat' on the web >group = oldtfr; >group.sgn = oldtfr.label; >group.powspctrm = []; > >files = dir('Average_L_A1_sub*mat'); % all the files created in step 1 >above, e.g. 'output_example_Step1_sub12_a_C1_A1.mat' > >for i = 1:length(files) > load (files(i).name); > group.powspctrm(i,:,:,:) = tfr.powspctrm; % load subject data >end >group.toi=tfr.toi; >group.foi=tfr.foi; >group.dimord = 'rpt_sgn_frq_tim'; >save ('group_Spec_L_A1.mat', 'group') >%%%%%%%%%%%%%%%%%%%%%%%%%% > >creates 'output_Step2_group_Spec_L_A1.mat' on the web. > >When a matrix with 151 channels is created in step 1 by: >tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2) > > the files become too large for the machine to handle at the group level >(~500Mb each x 13 sets). > >Therefore, I proceed to the next step with a matrix of one channel >tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); > > > >Step 3: >(comparing two conditions from 13 subjects) >%%%%%%%%%%%%%%%%%%%%%%%%% >cfg = []; >cfg.statistic = 'depsamplesT'; >cfg.alphathresh = 0.05; >cfg.makeclusters = 'yes'; >cfg.minnbchan = 2; >cfg.clusterteststat = 'maxsum'; >cfg.onetwo = 'twosided'; >cfg.alpha = 0.05; >cfg.nranddraws = 100; >cfg.channel = {'MEG'}; >cfg.latency = [0 1]; > >[clusrand] = clusterrandanalysis (cfg, group_A, group_B); > >%%%%%%%%%%%%%%%%%%%%%%%%%% > >Then the following error message appears: > >>> [clusrand] = clusterrandanalysis (cfg, group_C1, group_C4); >Selecting and formatting the data. >selected 151 channels >selected 626 time bins >selected 159 frequency bins >??? Index exceeds matrix dimensions. > >Error in ==> >/home/magnum/tnt//Fieldtrip/fieldtrip-20050522/private/prepare_timefreq_data.m >On line 360 ==> dat{c} = avgoverdim(varargin{c}.dat(:, chansel, >freqsel, timesel), avgdim); > >Error in ==> >/home/magnum/tnt//Fieldtrip/fieldtrip-20050522/clusterrandanalysis.m >On line 267 ==> [cfg,data]=prepare_timefreq_data(cfg, >varargin{1:Nvarargin}); > >> > >%%%%%%%%%%%%%% > > >Thanks a lot in advance for your help. > >Thomas From tnt at PHYSIOL.OX.AC.UK Wed May 25 11:18:05 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Wed, 25 May 2005 11:18:05 +0200 Subject: data conversion Message-ID: Dear Robert, Thank you for your comment. When running CLUSTERRANDANALYSIS I have the following data structures that feed into the statistical analysis: group_C1 = label: {151x1 cell} dimord: 'rpt_sgn_frq_tim' powspctrm: [4-D double] foi: [1x159 double] toi: [1x2187 double] cfg: [1x1 struct] grad: [1x1 struct] sgn: {151x1 cell} As you said "group_C4.sgn" and "group_C4.label" indicate 151 channels, whereas the data in fact has only 1. I've tried the following: group_C4.sgn = ['spec'] group_C4.label = ['spec'] and group_C4.sgn={'spec'} group_C4.label={'spec'} but no success. Do you have any suggestion? Thanks a lot, Thomas On Wed, 25 May 2005 10:54:08 +0200, Thomas Thesen wrote: >Hi Thomas > > >I did not look in full detail at the mail, but just browsed over it and >noticed something that may be the cause: It states "selected 151 >channels", but you mentioned that you have only one channel. In >selecting a single channel to reduce the amount of data, did you also >make the corresponding change in freq.label? > > >Robert > >On Wed, 25 May 2005 10:52:59 +0200, Thomas Thesen wrote: > >>Hi. >> >>I have 3-D spectrograms (time x frequency x amplitude) for different >>conditions and multiple subjects which were generated outside FieldTrip. I >>would like to compare them statistically using the paired t-test in >>CLUSTERRANDANALYS with correction for multiple comparisons. I have attempted >>to transfer these data into a format which FieldTrip should be able to read. >>However, it doesn't seem to work correctly. >>Below are the steps I have made during the transformation including a link >>to the files that were used or were generated in the process. >> >>Examples of the input and output data of various steps can be found here: >>http://www.physiol.ox.ac.uk/~tnt/specs/ >> >> >>Step 1: >>(converting data structure of individual subjects into FieldTrip format, one >>.mat file per condition per subject) >>%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>subj = { >>'C1_A1/Average_L_A1_sub01_a_C1_A1' % example: >>'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web >>'C1_A1/Average_L_A1_sub02_a_C1_A1' >>'C1_A1/Average_L_A1_sub04_a_C1_A1' >>'C1_A1/Average_L_A1_sub05_a_C1_A1' >>'C1_A1/Average_L_A1_sub07_a_C1_A1' >>'C1_A1/Average_L_A1_sub07_b_C1_A1' >>'C1_A1/Average_L_A1_sub09_a_C1_A1' >>'C1_A1/Average_L_A1_sub10_a_C1_A1' >>'C1_A1/Average_L_A1_sub10_b_C1_A1' >>'C1_A1/Average_L_A1_sub11_a_C1_A1' >>'C1_A1/Average_L_A1_sub11_b_C1_A1' >>'C1_A1/Average_L_A1_sub12_a_C1_A1' >>'C1_A1/Average_L_A1_sub12_b_C1_A1'; >>}; >>load fieldtrip_example1 % load template of data structure used by >>FieldTrip (example: 'fieldtrip_example1.mat' on the web ) >> >>Nsubj = 13; >>for i=1:Nsubj >> dataset = >>['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/Spectrograms/' >>subj{i} '.mat']; >> outputname = >>['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/fieldtrip_analysis/specs/' >>subj{i} '.mat']; >> load (dataset); % a sample dataset: >>'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web >> tfr = oldtfr; >> %tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2)); % if htis >>line is used, 151 channels are created >> tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); % if this line is >>used 1 channel is created >> tfr.powspctrm(1,:,:) = data.specgr.data; % 3D >>put spectogram data into channel 1 of FieldTrip structure >> tfr.foi = data.F; % frequency information for y-axis >> tfr.toi= data.T; % time information for x-axis >> save (outputname, 'tfr'); >>end >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>This produces 'output_example_Step1_sub12_a_C1_A1.mat' on the web. >> >>In the next step I tried to convert all spectrograms from individual >>subjects into one data structure carrying the data for all subjects within >>one structure (this was done separately for two conditions): >> >> >>Step 2: >>(moving all subject data into a group structure, one for each condition) >>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >>load fieldtrip_example1.mat; % example: 'fieldtrip_example1.mat' on the web >>group = oldtfr; >>group.sgn = oldtfr.label; >>group.powspctrm = []; >> >>files = dir('Average_L_A1_sub*mat'); % all the files created in step 1 >>above, e.g. 'output_example_Step1_sub12_a_C1_A1.mat' >> >>for i = 1:length(files) >> load (files(i).name); >> group.powspctrm(i,:,:,:) = tfr.powspctrm; % load subject data >>end >>group.toi=tfr.toi; >>group.foi=tfr.foi; >>group.dimord = 'rpt_sgn_frq_tim'; >>save ('group_Spec_L_A1.mat', 'group') >>%%%%%%%%%%%%%%%%%%%%%%%%%% >> >>creates 'output_Step2_group_Spec_L_A1.mat' on the web. >> >>When a matrix with 151 channels is created in step 1 by: >>tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2) >> >> the files become too large for the machine to handle at the group level >>(~500Mb each x 13 sets). >> >>Therefore, I proceed to the next step with a matrix of one channel >>tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); >> >> >> >>Step 3: >>(comparing two conditions from 13 subjects) >>%%%%%%%%%%%%%%%%%%%%%%%%% >>cfg = []; >>cfg.statistic = 'depsamplesT'; >>cfg.alphathresh = 0.05; >>cfg.makeclusters = 'yes'; >>cfg.minnbchan = 2; >>cfg.clusterteststat = 'maxsum'; >>cfg.onetwo = 'twosided'; >>cfg.alpha = 0.05; >>cfg.nranddraws = 100; >>cfg.channel = {'MEG'}; >>cfg.latency = [0 1]; >> >>[clusrand] = clusterrandanalysis (cfg, group_A, group_B); >> >>%%%%%%%%%%%%%%%%%%%%%%%%%% >> >>Then the following error message appears: >> >>>> [clusrand] = clusterrandanalysis (cfg, group_C1, group_C4); >>Selecting and formatting the data. >>selected 151 channels >>selected 626 time bins >>selected 159 frequency bins >>??? Index exceeds matrix dimensions. >> >>Error in ==> >>/home/magnum/tnt//Fieldtrip/fieldtrip-20050522/private/prepare_timefreq_data.m >>On line 360 ==> dat{c} = avgoverdim(varargin{c}.dat(:, chansel, >>freqsel, timesel), avgdim); >> >>Error in ==> >>/home/magnum/tnt//Fieldtrip/fieldtrip-20050522/clusterrandanalysis.m >>On line 267 ==> [cfg,data]=prepare_timefreq_data(cfg, >>varargin{1:Nvarargin}); >> >> >> >>%%%%%%%%%%%%%% >> >> >>Thanks a lot in advance for your help. >> >>Thomas From r.oostenveld at FCDONDERS.RU.NL Wed May 25 22:25:40 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 25 May 2005 22:25:40 +0200 Subject: data conversion In-Reply-To: Message-ID: On 25 May 2005, at 11:18, Thomas Thesen wrote: > group_C4.sgn={'spec'} > group_C4.label={'spec'} > > but no success. Do you have any suggestion? Could you be more specific? Robert From matsuham at NINDS.NIH.GOV Wed May 25 23:35:09 2005 From: matsuham at NINDS.NIH.GOV (Matsuhashi, Masao (NIH/NINDS)) Date: Wed, 25 May 2005 17:35:09 -0400 Subject: Source coherence Message-ID: Hi Robert, Thank you for your precious advice. I am still working to check the points you indicated. (At this moment, the topoplotER stopped working with reshaped freqdescriptive-ed data, but I will figure it out...) As regards the low-occipital low frequency noise, I thought that as long as such activity was not correlated with the reference signal it would not affect the coherence analysis very much (only that it might lower the coherence value in some channels). How do you think it will affect the source coherence? Masao ------------------------------------------------ Masao Matsuhashi, MD, PhD NINDS, NIH Tel: 1-301-594-9139 E-mail: MatsuhaM at ninds.nih.gov ------------------------------------------------ From sanja at UNM.EDU Thu May 26 03:13:18 2005 From: sanja at UNM.EDU (Sanja Kovacevic) Date: Thu, 26 May 2005 03:13:18 +0200 Subject: 275ch CTF stimulus channel and new CTF data format Message-ID: Hi Robert, Your answer helped a lot but there was also another problem. My stimulus channel “on” states were not 9, but 5 or 6 samples long. That's why I was getting all zeros for both frontpanel and backpanel. I adjusted trigshift (line 60) to 0 as the trigger values were either 0 or the predetermined on values. For all of my datasets I've looked at so far, there is no rising time for the stimulus channel. So, I guess this is another (nice) change in the new CTF 275 acquisition program... On another note, I ran some timefrequency analyses on the sensor level and I wanted to plot the data using multiplotTFR. I'd like to use the information from the header when plotting the sensors. However, if I use the gradiometer structure created with read_ctf_res4, i.e. cfg.layout = hdr.grad, I get an error message ??? Undefined command/function 'dist'. Error in ==> createlayout at 93 d = dist(prj'); You mentioned in one of your previous replies that sensor position and information is not being read correctly for the new CTF 275 datasets. (BTW, what tells you that read_fcdc_header does not read it correctly?) If I use ctf_read_res4 (ctf2matlab toolbox as mentioned by Tom Holroyd) I should be getting correct gradiometer information (right?).Well. I tried it both ways and I get identical position information with read_ctf_res4 (fcdc) and ctf_read_res4 (nimh). Orientation information differs in that that nimh code stores only first coil orientation, whereas the fcdc code stores both coil orientations. Both codes adjust for the possibility that sometimes coil orientations stored in res4 file may be pointing toward center. It is still not clear to me what happens later with orientation information and what effect of using only first coil orientation would be... What I would ultimately like to do is to run time frequency analysis (on the sensor level first, but also on the virtual sensor level) for each subject in the group and be able to compare the results using some statistical approach. However, first I need to establish whether the data is correctly read. I appreciate your and any other fieldtriper help, Sanja On Fri, 6 May 2005 09:21:48 +0200, Robert Oostenveld wrote: >Hi Sanja, > ><--let's move our email exchange over towards the discussion list--> > >On 5 May 2005, at 22:50, Sanja Kovacevic wrote: > >> Thank you for helping me with this. I changed the filetype and >> read_ctf_res.m files as you suggested, and I was able to read in the >> data, however now I got problem with definetrial.m. Actually, I think >> the problem is with read_ctf_trigger as the 275 CTF dataset does not >> have a channel named 'STIM' but 'UPPT001' (line 63 in >> read_ctf_trigger). That was easy to fix by replacing STIM with >> UPPT001. >> >> However, I don't understand why you use (line 70 and 71 in >> read_ctf_trigger.m) >> >> bpstim = fix(stim / 2^16); >> fpstim = double(bitand(uint32(stim), 2^16-1)); > >WHen I started at the donders and implemented this, I was told that our >151 ch system has a "frontpanel" and a "backpanel". I never looked very >acurately at the electronics cabinet and all the cables that go into >it, but I guess that they refer to the way in which the cabinet is >placed in our lab. Somehow, the CTF system's own triggers are put on >the frontpanel, and the triggers that are generated on the stimulus PC >are put on the backpanel. Since people write their stimulus programs on >the presentations pc, and define/write trigger values in the 16 >bit-range on that computer. They appear in the higher 16 bits of the 32 >bit STIM channel, which is confusing since then the values don't match >the ones on the presentation computer. Therefore the 16 lowest and 16 >highest bits are separated and treated separately. On line 70, the >highest 16 bits are shifted downward by 16 bits (i.e. divide by 2^16). >On line 71, the highest 16 bits are masked away, keeping only the >lowest 16 bits. > >> The trigger values on our CTF system use lower 8 bits, i.e. possible >> values of the triggers are from 0 to 255. I am now quite confused with >> what happens to my trigger values. The bottom line is that I have all >> zeroes for backpanel and frontpanel. > >I think that you should look at the so called "frontpanel" triggers >(whose bits are not shifted). > >> BTW, could you give me or point to an example of a user specified >> trialfun that would include trials where trigger with value of 10 ir >> trigger with value of 138 occurs? > >You mean either a 10 or a 138? Just from my head: > >function [trl] = trigger138(cfg) >hdr = read_fcdc_header(cfg.dataset); >event = read_fcdc_event(cfg.dataset); >trl = []; >prestim = 0.1; >poststim = 0.5; >for i=1:length(event) > if strcmp(event(i).type, 'frontpannel trigger') > if (event(i).value==10) | (event(i).value==138) > % found trigger of interest > trl(end+1,1) = event(i).sample - prestim*hds.Fs; > trl(end ,2) = event(i).sample + poststim*hds.Fs; > trl(end ,3) = - prestim*hds.Fs; > end > end >end > >You could put prestim and poststim (time in seconds) in the cfg >structure, to keep the function more flexible. From this example, you >caneasily to make a conditional function, i.e. find the sample at >which a trigger 138 occurred and which was preceded by a trigger 10. > >Alternatively, you can also use the standard code, i.e. without a >custom trialfunction, to achieve the same. Try this: > >cfg = []; >cfg.dataset = 'something.ds'; >cfg.trialdef.eventtype = 'frontpannel trigger'; >cfg.trialdef.eventvalue = [10 138]; >cfg.trialdef.prestim = 0.1; >cfg.trialdef.poststim = 0.5; >cfg = definetrial(cfg); > >best regards, >Robert From r.oostenveld at FCDONDERS.RU.NL Thu May 26 09:54:05 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 26 May 2005 09:54:05 +0200 Subject: 275ch CTF stimulus channel and new CTF data format In-Reply-To: Message-ID: Hi Sanja, On 26 May 2005, at 3:13, Sanja Kovacevic wrote: > Your answer helped a lot but there was also another problem. My > stimulus > channel “on” states were not 9, but 5 or 6 samples long. That's why I > was > getting all zeros for both frontpanel and backpanel. I adjusted > trigshift > (line 60) to 0 as the trigger values were either 0 or the > predetermined on This is something that was noted by Tom Holroyd as well. Furthermore, according to him the 275ch systems can have trigger channels that are not called 'STIM' (which is what our read_ctf_trigger assumes). The latest version of fieldtrip has an addition to read_fcdc_event, which automatically detects and reads all stimulus channels, does a flank detection and returns the value with no timeshift. The events will have the name 'STIM', 'UTGR001' etc. Thhe 'bakckpanel' and 'frontpanel' trigger with a 9 sample shift at 1200 Hz will remain to be supported for Donders people. I suggest that you have a look at the new code (which again only works sofar for the fcdc importer, but that should be easy to fix). > values. For all of my datasets I've looked at so far, there is no > rising > time for the stimulus channel. So, I guess this is another (nice) > change in > the new CTF 275 acquisition program... The slow rising trigger value might be due to our presentation computer and not to the CTF hardware itself. I am not sure though, I just knows that it is a feature of our MEG setup. > On another note, I ran some timefrequency analyses on the sensor level > and I > wanted to plot the data using multiplotTFR. I'd like to use the > information > from the header when plotting the sensors. However, if I use the > gradiometer structure created with read_ctf_res4, i.e. cfg.layout = > hdr.grad, I get an error message > ??? Undefined command/function 'dist'. > Error in ==> createlayout at 93 > d = dist(prj'); I just checked, dist turns out to be a function from the neural networks toolbox. >> which dist /opt/matlab-7.0.1/toolbox/nnet/nnet/dist.m There is no reason to use it, I will add my own implementation of dist which replaces the NN functionality. See attached file. -------------- next part -------------- A non-text attachment was scrubbed... Name: dist.m Type: application/octet-stream Size: 609 bytes Desc: not available URL: -------------- next part -------------- > You mentioned in one of your previous replies that sensor position and > information is not being read correctly for the new CTF 275 datasets. > (BTW, > what tells you that read_fcdc_header does not read it correctly?) I don't know actually. The header information from the nimh and the fcdc res4 importers are structured differently. The read_fcdc_wrapper around it does not shape all elements of the nimh hearer into the same format, and in particular the grad information is not assigned. SO I guess that "incorrect" only means incomplete. > If I use > ctf_read_res4 (ctf2matlab toolbox as mentioned by Tom Holroyd) I > should be > getting correct gradiometer information (right?). yes, I have no reason to assume that it is not correct. It is just shaped into a different structure. B.t.w. I recall that the ctf header contains the informatino twice, once in dewar coordinates and once in head coordinates. > It is still not clear to me what happens later with orientation > information > and what effect of using only first coil orientation would be... MEG data is the magnetic flux through the coil. If the coil is oriented in the opposite way but the field is the same, the flux is the opposite. However, somewhere in the reading routine there is a flag being used to indicate that the field has to be inverted, i.e. the MEG data is always represented as outgoing flux. That means that the forward computation also has to compute the outward flux for a given coil, and that in turn means that teh coil has to be oriented outwards (using the right hand rule) > What I > would ultimately like to do is to run time frequency analysis (on the > sensor > level first, but also on the virtual sensor level) for each subject in > the > group and be able to compare the results using some statistical > approach. For sensor level analysis you do'nt have to worry about the gradiometer orientations. If you compute virtual channels with SAM, you also don't have to worry. If you want to use the fieldtrip beamformer, the grad-structure should be correct. Robert From r.oostenveld at FCDONDERS.RU.NL Thu May 26 09:57:48 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 26 May 2005 09:57:48 +0200 Subject: Source coherence In-Reply-To: <6B5952376E0A164C81F2F18BF77B3FAB2ECDD3@NIHCESMLBX.nih.gov> Message-ID: Hi Masao, On 25 May 2005, at 23:35, Matsuhashi, Masao (NIH/NINDS) wrote: > As regards the low-occipital low frequency noise, I thought that as > long as > such activity was not correlated with the reference signal it would not > affect the coherence analysis very much (only that it might lower the > coherence value in some channels). How do you think it will affect the > source coherence? If present in the spatial structure of the cross-spectral density matrix, it affects the spatial filters. And hence it will affect the estimate of the source cross-spectral density. Since coherence is source CSD normalised by power, ideally it would not affect the source coherence. But I still would not be too confident about it, since the influence of artifacts on the filter can be difficult to predict. Robert From tnt at PHYSIOL.OX.AC.UK Thu May 26 10:52:09 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Thu, 26 May 2005 10:52:09 +0200 Subject: data conversion Message-ID: Hi Robert, You said: >It states "selected 151 >channels", but you mentioned that you have only one channel. In >selecting a single channel to reduce the amount of data, did you also >make the corresponding change in freq.label? How exactly do make the corresponding change to tell CLUSTERRANDANALYSIS that there is only one frequency channel to be analyzed? I assume I change something in the data structure, not in the cfg. setup, right? I tried to change group_C4.sgn={'spec'} group_C4.label={'spec'} to have single channel name entries, but that didn't do the job. Thanks a lot, Thomas On Wed, 25 May 2005 22:25:40 +0200, Robert Oostenveld wrote: >On 25 May 2005, at 11:18, Thomas Thesen wrote: > >> group_C4.sgn={'spec'} >> group_C4.label={'spec'} >> >> but no success. Do you have any suggestion? > >Could you be more specific? > >Robert> From maris at NICI.RU.NL Thu May 26 11:03:16 2005 From: maris at NICI.RU.NL (Eric Maris) Date: Thu, 26 May 2005 11:03:16 +0200 Subject: data conversion Message-ID: Hi Thomas, > Hi Robert, > You said: >>It states "selected 151 >>channels", but you mentioned that you have only one channel. In >>selecting a single channel to reduce the amount of data, did you also >>make the corresponding change in freq.label? > > How exactly do make the corresponding change to tell CLUSTERRANDANALYSIS > that there is only one frequency channel to be analyzed? I assume I > change > something in the data structure, not in the cfg. setup, right? I tried to > change group_C4.sgn={'spec'} group_C4.label={'spec'} to have single > channel > name entries, but that didn't do the job. > > Thanks a lot, > Thomas If your data structure (containing the TFR) has a single frequency only (e.g., group_C4.sgn={'chan1'}), then you have to do nothing. If the data structure contains multiple channels (e.g., group_C4.sgn={'chan1','chan2'}), then you have to specify cfg.channel={'chan1'} if you want to analyze this channel only. Good luck, Eric Maris > > > On Wed, 25 May 2005 22:25:40 +0200, Robert Oostenveld > wrote: > >>On 25 May 2005, at 11:18, Thomas Thesen wrote: >> >>> group_C4.sgn={'spec'} >>> group_C4.label={'spec'} >>> >>> but no success. Do you have any suggestion? >> >>Could you be more specific? >> >>Robert> From tnt at PHYSIOL.OX.AC.UK Thu May 26 12:11:18 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Thu, 26 May 2005 12:11:18 +0200 Subject: data conversion Message-ID: Thank you Eric. Where did you get the NAN_SUM function from? A specific toolbox other than the Stats toolbox? In April you made revision 1.5 to CLUSTERRANDSTATISTICS and included NAN_SUM. I'm running matlab6 & 7 with the Stats toolbox and don't have this function. Looking online I couldn't find anything about NAN_SUM either. However, there is NANSUM, but replacing it in CLUSTERRANDSTATISTIC produces an error. Do you have any suggestions? cheers, Thomas On Thu, 26 May 2005 11:03:16 +0200, Eric Maris wrote: >Hi Thomas, > > >> Hi Robert, >> You said: >>>It states "selected 151 >>>channels", but you mentioned that you have only one channel. In >>>selecting a single channel to reduce the amount of data, did you also >>>make the corresponding change in freq.label? >> >> How exactly do make the corresponding change to tell CLUSTERRANDANALYSIS >> that there is only one frequency channel to be analyzed? I assume I >> change >> something in the data structure, not in the cfg. setup, right? I tried to >> change group_C4.sgn={'spec'} group_C4.label={'spec'} to have single >> channel >> name entries, but that didn't do the job. >> >> Thanks a lot, >> Thomas > >If your data structure (containing the TFR) has a single frequency only >(e.g., group_C4.sgn={'chan1'}), then you have to do nothing. If the data >structure contains multiple channels (e.g., group_C4.sgn={'chan1','chan2'}), >then you have to specify cfg.channel={'chan1'} if you want to analyze this >channel only. > > > >Good luck, > >Eric Maris > > > > >> >> >> On Wed, 25 May 2005 22:25:40 +0200, Robert Oostenveld >> wrote: >> >>>On 25 May 2005, at 11:18, Thomas Thesen wrote: >>> >>>> group_C4.sgn={'spec'} >>>> group_C4.label={'spec'} >>>> >>>> but no success. Do you have any suggestion? >>> >>>Could you be more specific? >>> >>>Robert> From r.oostenveld at FCDONDERS.RU.NL Thu May 26 16:30:47 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 26 May 2005 16:30:47 +0200 Subject: data conversion In-Reply-To: Message-ID: It is a different implementation than the nansum from teh Matlab statistics toolbox that you ar ereferring to. lease find it attached. It will be included in the next release. Robert -------------- next part -------------- A non-text attachment was scrubbed... Name: nan_sum.m Type: application/octet-stream Size: 1339 bytes Desc: not available URL: -------------- next part -------------- On 26 May 2005, at 12:11, Thomas Thesen wrote: > Thank you Eric. > > Where did you get the NAN_SUM function from? A specific toolbox other > than > the Stats toolbox? In April you made revision 1.5 to > CLUSTERRANDSTATISTICS > and included NAN_SUM. > I'm running matlab6 & 7 with the Stats toolbox and don't have this > function. > Looking online I couldn't find anything about NAN_SUM either. However, > there > is NANSUM, but replacing it in CLUSTERRANDSTATISTIC produces an error. > Do > you have any suggestions? From stephan.moratti at UNI-KONSTANZ.DE Fri May 27 09:48:29 2005 From: stephan.moratti at UNI-KONSTANZ.DE (Stephan Moratti) Date: Fri, 27 May 2005 09:48:29 +0200 Subject: 275ch CTF stimulus channel and new CTF data format In-Reply-To: Message-ID: Hi Sanja, I had the same problem and I just created this kind of m-file: function [d] = dist(A); d = sum((A).^2).^0.5; At least it works, I hope I didn't something wrong, Best, Stephan At 03:13 26.05.2005 +0200, you wrote: >Hi Robert, > >Your answer helped a lot but there was also another problem. My stimulus >channel �on� states were not 9, but 5 or 6 samples long. That's why I was >getting all zeros for both frontpanel and backpanel. I adjusted trigshift >(line 60) to 0 as the trigger values were either 0 or the predetermined on >values. For all of my datasets I've looked at so far, there is no rising >time for the stimulus channel. So, I guess this is another (nice) change in >the new CTF 275 acquisition program... > >On another note, I ran some timefrequency analyses on the sensor level and I >wanted to plot the data using multiplotTFR. I'd like to use the information >from the header when plotting the sensors. However, if I use the >gradiometer structure created with read_ctf_res4, i.e. cfg.layout = >hdr.grad, I get an error message >??? Undefined command/function 'dist'. >Error in ==> createlayout at 93 > d = dist(prj'); > >You mentioned in one of your previous replies that sensor position and >information is not being read correctly for the new CTF 275 datasets. (BTW, >what tells you that read_fcdc_header does not read it correctly?) If I use >ctf_read_res4 (ctf2matlab toolbox as mentioned by Tom Holroyd) I should be >getting correct gradiometer information (right?).Well. I tried it both ways >and I get identical position information with read_ctf_res4 (fcdc) and >ctf_read_res4 (nimh). Orientation information differs in that that nimh code >stores only first coil orientation, whereas the fcdc code stores both coil >orientations. Both codes adjust for the possibility that sometimes coil >orientations stored in res4 file may be pointing toward center. > > It is still not clear to me what happens later with orientation information >and what effect of using only first coil orientation would be... What I >would ultimately like to do is to run time frequency analysis (on the sensor >level first, but also on the virtual sensor level) for each subject in the >group and be able to compare the results using some statistical approach. >However, first I need to establish whether the data is correctly read. > >I appreciate your and any other fieldtriper help, > >Sanja > > >On Fri, 6 May 2005 09:21:48 +0200, Robert Oostenveld > wrote: > >>Hi Sanja, >> >><--let's move our email exchange over towards the discussion list--> >> >>On 5 May 2005, at 22:50, Sanja Kovacevic wrote: >> >>> Thank you for helping me with this. I changed the filetype and >>> read_ctf_res.m files as you suggested, and I was able to read in the >>> data, however now I got problem with definetrial.m. Actually, I think >>> the problem is with read_ctf_trigger as the 275 CTF dataset does not >>> have a channel named 'STIM' but 'UPPT001' (line 63 in >>> read_ctf_trigger). That was easy to fix by replacing STIM with >>> UPPT001. >>> >>> However, I don't understand why you use (line 70 and 71 in >>> read_ctf_trigger.m) >>> >>> bpstim = fix(stim / 2^16); >>> fpstim = double(bitand(uint32(stim), 2^16-1)); >> >>WHen I started at the donders and implemented this, I was told that our >>151 ch system has a "frontpanel" and a "backpanel". I never looked very >>acurately at the electronics cabinet and all the cables that go into >>it, but I guess that they refer to the way in which the cabinet is >>placed in our lab. Somehow, the CTF system's own triggers are put on >>the frontpanel, and the triggers that are generated on the stimulus PC >>are put on the backpanel. Since people write their stimulus programs on >>the presentations pc, and define/write trigger values in the 16 >>bit-range on that computer. They appear in the higher 16 bits of the 32 >>bit STIM channel, which is confusing since then the values don't match >>the ones on the presentation computer. Therefore the 16 lowest and 16 >>highest bits are separated and treated separately. On line 70, the >>highest 16 bits are shifted downward by 16 bits (i.e. divide by 2^16). >>On line 71, the highest 16 bits are masked away, keeping only the >>lowest 16 bits. >> >>> The trigger values on our CTF system use lower 8 bits, i.e. possible >>> values of the triggers are from 0 to 255. I am now quite confused with >>> what happens to my trigger values. The bottom line is that I have all >>> zeroes for backpanel and frontpanel. >> >>I think that you should look at the so called "frontpanel" triggers >>(whose bits are not shifted). >> >>> BTW, could you give me or point to an example of a user specified >>> trialfun that would include trials where trigger with value of 10 ir >>> trigger with value of 138 occurs? >> >>You mean either a 10 or a 138? Just from my head: >> >>function [trl] = trigger138(cfg) >>hdr = read_fcdc_header(cfg.dataset); >>event = read_fcdc_event(cfg.dataset); >>trl = []; >>prestim = 0.1; >>poststim = 0.5; >>for i=1:length(event) >> if strcmp(event(i).type, 'frontpannel trigger') >> if (event(i).value==10) | (event(i).value==138) >> % found trigger of interest >> trl(end+1,1) = event(i).sample - prestim*hds.Fs; >> trl(end ,2) = event(i).sample + poststim*hds.Fs; >> trl(end ,3) = - prestim*hds.Fs; >> end >> end >>end >> >>You could put prestim and poststim (time in seconds) in the cfg >>structure, to keep the function more flexible. From this example, you >>caneasily to make a conditional function, i.e. find the sample at >>which a trigger 138 occurred and which was preceded by a trigger 10. >> >>Alternatively, you can also use the standard code, i.e. without a >>custom trialfunction, to achieve the same. Try this: >> >>cfg = []; >>cfg.dataset = 'something.ds'; >>cfg.trialdef.eventtype = 'frontpannel trigger'; >>cfg.trialdef.eventvalue = [10 138]; >>cfg.trialdef.prestim = 0.1; >>cfg.trialdef.poststim = 0.5; >>cfg = definetrial(cfg); >> >>best regards, >>Robert > ----------------------------- Dipl. Psych. Stephan Moratti Dept. of Psychology University of Konstanz P.O Box D25 Phone: +40 (0)7531 882385 Fax: +49 (0)7531 884601 D-78457 Konstanz, Germany e-mail: Stephan.Moratti at uni-konstanz.de http://www.clinical-psychology.uni-konstanz.de/ From stephan.moratti at UNI-KONSTANZ.DE Fri May 27 10:24:45 2005 From: stephan.moratti at UNI-KONSTANZ.DE (Stephan Moratti) Date: Fri, 27 May 2005 10:24:45 +0200 Subject: 275ch CTF stimulus channel and new CTF data format In-Reply-To: <3.0.5.32.20050527094829.00bce6e0@popserver.uni-konstanz.de > Message-ID: Hi Sanja, Please use Roberts m-file. The one I suggested doesn't produce the same results regarding dimensionalty (explaining some error I had :-) I replaced my dist.m with Robert's one. Sorry, if I produced confusion, Stephan At 09:48 27.05.2005 +0200, you wrote: >Hi Sanja, > >I had the same problem and I just created this kind of m-file: > >function [d] = dist(A); >d = sum((A).^2).^0.5; > >At least it works, I hope I didn't something wrong, > >Best, > >Stephan > > >At 03:13 26.05.2005 +0200, you wrote: >>Hi Robert, >> >>Your answer helped a lot but there was also another problem. My stimulus >>channel �on� states were not 9, but 5 or 6 samples long. That's why I was >>getting all zeros for both frontpanel and backpanel. I adjusted trigshift >>(line 60) to 0 as the trigger values were either 0 or the predetermined on >>values. For all of my datasets I've looked at so far, there is no rising >>time for the stimulus channel. So, I guess this is another (nice) change in >>the new CTF 275 acquisition program... >> >>On another note, I ran some timefrequency analyses on the sensor level and I >>wanted to plot the data using multiplotTFR. I'd like to use the information >>from the header when plotting the sensors. However, if I use the >>gradiometer structure created with read_ctf_res4, i.e. cfg.layout = >>hdr.grad, I get an error message >>??? Undefined command/function 'dist'. >>Error in ==> createlayout at 93 >> d = dist(prj'); >> >>You mentioned in one of your previous replies that sensor position and >>information is not being read correctly for the new CTF 275 datasets. (BTW, >>what tells you that read_fcdc_header does not read it correctly?) If I use >>ctf_read_res4 (ctf2matlab toolbox as mentioned by Tom Holroyd) I should be >>getting correct gradiometer information (right?).Well. I tried it both ways >>and I get identical position information with read_ctf_res4 (fcdc) and >>ctf_read_res4 (nimh). Orientation information differs in that that nimh code >>stores only first coil orientation, whereas the fcdc code stores both coil >>orientations. Both codes adjust for the possibility that sometimes coil >>orientations stored in res4 file may be pointing toward center. >> >> It is still not clear to me what happens later with orientation information >>and what effect of using only first coil orientation would be... What I >>would ultimately like to do is to run time frequency analysis (on the sensor >>level first, but also on the virtual sensor level) for each subject in the >>group and be able to compare the results using some statistical approach. >>However, first I need to establish whether the data is correctly read. >> >>I appreciate your and any other fieldtriper help, >> >>Sanja >> >> >>On Fri, 6 May 2005 09:21:48 +0200, Robert Oostenveld >> wrote: >> >>>Hi Sanja, >>> >>><--let's move our email exchange over towards the discussion list--> >>> >>>On 5 May 2005, at 22:50, Sanja Kovacevic wrote: >>> >>>> Thank you for helping me with this. I changed the filetype and >>>> read_ctf_res.m files as you suggested, and I was able to read in the >>>> data, however now I got problem with definetrial.m. Actually, I think >>>> the problem is with read_ctf_trigger as the 275 CTF dataset does not >>>> have a channel named 'STIM' but 'UPPT001' (line 63 in >>>> read_ctf_trigger). That was easy to fix by replacing STIM with >>>> UPPT001. >>>> >>>> However, I don't understand why you use (line 70 and 71 in >>>> read_ctf_trigger.m) >>>> >>>> bpstim = fix(stim / 2^16); >>>> fpstim = double(bitand(uint32(stim), 2^16-1)); >>> >>>WHen I started at the donders and implemented this, I was told that our >>>151 ch system has a "frontpanel" and a "backpanel". I never looked very >>>acurately at the electronics cabinet and all the cables that go into >>>it, but I guess that they refer to the way in which the cabinet is >>>placed in our lab. Somehow, the CTF system's own triggers are put on >>>the frontpanel, and the triggers that are generated on the stimulus PC >>>are put on the backpanel. Since people write their stimulus programs on >>>the presentations pc, and define/write trigger values in the 16 >>>bit-range on that computer. They appear in the higher 16 bits of the 32 >>>bit STIM channel, which is confusing since then the values don't match >>>the ones on the presentation computer. Therefore the 16 lowest and 16 >>>highest bits are separated and treated separately. On line 70, the >>>highest 16 bits are shifted downward by 16 bits (i.e. divide by 2^16). >>>On line 71, the highest 16 bits are masked away, keeping only the >>>lowest 16 bits. >>> >>>> The trigger values on our CTF system use lower 8 bits, i.e. possible >>>> values of the triggers are from 0 to 255. I am now quite confused with >>>> what happens to my trigger values. The bottom line is that I have all >>>> zeroes for backpanel and frontpanel. >>> >>>I think that you should look at the so called "frontpanel" triggers >>>(whose bits are not shifted). >>> >>>> BTW, could you give me or point to an example of a user specified >>>> trialfun that would include trials where trigger with value of 10 ir >>>> trigger with value of 138 occurs? >>> >>>You mean either a 10 or a 138? Just from my head: >>> >>>function [trl] = trigger138(cfg) >>>hdr = read_fcdc_header(cfg.dataset); >>>event = read_fcdc_event(cfg.dataset); >>>trl = []; >>>prestim = 0.1; >>>poststim = 0.5; >>>for i=1:length(event) >>> if strcmp(event(i).type, 'frontpannel trigger') >>> if (event(i).value==10) | (event(i).value==138) >>> % found trigger of interest >>> trl(end+1,1) = event(i).sample - prestim*hds.Fs; >>> trl(end ,2) = event(i).sample + poststim*hds.Fs; >>> trl(end ,3) = - prestim*hds.Fs; >>> end >>> end >>>end >>> >>>You could put prestim and poststim (time in seconds) in the cfg >>>structure, to keep the function more flexible. From this example, you >>>caneasily to make a conditional function, i.e. find the sample at >>>which a trigger 138 occurred and which was preceded by a trigger 10. >>> >>>Alternatively, you can also use the standard code, i.e. without a >>>custom trialfunction, to achieve the same. Try this: >>> >>>cfg = []; >>>cfg.dataset = 'something.ds'; >>>cfg.trialdef.eventtype = 'frontpannel trigger'; >>>cfg.trialdef.eventvalue = [10 138]; >>>cfg.trialdef.prestim = 0.1; >>>cfg.trialdef.poststim = 0.5; >>>cfg = definetrial(cfg); >>> >>>best regards, >>>Robert >> > > >----------------------------- >Dipl. Psych. Stephan Moratti >Dept. of Psychology >University of Konstanz >P.O Box D25 >Phone: +40 (0)7531 882385 >Fax: +49 (0)7531 884601 >D-78457 Konstanz, Germany >e-mail: Stephan.Moratti at uni-konstanz.de > > >http://www.clinical-psychology.uni-konstanz.de/ > ----------------------------- Dipl. Psych. Stephan Moratti Dept. of Psychology University of Konstanz P.O Box D25 Phone: +40 (0)7531 882385 Fax: +49 (0)7531 884601 D-78457 Konstanz, Germany e-mail: Stephan.Moratti at uni-konstanz.de http://www.clinical-psychology.uni-konstanz.de/ From tomh at KURAGE.NIMH.NIH.GOV Sun May 29 19:21:50 2005 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Sun, 29 May 2005 13:21:50 -0400 Subject: time shift in mtmconvol? Message-ID: I've been working with time-frequency plots made with mtmconvol. I'm using adapted t-f windows as shown below, and I've noticed that my peak ERD and ERS appear to be moving in time depending on the time window width. Here's part of the script, after preprocessing: cfg = []; cfg.output = 'pow'; cfg.method = 'mtmconvol'; N = 6; # number of cycles per time window K = 4; # number of tapers (amount of smoothing) cfg.foi = 2:.25:20; n = length(cfg.foi); cfg.t_ftimwin = zeros(1, n); cfg.t_ftimwin(:) = N ./ cfg.foi; cfg.tapsmofrq = zeros(1, n); cfg.tapsmofrq(:) = cfg.foi .* ((K + 1) / (2 * N)); cfg.keeptrials = 'no'; [freq] = freqanalysis(cfg, data); cfg = []; cfg.baseline = [-.4 .4]; cfg.baselinetype = 'relative'; fr = freqbaseline(cfg, freq); The plots show fr.powspctrm(1,:,:), that is, just one channel. There are 116 trials in each average, and time 0 is peak flexion of a thumb movement. In the first figure, the array of 4, the N parameter above is the only thing that changes, starting with a value of 2 in the upper left, and taking on values of 3, 4, and 5 for the upper right, lower left, and lower right, resp. The second figure is for N = 6. Since the t-f windows are functions of frequency, they also get narrower in bandwidth as the time width is stretched. The (K+1)/(2*N) factor ensures that the W parameter to dpss is always a multiple of 1/2. I'm not sure why that is a requirement in general, but I should also note that I'm doing all these computations using Octave, not Matlab, and the dpss.m file I'm using fails to converge properly if W is not a multiple of 1/2. Anyway, there's a very obvious shift in the positions of the peaks, as a function of N. Is there some problem with the way the padding is being done? I thought that the toi specified the centers of the time windows, so I didn't expect any shifts of this kind. Or are N = 2, 3, simply too small? The apparent shift might be a result of too much smoothing when N is small, perhaps. Thanks in advance for any insights you could give me. P.S. The latest CVS of Octave (2.9.3) will run fieldtrip, at least for CTF datasets and t-f plots. I haven't tested all of it, and there are some extra functions you need. I'll make them available on my website soon; email me if you can't wait. -- Dr. Tom Holroyd "A man of genius makes no mistakes. His errors are volitional and are the portals of discovery." -- James Joyce -------------- next part -------------- A non-text attachment was scrubbed... Name: mlc11b.png Type: image/png Size: 548248 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mlc11c.png Type: image/png Size: 152220 bytes Desc: not available URL: From tomh at KURAGE.NIMH.NIH.GOV Sun May 29 21:19:04 2005 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Sun, 29 May 2005 15:19:04 -0400 Subject: time shift in mtmconvol? In-Reply-To: <4299FA2E.7090005@kurage.nimh.nih.gov> Message-ID: Oh, the toi was missing from that message, sorry. cfg.toi = -.4:.02:.4; Dr. Tom Holroyd "A man of genius makes no mistakes. His errors are volitional and are the portals of discovery." -- James Joyce From t.montez at VUMC.NL Mon May 2 09:20:31 2005 From: t.montez at VUMC.NL (Montez, T.) Date: Mon, 2 May 2005 09:20:31 +0200 Subject: Grand Averages Message-ID: Hi, I would like to make two multiplots of power spectrum: one for controls and one for patients. I wrote a code to compute the planar gradiometers, the average over trials for each subject and the power spectrum (see attachment). I want to run it through the two groups and grand average within the groups to have a first glance at the differences between them.   The database is structured like:   E:\Data\AD_Project\Patients\A001 ... E:\Data\AD_Project\Patients\A017   And E:\Data\AD_Project\Controls\C001 ... E:\Data\AD_Project\Controls\C018   Inside each folder there is a "data" Matlab file (*).   - How are your databases organized and how do you compute Grand Averages?   Thanks, Teresa     (*) Example of how the data was read from CTF.   cfg = []; cfg.dataset = 'E:\Data\AD-EC\A001-ED_20020719_02.ds' cfg.trl= [[ones(1,37)]', [4096*ones(1,37)]', [zeros(1,37)]'] cfg.channel='all' data = preprocessing(cfg)   It is just no-task eyes closed data acquired with 37 trials of 4096 samples. So I want to apply the filters later as if it is continuous data. - How is it handled in the last 0.9.6 version? -------------- next part -------------- A non-text attachment was scrubbed... Name: script_home_database.m Type: application/octet-stream Size: 4075 bytes Desc: not available URL: From tnt at PHYSIOL.OX.AC.UK Tue May 3 23:05:47 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Tue, 3 May 2005 23:05:47 +0200 Subject: importing CTF data Message-ID: Dear Robert and Ole, I am trying to import data from a 151 channel CTF system into FieldTrip format. I tried following the instructions in preprocessing.m and definetrial.m but got the error message that the markerfile can't be read. I think that importing raw data wasn't covered during the last workshop (which was extremely helpful by the way!), so I am not sure if I did the right thing at all and probably have overlooked something. I have put an example dataset here: http://www.physiol.ox.ac.uk/~tnt/fieldtrip/ There is one trigger in this dataset (C1_A1). Would it be possible for you to have a look and suggest some Matlab code that will allow me to import the data so that I can use it with preprocessing.m, etc? Thank you very much for your help. Best wishes, Thomas --------------------------------------------------- Thomas Thesen University Laboratory of Physiology & Centre for Functional MRI of the Brain University of Oxford Oxford, OX1 3PT United Kingdom Phone: +44(0)1865-272 434 Mobile: +44(0)781-355 6528 Fax: +44(0)1865-272 469 e-mail: thomas.thesen at physiol.oxford.ac.uk http://www.fmrib.ox.ac.uk/~tnt/ --------------------------------------------------- From ole.jensen at FCDONDERS.RU.NL Wed May 4 01:01:48 2005 From: ole.jensen at FCDONDERS.RU.NL (Ole Jensen) Date: Wed, 4 May 2005 01:01:48 +0200 Subject: importing CTF data In-Reply-To: Message-ID: Dear Thomas, First try to have a look at the appendix in of the tutorial 'Event Related Fields'. There is an example on reading 'continues' data (this includes AUX files). There is also a definetrial.m example function - you can use this to check the stimulus channel etc - hopefully this will help you get going. Good luck, Ole Thomas Thesen wrote: >Dear Robert and Ole, > >I am trying to import data from a 151 channel CTF system into FieldTrip >format. I tried following the instructions in preprocessing.m and >definetrial.m but got the error message that the markerfile can't be read. I >think that importing raw data wasn't covered during the last workshop (which >was extremely helpful by the way!), so I am not sure if I did the right >thing at all and probably have overlooked something. > >I have put an example dataset here: >http://www.physiol.ox.ac.uk/~tnt/fieldtrip/ >There is one trigger in this dataset (C1_A1). Would it be possible for you >to have a look and suggest some Matlab code that will allow me to import the >data so that I can use it with preprocessing.m, etc? > >Thank you very much for your help. > >Best wishes, > >Thomas > >--------------------------------------------------- >Thomas Thesen >University Laboratory of Physiology >& Centre for Functional MRI of the Brain >University of Oxford >Oxford, OX1 3PT >United Kingdom > >Phone: +44(0)1865-272 434 >Mobile: +44(0)781-355 6528 >Fax: +44(0)1865-272 469 >e-mail: thomas.thesen at physiol.oxford.ac.uk >http://www.fmrib.ox.ac.uk/~tnt/ > >--------------------------------------------------- > > > -- Ole Jensen Principal Investigator F.C. Donders Centre for Cognitive Neuroimaging P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Office : +31 24 36 10884 MEG lab : +31 24 36 10988 Fax : +31 24 36 10989 e-mail : ole.jensen at fcdonders.ru.nl URL : http://oase.uci.ru.nl/~olejen From r.oostenveld at FCDONDERS.RU.NL Wed May 4 09:02:17 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 4 May 2005 09:02:17 +0200 Subject: importing CTF data In-Reply-To: <427802DC.40900@fcdonders.ru.nl> Message-ID: Hi Thomas, Your data is pretty standard, the following snippet of code should get you started. cfg = []; cfg.dataset = 'sub12_SAM_a_C1_A1.ds'; cfg.trialdef.eventtype = '?' % see which eventtypes and values are present in the dataset % dum = definetrial(cfg); cfg.trialdef.eventtype = 'C1_A1' cfg.trialdef.prestim = 0; % trial starts at time t=0 at the marker cfg.trialdef.poststim = 0.5; % trial ends at t=0.5 sec cfg = definetrial(cfg); raw = preprocessing(cfg); cfg = []; avg = timelockanalysis(cfg, raw); plot(avg.time, avg.avg(31:180,:)) If you want to do conditional definition of trials (e.g. exclude bad trials), you should have a look at the example that Ole mentioned. best, Robert On 4 May 2005, at 1:01, Ole Jensen wrote: > Dear Thomas, > > First try to have a look at the appendix in of the tutorial 'Event > Related Fields'. There is an example on reading 'continues' data (this > includes AUX files). There is also a definetrial.m example function - > you can use this to check the stimulus channel etc - hopefully this > will help you get going. > > Good luck, > > Ole > > Thomas Thesen wrote: > >> Dear Robert and Ole, >> >> I am trying to import data from a 151 channel CTF system into >> FieldTrip >> format. I tried following the instructions in preprocessing.m and >> definetrial.m but got the error message that the markerfile can't be >> read. I >> think that importing raw data wasn't covered during the last workshop >> (which >> was extremely helpful by the way!), so I am not sure if I did the >> right >> thing at all and probably have overlooked something. >> >> I have put an example dataset here: >> http://www.physiol.ox.ac.uk/~tnt/fieldtrip/ >> There is one trigger in this dataset (C1_A1). Would it be possible >> for you >> to have a look and suggest some Matlab code that will allow me to >> import the >> data so that I can use it with preprocessing.m, etc? >> >> Thank you very much for your help. >> >> Best wishes, >> >> Thomas >> >> --------------------------------------------------- >> Thomas Thesen >> University Laboratory of Physiology >> & Centre for Functional MRI of the Brain >> University of Oxford >> Oxford, OX1 3PT >> United Kingdom >> >> Phone: +44(0)1865-272 434 >> Mobile: +44(0)781-355 6528 >> Fax: +44(0)1865-272 469 >> e-mail: thomas.thesen at physiol.oxford.ac.uk >> http://www.fmrib.ox.ac.uk/~tnt/ >> >> --------------------------------------------------- >> >> > > > -- > Ole Jensen > Principal Investigator > F.C. Donders Centre for Cognitive Neuroimaging > P.O. Box 9101 > NL-6500 HB Nijmegen > The Netherlands > > Office : +31 24 36 10884 > MEG lab : +31 24 36 10988 > > Fax : +31 24 36 10989 > > e-mail : ole.jensen at fcdonders.ru.nl > URL : http://oase.uci.ru.nl/~olejen > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From r.oostenveld at FCDONDERS.RU.NL Wed May 4 09:16:46 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 4 May 2005 09:16:46 +0200 Subject: Grand Averages In-Reply-To: <05May2.092319cest.334208@nucleus.azvu.nl> Message-ID: Hi Theresa We do not work with "databases", structuring the analysis of a larger group of subject is something that you have to do yourself in your own scripts. My preferred way of doing this is something like subj = { 'A001' 'A002' 'A003' 'A004' }; Nsubj = 4; for s=1:Nsubj dataset = ['E:\Data\AD_Project\Patients\' subj{i} '.ds']; matfile = ['E:\Data\AD_Project\Matlab\' subj{i} '.mat']; cfg = []; cfg.dataset = subj{s}; cfg.otheroption = ... cfg.otheroption = ... cfg.otheroption = ... raw = preprocessing(cfg) save(matfile, raw); clear raw end This ensures that you are using the same analysis options for each subject. Then in the next step (e.g. timelockanalysis or ferqanalysis), you can repeat the for-loop over the subjects, read the raw data and perform the nest step. Grand averaging is done using the TIMELOCKGRANDAVERAGE function or the FERQGRANDAVERAGE function. For MEG data, it is preferable to spatially realign them prior to averaging, since the helmet location is different for each subject. best, Robert On 2 May 2005, at 9:20, Montez, T. wrote: > Hi, > > I would like to make two multiplots of power spectrum: one for > controls and one for patients. > I wrote a code to compute the planar gradiometers, the average over > trials for each subject and the power spectrum (see attachment). > I want to run it through the two groups and grand average within the > groups to have a first glance at the differences between them. >   > The database is structured like: >   > E:\Data\AD_Project\Patients\A001 ... E:\Data\AD_Project\Patients\A017 >   > And E:\Data\AD_Project\Controls\C001 ... > E:\Data\AD_Project\Controls\C018 >   > Inside each folder there is a "data" Matlab file (*). >   > - How are your databases organized and how do you compute Grand > Averages? >   > Thanks, > Teresa >   >   > (*) Example of how the data was read from CTF. >   > cfg = []; > cfg.dataset = 'E:\Data\AD-EC\A001-ED_20020719_02.ds' > cfg.trl= [[ones(1,37)]', [4096*ones(1,37)]', [zeros(1,37)]'] > cfg.channel='all' > data = preprocessing(cfg) >   > It is just no-task eyes closed data acquired with 37 trials of 4096 > samples. > So I want to apply the filters later as if it is continuous data. > - How is it handled in the last 0.9.6 version? > > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From r.oostenveld at FCDONDERS.RU.NL Fri May 6 09:21:48 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 6 May 2005 09:21:48 +0200 Subject: 275ch CTF stimulus channel In-Reply-To: Message-ID: Hi Sanja, <--let's move our email exchange over towards the discussion list--> On 5 May 2005, at 22:50, Sanja Kovacevic wrote: > Thank you for helping me with this. I changed the filetype and > read_ctf_res.m files as you suggested, and I was able to read in the > data, however now I got problem with definetrial.m. Actually, I think > the problem is with read_ctf_trigger as the 275 CTF dataset does not > have a channel named 'STIM' but 'UPPT001' (line 63 in > read_ctf_trigger). That was easy to fix by replacing STIM with > UPPT001. > > However, I don't understand why you use (line 70 and 71 in > read_ctf_trigger.m) > > bpstim = fix(stim / 2^16); > fpstim = double(bitand(uint32(stim), 2^16-1)); WHen I started at the donders and implemented this, I was told that our 151 ch system has a "frontpanel" and a "backpanel". I never looked very acurately at the electronics cabinet and all the cables that go into it, but I guess that they refer to the way in which the cabinet is placed in our lab. Somehow, the CTF system's own triggers are put on the frontpanel, and the triggers that are generated on the stimulus PC are put on the backpanel. Since people write their stimulus programs on the presentations pc, and define/write trigger values in the 16 bit-range on that computer. They appear in the higher 16 bits of the 32 bit STIM channel, which is confusing since then the values don't match the ones on the presentation computer. Therefore the 16 lowest and 16 highest bits are separated and treated separately. On line 70, the highest 16 bits are shifted downward by 16 bits (i.e. divide by 2^16). On line 71, the highest 16 bits are masked away, keeping only the lowest 16 bits. > The trigger values on our CTF system use lower 8 bits, i.e. possible > values of the triggers are from 0 to 255. I am now quite confused with > what happens to my trigger values. The bottom line is that I have all > zeroes for backpanel and frontpanel. I think that you should look at the so called "frontpanel" triggers (whose bits are not shifted). > BTW, could you give me or point to an example of a user specified > trialfun that would include trials where trigger with value of 10 ir > trigger with value of 138 occurs? You mean either a 10 or a 138? Just from my head: function [trl] = trigger138(cfg) hdr = read_fcdc_header(cfg.dataset); event = read_fcdc_event(cfg.dataset); trl = []; prestim = 0.1; poststim = 0.5; for i=1:length(event) if strcmp(event(i).type, 'frontpannel trigger') if (event(i).value==10) | (event(i).value==138) % found trigger of interest trl(end+1,1) = event(i).sample - prestim*hds.Fs; trl(end ,2) = event(i).sample + poststim*hds.Fs; trl(end ,3) = - prestim*hds.Fs; end end end You could put prestim and poststim (time in seconds) in the cfg structure, to keep the function more flexible. From this example, you caneasily to make a conditional function, i.e. find the sample at which a trigger 138 occurred and which was preceded by a trigger 10. Alternatively, you can also use the standard code, i.e. without a custom trialfunction, to achieve the same. Try this: cfg = []; cfg.dataset = 'something.ds'; cfg.trialdef.eventtype = 'frontpannel trigger'; cfg.trialdef.eventvalue = [10 138]; cfg.trialdef.prestim = 0.1; cfg.trialdef.poststim = 0.5; cfg = definetrial(cfg); best regards, Robert From r.oostenveld at FCDONDERS.RU.NL Fri May 6 09:29:38 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 6 May 2005 09:29:38 +0200 Subject: importing CTF data In-Reply-To: <6.2.0.14.0.20050505113258.01ea7300@mail.physiol.ox.ac.uk> Message-ID: Hi Thomas, On 5 May 2005, at 12:38, Thomas Thesen wrote: > Thank you for your help! I have run the first lines of code: > > cfg = []; > cfg.dataset = 'sub12_SAM_a_C1_A1.ds'; > cfg.trialdef.eventtype = '?' > cfg.trialdef.eventtype = 'C1_A1' > cfg.trialdef.prestim = 0; % trial starts at time t=0 at the marker > cfg.trialdef.poststim = 0.5; % trial ends at t=0.5 sec > cfg = definetrial(cfg); > > and it has been running for over 12 hours now on a 2 GHz machine using > Matlab version 6.5. Is that normal? No, reading a stimulus channel and making a trial definition does not take that long. If I do the same on the dataset that you gave me, it takes about 2 seconds and shows me the following on screen found 92 events created 38 trials >> cfg cfg = dataset: 'sub12_SAM_a_C1_A1.ds' trialdef: [1x1 struct] datafile: 'sub12_SAM_a_C1_A1.ds/sub12_SAM_a_C1_A1.meg4' headerfile: 'sub12_SAM_a_C1_A1.ds/sub12_SAM_a_C1_A1.res4' event: [1x92 struct] trl: [38x3 double] version: [1x1 struct] Try whether these two commands work for you: hdr = read_fcdc_header(cfg.dataset) event = read_fcdc_event(cfg.dataset) Robert From tnt at PHYSIOL.OX.AC.UK Fri May 6 11:16:41 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Fri, 6 May 2005 11:16:41 +0200 Subject: importing CTF data Message-ID: Hi Robert, Thank you for your help! I have run the first lines of code: cfg = []; cfg.dataset = 'sub12_SAM_a_C1_A1.ds'; cfg.trialdef.eventtype = '?' cfg.trialdef.eventtype = 'C1_A1' cfg.trialdef.prestim = 0; % trial starts at time t=0 at the marker cfg.trialdef.poststim = 0.5; % trial ends at t=0.5 sec cfg = definetrial(cfg); and it has been running for over 36 hours now on a 2 GHz machine using Matlab version 6.5 and 7.0.1. I have tried both CTF datasets containing epochs and continuos data. thanks, Thomas From matsuham at NINDS.NIH.GOV Fri May 6 20:34:08 2005 From: matsuham at NINDS.NIH.GOV (Matsuhashi, Masao (NIH/NINDS)) Date: Fri, 6 May 2005 14:34:08 -0400 Subject: sourcestatistics Message-ID: Hi, It is nice to see more and more people start using FieldTrip and join the discussion here. Just reading through the posted messages gives me lots of ideas. I have questions about statistical measures using random re-sampling and permutation. i) Where can I find the sourcestatistics.m? According to the tutorials or documents, this script seems essential but I couldn't find it in recent distributions of FieldTrip. ii) In the sourceanalysis.m, re-sampling or permutation uses lots of memory and the computation ends up with OUT OF MEMORY. (e.g. rnd_aCf and rnd_bCf use 2 conditions * 500 trials * 274 channels * 274 channels * 16 bytes/complex = 1.2GBytes) Is there any way to go around this problem, such as repeating 100 trial random re-sampling for 10 times, or must I switch to Opteron? iii) As expected, this is very time-consuming process. Can I somehow use the Beowulf support feature, and if yes, how? We have Beowulf cluster available, but the number of Matlab license is limited to 8.... Thanks, Masao Matsuhashi HMCS/NINDS From t.montez at VUMC.NL Mon May 9 00:17:23 2005 From: t.montez at VUMC.NL (Teresa Montez) Date: Sun, 8 May 2005 22:17:23 -0000 Subject: megrealign, head models In-Reply-To: <0f4160725545991ee60d373838469b0e@fcdonders.ru.nl> Message-ID: Dear Robert, Thanks for your help. > For MEG data, it is preferable to spatially realign them prior to averaging, since the helmet location is different for each subject. Using: cd (['E:\Data\AD_Project\Patients\' subj{i}]) load data cfg=[]; cfg.channel = {'all','-MLT21','-MLT22' , '-MLC42', '-MLO43', '-MZO02' , '-MLT41' , '-MZP01' , '-MRT35'}; cfg.repair = 'yes' cfg.realign = 'yes' cfg.hdmfile='E:\Backup_Compaq\Matlab\DIPOLE\singleSphere.hdm'; cfg.planar = 'yes' data_planar_nobad=meginterpolate(cfg,data); I get the error message: ??? Error using ==> svd NaN or Inf prevents convergence. Error in ==> megrealign>prunedinv at 361 [u, s, v] = svd(lf); Error in ==> megrealign at 260 bkalign = lfold * prunedinv(lfnew, cfg.pruneratio) * realign; Error in ==> meginterpolate at 116 data = megrealign(cfg, data); Error in ==> script_home_database_rob at 66 data_planar_nobad=meginterpolate(cfg,data); - Should I use a local spheres head model? Best regards, Teresa From r.oostenveld at FCDONDERS.RU.NL Mon May 9 08:36:34 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 May 2005 08:36:34 +0200 Subject: importing CTF data In-Reply-To: Message-ID: Hi Thomas On 6 May 2005, at 11:16, Thomas Thesen wrote: > I have tried both CTF datasets containing > epochs and continuos data. Did you try the dataset that you sent me? Please be more specific, otherwise I cannot help you. And try whether these two commands work for you: hdr = read_fcdc_header(cfg.dataset) event = read_fcdc_event(cfg.dataset) Robert From r.oostenveld at FCDONDERS.RU.NL Mon May 9 08:56:45 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 May 2005 08:56:45 +0200 Subject: sourcestatistics In-Reply-To: <6EF659D3CB8D724BBA76CF97214D8DAC1122F111@nihexchange17.nih.gov> Message-ID: Hi Masao, On 6 May 2005, at 20:34, Matsuhashi, Masao (NIH/NINDS) wrote: > I have questions about statistical measures using random re-sampling > and > permutation. > > i) Where can I find the sourcestatistics.m? According to the tutorials > or documents, this script seems essential but I couldn't find it in > recent > distributions of FieldTrip. I thought that it was included in the 0.9.6 version, but it seems not to. I'll send it to you in a separate mail. We are about to release 1.0, which will include it. > ii) In the sourceanalysis.m, re-sampling or permutation uses lots of > memory and the computation ends up with OUT OF MEMORY. (e.g. rnd_aCf > and > rnd_bCf use 2 conditions * 500 trials * 274 channels * 274 channels * > 16 > bytes/complex = 1.2GBytes) > Is there any way to go around this problem, such as repeating 100 trial > random re-sampling for 10 times, or must I switch to Opteron? There are two memory consuming aspects: first, each randomization takes uses two cross-spectral density matrices (one for each condition). The second memory consuming aspect is the source reconstruction volumes, in your case that would consist of (500+1)*2 volumes. Each volume contains of several parameters (depending on what you are beaming: pow, noise, coh), increasing the number of volumes with a factor of 2 or 3. The size in bytes of a volume depends on the resolution that you choose, but I suggest that you also try to estimate whether that would fit into memory prior to starting the computation. Btw. 500 is quite a lot, we typically find that the probabilities don't change that much after 200-300. You can indeed run multiple randomizations separately. If you do that in separate matlab sessions (on different machines), make sure that you use the matlab seed() function to prevent the random number generator from creating the same random sequence in every matlab session. Afterwards, you have to concatenate the contents of the source.trialA and trialB fields. > iii) As expected, this is very time-consuming process. Can I somehow > use > the Beowulf support feature, and if yes, how? We have Beowulf cluster > available, but the number of Matlab license is limited to 8.... It is very timeconsuming indeed. Are you using precomputed leadfields? And a decent grid resolution (not too high)? I have been trying around with different paralellization algorithms, and also found that the number of Matlab licenses was more of a problem than the number of machines. The paralellizationis still in an experimental stage. The latest and most promising implementation of the parallellization (the "mentat" version) code can be fuond as a separate toolbox on http://oase.uci.kun.nl/~roberto/mentat/. It uses only one matlab license on the head node and creates standalone binaries for the slave nodes using the matlab compiler. If you want, you can give it a try and see whether you can get it to work on your cluster. best regards, Robert ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From r.oostenveld at FCDONDERS.RU.NL Mon May 9 09:09:33 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 May 2005 09:09:33 +0200 Subject: megrealign, head models In-Reply-To: <20050508202118.7706.qmail@smtp2.versatel.nl> Message-ID: On 9 May 2005, at 0:17, Teresa Montez wrote: > I get the error message: > > ??? Error using ==> svd > NaN or Inf prevents convergence. There seems to be a problem with your head model, the forward model has a nan or an inf. > - Should I use a local spheres head model? In general you should not use a local spheres model for realignment. I have no idea what is causing the problem. Could you send me a matlab file with an averaged ERF that you want to align and the headmodel file? Please use ftp://ftp.fcdonders.nl and put the files in the directory /pub/inccoming (the directory is one-way-traffic: you cannot see them there after copying, but I can pich them up from there). Robert From tnt at PHYSIOL.OX.AC.UK Mon May 9 12:18:41 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Mon, 9 May 2005 12:18:41 +0200 Subject: importing CTF data Message-ID: Hi Robert, < Did you try the dataset that you sent me? Please be more specific, > event = read_fcdc_event(cfg.dataset) Error in ==> read_fcdc_event at 148 mrk = readmarkerfile(filename); >> I installed FieldTrip only 2 weeks ago. So assuming we both have the same version installed the only difference might to be the matlab version. Which version are you using? Thanks a lot. Thomas From r.oostenveld at FCDONDERS.RU.NL Mon May 9 12:28:13 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 May 2005 12:28:13 +0200 Subject: importing CTF data In-Reply-To: Message-ID: Hi Thomas > Error in ==> read_fcdc_event at 148 > mrk = readmarkerfile(filename); The error which is causing the infinite loop seems to be in the private/readmarkerfile function. I did not write that function myself (Tom Holroyd gave it to me). We are not using the CTF markerfiles in Nijmegen, and it would not surprise me that there is an undetected bug in it. Could you try out the readmarkerfile function itself on the dataset? > I installed FieldTrip only 2 weeks ago. So assuming we both have the > same > version installed the only difference might to be the matlab version. > Which > version are you using? I am using Matlab 7.01 on Mac OS X and Matlab 7.01 on Linux. Are you running it on windows? Maybe there is a problem with the different way in which linux and windows are treating the text files. Robert From tnt at PHYSIOL.OX.AC.UK Mon May 9 12:50:59 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Mon, 9 May 2005 12:50:59 +0200 Subject: importing CTF data Message-ID: Dear Robert, Thank you for your suggestion. I think I found out now what the problem is. >The error which is causing the infinite loop seems to be in the >private/readmarkerfile function. In my installation (version 0.9.6) there is no private/readmarkerfile.m file. And the reason why it did not crash immediately was that I had another function (from Aston) with the same name in my path. Do you have another copy of your version of readmarkerfile.m? Thanks a lot for your help. cheers, Thomas From r.oostenveld at FCDONDERS.RU.NL Mon May 9 13:42:16 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 May 2005 13:42:16 +0200 Subject: importing CTF data In-Reply-To: Message-ID: Hi Thomas, Please find the function attached. Robert -------------- next part -------------- A non-text attachment was scrubbed... Name: readmarkerfile.m Type: application/octet-stream Size: 2114 bytes Desc: not available URL: -------------- next part -------------- On 9 May 2005, at 12:50, Thomas Thesen wrote: > Dear Robert, > > Thank you for your suggestion. I think I found out now what the > problem is. > >> The error which is causing the infinite loop seems to be in the >> private/readmarkerfile function. > > In my installation (version 0.9.6) there is no private/readmarkerfile.m > file. And the reason why it did not crash immediately was that I had > another > function (from Aston) with the same name in my path. > > Do you have another copy of your version of readmarkerfile.m? > > Thanks a lot for your help. > > cheers, > Thomas > > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From tnt at PHYSIOL.OX.AC.UK Mon May 9 14:39:42 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Mon, 9 May 2005 14:39:42 +0200 Subject: importing CTF data Message-ID: That worked! Thanks a lot for your help!! Thomas r.oostenveld at FCDONDERS.RU.NL> wrote: >Hi Thomas, > >Please find the function attached. > >Robert > > > >On 9 May 2005, at 12:50, Thomas Thesen wrote: > >> Dear Robert, >> >> Thank you for your suggestion. I think I found out now what the >> problem is. >> >>> The error which is causing the infinite loop seems to be in the >>> private/readmarkerfile function. >> >> In my installation (version 0.9.6) there is no private/readmarkerfile.m >> file. And the reason why it did not crash immediately was that I had >> another >> function (from Aston) with the same name in my path. >> >> Do you have another copy of your version of readmarkerfile.m? >> >> Thanks a lot for your help. >> >> cheers, >> Thomas >> >> >---------------------------------------------------------------------- >Robert Oostenveld, PhD >F.C. Donders Centre for Cognitive Neuroimaging >Radboud University Nijmegen >phone: +31-24-3619695 >http://www.ru.nl/fcdonders/ >---------------------------------------------------------------------- >N.B. Starting from 1 September 2004, the University of Nijmegen has >changed its name to Radboud University Nijmegen. All web- and >email-addresses ending in ".kun.nl" should therefore be changed into >".ru.nl". Please update your address book and links. > From matsuham at NINDS.NIH.GOV Tue May 10 05:22:42 2005 From: matsuham at NINDS.NIH.GOV (Matsuhashi, Masao (NIH/NINDS)) Date: Mon, 9 May 2005 23:22:42 -0400 Subject: sourcestatistics Message-ID: Dear Robert, Thank you for the response. i) Great. Freqstatistics and timelockedstatistics are included in 0.9.6 but not sourcestatistics. I am very much looking forward to the ver 1.0!! ii) I see. I thought the random re-sampling method requires very large number of samplings, but it seems not necessarily to be true, then. Thank you for the idea of concatenating the re-sampled sources. I will try. iii) Precomputed leadfield and very low resolution actually shortened the time pretty much. Thank you. The higher resolution (I want 1 cm pitch) will be necessary only in limited condition... The mentat toolbox sounds very nice. We do not have the Matlab compiler in our system but I'll ask them. Regards, Masao From tnt at PHYSIOL.OX.AC.UK Tue May 10 11:57:54 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Tue, 10 May 2005 11:57:54 +0200 Subject: importing CTF data Message-ID: Dear Robert, When trying to use definetrial.m/preprocessing.m to load in the dataset cfg = []; cfg.dataset = 'sub12_SAM_a_C1_A1.ds'; cfg.trialdef.eventtype = '?' cfg.trialdef.eventtype = 'C1_A1' cfg.trialdef.prestim = 0; % trial starts at time t=0 at the marker cfg.trialdef.poststim = 0.5; % trial ends at t=0.5 sec and adding the line: cfg.trialdef.excludeConditions = {'BAD'}; and running: cfg = definetrial(cfg); raw = preprocessing(cfg); the trials marked 'BAD' are not excluded. However, when doing the same procedure on the FieldTrip workshop data set for example, where the trials are defined through a trigger, the marked trials are removed. Do you have any suggestions on how to exclude 'BAD' trials before they are loaded? Or is my only option to remove these 'BAD' trials after they have been loaded into FieldTrip format? In that case would you advise to remove the appropriate columns (trials) by hand or rather use the artifact rejection option? Thanks a lot. Thomas From r.oostenveld at FCDONDERS.RU.NL Wed May 11 17:54:34 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 11 May 2005 17:54:34 +0200 Subject: importing CTF data In-Reply-To: Message-ID: Hi Thomas On 10 May 2005, at 11:57, Thomas Thesen wrote: > When trying to use definetrial.m/preprocessing.m to load in the dataset > > cfg = []; > cfg.dataset = 'sub12_SAM_a_C1_A1.ds'; > cfg.trialdef.eventtype = '?' > cfg.trialdef.eventtype = 'C1_A1' > cfg.trialdef.prestim = 0; % trial starts at time t=0 at the marker > cfg.trialdef.poststim = 0.5; % trial ends at t=0.5 sec > > and adding the line: > > cfg.trialdef.excludeConditions = {'BAD'}; > > and running: > cfg = definetrial(cfg); > raw = preprocessing(cfg); > > the trials marked 'BAD' are not excluded. However, when doing the same > procedure on the FieldTrip workshop data set for example, where the > trials > are defined through a trigger, the marked trials are removed. The fieldtrip tutorial that you refer to uses an old CTF-format specific trialfunction that is not in the release version. This type of "combinatorial" definition of events (include the trials with marker C1_A1 and exclude the trials with classification BAD) is not supported any more. Furthermore, the underlying code of that tutorial section only worked for a trial-based file format without markers... As you can see, it is quite difficult to combine all the different types of information (trials, triggers, classifications, markers) and especially sinc e every file format has it's own way of dealing with them. Therefore I decided not to support all of them. There is a common way of handling them all, and that is through using the read_fcdc_event function, which results in a well-defined collection of all information which you can to cut up your data into pieces of interest. Using the event structure (i.e. the output from read_fcdc_event), you can create your own trialfunction. Please read the documentaion on read_fcdc_event, try it out on your data, and then read the documentation in definetrial about the custom trialfunction. A short example of a custom trialfunction was given in the clusterstatistics tutorial. > Do you have any suggestions on how to exclude 'BAD' trials before they > are > loaded? Or is my only option to remove these 'BAD' trials after they > have > been loaded into FieldTrip format? In that case would you advise to > remove > the appropriate columns (trials) by hand or rather use the artifact > rejection option? No, you should not remove them afterwards, but you should use the custom trialfunction to prevent them from being read in the beginning. Robert From t.montez at VUMC.NL Thu May 12 15:58:53 2005 From: t.montez at VUMC.NL (Montez, T.) Date: Thu, 12 May 2005 15:58:53 +0200 Subject: megrealign, head models Message-ID: Dear Robert, I can not access the ftp://ftp.fcdonders.nl. I can access ftp://eegmeg2005 at m50-336.azn.nl/ but I do not have permission to copy things there. Can you please tell me another place to put the files? (The average file is just around 6 MB.) I also tried to define the head model manually by: cfg.vol.r = 7.5 cfg.vol.o = [0, 0, 5] and it still does not work, so it seems to not be related to the headmodel file. Meanwhile I got errors with the grandaverages functions (applied to the non aligned files): ??? Index exceeds matrix dimensions. Error in ==> timelockgrandaverage at 85 varargin{i}.avg = varargin{i}.avg(chansel,:); (It works for a reduced number of subjects.) And I run out of memory when I have to load 18 subject, so maybe I have to do the grand average in steps for a higher number of subjects? Thanks for your help, Teresa -----Original Message----- From: Robert Oostenveld [mailto:r.oostenveld at FCDONDERS.RU.NL] Sent: Monday, May 09, 2005 9:10 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] megrealign, head models On 9 May 2005, at 0:17, Teresa Montez wrote: > I get the error message: > > ??? Error using ==> svd > NaN or Inf prevents convergence. There seems to be a problem with your head model, the forward model has a nan or an inf. > - Should I use a local spheres head model? In general you should not use a local spheres model for realignment. I have no idea what is causing the problem. Could you send me a matlab file with an averaged ERF that you want to align and the headmodel file? Please use ftp://ftp.fcdonders.nl and put the files in the directory /pub/inccoming (the directory is one-way-traffic: you cannot see them there after copying, but I can pich them up from there). Robert From darja.osipova at CBRU.HELSINKI.FI Mon May 16 15:46:38 2005 From: darja.osipova at CBRU.HELSINKI.FI (Daria Osipova) Date: Mon, 16 May 2005 16:46:38 +0300 Subject: detrend/partial artefact rejection In-Reply-To: <2955bdedbc3931e9ef4c994bbcf55ddb@fcdonders.ru.nl> Message-ID: Hi, We have a question on detrend in preprocessing.m in relation to partial artifact rejection. As we understand detrend is first applied and then the partical rejection is performed. This results in some subtrials in which for instance a DC offset is present. Would it not be more optimal to perform another detrend prior to the calculation of the wavelet/fourier transforms to avoid boundary effects? Dasha and Ole From Jan.Schoffelen at FCDONDERS.RU.NL Tue May 17 09:38:06 2005 From: Jan.Schoffelen at FCDONDERS.RU.NL (J.M. Schoffelen) Date: Tue, 17 May 2005 09:38:06 +0200 Subject: detrend/partial artefact rejection In-Reply-To: <1116251198.4288a43e5f8db@www.cbru.helsinki.fi> Message-ID: Dear Dasha and Ole, Thanks a lot for this question. Indeed it is very true that in theory detrending prior to the partial rejection of artifacts could lead to little subtrials having a DC-offset. It is also very true that a detrend-operation after the identification of artifacts is helpful to get rid of these potential confounds for your further frequency analysis. This is exactly what is done in preprocessing! The artifact-rejection routines that are provided by fieldtrip, read in the data and does a lot of fancy stuff with it, one of the things is detrending. However, once the data has been read in in one of these routines and the artifacts are detected, the data itself is discarded again. The real reading in of the data takes place after the artifact-detection, and the cfg.detrend = 'yes' option takes proper care that all the separate subtrials will be detrended. At least, that is what it should do... Yours, Jan-M -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Daria Osipova Sent: Monday, May 16, 2005 3:47 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] detrend/partial artefact rejection Hi, We have a question on detrend in preprocessing.m in relation to partial artifact rejection. As we understand detrend is first applied and then the partical rejection is performed. This results in some subtrials in which for instance a DC offset is present. Would it not be more optimal to perform another detrend prior to the calculation of the wavelet/fourier transforms to avoid boundary effects? Dasha and Ole From r.oostenveld at FCDONDERS.RU.NL Tue May 17 14:21:57 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Tue, 17 May 2005 14:21:57 +0200 Subject: megrealign, head models In-Reply-To: <05May12.160201cest.334247@nucleus.azvu.nl> Message-ID: On 12 May 2005, at 15:58, Montez, T. wrote: > Dear Robert, > > I can not access the ftp://ftp.fcdonders.nl. > I can access ftp://eegmeg2005 at m50-336.azn.nl/ but I do not have > permission > to copy things there. No, please read my original mail below. Log in as anonymous and put the stuff in /pub/incoming. You should not use the eegmeg2005 account, that is only for the write protected course pfd material. > ??? Index exceeds matrix dimensions. > > Error in ==> timelockgrandaverage at 85 > varargin{i}.avg = varargin{i}.avg(chansel,:); > > (It works for a reduced number of subjects.) Do some subjects have fewer channels than other subjects? If so, please download the latest fieldtrip release from teh ftp server. > And I run out of memory when I have to load 18 subject, so maybe I > have to > do the grand average in steps for a higher number of subjects? In timelockanalysis you should do keeptrials=no prior to timelockgrandaverage. best, Robert > -----Original Message----- > From: Robert Oostenveld [mailto:r.oostenveld at FCDONDERS.RU.NL] > Sent: Monday, May 09, 2005 9:10 AM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: Re: [FIELDTRIP] megrealign, head models > > > On 9 May 2005, at 0:17, Teresa Montez wrote: > >> I get the error message: >> >> ??? Error using ==> svd >> NaN or Inf prevents convergence. > > There seems to be a problem with your head model, the forward model has > a nan or an inf. > >> - Should I use a local spheres head model? > > In general you should not use a local spheres model for realignment. > > I have no idea what is causing the problem. Could you send me a matlab > file with an averaged ERF that you want to align and the headmodel > file? Please > use ftp://ftp.fcdonders.nl and put the files in the directory > /pub/inccoming (the directory is one-way-traffic: you cannot see them > there after copying, but I can pich them up from there). > > Robert > > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From r.oostenveld at FCDONDERS.RU.NL Wed May 18 10:14:24 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 18 May 2005 10:14:24 +0200 Subject: detrend/partial artefact rejection In-Reply-To: <1116251198.4288a43e5f8db@www.cbru.helsinki.fi> Message-ID: Hi Dasha and Ole You might also want to take a look at the documentation. On http://www2.ru.nl/fcdonders/fieldtrip/, click on "ERP/ERF analysis" or "Frequency analysis", and you will recognise the individual steps that are taken. REJECTARTIFACT doew not work on the preprocessed data (although it looks at the data from the file and applies its own filters, baselinecorrection, etc.), but it only detects the pieces of data which should not be read into Matlab memory and preprocessed by the PREPROCESSING function. Robert On 16 May 2005, at 15:46, Daria Osipova wrote: > Hi, > > We have a question on detrend in preprocessing.m in relation to > partial artifact > rejection. As we understand detrend is first applied and then the > partical > rejection is performed. This results in some subtrials in which for > instance a > DC offset is present. Would it not be more optimal to perform another > detrend > prior to the calculation of the wavelet/fourier transforms to avoid > boundary > effects? > > Dasha and Ole > > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From laura at GBT.TFO.UPM.ES Wed May 18 14:09:54 2005 From: laura at GBT.TFO.UPM.ES (Laura Espino) Date: Wed, 18 May 2005 14:09:54 +0200 Subject: BTI MEG In-Reply-To: <1afbdbf7c342f63b8bf586adccaedb95@fcdonders.ru.nl> Message-ID: Hello, I am working with data obtained from a BTI MEG, 148 channels I want to make some time-frequency analysis. Is it possible to make it through fieldtrip? thanks Laura From stephan.moratti at UNI-KONSTANZ.DE Wed May 18 15:24:06 2005 From: stephan.moratti at UNI-KONSTANZ.DE (Stephan Moratti) Date: Wed, 18 May 2005 15:24:06 +0200 Subject: BTI MEG In-Reply-To: <5.2.0.9.0.20050518140732.00be33e8@pop3.gbt.tfo.upm.es> Message-ID: Hi Laura At 14:09 18.05.2005 +0200, you wrote: >Hello, >I am working with data obtained from a BTI MEG, 148 channels I want to make >some time-frequency analysis. Is it possible to make it through fieldtrip? > >thanks >Laura > I am just working on it and try to get BTI MEG 148 channel data in the field trip data structure. As soon as it works I will let you know. Stephan ----------------------------- Dipl. Psych. Stephan Moratti Dept. of Psychology University of Konstanz P.O Box D25 Phone: +40 (0)7531 882385 Fax: +49 (0)7531 884601 D-78457 Konstanz, Germany e-mail: Stephan.Moratti at uni-konstanz.de http://www.clinical-psychology.uni-konstanz.de/ From D.Talsma at PSY.VU.NL Wed May 18 15:49:08 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Wed, 18 May 2005 15:49:08 +0200 Subject: No subject Message-ID: Hi Everybody, I'm trying to read a ctf, which was collected at the VUMC MEG center in Amsterdam, using fieldtrip. I've tried tried reading the data with as well as without Darren Weber's ctf code. Anyways, I'm following the fieldtrip example code pretty closely (see below) and both attempts have resulted in the error messages attached below stating that a function or variable named coil2_pos is missing. Any help would be appreciated. Cheers, Durk p.s., Since this is my first post to this list, I would like to thank everybody involved in making this stuff work. [matlab script] cfg = []; cfg.dataset = 'PP01_20040716_Eriksen.ds'; cfg.channel = {'MEG' 'STIM'}; cfg.trialdef.excludeConditions = {'BAD'}; cfg.trialdef.includeTrigger = []; cfg.trialdef.excludeTrigger = []; cfg.trialdef.prestim = 0.1; cfg.traildef.poststim = 0.1; dataFIC = preprocessing(cfg); [error messages] Warning: Divide by zero. > In C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p>read_ctf_r es4 at 194 In fieldtrip\private\read_ctf_trigger at 56 In read_fcdc_event at 99 In definetrial at 196 In preprocessing at 239 In tfanalysis at 10 Warning: not adding event information to the output configuration structure > In definetrial at 205 In preprocessing at 239 In tfanalysis at 10 >> >> >> >> >> >> >> >> >> >> Warning: Divide by zero. > In C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p>read_ctf_r es4 at 194 In fieldtrip\private\read_ctf_trigger at 56 In definetrial at 403 In preprocessing at 239 In tfanalysis at 10 ??? Undefined function or variable "coil2_pos". Error in ==> C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p>read_ctf_r es4 at 226 Error in ==> fieldtrip\private\read_ctf_trigger at 56 hdr = read_ctf_res4(headerfile); Error in ==> definetrial at 403 triggerChan = read_ctf_trigger(cfg.dataset); Error in ==> preprocessing at 239 [cfg] = definetrial(cfg); Error in ==> tfanalysis at 10 dataFIC = preprocessing(cfg); From r.oostenveld at FCDONDERS.RU.NL Wed May 18 18:39:32 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 18 May 2005 18:39:32 +0200 Subject: No subject In-Reply-To: Message-ID: Hi Durk, The VUMC MEG system is known to generate a CTF file format that is slightly different from the format that we have in Nijmegen. However, I have succesfully read in data from Amsterdam using Darren's functions, so that should work, except that the sensor position information that originates from Darrens function is not trasferred into Fieldtrip. It would not be difficult to implement that as well, but it is only needed if you want to do source analysis (or MEG realignment). But I also I notice that your Matlab error log refers to some closed-source p-files which are open source by now. Please download the latest version of fieldtrip, maybe that already solves part of your problem. See ftp://m50-336.azn.nl/pub/fieldtrip and fetch version 0.9.6 or the latest daily release. Robert On 18 May 2005, at 15:49, Talsma D wrote: > Hi Everybody, > > I'm trying to read a ctf, which was collected at the VUMC MEG center in > Amsterdam, using fieldtrip. I've tried tried reading the data with as > well as without Darren Weber's ctf code. Anyways, I'm following the > fieldtrip example code pretty closely (see below) and both attempts > have > resulted in the error messages attached below stating that a function > or > variable named coil2_pos is missing. ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From D.Talsma at PSY.VU.NL Thu May 19 13:01:01 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Thu, 19 May 2005 13:01:01 +0200 Subject: No subject Message-ID: Hi Robert, Thanks for your reply. I guess your suggestion of upgrading fieldtrip helped a lot. Using pretty much the same preprocessing script as I used yesterday, it looks like I'm getting through CTF_READ_RES4 twice, but then the script bombs with a message that the function private\read_ctf_res4.p is inaccessible. Could this be something in my setup? I've tried version 0.9.6 as well as the latest snapshot, both giving the same results. Cheers, Durk CTF_READ_RES4 [v 1.15] ...done ( 0.85 sec) CTF_READ_RES4 [v 1.15] ...done ( 0.72 sec) ??? Previously accessible file "C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p" is now inaccessible. Error in ==> fieldtrip\private\read_ctf_trigger at 56 hdr = read_ctf_res4(headerfile); Error in ==> definetrial at 411 triggerChan = read_ctf_trigger(cfg.dataset); Error in ==> preprocessing at 250 [cfg] = definetrial(cfg); Error in ==> tfanalysis at 12 dataFIC = preprocessing(cfg); -----Oorspronkelijk bericht----- Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens Robert Oostenveld Verzonden: woensdag 18 mei 2005 18:40 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: Re: [FIELDTRIP] Hi Durk, The VUMC MEG system is known to generate a CTF file format that is slightly different from the format that we have in Nijmegen. However, I have succesfully read in data from Amsterdam using Darren's functions, so that should work, except that the sensor position information that originates from Darrens function is not trasferred into Fieldtrip. It would not be difficult to implement that as well, but it is only needed if you want to do source analysis (or MEG realignment). But I also I notice that your Matlab error log refers to some closed-source p-files which are open source by now. Please download the latest version of fieldtrip, maybe that already solves part of your problem. See ftp://m50-336.azn.nl/pub/fieldtrip and fetch version 0.9.6 or the latest daily release. Robert On 18 May 2005, at 15:49, Talsma D wrote: > Hi Everybody, > > I'm trying to read a ctf, which was collected at the VUMC MEG center > in Amsterdam, using fieldtrip. I've tried tried reading the data with > as well as without Darren Weber's ctf code. Anyways, I'm following the > fieldtrip example code pretty closely (see below) and both attempts > have resulted in the error messages attached below stating that a > function or > variable named coil2_pos is missing. ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From r.oostenveld at FCDONDERS.RU.NL Thu May 19 19:17:16 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 19 May 2005 19:17:16 +0200 Subject: megrealign, head models In-Reply-To: <001501c55c70$b32b5060$0d00000a@vulcan> Message-ID: Hi Teresa Realignment of MEG data means that you interpolate the data from the helmet location at which it was measured to a template location of the helmet. You have not specified the template location: cfg.template should contain one or multiple CTF datasets. The average helmet location will be computed from those datasets, and that will be used as the template on which the interpolated value is computed. Typically, the average of all subjects in your study is used as the template (i.e. all subjects are aligned to the mean of all subjects). Realigning to an empty template gave this error. I will add an extra check with an easier to understand error message to make this error in teh configuration more clear. Robert Robert >> For MEG data, it is preferable to spatially realign them prior to >> averaging, since the helmet location is different for each subject. > > Using: > > cd (['E:\Data\AD_Project\Patients\' subj{i}]) > load data > cfg=[]; > cfg.channel = {'all','-MLT21','-MLT22' , '-MLC42', '-MLO43', '-MZO02' , > '-MLT41' , '-MZP01' , '-MRT35'}; > cfg.repair = 'yes' > cfg.realign = 'yes' > cfg.hdmfile='E:\Backup_Compaq\Matlab\DIPOLE\singleSphere.hdm'; > cfg.planar = 'yes' > data_planar_nobad=meginterpolate(cfg,data); > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From matsuham at NINDS.NIH.GOV Thu May 19 20:14:35 2005 From: matsuham at NINDS.NIH.GOV (Matsuhashi, Masao (NIH/NINDS)) Date: Thu, 19 May 2005 14:14:35 -0400 Subject: Source coherence Message-ID: Hi Robert, I am posting this message to the mailing list, with the original message added to the bottom. Thank you for your response. 1. Actually, the two frequencies are very close to each other. One is 5 Hz and the other is 4.6 (60/13) Hz. Sampling is 600/sec. I used 6000 trial length so the frequency resolution should be 0.1 Hz, but I am not sure because MTM decreases the frequency resolution in terms of W. The two reference signals are not independent, as they share the common carrier frequency of 60Hz, but when we calculated the coherence sensor-wise, they were separated relatively nicely. 2. I pushed the data to your ftp site. I hope it's working ok. The filename is DICS_Matsuhashi_20050519.zip, containing 4 files. Freq_01_050 and Source_01_050 are from condition 1, foi=5.0 Hz. Freq_01_046 and Source_01_046 are from condition 2, foi=4.6 Hz. Regards, Masao ------------------------------------------------ Masao Matsuhashi, MD, PhD NINDS, NIH Tel: 1-301-594-9139 E-mail: MatsuhaM at ninds.nih.gov ------------------------------------------------ > -----Original Message----- > From: Robert Oostenveld [mailto:r.oostenveld at fcdonders.ru.nl] > Sent: Thursday, May 19, 2005 7:08 AM > To: Matsuhashi, Masao (NIH/NINDS) > Subject: Re: [FIELDTRIP] sourcestatistics > > Hi Masao > > > signal. There are two reference signals simultaneously throughout the > > recording, say, REF1 and REF2, with slightly different center > > frequency, f1 > > and f2. I want to compare the coherence of cortical activity to > > reference > > Just a question of general relevance. How well are the two frequencies > separated, i.e. how far are they apart and what is your frequency > resolution? > > > Is it quite common to see this kind of discrepancy in the result of > > sensor > > level coherence and source level coherence? > > No, I would not expect a very large difference between them. If the > frequencies are far apart, the csd matrix for either f1 or f2 might > contain more noise, affecting the filter (and hence the localization) > more in one frequency than the other. But as I read your mail, I see no > reason to assume that that is the case. > > > If you want to see the data, I will send them to you (frequency data > > were > > about 75M each, source 9M each). > > That would be nice, so that I can see it with my own eyes. Could you > send both to ftp://m50-336.azn.nl/pub/incoming (login as anonymous) and > send me a mail when they are there? The "incoming" directory is a > drop-box, you cannot see what is in there (so you cannot read, but you > can write) which might be a little confusing. > > > PS. If you think it is more appropriate to discuss this in the Mailing > > List, > > I can post this message to the list myself. I didn't do it, because the > > update for DICS may not be available for public access. > > I think that it is interesting to have this discussion on the mailing > list. Then also Jan-Mathijs and Pascal can think along. > > Robert ======================================================================= > -----Original Message----- > From: Matsuhashi, Masao (NIH/NINDS) > Sent: Wednesday, May 18, 2005 3:59 PM > To: 'Robert Oostenveld' > Subject: RE: [FIELDTRIP] sourcestatistics > > Hello Robert, > > I am now using your new DICS code with FieldTrip 0.9.6, and found a > strange phenomenon. I've not yet checked into detail, but would like to > have your idea. > > As you know, I am trying to calculate source coherence to external > reference signal. There are two reference signals simultaneously > throughout the recording, say, REF1 and REF2, with slightly different > center frequency, f1 and f2. I want to compare the coherence of cortical > activity to reference signal REF1 at frequency f1 (condition 1) and the > coherence of cortical activity to REF2 at f2 (condition 2). > The result of freqanalysis showed that coherence at sensor level (such as > MRT31 x REF1) was much larger in condition 1 (up to 0.3) than in condition > 2 (up to 0.05). However, when I calculate the source coherence from the > above result using sourceanalysis, contrary to the above result, condition > 2 showed larger source coherence. Actually, the maximum coherence was > almost the same in both condition (about 0.02), but their distribution > were quite different. The median value of the coherence in condition1 was > 0.001, while in condition 2 it was 0.003. > > Is it quite common to see this kind of discrepancy in the result of sensor > level coherence and source level coherence? > > If you want to see the data, I will send them to you (frequency data were > about 75M each, source 9M each). > > Thanks, > Masao > > > PS. If you think it is more appropriate to discuss this in the Mailing > List, I can post this message to the list myself. I didn't do it, because > the update for DICS may not be available for public access. > From r.oostenveld at FCDONDERS.RU.NL Thu May 19 20:46:24 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 19 May 2005 20:46:24 +0200 Subject: No subject In-Reply-To: Message-ID: Hi Durk, On 19 May 2005, at 13:01, Talsma D wrote: > ??? Previously accessible file > "C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p" is now > inaccessible. > > Error in ==> fieldtrip\private\read_ctf_trigger at 56 > hdr = read_ctf_res4(headerfile); I guess that you did not restart Matlab in between, since in that case Matlab would not have known anything about that p-file. Matlab remembers the location and filename of functions in its cache, and it seems that it got confused by the file disappearing. A "rehash path" command sometimes helps. Or just a restart of Matlab. Robert From D.Talsma at PSY.VU.NL Fri May 20 11:25:12 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Fri, 20 May 2005 11:25:12 +0200 Subject: No subject Message-ID: Hi Robert, Well, I tried a again this morning: Fresh login and restart of matlab, but still no luck. Are there any specific path definition requirements that I should be aware of? I am running this off a 24/7 NT multi-user server. Could that be related to the problem? Again, thanks for your reply. Durk -----Oorspronkelijk bericht----- Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens Robert Oostenveld Verzonden: donderdag 19 mei 2005 20:46 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: Re: [FIELDTRIP] Hi Durk, On 19 May 2005, at 13:01, Talsma D wrote: > ??? Previously accessible file > "C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p" is now > inaccessible. > > Error in ==> fieldtrip\private\read_ctf_trigger at 56 > hdr = read_ctf_res4(headerfile); I guess that you did not restart Matlab in between, since in that case Matlab would not have known anything about that p-file. Matlab remembers the location and filename of functions in its cache, and it seems that it got confused by the file disappearing. A "rehash path" command sometimes helps. Or just a restart of Matlab. Robert From r.oostenveld at FCDONDERS.RU.NL Fri May 20 15:18:00 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 20 May 2005 15:18:00 +0200 Subject: No subject In-Reply-To: Message-ID: Hi Durk, > Well, I tried a again this morning: Fresh login and restart of matlab, > but still no luck. Are there any specific path definition requirements > that I should be aware of? I am running this off a 24/7 NT multi-user > server. Could that be related to the problem? But in your mail you mentioned that the problem was with the p-file, which is not included in the latest FT distrubution any more. If you installed that distribution, and completely removed the previous version, how can the p-file problem then still exist? Could you do a search from within explorer on the file "read_ctf_res4.p"? What is a "24/7 NT multi-user server"? A computer running windows NT on which you are logged in remotely? Which version of NT is running on it, and which Matlab version are you using? Robert > > Again, thanks for your reply. > > Durk > > -----Oorspronkelijk bericht----- > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > Robert Oostenveld > Verzonden: donderdag 19 mei 2005 20:46 > Aan: FIELDTRIP at NIC.SURFNET.NL > Onderwerp: Re: [FIELDTRIP] > > > Hi Durk, > > > On 19 May 2005, at 13:01, Talsma D wrote: > >> ??? Previously accessible file >> "C:\MATLAB704\toolbox\shared\fieldtrip\private\read_ctf_res4.p" is now > >> inaccessible. >> >> Error in ==> fieldtrip\private\read_ctf_trigger at 56 >> hdr = read_ctf_res4(headerfile); > > I guess that you did not restart Matlab in between, since in that case > Matlab would not have known anything about that p-file. Matlab > remembers the location and filename of functions in its cache, and it > seems that it got confused by the file disappearing. A "rehash path" > command sometimes helps. Or just a restart of Matlab. > > Robert > > ---------------------------------------------------------------------- Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ---------------------------------------------------------------------- N.B. Starting from 1 September 2004, the University of Nijmegen has changed its name to Radboud University Nijmegen. All web- and email-addresses ending in ".kun.nl" should therefore be changed into ".ru.nl". Please update your address book and links. From D.Talsma at PSY.VU.NL Mon May 23 09:15:20 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Mon, 23 May 2005 09:15:20 +0200 Subject: Path problem fixed Message-ID: Hi Robert, I found the solution to the Matlab path problem. What I needed to do after upgrading the fieltrip version was the following: 1) Remove the Fieldtrip directory from the matlab search path, restart matlab, 2) add the fieldtrip path again. 3) Restart matlab. 4) Et Voila. It works. We've installed fieldtrip in a directory called Fieldtrip, under c:\Matlab704\toolbox\shared and I upgraded fieldtrip by just deleting the old files and and copying the new ones into the old directory. Apparently, I needed to remove and add the path to trigger a rehash of the file cache. This is indeed from a remote server. I'm running it off MS Windows Server 2003, standard edition, using matlab 7.0.4. Right now, I'm back at the "unknown variable" error message again (see below):. At least the error is coming from a human-readable .m file now, so I'll see if I can track down what is happening here. Cheers, Durk ??? Undefined function or variable "coil2_pos". Error in ==> FieldTrip\private\read_ctf_res4 at 233 tmp = coil2_pos - coil1_pos; -----Oorspronkelijk bericht----- Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens Robert Oostenveld Verzonden: vrijdag 20 mei 2005 15:18 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: Re: [FIELDTRIP] Hi Durk, > Well, I tried a again this morning: Fresh login and restart of matlab, > but still no luck. Are there any specific path definition requirements > that I should be aware of? I am running this off a 24/7 NT multi-user > server. Could that be related to the problem? But in your mail you mentioned that the problem was with the p-file, which is not included in the latest FT distrubution any more. If you installed that distribution, and completely removed the previous version, how can the p-file problem then still exist? Could you do a search from within explorer on the file "read_ctf_res4.p"? What is a "24/7 NT multi-user server"? A computer running windows NT on which you are logged in remotely? Which version of NT is running on it, and which Matlab version are you using? Robert From D.Talsma at PSY.VU.NL Mon May 23 10:00:16 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Mon, 23 May 2005 10:00:16 +0200 Subject: Path problem fixed Message-ID: Replying to my own message :-) I think I have a tracked down the cause of the coil2_pos error: It appears the code doesn't iterate through the MEG sensor list, because it does not find any channel names starting with 'M', return 0 valid MEG sensors. In our setup, it appears, there are some leading NULL characters preceding each MEG sensor name. Because of this, the code in read_ctf_res4, around line 119 chops off the channel name altogether. I'm working on a fix. Cheers, Durk -----Oorspronkelijk bericht----- Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens Talsma D Verzonden: maandag 23 mei 2005 9:15 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: [FIELDTRIP] Path problem fixed Hi Robert, I found the solution to the Matlab path problem. What I needed to do after upgrading the fieltrip version was the following: 1) Remove the Fieldtrip directory from the matlab search path, restart matlab, 2) add the fieldtrip path again. 3) Restart matlab. 4) Et Voila. It works. We've installed fieldtrip in a directory called Fieldtrip, under c:\Matlab704\toolbox\shared and I upgraded fieldtrip by just deleting the old files and and copying the new ones into the old directory. Apparently, I needed to remove and add the path to trigger a rehash of the file cache. This is indeed from a remote server. I'm running it off MS Windows Server 2003, standard edition, using matlab 7.0.4. Right now, I'm back at the "unknown variable" error message again (see below):. At least the error is coming from a human-readable .m file now, so I'll see if I can track down what is happening here. Cheers, Durk ??? Undefined function or variable "coil2_pos". Error in ==> FieldTrip\private\read_ctf_res4 at 233 tmp = coil2_pos - coil1_pos; -----Oorspronkelijk bericht----- Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens Robert Oostenveld Verzonden: vrijdag 20 mei 2005 15:18 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: Re: [FIELDTRIP] Hi Durk, > Well, I tried a again this morning: Fresh login and restart of matlab, > but still no luck. Are there any specific path definition requirements > that I should be aware of? I am running this off a 24/7 NT multi-user > server. Could that be related to the problem? But in your mail you mentioned that the problem was with the p-file, which is not included in the latest FT distrubution any more. If you installed that distribution, and completely removed the previous version, how can the p-file problem then still exist? Could you do a search from within explorer on the file "read_ctf_res4.p"? What is a "24/7 NT multi-user server"? A computer running windows NT on which you are logged in remotely? Which version of NT is running on it, and which Matlab version are you using? Robert From D.Talsma at PSY.VU.NL Mon May 23 12:41:37 2005 From: D.Talsma at PSY.VU.NL (Talsma D) Date: Mon, 23 May 2005 12:41:37 +0200 Subject: CTF res4 File format Message-ID: Hi Everybody, Looking through the matlab code, I traced the coil-error back to a res4 file read error somewhat earlier: On line 100, of read_ctf_res4.m, the file pointer is set to position 1839, and only a single byte of data is read from this position. As far as I know, this read should start immediately after the preceding one, and the field is defined as an 32-byte integer. So changig the code to the snippet below fixed the problem. IFAICT, the old code would work, as long as you had run descriptor fields that were shorter than 256 characters. In our case we had a descriptor length of 572 chars. % 2005-05-23: The following statement needed to be commented out % In order to make this file work with the VUMC data (Durk) %fseek(fid,1839,'bof'); % Read in the run description length rd_len=fread(fid,1,'uint32'); % Go to the run description and read it in fseek(fid,1844,'bof'); run_desc=setstr(fread(fid,rd_len,'char')'); Next, changing the above byte read also eliminates the additional requirement of reading one extra short int before reading the filter parameters. In addition, as far as I can tell, reading in the filter definition as 18 8-byte integers is not correct either: Each filter definition should consist of the following fields: frequency (double) class (int) type (int) num_params (short int) Therefore, the real value of num_fparams is stored in the last two byte (17, and 18). Again, the original code would work, as long as you have 255 or less parameters. % read in the filter information % Filter read code modified dd; 2005-05-23 Durk) num_filt=fread(fid,1,'uint16'); %num_filt=temp(1); for fi=0:(num_filt-1), %filt_info=fread(fid,18,'uint8'); filt_freq =fread(fid,1, 'double'); filt_class=fread(fid,1, 'uint32'); filt_type =fread(fid,1, 'uint32'); num_fparm=fread(fid, 1, 'uint16'); %num_fparm=filt_info(18); if num_fparm ~= 0, filt_parm=fread(fid,8*num_fparm,'uint8'); end % if end % for fi Any comments? Cheers Durk From r.oostenveld at FCDONDERS.RU.NL Mon May 23 13:18:18 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 23 May 2005 13:18:18 +0200 Subject: CTF res4 File format In-Reply-To: Message-ID: Hi Durk, On 23 May 2005, at 12:41, Talsma D wrote: > Looking through the matlab code, I traced the coil-error back to a res4 > file read error somewhat earlier: > > On line 100, of read_ctf_res4.m, the file pointer is set to position > 1839, and only a single byte of data is read from this position. As far ... > Any comments? The read_ctf_res4 is legacy code and already has passed through the hands of multiple people. Personally I don't know all the details of the file format. Your suggestions make sense from a technical point of view, and also work fine for our own data. Therefore I will incorporate your suggestions in the code. Thanks for the contribution. Robert PS this evening the change will be in the daily release version, which you can get from the ftp server. From tnt at PHYSIOL.OX.AC.UK Mon May 23 14:58:12 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Mon, 23 May 2005 14:58:12 +0200 Subject: tokenize.m Message-ID: Hi, I attempted to run clusterrandanalysis.m, but it seems that the most current version of FieldTrip (Fieldtrip-20050522) is missing the file tokenize.m which is called by prepare_time_frequ_data.m. Thanks a lot. Thomas --------------------------------------------------- Thomas Thesen University Laboratory of Physiology & Centre for Functional MRI of the Brain University of Oxford Oxford, OX1 3PT United Kingdom Phone: +44(0)1865-272 434 Mobile: +44(0)781-355 6528 Fax: +44(0)1865-272 469 e-mail: thomas.thesen at physiol.oxford.ac.uk http://www.fmrib.ox.ac.uk/~tnt/ --------------------------------------------------- From G.vanElswijk at NEURO.UMCN.NL Mon May 23 15:01:28 2005 From: G.vanElswijk at NEURO.UMCN.NL (Gijs van Elswijk) Date: Mon, 23 May 2005 15:01:28 +0200 Subject: tokenize.m Message-ID: I had the same problem with FREQSTATISTICS in FieldTrip 0.9.6. Copying TOKENIZE.M from the private directory of FieldTrip 0.9.5 solved the problem in my case. Gijs > -----Original Message----- > From: FieldTrip discussion list > [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Thomas Thesen > Sent: maandag 23 mei 2005 14:58 > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] tokenize.m > > Hi, > > I attempted to run clusterrandanalysis.m, but it seems that > the most current version of FieldTrip (Fieldtrip-20050522) is > missing the file tokenize.m which is called by > prepare_time_frequ_data.m. > > Thanks a lot. > > Thomas > > > --------------------------------------------------- > Thomas Thesen > University Laboratory of Physiology > & Centre for Functional MRI of the Brain University of Oxford > Oxford, OX1 3PT United Kingdom > > Phone: +44(0)1865-272 434 > Mobile: +44(0)781-355 6528 > Fax: +44(0)1865-272 469 > e-mail: thomas.thesen at physiol.oxford.ac.uk > http://www.fmrib.ox.ac.uk/~tnt/ > > --------------------------------------------------- > > From r.oostenveld at FCDONDERS.RU.NL Mon May 23 15:45:37 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 23 May 2005 15:45:37 +0200 Subject: tokenize.m In-Reply-To: <4CD85D348E46984983185B911CBF3ED11B6F66@umcnet13.umcn.nl> Message-ID: Hi Thomas and Gijs, It seems that I forgot to put that function into the daily release version. Gijs' workaround will help you out for the moment, and I will make sure that it will be included in the upcoming release versions. Robert On 23 May 2005, at 15:01, Gijs van Elswijk wrote: > I had the same problem with FREQSTATISTICS in FieldTrip 0.9.6. Copying > TOKENIZE.M from the private directory of FieldTrip 0.9.5 solved the > problem in my case. > > Gijs > >> -----Original Message----- >> From: FieldTrip discussion list >> [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Thomas Thesen >> Sent: maandag 23 mei 2005 14:58 >> To: FIELDTRIP at NIC.SURFNET.NL >> Subject: [FIELDTRIP] tokenize.m >> >> Hi, >> >> I attempted to run clusterrandanalysis.m, but it seems that >> the most current version of FieldTrip (Fieldtrip-20050522) is >> missing the file tokenize.m which is called by >> prepare_time_frequ_data.m. >> >> Thanks a lot. >> >> Thomas From r.oostenveld at FCDONDERS.RU.NL Mon May 23 17:03:20 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 23 May 2005 17:03:20 +0200 Subject: Source coherence In-Reply-To: <6B5952376E0A164C81F2F18BF77B3FAB2128B3@NIHCESMLBX.nih.gov> Message-ID: Hi Masao, I had a look at your data, and at the computations that you perfomed for the analysis. Your frequencies of interest are 4.6 and 5Hz, and your time windows are 10 seconds long (right?). That means that you have an intrinsic frequency resolution of 0.1 Hz, which is enough to separate the two frequencies. But looking at your configuration, you seem to be using multitapering with a frequency smoothing of 0.5 Hz. That means that you are using ~5 tapers and that the two frequencies of interest will be smeared into each other. If you want to use multitapering, you should decrease the cfg.tapsmofrq to less than 0.4 (e.g. 0.2). But I doubt whether you should use frequency smoothing here at all, since the frequencies are so low and only separated by a small amount. Better not use multitapering: in freqanalysis do cfg.taper='hanning' instead of the default 'dpss'. Furthermore, I suggest that you also look at the coherence between all MEG channels and the REF21 for the 46Hz and the REF11 for the 50Hz (i.e. the reference channel with which there probably should not be any coherence). You did not include those in your crsspctrm channel combinations. I started by looking at power. There seems to be quite some temporal and low-occipital (neck?) power in both conditions, which might be indicative of artifacts (although EMG typically peaks at much higher frequencies). That is something that you might want to check. -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic5.tiff Type: image/tiff Size: 17310 bytes Desc: not available URL: -------------- next part -------------- The topography of channel level coherence with REF22 looks nicely dipolar for the 46Hz, but with REF21 it does not look so clear for the 50Hz. AT 50Hz, there seems to be a bilateral blob that also extends into the right hemisphere. -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic1.tiff Type: image/tiff Size: 26772 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic2.tiff Type: image/tiff Size: 25120 bytes Desc: not available URL: -------------- next part -------------- I have recomputed the dics source reconstructions (just to be sure that they are done with the latest version). If I look at the 4.6 Hz, it looks nice. If I look at the 5 Hz, there is a relatively high and very sharp blob in the occipital midline, very close to the surface of the scanned volume. Given it's spatial sharpness, I don't trust it too much. But given the bilateral distribution of the coherence with REF21 in that condition, it also does not surprise me that a source at that location could be relatively highly coherent. -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic3.tiff Type: image/tiff Size: 44228 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic4.tiff Type: image/tiff Size: 42180 bytes Desc: not available URL: -------------- next part -------------- So, to me the outcome of the analysis looks more or less like I would expect from this data. I hope that you can further improve your analysis with the hints that I have given. best regards, Robert P.S. I executed the following lines of matlab code: load Freq_01_046 load Freq_01_050 load Source_01_046 load Source_01_050 frqdes46 = freqdescriptives([], freqDICS01_046); frqdes50 = freqdescriptives([], freqDICS01_050); cfg = []; cfg.xparam = 'foi'; cfg.zparam = 'powspctrm'; figure; topoplotER(cfg, frqdes46); figure; topoplotER(cfg, frqdes50); cfg.zparam = 'cohspctrm'; cfg.cohrefchannel = 'REF22' figure; topoplotER(cfg, frqdes46); cfg.cohrefchannel = 'REF21' figure; topoplotER(cfg, frqdes50); cfg = []; cfg = source01_046.cfg; cfg = rmfield(cfg, 'hdmfile'); cfg.vol = source01_046.vol; cfg.method = 'dics'; cfg.refchan = 'REF22'; source46 = sourceanalysis(cfg, freqDICS01_046); cfg.refchan = 'REF21'; source50 = sourceanalysis(cfg, freqDICS01_050); cfg = []; cfg.funparameter = 'avg.coh'; figure; sourceplot(cfg, source46) figure; sourceplot(cfg, source50) On 19 May 2005, at 20:14, Matsuhashi, Masao (NIH/NINDS) wrote: > Hi Robert, > > I am posting this message to the mailing list, with the original > message > added to the bottom. > > Thank you for your response. > > 1. Actually, the two frequencies are very close to each other. One is > 5 Hz > and the other is 4.6 (60/13) Hz. Sampling is 600/sec. I used 6000 trial > length so the frequency resolution should be 0.1 Hz, but I am not sure > because MTM decreases the frequency resolution in terms of W. > The two reference signals are not independent, as they share the common > carrier frequency of 60Hz, but when we calculated the coherence > sensor-wise, > they were separated relatively nicely. > > 2. I pushed the data to your ftp site. I hope it's working ok. > The filename is DICS_Matsuhashi_20050519.zip, containing 4 files. > Freq_01_050 and Source_01_050 are from condition 1, foi=5.0 Hz. > Freq_01_046 > and Source_01_046 are from condition 2, foi=4.6 Hz. > > Regards, > Masao From rajamoni at CCS.FAU.EDU Mon May 23 17:14:42 2005 From: rajamoni at CCS.FAU.EDU (R. Sreenivasan) Date: Mon, 23 May 2005 11:14:42 -0400 Subject: Anatomical names and coordiante system Message-ID: Hi I wish to study DICS with reference to some antomical location (s) - say Fusiform Gyrus Posterior - Right hemisphere. Now, How do I get the cooridate system for this location in order to compute DICS? Thanks, Vasan From tomh at KURAGE.NIMH.NIH.GOV Mon May 23 18:04:25 2005 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Mon, 23 May 2005 12:04:25 -0400 Subject: Anatomical names and coordiante system In-Reply-To: <003201c55faa$25a0ee70$061e5b83@vasan> Message-ID: R. Sreenivasan wrote: > I wish to study DICS with reference to some antomical location (s) - say > Fusiform Gyrus Posterior - Right hemisphere. Now, How do I get the > cooridate system for this location in order to compute DICS? You could use AFNI to look at your anatomical dataset, and it'll tell you the coordinates in either original or Talairach space. If you have a Talairached anatomical volume, you can display the fusiform using the Talairach Atlas (turn on atlas colors with a right click), and then you can convert to original coordinates. CTF datasets use PRI coordinates. -- Dr. Tom Holroyd "A man of genius makes no mistakes. His errors are volitional and are the portals of discovery." -- James Joyce From tomh at KURAGE.NIMH.NIH.GOV Mon May 23 21:26:25 2005 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Mon, 23 May 2005 15:26:25 -0400 Subject: CTF res4 File format In-Reply-To: Message-ID: > Looking through the matlab code, I traced the coil-error back to a res4 > file read error somewhat earlier: > > Any comments? Hmm, I just got the error: `coil2_pos' undefined near line 233 column 7 myself, but in my case it's much more easily explained: I had created a dataset using newDs2 that does not have _any_ MEG channels! It only contains virtual channels. So there are no gradiometers.... By the way, the ctf2matlab package from our website: http://kurage.nimh.nih.gov/meglab/Meg/Ctf2matlab reads this dataset properly, and I noticed that recent versions of Fieldtrip can use it (that's the ctf_read_res4 function). Right now it only uses the ctf2matlab verions if the read_ctf_res4 function fails and haseegsf is set (see the try code in read_fcdc_header.m). But you could switch it around to try the other one first. -- Dr. Tom Holroyd "A man of genius makes no mistakes. His errors are volitional and are the portals of discovery." -- James Joyce From tnt at PHYSIOL.OX.AC.UK Wed May 25 10:52:59 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Wed, 25 May 2005 10:52:59 +0200 Subject: data conversion Message-ID: Hi. I have 3-D spectrograms (time x frequency x amplitude) for different conditions and multiple subjects which were generated outside FieldTrip. I would like to compare them statistically using the paired t-test in CLUSTERRANDANALYS with correction for multiple comparisons. I have attempted to transfer these data into a format which FieldTrip should be able to read. However, it doesn't seem to work correctly. Below are the steps I have made during the transformation including a link to the files that were used or were generated in the process. Examples of the input and output data of various steps can be found here: http://www.physiol.ox.ac.uk/~tnt/specs/ Step 1: (converting data structure of individual subjects into FieldTrip format, one .mat file per condition per subject) %%%%%%%%%%%%%%%%%%%%%%%%%%%%% subj = { 'C1_A1/Average_L_A1_sub01_a_C1_A1' % example: 'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web 'C1_A1/Average_L_A1_sub02_a_C1_A1' 'C1_A1/Average_L_A1_sub04_a_C1_A1' 'C1_A1/Average_L_A1_sub05_a_C1_A1' 'C1_A1/Average_L_A1_sub07_a_C1_A1' 'C1_A1/Average_L_A1_sub07_b_C1_A1' 'C1_A1/Average_L_A1_sub09_a_C1_A1' 'C1_A1/Average_L_A1_sub10_a_C1_A1' 'C1_A1/Average_L_A1_sub10_b_C1_A1' 'C1_A1/Average_L_A1_sub11_a_C1_A1' 'C1_A1/Average_L_A1_sub11_b_C1_A1' 'C1_A1/Average_L_A1_sub12_a_C1_A1' 'C1_A1/Average_L_A1_sub12_b_C1_A1'; }; load fieldtrip_example1 % load template of data structure used by FieldTrip (example: 'fieldtrip_example1.mat' on the web ) Nsubj = 13; for i=1:Nsubj dataset = ['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/Spectrograms/' subj{i} '.mat']; outputname = ['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/fieldtrip_analysis/specs/' subj{i} '.mat']; load (dataset); % a sample dataset: 'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web tfr = oldtfr; %tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2)); % if htis line is used, 151 channels are created tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); % if this line is used 1 channel is created tfr.powspctrm(1,:,:) = data.specgr.data; % 3D put spectogram data into channel 1 of FieldTrip structure tfr.foi = data.F; % frequency information for y-axis tfr.toi= data.T; % time information for x-axis save (outputname, 'tfr'); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% This produces 'output_example_Step1_sub12_a_C1_A1.mat' on the web. In the next step I tried to convert all spectrograms from individual subjects into one data structure carrying the data for all subjects within one structure (this was done separately for two conditions): Step 2: (moving all subject data into a group structure, one for each condition) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% load fieldtrip_example1.mat; % example: 'fieldtrip_example1.mat' on the web group = oldtfr; group.sgn = oldtfr.label; group.powspctrm = []; files = dir('Average_L_A1_sub*mat'); % all the files created in step 1 above, e.g. 'output_example_Step1_sub12_a_C1_A1.mat' for i = 1:length(files) load (files(i).name); group.powspctrm(i,:,:,:) = tfr.powspctrm; % load subject data end group.toi=tfr.toi; group.foi=tfr.foi; group.dimord = 'rpt_sgn_frq_tim'; save ('group_Spec_L_A1.mat', 'group') %%%%%%%%%%%%%%%%%%%%%%%%%% creates 'output_Step2_group_Spec_L_A1.mat' on the web. When a matrix with 151 channels is created in step 1 by: tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2) the files become too large for the machine to handle at the group level (~500Mb each x 13 sets). Therefore, I proceed to the next step with a matrix of one channel tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); Step 3: (comparing two conditions from 13 subjects) %%%%%%%%%%%%%%%%%%%%%%%%% cfg = []; cfg.statistic = 'depsamplesT'; cfg.alphathresh = 0.05; cfg.makeclusters = 'yes'; cfg.minnbchan = 2; cfg.clusterteststat = 'maxsum'; cfg.onetwo = 'twosided'; cfg.alpha = 0.05; cfg.nranddraws = 100; cfg.channel = {'MEG'}; cfg.latency = [0 1]; [clusrand] = clusterrandanalysis (cfg, group_A, group_B); %%%%%%%%%%%%%%%%%%%%%%%%%% Then the following error message appears: >> [clusrand] = clusterrandanalysis (cfg, group_C1, group_C4); Selecting and formatting the data. selected 151 channels selected 626 time bins selected 159 frequency bins ??? Index exceeds matrix dimensions. Error in ==> /home/magnum/tnt//Fieldtrip/fieldtrip-20050522/private/prepare_timefreq_data.m On line 360 ==> dat{c} = avgoverdim(varargin{c}.dat(:, chansel, freqsel, timesel), avgdim); Error in ==> /home/magnum/tnt//Fieldtrip/fieldtrip-20050522/clusterrandanalysis.m On line 267 ==> [cfg,data]=prepare_timefreq_data(cfg, varargin{1:Nvarargin}); >> %%%%%%%%%%%%%% Thanks a lot in advance for your help. Thomas From tnt at PHYSIOL.OX.AC.UK Wed May 25 10:54:08 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Wed, 25 May 2005 10:54:08 +0200 Subject: data conversion Message-ID: Hi Thomas I did not look in full detail at the mail, but just browsed over it and noticed something that may be the cause: It states "selected 151 channels", but you mentioned that you have only one channel. In selecting a single channel to reduce the amount of data, did you also make the corresponding change in freq.label? Robert On Wed, 25 May 2005 10:52:59 +0200, Thomas Thesen wrote: >Hi. > >I have 3-D spectrograms (time x frequency x amplitude) for different >conditions and multiple subjects which were generated outside FieldTrip. I >would like to compare them statistically using the paired t-test in >CLUSTERRANDANALYS with correction for multiple comparisons. I have attempted >to transfer these data into a format which FieldTrip should be able to read. >However, it doesn't seem to work correctly. >Below are the steps I have made during the transformation including a link >to the files that were used or were generated in the process. > >Examples of the input and output data of various steps can be found here: >http://www.physiol.ox.ac.uk/~tnt/specs/ > > >Step 1: >(converting data structure of individual subjects into FieldTrip format, one >.mat file per condition per subject) >%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >subj = { >'C1_A1/Average_L_A1_sub01_a_C1_A1' % example: >'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web >'C1_A1/Average_L_A1_sub02_a_C1_A1' >'C1_A1/Average_L_A1_sub04_a_C1_A1' >'C1_A1/Average_L_A1_sub05_a_C1_A1' >'C1_A1/Average_L_A1_sub07_a_C1_A1' >'C1_A1/Average_L_A1_sub07_b_C1_A1' >'C1_A1/Average_L_A1_sub09_a_C1_A1' >'C1_A1/Average_L_A1_sub10_a_C1_A1' >'C1_A1/Average_L_A1_sub10_b_C1_A1' >'C1_A1/Average_L_A1_sub11_a_C1_A1' >'C1_A1/Average_L_A1_sub11_b_C1_A1' >'C1_A1/Average_L_A1_sub12_a_C1_A1' >'C1_A1/Average_L_A1_sub12_b_C1_A1'; >}; >load fieldtrip_example1 % load template of data structure used by >FieldTrip (example: 'fieldtrip_example1.mat' on the web ) > >Nsubj = 13; >for i=1:Nsubj > dataset = >['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/Spectrograms/' >subj{i} '.mat']; > outputname = >['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/fieldtrip_analysis/specs/' >subj{i} '.mat']; > load (dataset); % a sample dataset: >'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web > tfr = oldtfr; > %tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2)); % if htis >line is used, 151 channels are created > tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); % if this line is >used 1 channel is created > tfr.powspctrm(1,:,:) = data.specgr.data; % 3D >put spectogram data into channel 1 of FieldTrip structure > tfr.foi = data.F; % frequency information for y-axis > tfr.toi= data.T; % time information for x-axis > save (outputname, 'tfr'); >end > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >This produces 'output_example_Step1_sub12_a_C1_A1.mat' on the web. > >In the next step I tried to convert all spectrograms from individual >subjects into one data structure carrying the data for all subjects within >one structure (this was done separately for two conditions): > > >Step 2: >(moving all subject data into a group structure, one for each condition) >%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > >load fieldtrip_example1.mat; % example: 'fieldtrip_example1.mat' on the web >group = oldtfr; >group.sgn = oldtfr.label; >group.powspctrm = []; > >files = dir('Average_L_A1_sub*mat'); % all the files created in step 1 >above, e.g. 'output_example_Step1_sub12_a_C1_A1.mat' > >for i = 1:length(files) > load (files(i).name); > group.powspctrm(i,:,:,:) = tfr.powspctrm; % load subject data >end >group.toi=tfr.toi; >group.foi=tfr.foi; >group.dimord = 'rpt_sgn_frq_tim'; >save ('group_Spec_L_A1.mat', 'group') >%%%%%%%%%%%%%%%%%%%%%%%%%% > >creates 'output_Step2_group_Spec_L_A1.mat' on the web. > >When a matrix with 151 channels is created in step 1 by: >tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2) > > the files become too large for the machine to handle at the group level >(~500Mb each x 13 sets). > >Therefore, I proceed to the next step with a matrix of one channel >tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); > > > >Step 3: >(comparing two conditions from 13 subjects) >%%%%%%%%%%%%%%%%%%%%%%%%% >cfg = []; >cfg.statistic = 'depsamplesT'; >cfg.alphathresh = 0.05; >cfg.makeclusters = 'yes'; >cfg.minnbchan = 2; >cfg.clusterteststat = 'maxsum'; >cfg.onetwo = 'twosided'; >cfg.alpha = 0.05; >cfg.nranddraws = 100; >cfg.channel = {'MEG'}; >cfg.latency = [0 1]; > >[clusrand] = clusterrandanalysis (cfg, group_A, group_B); > >%%%%%%%%%%%%%%%%%%%%%%%%%% > >Then the following error message appears: > >>> [clusrand] = clusterrandanalysis (cfg, group_C1, group_C4); >Selecting and formatting the data. >selected 151 channels >selected 626 time bins >selected 159 frequency bins >??? Index exceeds matrix dimensions. > >Error in ==> >/home/magnum/tnt//Fieldtrip/fieldtrip-20050522/private/prepare_timefreq_data.m >On line 360 ==> dat{c} = avgoverdim(varargin{c}.dat(:, chansel, >freqsel, timesel), avgdim); > >Error in ==> >/home/magnum/tnt//Fieldtrip/fieldtrip-20050522/clusterrandanalysis.m >On line 267 ==> [cfg,data]=prepare_timefreq_data(cfg, >varargin{1:Nvarargin}); > >> > >%%%%%%%%%%%%%% > > >Thanks a lot in advance for your help. > >Thomas From tnt at PHYSIOL.OX.AC.UK Wed May 25 11:18:05 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Wed, 25 May 2005 11:18:05 +0200 Subject: data conversion Message-ID: Dear Robert, Thank you for your comment. When running CLUSTERRANDANALYSIS I have the following data structures that feed into the statistical analysis: group_C1 = label: {151x1 cell} dimord: 'rpt_sgn_frq_tim' powspctrm: [4-D double] foi: [1x159 double] toi: [1x2187 double] cfg: [1x1 struct] grad: [1x1 struct] sgn: {151x1 cell} As you said "group_C4.sgn" and "group_C4.label" indicate 151 channels, whereas the data in fact has only 1. I've tried the following: group_C4.sgn = ['spec'] group_C4.label = ['spec'] and group_C4.sgn={'spec'} group_C4.label={'spec'} but no success. Do you have any suggestion? Thanks a lot, Thomas On Wed, 25 May 2005 10:54:08 +0200, Thomas Thesen wrote: >Hi Thomas > > >I did not look in full detail at the mail, but just browsed over it and >noticed something that may be the cause: It states "selected 151 >channels", but you mentioned that you have only one channel. In >selecting a single channel to reduce the amount of data, did you also >make the corresponding change in freq.label? > > >Robert > >On Wed, 25 May 2005 10:52:59 +0200, Thomas Thesen wrote: > >>Hi. >> >>I have 3-D spectrograms (time x frequency x amplitude) for different >>conditions and multiple subjects which were generated outside FieldTrip. I >>would like to compare them statistically using the paired t-test in >>CLUSTERRANDANALYS with correction for multiple comparisons. I have attempted >>to transfer these data into a format which FieldTrip should be able to read. >>However, it doesn't seem to work correctly. >>Below are the steps I have made during the transformation including a link >>to the files that were used or were generated in the process. >> >>Examples of the input and output data of various steps can be found here: >>http://www.physiol.ox.ac.uk/~tnt/specs/ >> >> >>Step 1: >>(converting data structure of individual subjects into FieldTrip format, one >>.mat file per condition per subject) >>%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>subj = { >>'C1_A1/Average_L_A1_sub01_a_C1_A1' % example: >>'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web >>'C1_A1/Average_L_A1_sub02_a_C1_A1' >>'C1_A1/Average_L_A1_sub04_a_C1_A1' >>'C1_A1/Average_L_A1_sub05_a_C1_A1' >>'C1_A1/Average_L_A1_sub07_a_C1_A1' >>'C1_A1/Average_L_A1_sub07_b_C1_A1' >>'C1_A1/Average_L_A1_sub09_a_C1_A1' >>'C1_A1/Average_L_A1_sub10_a_C1_A1' >>'C1_A1/Average_L_A1_sub10_b_C1_A1' >>'C1_A1/Average_L_A1_sub11_a_C1_A1' >>'C1_A1/Average_L_A1_sub11_b_C1_A1' >>'C1_A1/Average_L_A1_sub12_a_C1_A1' >>'C1_A1/Average_L_A1_sub12_b_C1_A1'; >>}; >>load fieldtrip_example1 % load template of data structure used by >>FieldTrip (example: 'fieldtrip_example1.mat' on the web ) >> >>Nsubj = 13; >>for i=1:Nsubj >> dataset = >>['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/Spectrograms/' >>subj{i} '.mat']; >> outputname = >>['/home/magnum/tnt/data/meg/analysis/McGurk/MEG_for_SAM/fieldtrip_analysis/specs/' >>subj{i} '.mat']; >> load (dataset); % a sample dataset: >>'input_example_Step1_Average_L_A1_sub12_a_C1_A1.mat' on the web >> tfr = oldtfr; >> %tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2)); % if htis >>line is used, 151 channels are created >> tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); % if this line is >>used 1 channel is created >> tfr.powspctrm(1,:,:) = data.specgr.data; % 3D >>put spectogram data into channel 1 of FieldTrip structure >> tfr.foi = data.F; % frequency information for y-axis >> tfr.toi= data.T; % time information for x-axis >> save (outputname, 'tfr'); >>end >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>This produces 'output_example_Step1_sub12_a_C1_A1.mat' on the web. >> >>In the next step I tried to convert all spectrograms from individual >>subjects into one data structure carrying the data for all subjects within >>one structure (this was done separately for two conditions): >> >> >>Step 2: >>(moving all subject data into a group structure, one for each condition) >>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >>load fieldtrip_example1.mat; % example: 'fieldtrip_example1.mat' on the web >>group = oldtfr; >>group.sgn = oldtfr.label; >>group.powspctrm = []; >> >>files = dir('Average_L_A1_sub*mat'); % all the files created in step 1 >>above, e.g. 'output_example_Step1_sub12_a_C1_A1.mat' >> >>for i = 1:length(files) >> load (files(i).name); >> group.powspctrm(i,:,:,:) = tfr.powspctrm; % load subject data >>end >>group.toi=tfr.toi; >>group.foi=tfr.foi; >>group.dimord = 'rpt_sgn_frq_tim'; >>save ('group_Spec_L_A1.mat', 'group') >>%%%%%%%%%%%%%%%%%%%%%%%%%% >> >>creates 'output_Step2_group_Spec_L_A1.mat' on the web. >> >>When a matrix with 151 channels is created in step 1 by: >>tfr.powspctrm = zeros(151, size(data.F,2), size(data.T,2) >> >> the files become too large for the machine to handle at the group level >>(~500Mb each x 13 sets). >> >>Therefore, I proceed to the next step with a matrix of one channel >>tfr.powspctrm = zeros(1, size(data.F,2), size(data.T,2)); >> >> >> >>Step 3: >>(comparing two conditions from 13 subjects) >>%%%%%%%%%%%%%%%%%%%%%%%%% >>cfg = []; >>cfg.statistic = 'depsamplesT'; >>cfg.alphathresh = 0.05; >>cfg.makeclusters = 'yes'; >>cfg.minnbchan = 2; >>cfg.clusterteststat = 'maxsum'; >>cfg.onetwo = 'twosided'; >>cfg.alpha = 0.05; >>cfg.nranddraws = 100; >>cfg.channel = {'MEG'}; >>cfg.latency = [0 1]; >> >>[clusrand] = clusterrandanalysis (cfg, group_A, group_B); >> >>%%%%%%%%%%%%%%%%%%%%%%%%%% >> >>Then the following error message appears: >> >>>> [clusrand] = clusterrandanalysis (cfg, group_C1, group_C4); >>Selecting and formatting the data. >>selected 151 channels >>selected 626 time bins >>selected 159 frequency bins >>??? Index exceeds matrix dimensions. >> >>Error in ==> >>/home/magnum/tnt//Fieldtrip/fieldtrip-20050522/private/prepare_timefreq_data.m >>On line 360 ==> dat{c} = avgoverdim(varargin{c}.dat(:, chansel, >>freqsel, timesel), avgdim); >> >>Error in ==> >>/home/magnum/tnt//Fieldtrip/fieldtrip-20050522/clusterrandanalysis.m >>On line 267 ==> [cfg,data]=prepare_timefreq_data(cfg, >>varargin{1:Nvarargin}); >> >> >> >>%%%%%%%%%%%%%% >> >> >>Thanks a lot in advance for your help. >> >>Thomas From r.oostenveld at FCDONDERS.RU.NL Wed May 25 22:25:40 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 25 May 2005 22:25:40 +0200 Subject: data conversion In-Reply-To: Message-ID: On 25 May 2005, at 11:18, Thomas Thesen wrote: > group_C4.sgn={'spec'} > group_C4.label={'spec'} > > but no success. Do you have any suggestion? Could you be more specific? Robert From matsuham at NINDS.NIH.GOV Wed May 25 23:35:09 2005 From: matsuham at NINDS.NIH.GOV (Matsuhashi, Masao (NIH/NINDS)) Date: Wed, 25 May 2005 17:35:09 -0400 Subject: Source coherence Message-ID: Hi Robert, Thank you for your precious advice. I am still working to check the points you indicated. (At this moment, the topoplotER stopped working with reshaped freqdescriptive-ed data, but I will figure it out...) As regards the low-occipital low frequency noise, I thought that as long as such activity was not correlated with the reference signal it would not affect the coherence analysis very much (only that it might lower the coherence value in some channels). How do you think it will affect the source coherence? Masao ------------------------------------------------ Masao Matsuhashi, MD, PhD NINDS, NIH Tel: 1-301-594-9139 E-mail: MatsuhaM at ninds.nih.gov ------------------------------------------------ From sanja at UNM.EDU Thu May 26 03:13:18 2005 From: sanja at UNM.EDU (Sanja Kovacevic) Date: Thu, 26 May 2005 03:13:18 +0200 Subject: 275ch CTF stimulus channel and new CTF data format Message-ID: Hi Robert, Your answer helped a lot but there was also another problem. My stimulus channel “on” states were not 9, but 5 or 6 samples long. That's why I was getting all zeros for both frontpanel and backpanel. I adjusted trigshift (line 60) to 0 as the trigger values were either 0 or the predetermined on values. For all of my datasets I've looked at so far, there is no rising time for the stimulus channel. So, I guess this is another (nice) change in the new CTF 275 acquisition program... On another note, I ran some timefrequency analyses on the sensor level and I wanted to plot the data using multiplotTFR. I'd like to use the information from the header when plotting the sensors. However, if I use the gradiometer structure created with read_ctf_res4, i.e. cfg.layout = hdr.grad, I get an error message ??? Undefined command/function 'dist'. Error in ==> createlayout at 93 d = dist(prj'); You mentioned in one of your previous replies that sensor position and information is not being read correctly for the new CTF 275 datasets. (BTW, what tells you that read_fcdc_header does not read it correctly?) If I use ctf_read_res4 (ctf2matlab toolbox as mentioned by Tom Holroyd) I should be getting correct gradiometer information (right?).Well. I tried it both ways and I get identical position information with read_ctf_res4 (fcdc) and ctf_read_res4 (nimh). Orientation information differs in that that nimh code stores only first coil orientation, whereas the fcdc code stores both coil orientations. Both codes adjust for the possibility that sometimes coil orientations stored in res4 file may be pointing toward center. It is still not clear to me what happens later with orientation information and what effect of using only first coil orientation would be... What I would ultimately like to do is to run time frequency analysis (on the sensor level first, but also on the virtual sensor level) for each subject in the group and be able to compare the results using some statistical approach. However, first I need to establish whether the data is correctly read. I appreciate your and any other fieldtriper help, Sanja On Fri, 6 May 2005 09:21:48 +0200, Robert Oostenveld wrote: >Hi Sanja, > ><--let's move our email exchange over towards the discussion list--> > >On 5 May 2005, at 22:50, Sanja Kovacevic wrote: > >> Thank you for helping me with this. I changed the filetype and >> read_ctf_res.m files as you suggested, and I was able to read in the >> data, however now I got problem with definetrial.m. Actually, I think >> the problem is with read_ctf_trigger as the 275 CTF dataset does not >> have a channel named 'STIM' but 'UPPT001' (line 63 in >> read_ctf_trigger). That was easy to fix by replacing STIM with >> UPPT001. >> >> However, I don't understand why you use (line 70 and 71 in >> read_ctf_trigger.m) >> >> bpstim = fix(stim / 2^16); >> fpstim = double(bitand(uint32(stim), 2^16-1)); > >WHen I started at the donders and implemented this, I was told that our >151 ch system has a "frontpanel" and a "backpanel". I never looked very >acurately at the electronics cabinet and all the cables that go into >it, but I guess that they refer to the way in which the cabinet is >placed in our lab. Somehow, the CTF system's own triggers are put on >the frontpanel, and the triggers that are generated on the stimulus PC >are put on the backpanel. Since people write their stimulus programs on >the presentations pc, and define/write trigger values in the 16 >bit-range on that computer. They appear in the higher 16 bits of the 32 >bit STIM channel, which is confusing since then the values don't match >the ones on the presentation computer. Therefore the 16 lowest and 16 >highest bits are separated and treated separately. On line 70, the >highest 16 bits are shifted downward by 16 bits (i.e. divide by 2^16). >On line 71, the highest 16 bits are masked away, keeping only the >lowest 16 bits. > >> The trigger values on our CTF system use lower 8 bits, i.e. possible >> values of the triggers are from 0 to 255. I am now quite confused with >> what happens to my trigger values. The bottom line is that I have all >> zeroes for backpanel and frontpanel. > >I think that you should look at the so called "frontpanel" triggers >(whose bits are not shifted). > >> BTW, could you give me or point to an example of a user specified >> trialfun that would include trials where trigger with value of 10 ir >> trigger with value of 138 occurs? > >You mean either a 10 or a 138? Just from my head: > >function [trl] = trigger138(cfg) >hdr = read_fcdc_header(cfg.dataset); >event = read_fcdc_event(cfg.dataset); >trl = []; >prestim = 0.1; >poststim = 0.5; >for i=1:length(event) > if strcmp(event(i).type, 'frontpannel trigger') > if (event(i).value==10) | (event(i).value==138) > % found trigger of interest > trl(end+1,1) = event(i).sample - prestim*hds.Fs; > trl(end ,2) = event(i).sample + poststim*hds.Fs; > trl(end ,3) = - prestim*hds.Fs; > end > end >end > >You could put prestim and poststim (time in seconds) in the cfg >structure, to keep the function more flexible. From this example, you >caneasily to make a conditional function, i.e. find the sample at >which a trigger 138 occurred and which was preceded by a trigger 10. > >Alternatively, you can also use the standard code, i.e. without a >custom trialfunction, to achieve the same. Try this: > >cfg = []; >cfg.dataset = 'something.ds'; >cfg.trialdef.eventtype = 'frontpannel trigger'; >cfg.trialdef.eventvalue = [10 138]; >cfg.trialdef.prestim = 0.1; >cfg.trialdef.poststim = 0.5; >cfg = definetrial(cfg); > >best regards, >Robert From r.oostenveld at FCDONDERS.RU.NL Thu May 26 09:54:05 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 26 May 2005 09:54:05 +0200 Subject: 275ch CTF stimulus channel and new CTF data format In-Reply-To: Message-ID: Hi Sanja, On 26 May 2005, at 3:13, Sanja Kovacevic wrote: > Your answer helped a lot but there was also another problem. My > stimulus > channel “on” states were not 9, but 5 or 6 samples long. That's why I > was > getting all zeros for both frontpanel and backpanel. I adjusted > trigshift > (line 60) to 0 as the trigger values were either 0 or the > predetermined on This is something that was noted by Tom Holroyd as well. Furthermore, according to him the 275ch systems can have trigger channels that are not called 'STIM' (which is what our read_ctf_trigger assumes). The latest version of fieldtrip has an addition to read_fcdc_event, which automatically detects and reads all stimulus channels, does a flank detection and returns the value with no timeshift. The events will have the name 'STIM', 'UTGR001' etc. Thhe 'bakckpanel' and 'frontpanel' trigger with a 9 sample shift at 1200 Hz will remain to be supported for Donders people. I suggest that you have a look at the new code (which again only works sofar for the fcdc importer, but that should be easy to fix). > values. For all of my datasets I've looked at so far, there is no > rising > time for the stimulus channel. So, I guess this is another (nice) > change in > the new CTF 275 acquisition program... The slow rising trigger value might be due to our presentation computer and not to the CTF hardware itself. I am not sure though, I just knows that it is a feature of our MEG setup. > On another note, I ran some timefrequency analyses on the sensor level > and I > wanted to plot the data using multiplotTFR. I'd like to use the > information > from the header when plotting the sensors. However, if I use the > gradiometer structure created with read_ctf_res4, i.e. cfg.layout = > hdr.grad, I get an error message > ??? Undefined command/function 'dist'. > Error in ==> createlayout at 93 > d = dist(prj'); I just checked, dist turns out to be a function from the neural networks toolbox. >> which dist /opt/matlab-7.0.1/toolbox/nnet/nnet/dist.m There is no reason to use it, I will add my own implementation of dist which replaces the NN functionality. See attached file. -------------- next part -------------- A non-text attachment was scrubbed... Name: dist.m Type: application/octet-stream Size: 609 bytes Desc: not available URL: -------------- next part -------------- > You mentioned in one of your previous replies that sensor position and > information is not being read correctly for the new CTF 275 datasets. > (BTW, > what tells you that read_fcdc_header does not read it correctly?) I don't know actually. The header information from the nimh and the fcdc res4 importers are structured differently. The read_fcdc_wrapper around it does not shape all elements of the nimh hearer into the same format, and in particular the grad information is not assigned. SO I guess that "incorrect" only means incomplete. > If I use > ctf_read_res4 (ctf2matlab toolbox as mentioned by Tom Holroyd) I > should be > getting correct gradiometer information (right?). yes, I have no reason to assume that it is not correct. It is just shaped into a different structure. B.t.w. I recall that the ctf header contains the informatino twice, once in dewar coordinates and once in head coordinates. > It is still not clear to me what happens later with orientation > information > and what effect of using only first coil orientation would be... MEG data is the magnetic flux through the coil. If the coil is oriented in the opposite way but the field is the same, the flux is the opposite. However, somewhere in the reading routine there is a flag being used to indicate that the field has to be inverted, i.e. the MEG data is always represented as outgoing flux. That means that the forward computation also has to compute the outward flux for a given coil, and that in turn means that teh coil has to be oriented outwards (using the right hand rule) > What I > would ultimately like to do is to run time frequency analysis (on the > sensor > level first, but also on the virtual sensor level) for each subject in > the > group and be able to compare the results using some statistical > approach. For sensor level analysis you do'nt have to worry about the gradiometer orientations. If you compute virtual channels with SAM, you also don't have to worry. If you want to use the fieldtrip beamformer, the grad-structure should be correct. Robert From r.oostenveld at FCDONDERS.RU.NL Thu May 26 09:57:48 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 26 May 2005 09:57:48 +0200 Subject: Source coherence In-Reply-To: <6B5952376E0A164C81F2F18BF77B3FAB2ECDD3@NIHCESMLBX.nih.gov> Message-ID: Hi Masao, On 25 May 2005, at 23:35, Matsuhashi, Masao (NIH/NINDS) wrote: > As regards the low-occipital low frequency noise, I thought that as > long as > such activity was not correlated with the reference signal it would not > affect the coherence analysis very much (only that it might lower the > coherence value in some channels). How do you think it will affect the > source coherence? If present in the spatial structure of the cross-spectral density matrix, it affects the spatial filters. And hence it will affect the estimate of the source cross-spectral density. Since coherence is source CSD normalised by power, ideally it would not affect the source coherence. But I still would not be too confident about it, since the influence of artifacts on the filter can be difficult to predict. Robert From tnt at PHYSIOL.OX.AC.UK Thu May 26 10:52:09 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Thu, 26 May 2005 10:52:09 +0200 Subject: data conversion Message-ID: Hi Robert, You said: >It states "selected 151 >channels", but you mentioned that you have only one channel. In >selecting a single channel to reduce the amount of data, did you also >make the corresponding change in freq.label? How exactly do make the corresponding change to tell CLUSTERRANDANALYSIS that there is only one frequency channel to be analyzed? I assume I change something in the data structure, not in the cfg. setup, right? I tried to change group_C4.sgn={'spec'} group_C4.label={'spec'} to have single channel name entries, but that didn't do the job. Thanks a lot, Thomas On Wed, 25 May 2005 22:25:40 +0200, Robert Oostenveld wrote: >On 25 May 2005, at 11:18, Thomas Thesen wrote: > >> group_C4.sgn={'spec'} >> group_C4.label={'spec'} >> >> but no success. Do you have any suggestion? > >Could you be more specific? > >Robert> From maris at NICI.RU.NL Thu May 26 11:03:16 2005 From: maris at NICI.RU.NL (Eric Maris) Date: Thu, 26 May 2005 11:03:16 +0200 Subject: data conversion Message-ID: Hi Thomas, > Hi Robert, > You said: >>It states "selected 151 >>channels", but you mentioned that you have only one channel. In >>selecting a single channel to reduce the amount of data, did you also >>make the corresponding change in freq.label? > > How exactly do make the corresponding change to tell CLUSTERRANDANALYSIS > that there is only one frequency channel to be analyzed? I assume I > change > something in the data structure, not in the cfg. setup, right? I tried to > change group_C4.sgn={'spec'} group_C4.label={'spec'} to have single > channel > name entries, but that didn't do the job. > > Thanks a lot, > Thomas If your data structure (containing the TFR) has a single frequency only (e.g., group_C4.sgn={'chan1'}), then you have to do nothing. If the data structure contains multiple channels (e.g., group_C4.sgn={'chan1','chan2'}), then you have to specify cfg.channel={'chan1'} if you want to analyze this channel only. Good luck, Eric Maris > > > On Wed, 25 May 2005 22:25:40 +0200, Robert Oostenveld > wrote: > >>On 25 May 2005, at 11:18, Thomas Thesen wrote: >> >>> group_C4.sgn={'spec'} >>> group_C4.label={'spec'} >>> >>> but no success. Do you have any suggestion? >> >>Could you be more specific? >> >>Robert> From tnt at PHYSIOL.OX.AC.UK Thu May 26 12:11:18 2005 From: tnt at PHYSIOL.OX.AC.UK (Thomas Thesen) Date: Thu, 26 May 2005 12:11:18 +0200 Subject: data conversion Message-ID: Thank you Eric. Where did you get the NAN_SUM function from? A specific toolbox other than the Stats toolbox? In April you made revision 1.5 to CLUSTERRANDSTATISTICS and included NAN_SUM. I'm running matlab6 & 7 with the Stats toolbox and don't have this function. Looking online I couldn't find anything about NAN_SUM either. However, there is NANSUM, but replacing it in CLUSTERRANDSTATISTIC produces an error. Do you have any suggestions? cheers, Thomas On Thu, 26 May 2005 11:03:16 +0200, Eric Maris wrote: >Hi Thomas, > > >> Hi Robert, >> You said: >>>It states "selected 151 >>>channels", but you mentioned that you have only one channel. In >>>selecting a single channel to reduce the amount of data, did you also >>>make the corresponding change in freq.label? >> >> How exactly do make the corresponding change to tell CLUSTERRANDANALYSIS >> that there is only one frequency channel to be analyzed? I assume I >> change >> something in the data structure, not in the cfg. setup, right? I tried to >> change group_C4.sgn={'spec'} group_C4.label={'spec'} to have single >> channel >> name entries, but that didn't do the job. >> >> Thanks a lot, >> Thomas > >If your data structure (containing the TFR) has a single frequency only >(e.g., group_C4.sgn={'chan1'}), then you have to do nothing. If the data >structure contains multiple channels (e.g., group_C4.sgn={'chan1','chan2'}), >then you have to specify cfg.channel={'chan1'} if you want to analyze this >channel only. > > > >Good luck, > >Eric Maris > > > > >> >> >> On Wed, 25 May 2005 22:25:40 +0200, Robert Oostenveld >> wrote: >> >>>On 25 May 2005, at 11:18, Thomas Thesen wrote: >>> >>>> group_C4.sgn={'spec'} >>>> group_C4.label={'spec'} >>>> >>>> but no success. Do you have any suggestion? >>> >>>Could you be more specific? >>> >>>Robert> From r.oostenveld at FCDONDERS.RU.NL Thu May 26 16:30:47 2005 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 26 May 2005 16:30:47 +0200 Subject: data conversion In-Reply-To: Message-ID: It is a different implementation than the nansum from teh Matlab statistics toolbox that you ar ereferring to. lease find it attached. It will be included in the next release. Robert -------------- next part -------------- A non-text attachment was scrubbed... Name: nan_sum.m Type: application/octet-stream Size: 1339 bytes Desc: not available URL: -------------- next part -------------- On 26 May 2005, at 12:11, Thomas Thesen wrote: > Thank you Eric. > > Where did you get the NAN_SUM function from? A specific toolbox other > than > the Stats toolbox? In April you made revision 1.5 to > CLUSTERRANDSTATISTICS > and included NAN_SUM. > I'm running matlab6 & 7 with the Stats toolbox and don't have this > function. > Looking online I couldn't find anything about NAN_SUM either. However, > there > is NANSUM, but replacing it in CLUSTERRANDSTATISTIC produces an error. > Do > you have any suggestions? From stephan.moratti at UNI-KONSTANZ.DE Fri May 27 09:48:29 2005 From: stephan.moratti at UNI-KONSTANZ.DE (Stephan Moratti) Date: Fri, 27 May 2005 09:48:29 +0200 Subject: 275ch CTF stimulus channel and new CTF data format In-Reply-To: Message-ID: Hi Sanja, I had the same problem and I just created this kind of m-file: function [d] = dist(A); d = sum((A).^2).^0.5; At least it works, I hope I didn't something wrong, Best, Stephan At 03:13 26.05.2005 +0200, you wrote: >Hi Robert, > >Your answer helped a lot but there was also another problem. My stimulus >channel �on� states were not 9, but 5 or 6 samples long. That's why I was >getting all zeros for both frontpanel and backpanel. I adjusted trigshift >(line 60) to 0 as the trigger values were either 0 or the predetermined on >values. For all of my datasets I've looked at so far, there is no rising >time for the stimulus channel. So, I guess this is another (nice) change in >the new CTF 275 acquisition program... > >On another note, I ran some timefrequency analyses on the sensor level and I >wanted to plot the data using multiplotTFR. I'd like to use the information >from the header when plotting the sensors. However, if I use the >gradiometer structure created with read_ctf_res4, i.e. cfg.layout = >hdr.grad, I get an error message >??? Undefined command/function 'dist'. >Error in ==> createlayout at 93 > d = dist(prj'); > >You mentioned in one of your previous replies that sensor position and >information is not being read correctly for the new CTF 275 datasets. (BTW, >what tells you that read_fcdc_header does not read it correctly?) If I use >ctf_read_res4 (ctf2matlab toolbox as mentioned by Tom Holroyd) I should be >getting correct gradiometer information (right?).Well. I tried it both ways >and I get identical position information with read_ctf_res4 (fcdc) and >ctf_read_res4 (nimh). Orientation information differs in that that nimh code >stores only first coil orientation, whereas the fcdc code stores both coil >orientations. Both codes adjust for the possibility that sometimes coil >orientations stored in res4 file may be pointing toward center. > > It is still not clear to me what happens later with orientation information >and what effect of using only first coil orientation would be... What I >would ultimately like to do is to run time frequency analysis (on the sensor >level first, but also on the virtual sensor level) for each subject in the >group and be able to compare the results using some statistical approach. >However, first I need to establish whether the data is correctly read. > >I appreciate your and any other fieldtriper help, > >Sanja > > >On Fri, 6 May 2005 09:21:48 +0200, Robert Oostenveld > wrote: > >>Hi Sanja, >> >><--let's move our email exchange over towards the discussion list--> >> >>On 5 May 2005, at 22:50, Sanja Kovacevic wrote: >> >>> Thank you for helping me with this. I changed the filetype and >>> read_ctf_res.m files as you suggested, and I was able to read in the >>> data, however now I got problem with definetrial.m. Actually, I think >>> the problem is with read_ctf_trigger as the 275 CTF dataset does not >>> have a channel named 'STIM' but 'UPPT001' (line 63 in >>> read_ctf_trigger). That was easy to fix by replacing STIM with >>> UPPT001. >>> >>> However, I don't understand why you use (line 70 and 71 in >>> read_ctf_trigger.m) >>> >>> bpstim = fix(stim / 2^16); >>> fpstim = double(bitand(uint32(stim), 2^16-1)); >> >>WHen I started at the donders and implemented this, I was told that our >>151 ch system has a "frontpanel" and a "backpanel". I never looked very >>acurately at the electronics cabinet and all the cables that go into >>it, but I guess that they refer to the way in which the cabinet is >>placed in our lab. Somehow, the CTF system's own triggers are put on >>the frontpanel, and the triggers that are generated on the stimulus PC >>are put on the backpanel. Since people write their stimulus programs on >>the presentations pc, and define/write trigger values in the 16 >>bit-range on that computer. They appear in the higher 16 bits of the 32 >>bit STIM channel, which is confusing since then the values don't match >>the ones on the presentation computer. Therefore the 16 lowest and 16 >>highest bits are separated and treated separately. On line 70, the >>highest 16 bits are shifted downward by 16 bits (i.e. divide by 2^16). >>On line 71, the highest 16 bits are masked away, keeping only the >>lowest 16 bits. >> >>> The trigger values on our CTF system use lower 8 bits, i.e. possible >>> values of the triggers are from 0 to 255. I am now quite confused with >>> what happens to my trigger values. The bottom line is that I have all >>> zeroes for backpanel and frontpanel. >> >>I think that you should look at the so called "frontpanel" triggers >>(whose bits are not shifted). >> >>> BTW, could you give me or point to an example of a user specified >>> trialfun that would include trials where trigger with value of 10 ir >>> trigger with value of 138 occurs? >> >>You mean either a 10 or a 138? Just from my head: >> >>function [trl] = trigger138(cfg) >>hdr = read_fcdc_header(cfg.dataset); >>event = read_fcdc_event(cfg.dataset); >>trl = []; >>prestim = 0.1; >>poststim = 0.5; >>for i=1:length(event) >> if strcmp(event(i).type, 'frontpannel trigger') >> if (event(i).value==10) | (event(i).value==138) >> % found trigger of interest >> trl(end+1,1) = event(i).sample - prestim*hds.Fs; >> trl(end ,2) = event(i).sample + poststim*hds.Fs; >> trl(end ,3) = - prestim*hds.Fs; >> end >> end >>end >> >>You could put prestim and poststim (time in seconds) in the cfg >>structure, to keep the function more flexible. From this example, you >>caneasily to make a conditional function, i.e. find the sample at >>which a trigger 138 occurred and which was preceded by a trigger 10. >> >>Alternatively, you can also use the standard code, i.e. without a >>custom trialfunction, to achieve the same. Try this: >> >>cfg = []; >>cfg.dataset = 'something.ds'; >>cfg.trialdef.eventtype = 'frontpannel trigger'; >>cfg.trialdef.eventvalue = [10 138]; >>cfg.trialdef.prestim = 0.1; >>cfg.trialdef.poststim = 0.5; >>cfg = definetrial(cfg); >> >>best regards, >>Robert > ----------------------------- Dipl. Psych. Stephan Moratti Dept. of Psychology University of Konstanz P.O Box D25 Phone: +40 (0)7531 882385 Fax: +49 (0)7531 884601 D-78457 Konstanz, Germany e-mail: Stephan.Moratti at uni-konstanz.de http://www.clinical-psychology.uni-konstanz.de/ From stephan.moratti at UNI-KONSTANZ.DE Fri May 27 10:24:45 2005 From: stephan.moratti at UNI-KONSTANZ.DE (Stephan Moratti) Date: Fri, 27 May 2005 10:24:45 +0200 Subject: 275ch CTF stimulus channel and new CTF data format In-Reply-To: <3.0.5.32.20050527094829.00bce6e0@popserver.uni-konstanz.de > Message-ID: Hi Sanja, Please use Roberts m-file. The one I suggested doesn't produce the same results regarding dimensionalty (explaining some error I had :-) I replaced my dist.m with Robert's one. Sorry, if I produced confusion, Stephan At 09:48 27.05.2005 +0200, you wrote: >Hi Sanja, > >I had the same problem and I just created this kind of m-file: > >function [d] = dist(A); >d = sum((A).^2).^0.5; > >At least it works, I hope I didn't something wrong, > >Best, > >Stephan > > >At 03:13 26.05.2005 +0200, you wrote: >>Hi Robert, >> >>Your answer helped a lot but there was also another problem. My stimulus >>channel �on� states were not 9, but 5 or 6 samples long. That's why I was >>getting all zeros for both frontpanel and backpanel. I adjusted trigshift >>(line 60) to 0 as the trigger values were either 0 or the predetermined on >>values. For all of my datasets I've looked at so far, there is no rising >>time for the stimulus channel. So, I guess this is another (nice) change in >>the new CTF 275 acquisition program... >> >>On another note, I ran some timefrequency analyses on the sensor level and I >>wanted to plot the data using multiplotTFR. I'd like to use the information >>from the header when plotting the sensors. However, if I use the >>gradiometer structure created with read_ctf_res4, i.e. cfg.layout = >>hdr.grad, I get an error message >>??? Undefined command/function 'dist'. >>Error in ==> createlayout at 93 >> d = dist(prj'); >> >>You mentioned in one of your previous replies that sensor position and >>information is not being read correctly for the new CTF 275 datasets. (BTW, >>what tells you that read_fcdc_header does not read it correctly?) If I use >>ctf_read_res4 (ctf2matlab toolbox as mentioned by Tom Holroyd) I should be >>getting correct gradiometer information (right?).Well. I tried it both ways >>and I get identical position information with read_ctf_res4 (fcdc) and >>ctf_read_res4 (nimh). Orientation information differs in that that nimh code >>stores only first coil orientation, whereas the fcdc code stores both coil >>orientations. Both codes adjust for the possibility that sometimes coil >>orientations stored in res4 file may be pointing toward center. >> >> It is still not clear to me what happens later with orientation information >>and what effect of using only first coil orientation would be... What I >>would ultimately like to do is to run time frequency analysis (on the sensor >>level first, but also on the virtual sensor level) for each subject in the >>group and be able to compare the results using some statistical approach. >>However, first I need to establish whether the data is correctly read. >> >>I appreciate your and any other fieldtriper help, >> >>Sanja >> >> >>On Fri, 6 May 2005 09:21:48 +0200, Robert Oostenveld >> wrote: >> >>>Hi Sanja, >>> >>><--let's move our email exchange over towards the discussion list--> >>> >>>On 5 May 2005, at 22:50, Sanja Kovacevic wrote: >>> >>>> Thank you for helping me with this. I changed the filetype and >>>> read_ctf_res.m files as you suggested, and I was able to read in the >>>> data, however now I got problem with definetrial.m. Actually, I think >>>> the problem is with read_ctf_trigger as the 275 CTF dataset does not >>>> have a channel named 'STIM' but 'UPPT001' (line 63 in >>>> read_ctf_trigger). That was easy to fix by replacing STIM with >>>> UPPT001. >>>> >>>> However, I don't understand why you use (line 70 and 71 in >>>> read_ctf_trigger.m) >>>> >>>> bpstim = fix(stim / 2^16); >>>> fpstim = double(bitand(uint32(stim), 2^16-1)); >>> >>>WHen I started at the donders and implemented this, I was told that our >>>151 ch system has a "frontpanel" and a "backpanel". I never looked very >>>acurately at the electronics cabinet and all the cables that go into >>>it, but I guess that they refer to the way in which the cabinet is >>>placed in our lab. Somehow, the CTF system's own triggers are put on >>>the frontpanel, and the triggers that are generated on the stimulus PC >>>are put on the backpanel. Since people write their stimulus programs on >>>the presentations pc, and define/write trigger values in the 16 >>>bit-range on that computer. They appear in the higher 16 bits of the 32 >>>bit STIM channel, which is confusing since then the values don't match >>>the ones on the presentation computer. Therefore the 16 lowest and 16 >>>highest bits are separated and treated separately. On line 70, the >>>highest 16 bits are shifted downward by 16 bits (i.e. divide by 2^16). >>>On line 71, the highest 16 bits are masked away, keeping only the >>>lowest 16 bits. >>> >>>> The trigger values on our CTF system use lower 8 bits, i.e. possible >>>> values of the triggers are from 0 to 255. I am now quite confused with >>>> what happens to my trigger values. The bottom line is that I have all >>>> zeroes for backpanel and frontpanel. >>> >>>I think that you should look at the so called "frontpanel" triggers >>>(whose bits are not shifted). >>> >>>> BTW, could you give me or point to an example of a user specified >>>> trialfun that would include trials where trigger with value of 10 ir >>>> trigger with value of 138 occurs? >>> >>>You mean either a 10 or a 138? Just from my head: >>> >>>function [trl] = trigger138(cfg) >>>hdr = read_fcdc_header(cfg.dataset); >>>event = read_fcdc_event(cfg.dataset); >>>trl = []; >>>prestim = 0.1; >>>poststim = 0.5; >>>for i=1:length(event) >>> if strcmp(event(i).type, 'frontpannel trigger') >>> if (event(i).value==10) | (event(i).value==138) >>> % found trigger of interest >>> trl(end+1,1) = event(i).sample - prestim*hds.Fs; >>> trl(end ,2) = event(i).sample + poststim*hds.Fs; >>> trl(end ,3) = - prestim*hds.Fs; >>> end >>> end >>>end >>> >>>You could put prestim and poststim (time in seconds) in the cfg >>>structure, to keep the function more flexible. From this example, you >>>caneasily to make a conditional function, i.e. find the sample at >>>which a trigger 138 occurred and which was preceded by a trigger 10. >>> >>>Alternatively, you can also use the standard code, i.e. without a >>>custom trialfunction, to achieve the same. Try this: >>> >>>cfg = []; >>>cfg.dataset = 'something.ds'; >>>cfg.trialdef.eventtype = 'frontpannel trigger'; >>>cfg.trialdef.eventvalue = [10 138]; >>>cfg.trialdef.prestim = 0.1; >>>cfg.trialdef.poststim = 0.5; >>>cfg = definetrial(cfg); >>> >>>best regards, >>>Robert >> > > >----------------------------- >Dipl. Psych. Stephan Moratti >Dept. of Psychology >University of Konstanz >P.O Box D25 >Phone: +40 (0)7531 882385 >Fax: +49 (0)7531 884601 >D-78457 Konstanz, Germany >e-mail: Stephan.Moratti at uni-konstanz.de > > >http://www.clinical-psychology.uni-konstanz.de/ > ----------------------------- Dipl. Psych. Stephan Moratti Dept. of Psychology University of Konstanz P.O Box D25 Phone: +40 (0)7531 882385 Fax: +49 (0)7531 884601 D-78457 Konstanz, Germany e-mail: Stephan.Moratti at uni-konstanz.de http://www.clinical-psychology.uni-konstanz.de/ From tomh at KURAGE.NIMH.NIH.GOV Sun May 29 19:21:50 2005 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Sun, 29 May 2005 13:21:50 -0400 Subject: time shift in mtmconvol? Message-ID: I've been working with time-frequency plots made with mtmconvol. I'm using adapted t-f windows as shown below, and I've noticed that my peak ERD and ERS appear to be moving in time depending on the time window width. Here's part of the script, after preprocessing: cfg = []; cfg.output = 'pow'; cfg.method = 'mtmconvol'; N = 6; # number of cycles per time window K = 4; # number of tapers (amount of smoothing) cfg.foi = 2:.25:20; n = length(cfg.foi); cfg.t_ftimwin = zeros(1, n); cfg.t_ftimwin(:) = N ./ cfg.foi; cfg.tapsmofrq = zeros(1, n); cfg.tapsmofrq(:) = cfg.foi .* ((K + 1) / (2 * N)); cfg.keeptrials = 'no'; [freq] = freqanalysis(cfg, data); cfg = []; cfg.baseline = [-.4 .4]; cfg.baselinetype = 'relative'; fr = freqbaseline(cfg, freq); The plots show fr.powspctrm(1,:,:), that is, just one channel. There are 116 trials in each average, and time 0 is peak flexion of a thumb movement. In the first figure, the array of 4, the N parameter above is the only thing that changes, starting with a value of 2 in the upper left, and taking on values of 3, 4, and 5 for the upper right, lower left, and lower right, resp. The second figure is for N = 6. Since the t-f windows are functions of frequency, they also get narrower in bandwidth as the time width is stretched. The (K+1)/(2*N) factor ensures that the W parameter to dpss is always a multiple of 1/2. I'm not sure why that is a requirement in general, but I should also note that I'm doing all these computations using Octave, not Matlab, and the dpss.m file I'm using fails to converge properly if W is not a multiple of 1/2. Anyway, there's a very obvious shift in the positions of the peaks, as a function of N. Is there some problem with the way the padding is being done? I thought that the toi specified the centers of the time windows, so I didn't expect any shifts of this kind. Or are N = 2, 3, simply too small? The apparent shift might be a result of too much smoothing when N is small, perhaps. Thanks in advance for any insights you could give me. P.S. The latest CVS of Octave (2.9.3) will run fieldtrip, at least for CTF datasets and t-f plots. I haven't tested all of it, and there are some extra functions you need. I'll make them available on my website soon; email me if you can't wait. -- Dr. Tom Holroyd "A man of genius makes no mistakes. His errors are volitional and are the portals of discovery." -- James Joyce -------------- next part -------------- A non-text attachment was scrubbed... Name: mlc11b.png Type: image/png Size: 548248 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mlc11c.png Type: image/png Size: 152220 bytes Desc: not available URL: From tomh at KURAGE.NIMH.NIH.GOV Sun May 29 21:19:04 2005 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Sun, 29 May 2005 15:19:04 -0400 Subject: time shift in mtmconvol? In-Reply-To: <4299FA2E.7090005@kurage.nimh.nih.gov> Message-ID: Oh, the toi was missing from that message, sorry. cfg.toi = -.4:.02:.4; Dr. Tom Holroyd "A man of genius makes no mistakes. His errors are volitional and are the portals of discovery." -- James Joyce