From Erin.Oakman at nyumc.org Tue Mar 1 22:41:58 2011 From: Erin.Oakman at nyumc.org (Oakman, Erin) Date: Tue, 1 Mar 2011 16:41:58 -0500 Subject: [FieldTrip] importing .cnt Message-ID: <0F47B6EFAC0110438AE026CEF86D445925BEF869D4@MSGWSDCPMB04.nyumc.org> Good day everyone, Before trials are defined, there is a problem using ft_read_header to import .cnt files. Importing other file formats (.bdf) works fine. My lab has had this problem for several FT versions, and I wonder if anyone could help out. ??? Error using ==> ft_read_header at 85 file or directory 'ms-01.cnt' does not exist Error in ==> trialfun_general at 55 hdr = ft_read_header(cfg.headerfile, 'headerformat', cfg.headerformat); Error in ==> ft_definetrial at 128 [trl, event] = feval(cfg.trialfun, cfg); I'm using a 64-bit Linus machine. Erin ------------------------------------------------------------ This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. ================================= From Erin.Oakman at nyumc.org Tue Mar 1 22:52:29 2011 From: Erin.Oakman at nyumc.org (Oakman, Erin) Date: Tue, 1 Mar 2011 16:52:29 -0500 Subject: [FieldTrip] importing .cnt, example Message-ID: <0F47B6EFAC0110438AE026CEF86D445925BEF869D5@MSGWSDCPMB04.nyumc.org> Hi, This code gave me an error using ft_definetrial : %define trial, FT version 20110301 cfg=[]; cfg.datafile='ms-01.cnt' cfg.headerfile='ms-01.cnt' cfg.trialdef.eventtype = 'trigger'; cfg.trialdef.eventvalue = 2; cfg.trialdef.prestim = .5; cfg.trialdef.poststim = 1; ft_definetrial(cfg) ??? Error using ==> ft_read_header at 85 file or directory 'ms-01.cnt' does not exist Error in ==> trialfun_general at 55 hdr = ft_read_header(cfg.headerfile, 'headerformat', cfg.headerformat); Error in ==> ft_definetrial at 128 [trl, event] = feval(cfg.trialfun, cfg); I had this problem using .cnt files from human subjects or mice. I'm not sure how to get past this error. Erin ------------------------------------------------------------ This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. ================================= From batrod at gmail.com Tue Mar 1 23:32:28 2011 From: batrod at gmail.com (Rodolphe Nenert) Date: Tue, 1 Mar 2011 16:32:28 -0600 Subject: [FieldTrip] importing .cnt, example In-Reply-To: <0F47B6EFAC0110438AE026CEF86D445925BEF869D5@MSGWSDCPMB04.nyumc.org> References: <0F47B6EFAC0110438AE026CEF86D445925BEF869D5@MSGWSDCPMB04.nyumc.org> Message-ID: Dear Erin, apparently your problem is that your script doesn't know where is your CNT file. Put your file in the same folder as your script, or specify the pathway in your cfg. Hope this helps, Rodolphe. On Tue, Mar 1, 2011 at 3:52 PM, Oakman, Erin wrote: > Hi, > > > This code gave me an error using ft_definetrial : > > %define trial, FT version 20110301 > cfg=[]; > cfg.datafile='ms-01.cnt' > cfg.headerfile='ms-01.cnt' > cfg.trialdef.eventtype = 'trigger'; > cfg.trialdef.eventvalue = 2; > cfg.trialdef.prestim = .5; > cfg.trialdef.poststim = 1; > ft_definetrial(cfg) > > ??? Error using ==> ft_read_header at 85 > file or directory 'ms-01.cnt' does not exist > > Error in ==> trialfun_general at 55 > hdr = ft_read_header(cfg.headerfile, 'headerformat', cfg.headerformat); > > Error in ==> ft_definetrial at 128 > [trl, event] = feval(cfg.trialfun, cfg); > > > I had this problem using .cnt files from human subjects or mice. > I'm not sure how to get past this error. > > Erin > > ------------------------------------------------------------ > This email message, including any attachments, is for the sole use of the > intended recipient(s) and may contain information that is proprietary, > confidential, and exempt from disclosure under applicable law. Any > unauthorized review, use, disclosure, or distribution is prohibited. If you > have received this email in error please notify the sender by return email > and delete the original message. Please note, the recipient should check > this email and any attachments for the presence of viruses. The organization > accepts no liability for any damage caused by any virus transmitted by this > email. > ================================= > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -------------- next part -------------- An HTML attachment was scrubbed... URL: From marco.rotonda at gmail.com Wed Mar 2 16:44:25 2011 From: marco.rotonda at gmail.com (Marco Rotonda) Date: Wed, 2 Mar 2011 16:44:25 +0100 Subject: [FieldTrip] again on plv Message-ID: Hi Fieldtrippers, I thought I had quite a simple task but it's coming more and more an hassle (at least for me) so I'm here asking from your knowledge. I would like to find the plv. As far as I've seen now the plv is inside the ft_connectivityanalysis and is taking freq data as input. ok, so I did: cfg = []; cfg.method = 'wavelet'; cfg.output = 'powandcsd'; cfg.foi = 1:1:44; cfg.toi = -0.999:0.01:1; cfg.keeptrials = 'yes'; WG = ft_freqanalysis(cfg, dataG); Now my question is how to optimize the width and the gwidth. The point is that I don't know yet in which freq to search and I have quite a big foi 1:44 and not such a good shape is done. I've tried tfr but no csd is given so no plv. I have to use any other multitapers? Sorry for this trivial question. Marco -------------- next part -------------- An HTML attachment was scrubbed... URL: From ekanal at cmu.edu Wed Mar 2 19:10:23 2011 From: ekanal at cmu.edu (Kanal Eliezer) Date: Wed, 2 Mar 2011 13:10:23 -0500 Subject: [FieldTrip] problem with ft_multiplotER Message-ID: <91684855-E90C-46E6-9095-8C1108DACF79@cmu.edu> Hello FT users - I'm experiencing an odd error with ft_multiplotER, which seems to be a problem in the code. Attempting to use the function results in the following error (note: "data_timelock" is the output of the ft_timelockanalysis function): ~~~~ >> cfg=[]; >> cfg.layout = 'neuromag306all.lay'; >> ft_multiplotER(cfg, data_timelock) ??? Undefined function or variable "data". Error in ==> ft_datatype_timelock at 70 if isfield(data, 'numsamples'), data = rmfield(data, 'numsamples'); end Error in ==> ft_checkdata at 163 data = ft_datatype_timelock(data); Error in ==> ft_multiplotER at 179 varargin{i} = ft_checkdata(varargin{i}, 'datatype', {'timelock', 'freq'}); ~~~~ Looking in the ft_datatype_timelock function, it takes an input of "timelock" but seems to try to work on a "data" field: ~~~~ function timelock = ft_datatype_timelock(timelock, varargin) ... % remove the unwanted fields, it is unclear when they were precisely used if isfield(data, 'numsamples'), data = rmfield(data, 'numsamples'); end if isfield(data, 'numcovsamples'), data = rmfield(data, 'numcovsamples'); end if isfield(data, 'numblcovsamples'), data = rmfield(data, 'numblcovsamples'); end ~~~~ Is this intentional? I do see that it's called with varargin, but there's nowhere where the input arguments are assigned to the "data" variable. If this isn't the problem, can anyone help me figure out what the actual problem is? Thanks - Elli Kanal From marco.rotonda at gmail.com Wed Mar 2 19:22:58 2011 From: marco.rotonda at gmail.com (Marco Rotonda) Date: Wed, 2 Mar 2011 19:22:58 +0100 Subject: [FieldTrip] again on plv Message-ID: Hi Fieldtrippers, I thought I had quite a simple task but it's coming more and more an hassle (at least for me) so I'm here asking from your knowledge. I would like to find the plv. As far as I've seen now the plv is inside the ft_connectivityanalysis and is taking freq data as input. ok, so I did: cfg = []; cfg.method = 'wavelet'; cfg.output = 'powandcsd'; cfg.foi = 1:1:44; cfg.toi = -0.999:0.01:1; cfg.keeptrials = 'yes'; WG = ft_freqanalysis(cfg, dataG); Now my question is how to optimize the width and the gwidth. The point is that I don't know yet in which freq to search so I have quite a big foi 1:44 and not such a good shape is performed. I've tried tfr but no csd is given so no plv. I have to use any other multitapers? Sorry for this trivial question. Marco -------------- next part -------------- An HTML attachment was scrubbed... URL: From mahdi_meng at yahoo.com Wed Mar 2 19:35:14 2011 From: mahdi_meng at yahoo.com (m m) Date: Wed, 2 Mar 2011 10:35:14 -0800 (PST) Subject: [FieldTrip] question about artifact rejection Message-ID: <627585.36123.qm@web45806.mail.sp1.yahoo.com> Hi FT users, I have a question about artifact rejection. Is there any method to reject one channel in one trial and not whole channel of that trial? Thanks Mahdi -------------- next part -------------- An HTML attachment was scrubbed... URL: From jenwhitman at gmail.com Thu Mar 3 02:17:34 2011 From: jenwhitman at gmail.com (Jen Whitman) Date: Wed, 2 Mar 2011 17:17:34 -0800 Subject: [FieldTrip] difficulty with nifti format and ft_write_volume In-Reply-To: <7F6275BA-C597-4E11-958C-9E944F27F6C4@donders.ru.nl> References: <1F0F0930-4606-4EE0-B2D6-3D379B2DC9B4@donders.ru.nl> <676C9A29-2C90-4E02-9B3E-865BCDC5E28F@donders.ru.nl> <7F6275BA-C597-4E11-958C-9E944F27F6C4@donders.ru.nl> Message-ID: Hi Jan, While I now have the segmented volumes lining up properly using the spm8 template, the final beamformed images are still not producing the expected results (i.e. those I obtained when writing to spm2-analyze format). I've been using the new 'nifti_img' filetype for ft_volumewrite, so maybe that's the source of the problem. Is it possible that the coordinates are off for the new nifti_img format? As for the coordinates specified in the cfg, I first tried specifying 'ctf' as the input for ft_volumenormalise and 'spm' as the coordinates to be used by ft_volumewrite when writing images (also with cfg.spmversion='SPM8'). When that didn't work, I started changing whether coordinates were 'ctf' or 'spm' for ft_volumewrite, ft_volumenormalise, and even ft_sourceinterpolate, but still fail to produce the expected results previously found with spm2 analyze format images. Perhaps a tutorial analogous to this one ( http://fieldtrip.fcdonders.nl/tutorial/beamformer) but writing beamformed images to nifti_img format would be useful? Thanks for all your help so far, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: > Hi Jen, > > At first glance I have a comment on your script. You may need to explicitly > check the alignment of your segmented volume and the original anatomy. A > while a go some changes were made to ft_volumesegment, taking away the need > to do the flipdim(flipdim... operations. I have posted this on the > discussion list last January, but you may not have noticed. > Anyway, if you now have used a recent version of FieldTrip for your > segmentation both the location of your dipole grid, and the volume conductor > model will not be adequately coregistered with the data, which may lead to > funky results to begin with. That's most likely not related to the filetype > in which the volumes are saved for later use. > > Best wishes, > > Jan-Mathijs > > > > On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: > > Hello Jan, > > When calling volumesegment, I specified 'ctf' as the coordinate system. The > function I wrote to call volumesegment and prepare_singleshell for each > subject and save the results is pasted below, with a couple of comments > added for clarity. > Over the weekend I tried specifying the coordinate system in the call to > ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the > lines that said cfg.spmversion = 'spm8'; before calling a function. However, > that created worse results, as each plot involved stripes of activation and > empty voxels, suggesting that 'ctf' was not the correct coordinate system to > specify. > > Thanks for the attached script. Looking in that the comments in that, I > suspect that the solution to my problems will be to specify my filetype as > nifti_img rather than nifti. I'll let you know how that goes. > > Jen > > > ------------------------------------------------------------------------------------------------------------ > % the variable subj is simply a string consisting of a subject number (e.g. > 's05') which can be a folder name or part of a filename > function [vol mri segmentedmri > segmentedmriF]=call_volume_segment_function_spm8(subj) > cfg.spmversion = 'spm8'; > cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; > %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; > cfg.name=[subj '_volseg']; > cfg.write='yes'; > cfg.smooth='no'; > cfg.coordinates='ctf'; > mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter > and mriViewer software, after fiducials were marked > segmentedmri = volumesegment(cfg, mri); > segmentedmriF = segmentedmri; > segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); > segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); > segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); > segmentedmriF.transform = mri.transform; > segmentedmriF.anatomy = mri.anatomy; > cfg = []; > cfg.spmversion = 'spm8'; > vol = prepare_singleshell(cfg, segmentedmriF); > eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF > vol']) > > > > On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < > jan.schoffelen at donders.ru.nl> wrote: > >> Dear Jen, >> >> I do not manage to reproduce your issue, when only focussing on the >> ft_volumewrite and visualization part of your pipeline. See attached script, >> and yet an updated version of ft_volumewrite which you need to (hopefully) >> draw the same conclusion as I did. >> Yet, I only now realize that your question may pertain to the entire >> pipeline. It could be that something is going wrong there. >> I only see now that in the part of your script of which you reported that >> it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling >> ft_volumenormalise. I assume this is correct, because the coordinate system >> your source-reconstructed data lives in, is according to the CTF-convention, >> and not according to the SPM-convention. On the other hand, the template for >> the spatial normalization lives in the SPM-coordinate system. In order for >> the spatial normalization to work OK, Fieldtrip tries to convert from one >> coordinate system to the other (once again, this is appropriate behaviour), >> before doing the actual normalization. It seems that at least in the script >> you sent along, in the final (not working version), you specified >> cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is >> probably wrong. >> Another important point that should be mentioned, is that the coordinate >> systems in which the functional data and the anatomical data live should be >> the same for the ft_sourceinterpolate to make sense. In other words, if your >> source reconstructed images are defined on a 3D grid of positions in >> CTF-space, the mri.transform of your anatomy should describe a >> transformation from voxel to CTF-space. >> I think you may want to revisit step by step this part of the pipeline; I >> don't think the problem lies in the writing. >> A final possibility of course is that Mricron is misbehaving... >> >> Best, >> >> Jan-Mathijs >> >> >> >> >> >> >> On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: >> >> Hi Jan, >> >> I tried re-running the analysis with the new script you sent me, and the >> latest version of fieldtrip (since I needed ft_get_opt as well), but the >> spm8 images being written are still producing flawed results. It's the same >> problem as I mentioned briefly in my previous post. I am not getting any >> error messages when writing these images. Rather, my problem is that the >> spm8 and spm2 results from the same data ought to be identical when viewed >> in mricron, but they're far from it. When I use mricron to look at the >> results from the spm8-format images, combined across participants to create >> a t-image, I just get a single 'blob' spanning roughly half the brain. In >> contrast, when I used spm2-format previously on the same data, the t-image >> was much more meaningful; a posterior alpha power decrease in a set of >> regions corresponding to the 'task-positive network' (a network found in the >> results of an fMRI version of my experiment, and widely reported in the fMRI >> literature). >> >> This failure to replicate the spm2 results when using spm8 images from the >> same data leads me to suspect that something is wrong with the coordinates >> for spm8 format. However, after experimenting extensively with different cfg >> options I still haven't identified the problem. If I my structural MRIs have >> been saved to .mri files using CTF's MRIConverter program, which cfg >> options, particularly for coordinates, template images, and filetypes, >> should I specify before calling the ft_volumesegment, >> ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and >> ft_volumewrite functions? Or should I be calling a different set of >> functions now? >> >> Thanks again for your help, >> >> Jen >> >> On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: >> >>> Great, thanks! >>> >>> I'll start the analysis with your new script today and will let you know >>> how it works out. >>> >>> Jen >>> >>> On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < >>> jan.schoffelen at donders.ru.nl> wrote: >>> >>>> Dear Jen, >>>> >>>> I managed to reproduce your problem. The code was rather buggy and >>>> indeed ft_volumewrite did not behave as it should have. I now fixed it in >>>> the code and it should run fine now. Please find the updated file attached. >>>> It will be available on our ftp-server as of tonight. Please note that I >>>> updated the documentation, and changed the names of some of the options a >>>> bit. If you want to save your data in analyze-format, you should specify >>>> cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it >>>> should write out a volume to nifti-format, using SPM8. >>>> >>>> Best wishes, >>>> >>>> Jan-Mathijs >>>> >>>> >>>> >>>> >>>> >>>> On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: >>>> >>>> >>>> Dear Jan, >>>> >>>> Thanks for the quick reply. Yes, I have tried it out quite a few times >>>> now, experimenting with different settings in the cfgs. Below I'll paste the >>>> code I've been using to write images - first the code that successfully >>>> created spm2 images that produced good results, then the code used for >>>> creating nifti format images from the same data. The comments in this second >>>> part are at this point a bit of a maze of cfg options I've been changing >>>> back & forth. Any insights/suggestions regarding how to set up my cfgs to >>>> make this work would be greatly appreciated. >>>> >>>> Jen >>>> >>>> >>>> %%%%%%%% this code generated spm2-compatible images which did work >>>> (producing results that made sense). >>>> >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>> >>>> sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ >>>> sourcePre.avg.pow; >>>> >>>> cfg = []; >>>> cfg.downsample = 2; >>>> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); >>>> >>>> % projecting the plot onto a surface... >>>> cfg = []; >>>> cfg.coordinates = 'ctf'; >>>> cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; >>>> %this template is in MNI coordinates >>>> sourcetempIntN = volumenormalise(cfg, sourcetempInt); >>>> >>>> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) >>>> 'HzWin' int2str(win) 'width750ms']; >>>> cfg=[]; >>>> cfg.parameter = 'avg.pow'; % string, describing the functional >>>> data to be processed, e.g. 'pow', 'coh' or 'nai' >>>> cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; >>>> % filename without the extension >>>> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' >>>> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive >>>> (default = []) >>>> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', >>>> 'int16', 'int32', 'float' or 'double' >>>> >>>> volumewrite(cfg, sourcetempIntN) >>>> >>>> >>>> >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>> >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>> >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>> >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>> %%%%% this code below hasn't worked yet... >>>> >>>> % I added cfg.spmversion = 'spm8'; >>>> % in the cfgs for the calls to ft_prepare_leadfield and >>>> ft_sourceanalysis, >>>> % and in the call to prepare_singleshell after calling volumesegment >>>> >>>> % I've also ensured that spm8 is the only spm version in my path, even >>>> in >>>> % the fieldtrip/external folder, and ensured that spm8 is installed >>>> properly >>>> % (files compiled correctly, etc..) >>>> >>>> sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ >>>> sourcePre.avg.pow; >>>> >>>> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) >>>> 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; >>>> >>>> cfg = []; >>>> % cfg.coordinates = 'spm'; % changed for version 5 >>>> % cfg.spmversion = 'spm8'; % changed for version 5 >>>> cfg.downsample = 4; >>>> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); >>>> >>>> >>>> % projecting the plot onto a surface... >>>> cfg = []; >>>> %cfg.coordinates = 'spm'; % changed for version 5 >>>> %cfg.coordinates = 'ctf'; % changed for version 5 >>>> cfg.coordinates = 'spm'; % changed back to spm for version 9 >>>> cfg.downsample = 4; >>>> %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets >>>> specified in volumewrite) >>>> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to >>>> using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) >>>> has the desired voxel size >>>> % cfg.name = [filename]; % changed for version 6 >>>> %cfg.write= 'yes'; % changed for version 6 (when this was set to >>>> 'yes' there was no subsequent call to volumewrite) >>>> cfg.write= 'no'; % changed for version 6 >>>> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); >>>> >>>> % this whole cfg and function call added for version 6 >>>> cfg=[]; >>>> % cfg.parameter = string, describing the functional data to be >>>> processed, e.g. 'pow', 'coh' or 'nai' >>>> % cfg.filename = filename without the extension >>>> % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' >>>> % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to >>>> use >>>> % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = >>>> []) >>>> cfg.parameter='pow'; >>>> cfg.filename=filename; >>>> cfg.filetype = 'spm'; >>>> cfg.spmversion = 'SPM8'; % capitalized after first error message >>>> from vers 6 >>>> % cfg.dataformat='nifti'; % added after first error message from vers >>>> 6 >>>> % commented out after 2nd error message >>>> from vers 6 >>>> %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to >>>> specify unless cfg.filetyp='vmp' >>>> cfg.coordinates='spm'; >>>> ft_volumewrite(cfg,sourcetempIntN); >>>> >>>> >>>> >>>> >>>> >>>> On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen < >>>> jan.schoffelen at donders.ru.nl> wrote: >>>> >>>>> Dear Jen, >>>>> >>>>> I notice that indeed in the documentation section of ft_write_volume >>>>> there is a FIXME behind nifti. Yet, nifti format seems to be supported by >>>>> ft_write_volume (at least in a recent version of fieldtrip). Did you try it >>>>> at all (and ran into problems) or were you held back by the FIXME statement? >>>>> Could you just try it out using a recent fieldtrip function? >>>>> >>>>> Thanks and best wishes >>>>> >>>>> Jan-Mathijs >>>>> >>>>> >>>>> >>>>> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: >>>>> >>>>> Hello, >>>>>> >>>>>> While writing beamformed images to spm2 format in a previous version >>>>>> of fieldtrip (now lost due to a computer crash), I was able to get >>>>>> nice-looking results; networks of brain regions consistent with existing >>>>>> literature. When I try to write images from the same dataset and the same >>>>>> analysis to spm8 format, my results (t-images computed across subjects) end >>>>>> up being single clusters spanning large sections of the brain (e.g. a 'blob' >>>>>> spanning all of one hemisphere but not the other). Unfortunately, some >>>>>> aspects of my planned data analyses cannot be performed on spm2 images, so I >>>>>> have to find a way of writing to successfully to nifti format. >>>>>> >>>>>> I just noticed that in the comments in the ft_write_volume function, >>>>>> which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under >>>>>> the list of supported dataformats. Is there by any chance a patch out there >>>>>> for writing nifti images? >>>>>> >>>>>> Thanks! >>>>>> >>>>>> _______________________________________________ >>>>>> fieldtrip mailing list >>>>>> fieldtrip at donders.ru.nl >>>>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >>>>>> >>>>> >>>>> Dr. J.M. (Jan-Mathijs) Schoffelen >>>>> Donders Institute for Brain, Cognition and Behaviour, >>>>> Centre for Cognitive Neuroimaging, >>>>> Radboud University Nijmegen, The Netherlands >>>>> J.Schoffelen at donders.ru.nl >>>>> Telephone: 0031-24-3614793 >>>>> >>>>> _______________________________________________ >>>>> fieldtrip mailing list >>>>> fieldtrip at donders.ru.nl >>>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >>>>> >>>> >>>> _______________________________________________ >>>> fieldtrip mailing list >>>> fieldtrip at donders.ru.nl >>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >>>> >>>> >>>> Dr. J.M. (Jan-Mathijs) Schoffelen >>>> Donders Institute for Brain, Cognition and Behaviour, >>>> Centre for Cognitive Neuroimaging, >>>> Radboud University Nijmegen, The Netherlands >>>> J.Schoffelen at donders.ru.nl >>>> Telephone: 0031-24-3614793 >>>> >>>> >>>> _______________________________________________ >>>> fieldtrip mailing list >>>> fieldtrip at donders.ru.nl >>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >>>> >>> >>> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Thu Mar 3 09:31:44 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 3 Mar 2011 09:31:44 +0100 Subject: [FieldTrip] problem with ft_multiplotER In-Reply-To: <91684855-E90C-46E6-9095-8C1108DACF79@cmu.edu> References: <91684855-E90C-46E6-9095-8C1108DACF79@cmu.edu> Message-ID: <105CD4DB-6648-4B3E-A5C5-42AA320499EE@donders.ru.nl> Dear Elli, Sorry for the bug. It is indeed something in the code, due to a recent change (i.e. day before yesterday). It is now fixed in the latest versions (I hope). Best wishes, Jan-Mathijs On Mar 2, 2011, at 7:10 PM, Kanal Eliezer wrote: > Hello FT users - > > I'm experiencing an odd error with ft_multiplotER, which seems to be > a problem in the code. Attempting to use the function results in the > following error (note: "data_timelock" is the output of the > ft_timelockanalysis function): > > ~~~~ >>> cfg=[]; >>> cfg.layout = 'neuromag306all.lay'; >>> ft_multiplotER(cfg, data_timelock) > ??? Undefined function or variable "data". > > Error in ==> ft_datatype_timelock at 70 > if isfield(data, 'numsamples'), data = rmfield(data, > 'numsamples'); end > > Error in ==> ft_checkdata at 163 > data = ft_datatype_timelock(data); > > Error in ==> ft_multiplotER at 179 > varargin{i} = ft_checkdata(varargin{i}, 'datatype', {'timelock', > 'freq'}); > ~~~~ > > Looking in the ft_datatype_timelock function, it takes an input of > "timelock" but seems to try to work on a "data" field: > > ~~~~ > function timelock = ft_datatype_timelock(timelock, varargin) > ... > % remove the unwanted fields, it is unclear when they were precisely > used > if isfield(data, 'numsamples'), data = rmfield(data, > 'numsamples'); end > if isfield(data, 'numcovsamples'), data = rmfield(data, > 'numcovsamples'); end > if isfield(data, 'numblcovsamples'), data = rmfield(data, > 'numblcovsamples'); end > ~~~~ > > Is this intentional? I do see that it's called with varargin, but > there's nowhere where the input arguments are assigned to the "data" > variable. If this isn't the problem, can anyone help me figure out > what the actual problem is? Thanks - > > Elli Kanal > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From jm.horschig at donders.ru.nl Thu Mar 3 09:43:32 2011 From: jm.horschig at donders.ru.nl (=?ISO-8859-1?Q?=22J=F6rn_M=2E_Horschig=22?=) Date: Thu, 03 Mar 2011 09:43:32 +0100 Subject: [FieldTrip] question about artifact rejection In-Reply-To: <627585.36123.qm@web45806.mail.sp1.yahoo.com> References: <627585.36123.qm@web45806.mail.sp1.yahoo.com> Message-ID: <4D6F54B4.3080009@donders.ru.nl> Dear Mahdi, In FieldTrip, you can either reject a trial or a channel completely for your whole dataset. If you want to reject individual channels for single trials, you have to do it manually. I would not recommend it, though, because it will lead to inconsistencies and thus errors throughout the rest of your analyses, e.g. for freqanalysis it is necessary to have the same amount of channels for all trials. You can hack your way through this by replacing the corresponding channel with NaNs or zeros, but that will also lead to problems and may make your results invalid (depending on what you want to do). My advise would be to dismiss the whole trial or use ICA to remove certain components (a tutorial can be found on the FieldTrip website) Best, Jörn On 3/2/2011 7:35 PM, m m wrote: > Hi FT users, > > I have a question about artifact rejection. Is there any method to > reject one channel in one trial and not whole channel of that trial? > > Thanks > Mahdi > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Jörn M. Horschig PhD Student Donders Institute for Brain, Cognition and Behaviour Centre for Cognitive Neuroimaging Radboud University Nijmegen P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Contact: E-Mail: jm.horschig at donders.ru.nl Tel: +31-(0)24-36-68493 Web: http://www.ru.nl/fcdonders Visiting address: Trigon, room 2.30 Kapitelweg 29 NL-6525 EN Nijmegen The Netherlands -------------- next part -------------- An HTML attachment was scrubbed... URL: From Gregor.Volberg at psychologie.uni-regensburg.de Thu Mar 3 10:24:59 2011 From: Gregor.Volberg at psychologie.uni-regensburg.de (Gregor Volberg) Date: Thu, 03 Mar 2011 10:24:59 +0100 Subject: [FieldTrip] Antw: question about artifact rejection In-Reply-To: <627585.36123.qm@web45806.mail.sp1.yahoo.com> References: <627585.36123.qm@web45806.mail.sp1.yahoo.com> Message-ID: <4D6F6C7B0200005700008B59@gwsmtp1.uni-regensburg.de> Hi Mahdi, you should perhaps have a look at ft_channelrepair. I have not used it yet, but as I understood it interpolates bad channels by replacing them with the mean of its neighbours. It has the cfg option "trials" and can thus be restricted to single trials. Best regards, Gregor -- Dr. rer. nat. Gregor Volberg ( mailto:gregor.volberg at psychologie.uni-regensburg.de ) University of Regensburg Institute for Experimental Psychology 93040 Regensburg, Germany Tel: +49 941 943 3862 Fax: +49 941 943 3233 http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html >>> m m 3/2/2011 7:35 PM >>> Hi FT users, I have a question about artifact rejection. Is there any method to reject one channel in one trial and not whole channel of that trial? Thanks Mahdi -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Thu Mar 3 14:33:16 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 3 Mar 2011 14:33:16 +0100 Subject: [FieldTrip] difficulty with nifti format and ft_write_volume In-Reply-To: References: <1F0F0930-4606-4EE0-B2D6-3D379B2DC9B4@donders.ru.nl> <676C9A29-2C90-4E02-9B3E-865BCDC5E28F@donders.ru.nl> <7F6275BA-C597-4E11-958C-9E944F27F6C4@donders.ru.nl> Message-ID: <20E2353C-12A6-477F-A677-2BC279C7B752@donders.ru.nl> Dear Jen, You still did not manage to convince me that this is a file-format writing issue. I am willing to believe that this is the case if you have done the following: Perform source analysis. Interpolate the results onto the corresponding anatomy. Write the resulting file to disk, either using spm2, or using spm8. Importantly, you need to use the same matlab-variable, i.e. the output of ft_sourceinterpolate and not two results which may have come from two slightly different processing pipelines. From the e-mail conversation so far, I did not yet get the impression that you made this critical comparison. You may have done so, but in that case you did not manage to communicate that clearly enough (at least not to me). One other possible cause for your problem could be that Mricro is treating the different file-formats in a different way. When I read in the different file formats in fieldtrip I don't find a difference. Best wishes, Jan-Mathijs On Mar 3, 2011, at 2:17 AM, Jen Whitman wrote: > Hi Jan, > > While I now have the segmented volumes lining up properly using the > spm8 template, the final beamformed images are still not producing > the expected results (i.e. those I obtained when writing to spm2- > analyze format). I've been using the new 'nifti_img' filetype for > ft_volumewrite, so maybe that's the source of the problem. Is it > possible that the coordinates are off for the new nifti_img format? > > As for the coordinates specified in the cfg, I first tried > specifying 'ctf' as the input for ft_volumenormalise and 'spm' as > the coordinates to be used by ft_volumewrite when writing images > (also with cfg.spmversion='SPM8'). When that didn't work, I started > changing whether coordinates were 'ctf' or 'spm' for ft_volumewrite, > ft_volumenormalise, and even ft_sourceinterpolate, but still fail to > produce the expected results previously found with spm2 analyze > format images. Perhaps a tutorial analogous to this one (http://fieldtrip.fcdonders.nl/tutorial/beamformer > ) but writing beamformed images to nifti_img format would be useful? > > Thanks for all your help so far, > > Jen > > On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen > wrote: > Hi Jen, > > At first glance I have a comment on your script. You may need to > explicitly check the alignment of your segmented volume and the > original anatomy. A while a go some changes were made to > ft_volumesegment, taking away the need to do the flipdim(flipdim... > operations. I have posted this on the discussion list last January, > but you may not have noticed. > Anyway, if you now have used a recent version of FieldTrip for your > segmentation both the location of your dipole grid, and the volume > conductor model will not be adequately coregistered with the data, > which may lead to funky results to begin with. That's most likely > not related to the filetype in which the volumes are saved for later > use. > > Best wishes, > > Jan-Mathijs > > > > On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: > >> Hello Jan, >> >> When calling volumesegment, I specified 'ctf' as the coordinate >> system. The function I wrote to call volumesegment and >> prepare_singleshell for each subject and save the results is pasted >> below, with a couple of comments added for clarity. >> Over the weekend I tried specifying the coordinate system in the >> call to ft_volumenormalise as 'ctf' rather than 'spm', and >> commented out all the lines that said cfg.spmversion = 'spm8'; >> before calling a function. However, that created worse results, as >> each plot involved stripes of activation and empty voxels, >> suggesting that 'ctf' was not the correct coordinate system to >> specify. >> >> Thanks for the attached script. Looking in that the comments in >> that, I suspect that the solution to my problems will be to specify >> my filetype as nifti_img rather than nifti. I'll let you know how >> that goes. >> >> Jen >> >> ------------------------------------------------------------------------------------------------------------ >> % the variable subj is simply a string consisting of a subject >> number (e.g. 's05') which can be a folder name or part of a filename >> function [vol mri segmentedmri >> segmentedmriF]=call_volume_segment_function_spm8(subj) >> cfg.spmversion = 'spm8'; >> cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; >> %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; >> cfg.name=[subj '_volseg']; >> cfg.write='yes'; >> cfg.smooth='no'; >> cfg.coordinates='ctf'; >> mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF >> mriConverter and mriViewer software, after fiducials were marked >> segmentedmri = volumesegment(cfg, mri); >> segmentedmriF = segmentedmri; >> segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3), >> 2),1); >> segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white, >> 3),2),1); >> segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3), >> 2),1); >> segmentedmriF.transform = mri.transform; >> segmentedmriF.anatomy = mri.anatomy; >> cfg = []; >> cfg.spmversion = 'spm8'; >> vol = prepare_singleshell(cfg, segmentedmriF); >> eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri >> segmentedmriF vol']) >> >> >> >> On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen > > wrote: >> Dear Jen, >> >> I do not manage to reproduce your issue, when only focussing on the >> ft_volumewrite and visualization part of your pipeline. See >> attached script, and yet an updated version of ft_volumewrite which >> you need to (hopefully) draw the same conclusion as I did. >> Yet, I only now realize that your question may pertain to the >> entire pipeline. It could be that something is going wrong there. >> I only see now that in the part of your script of which you >> reported that it gave 'good' results, you specify cfg.coordinates = >> 'ctf' before calling ft_volumenormalise. I assume this is correct, >> because the coordinate system your source-reconstructed data lives >> in, is according to the CTF-convention, and not according to the >> SPM-convention. On the other hand, the template for the spatial >> normalization lives in the SPM-coordinate system. In order for the >> spatial normalization to work OK, Fieldtrip tries to convert from >> one coordinate system to the other (once again, this is appropriate >> behaviour), before doing the actual normalization. It seems that at >> least in the script you sent along, in the final (not working >> version), you specified cfg.coordinates = 'spm' prior to calling >> ft_volumenormalise. This is probably wrong. >> Another important point that should be mentioned, is that the >> coordinate systems in which the functional data and the anatomical >> data live should be the same for the ft_sourceinterpolate to make >> sense. In other words, if your source reconstructed images are >> defined on a 3D grid of positions in CTF-space, the mri.transform >> of your anatomy should describe a transformation from voxel to CTF- >> space. >> I think you may want to revisit step by step this part of the >> pipeline; I don't think the problem lies in the writing. >> A final possibility of course is that Mricron is misbehaving... >> >> Best, >> >> Jan-Mathijs >> >> >> >> >> >> >> On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: >> >>> Hi Jan, >>> >>> I tried re-running the analysis with the new script you sent me, >>> and the latest version of fieldtrip (since I needed ft_get_opt as >>> well), but the spm8 images being written are still producing >>> flawed results. It's the same problem as I mentioned briefly in my >>> previous post. I am not getting any error messages when writing >>> these images. Rather, my problem is that the spm8 and spm2 results >>> from the same data ought to be identical when viewed in mricron, >>> but they're far from it. When I use mricron to look at the results >>> from the spm8-format images, combined across participants to >>> create a t-image, I just get a single 'blob' spanning roughly half >>> the brain. In contrast, when I used spm2-format previously on the >>> same data, the t-image was much more meaningful; a posterior alpha >>> power decrease in a set of regions corresponding to the 'task- >>> positive network' (a network found in the results of an fMRI >>> version of my experiment, and widely reported in the fMRI >>> literature). >>> >>> This failure to replicate the spm2 results when using spm8 images >>> from the same data leads me to suspect that something is wrong >>> with the coordinates for spm8 format. However, after experimenting >>> extensively with different cfg options I still haven't identified >>> the problem. If I my structural MRIs have been saved to .mri files >>> using CTF's MRIConverter program, which cfg options, particularly >>> for coordinates, template images, and filetypes, should I specify >>> before calling the ft_volumesegment, ft_prepare_singleshell, >>> ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite >>> functions? Or should I be calling a different set of functions now? >>> >>> Thanks again for your help, >>> >>> Jen >>> >>> On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman >>> wrote: >>> Great, thanks! >>> >>> I'll start the analysis with your new script today and will let >>> you know how it works out. >>> >>> Jen >>> >>> On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen >> > wrote: >>> Dear Jen, >>> >>> I managed to reproduce your problem. The code was rather buggy and >>> indeed ft_volumewrite did not behave as it should have. I now >>> fixed it in the code and it should run fine now. Please find the >>> updated file attached. It will be available on our ftp-server as >>> of tonight. Please note that I updated the documentation, and >>> changed the names of some of the options a bit. If you want to >>> save your data in analyze-format, you should specify cfg.filetype >>> = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should >>> write out a volume to nifti-format, using SPM8. >>> >>> Best wishes, >>> >>> Jan-Mathijs >>> >>> >>> >>> >>> >>> On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: >>> >>>> >>>> Dear Jan, >>>> >>>> Thanks for the quick reply. Yes, I have tried it out quite a few >>>> times now, experimenting with different settings in the cfgs. >>>> Below I'll paste the code I've been using to write images - first >>>> the code that successfully created spm2 images that produced good >>>> results, then the code used for creating nifti format images from >>>> the same data. The comments in this second part are at this point >>>> a bit of a maze of cfg options I've been changing back & forth. >>>> Any insights/suggestions regarding how to set up my cfgs to make >>>> this work would be greatly appreciated. >>>> >>>> Jen >>>> >>>> >>>> %%%%%%%% this code generated spm2-compatible images which did >>>> work (producing results that made sense). >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>> >>>> sourcetemp.avg.pow = (sourcetemp.avg.pow - >>>> sourcePre.avg.pow) ./ sourcePre.avg.pow; >>>> >>>> cfg = []; >>>> cfg.downsample = 2; >>>> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); >>>> >>>> % projecting the plot onto a surface... >>>> cfg = []; >>>> cfg.coordinates = 'ctf'; >>>> cfg.template = '/home/common/matlab/spm2/templates/ >>>> T1.mnc'; %this template is in MNI coordinates >>>> sourcetempIntN = volumenormalise(cfg, sourcetempInt); >>>> >>>> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >>>> int2str(f) 'HzWin' int2str(win) 'width750ms']; >>>> cfg=[]; >>>> cfg.parameter = 'avg.pow'; % string, describing the >>>> functional data to be processed, e.g. 'pow', 'coh' or 'nai' >>>> cfg.filename = [filename '.img']; >>>> %'testimageoutput_alphafreq'; % filename without the extension >>>> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' >>>> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for >>>> interactive (default = []) >>>> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', >>>> 'uint8', 'int16', 'int32', 'float' or 'double' >>>> >>>> volumewrite(cfg, sourcetempIntN) >>>> >>>> >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>> %%%%% this code below hasn't worked yet... >>>> >>>> % I added cfg.spmversion = 'spm8'; >>>> % in the cfgs for the calls to ft_prepare_leadfield and >>>> ft_sourceanalysis, >>>> % and in the call to prepare_singleshell after calling >>>> volumesegment >>>> >>>> % I've also ensured that spm8 is the only spm version in my path, >>>> even in >>>> % the fieldtrip/external folder, and ensured that spm8 is >>>> installed properly >>>> % (files compiled correctly, etc..) >>>> >>>> sourcetemp.avg.pow = (sourcetemp.avg.pow - >>>> sourcePre.avg.pow) ./ sourcePre.avg.pow; >>>> >>>> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >>>> int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; >>>> >>>> cfg = []; >>>> % cfg.coordinates = 'spm'; % changed for version 5 >>>> % cfg.spmversion = 'spm8'; % changed for version 5 >>>> cfg.downsample = 4; >>>> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); >>>> >>>> >>>> % projecting the plot onto a surface... >>>> cfg = []; >>>> %cfg.coordinates = 'spm'; % changed for version 5 >>>> %cfg.coordinates = 'ctf'; % changed for version 5 >>>> cfg.coordinates = 'spm'; % changed back to spm for version 9 >>>> cfg.downsample = 4; >>>> %cfg.spmversion = 'spm8'; % changed for version 6 (because >>>> this gets specified in volumewrite) >>>> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent >>>> to using spm8/templates/EPI.nii, except that mask.nii (produced >>>> from fmri data) has the desired voxel size >>>> % cfg.name = [filename]; % changed for version 6 >>>> %cfg.write= 'yes'; % changed for version 6 (when this was set >>>> to 'yes' there was no subsequent call to volumewrite) >>>> cfg.write= 'no'; % changed for version 6 >>>> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); >>>> >>>> % this whole cfg and function call added for version 6 >>>> cfg=[]; >>>> % cfg.parameter = string, describing the functional >>>> data to be processed, e.g. 'pow', 'coh' or 'nai' >>>> % cfg.filename = filename without the extension >>>> % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' >>>> % cfg.vmpversion = 1 or 2 (default) version of the vmp- >>>> format to use >>>> % cfg.coordinates = 'spm, 'ctf' or empty for interactive >>>> (default = []) >>>> cfg.parameter='pow'; >>>> cfg.filename=filename; >>>> cfg.filetype = 'spm'; >>>> cfg.spmversion = 'SPM8'; % capitalized after first error >>>> message from vers 6 >>>> % cfg.dataformat='nifti'; % added after first error message >>>> from vers 6 >>>> % commented out after 2nd error >>>> message from vers 6 >>>> %cfg.vmpversion=2; % this is a filetype, like spm, so don't >>>> need to specify unless cfg.filetyp='vmp' >>>> cfg.coordinates='spm'; >>>> ft_volumewrite(cfg,sourcetempIntN); >>>> >>>> >>>> >>>> >>>> >>>> On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen >>> > wrote: >>>> Dear Jen, >>>> >>>> I notice that indeed in the documentation section of >>>> ft_write_volume there is a FIXME behind nifti. Yet, nifti format >>>> seems to be supported by ft_write_volume (at least in a recent >>>> version of fieldtrip). Did you try it at all (and ran into >>>> problems) or were you held back by the FIXME statement? Could you >>>> just try it out using a recent fieldtrip function? >>>> >>>> Thanks and best wishes >>>> >>>> Jan-Mathijs >>>> >>>> >>>> >>>> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: >>>> >>>> Hello, >>>> >>>> While writing beamformed images to spm2 format in a previous >>>> version of fieldtrip (now lost due to a computer crash), I was >>>> able to get nice-looking results; networks of brain regions >>>> consistent with existing literature. When I try to write images >>>> from the same dataset and the same analysis to spm8 format, my >>>> results (t-images computed across subjects) end up being single >>>> clusters spanning large sections of the brain (e.g. a 'blob' >>>> spanning all of one hemisphere but not the other). Unfortunately, >>>> some aspects of my planned data analyses cannot be performed on >>>> spm2 images, so I have to find a way of writing to successfully >>>> to nifti format. >>>> >>>> I just noticed that in the comments in the ft_write_volume >>>> function, which I am calling via ft_volumewrite, it says 'FIXME' >>>> next to nifti under the list of supported dataformats. Is there >>>> by any chance a patch out there for writing nifti images? >>>> >>>> Thanks! >>>> >>>> _______________________________________________ >>>> fieldtrip mailing list >>>> fieldtrip at donders.ru.nl >>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >>>> >>>> Dr. J.M. (Jan-Mathijs) Schoffelen >>>> Donders Institute for Brain, Cognition and Behaviour, >>>> Centre for Cognitive Neuroimaging, >>>> Radboud University Nijmegen, The Netherlands >>>> J.Schoffelen at donders.ru.nl >>>> Telephone: 0031-24-3614793 >>>> >>>> _______________________________________________ >>>> fieldtrip mailing list >>>> fieldtrip at donders.ru.nl >>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >>>> >>>> _______________________________________________ >>>> fieldtrip mailing list >>>> fieldtrip at donders.ru.nl >>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >>> >>> >>> Dr. J.M. (Jan-Mathijs) Schoffelen >>> Donders Institute for Brain, Cognition and Behaviour, >>> Centre for Cognitive Neuroimaging, >>> Radboud University Nijmegen, The Netherlands >>> J.Schoffelen at donders.ru.nl >>> Telephone: 0031-24-3614793 >>> >>> >>> _______________________________________________ >>> fieldtrip mailing list >>> fieldtrip at donders.ru.nl >>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >>> >>> >>> _______________________________________________ >>> fieldtrip mailing list >>> fieldtrip at donders.ru.nl >>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ekanal at cmu.edu Fri Mar 4 15:10:57 2011 From: ekanal at cmu.edu (Kanal Eliezer) Date: Fri, 4 Mar 2011 09:10:57 -0500 Subject: [FieldTrip] ft_componentanalysis component timecourse Message-ID: Hello - I'm trying to use the ft_componentanalysis function to remove a motion artifact in my dataset, but I'm confused as to how this function works. If called as component = ft_componentanalysis(cfg, data), the output seems to be in two fields, component.topo and component.trials. However, neither of these seems to contain the actual components. "component.topo" holds some an NxN matrix, where N is the number of sensors; I would expect the components to be "N x time". "component.trials" is numTrials x sensors x time, which seems to represent many more components than were actually calculated. How do I get the actual component timecourses? Thanks, Eliezer From Jan.Hirschmann at med.uni-duesseldorf.de Fri Mar 4 15:27:05 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Fri, 4 Mar 2011 15:27:05 +0100 Subject: [FieldTrip] potential problem with ft_topoplotER Message-ID: <72E993C35FB11743B79FF9286E5B6D8B023D41AC@Mail2-UKD.VMED.UKD> Dear fieldtrip developers, I don't know whether it is a bug or due to badly chosen settings, but I have experienced a problem with ft_topoplotER. I suspect that the function does not plot power values appropriately in the presence of labelcmb field. I do frequency analysis with the output powandcsd with the newest fieldtrip release: cfg=[]; cfg.method='mtmfft'; cfg.output='powandcsd'; cfg.calcdof='yes'; cfg.taper='hanning'; cfg.channelcmb={'MEG***2',refchan;'MEG***3',refchan}; cfg.foilim=[5 90]; freq1=ft_freqanalysis(cfg,data1); What I get is a power spectrum matrix with all the channels of the original data and a cross spectrum matrix according to my labelcmb. freq1 = label: {320x1 cell} dimord: 'chan_freq' freq: [1x88 double] powspctrm: [320x88 double] labelcmb: {204x2 cell} crsspctrm: [204x88 double] dof: [240x88 double] cumtapcnt: [240x1 double] grad: [1x1 struct] cfg: [1x1 struct] After having some doubts about the power topoplots I set all but one channel in the .powspctrm field to 0. freq1.powspctrm=zeros(size(freq1.powspctrm)); ind=strmatch('MEG2222',freq1.label); freq1.powspctrm(ind,:)=1; When plotting I don't see the one channel that has power but everything is 0 (see topo1.jpg) cfg=[]; cfg.xparam='freq'; cfg.zparam='powspctrm'; cfg.cohrefchannel=refchan; cfg.layout='/data/apps/fieldtrip/latest/template/neuromag306all.lay'; ft_topoplotER(cfg,freq1) Yet, when I remove the labelcmb field from freq1 it works alright (topo2.jpg) freq1=rmfield(freq1,'labelcmb'); Likewise, I may get the index ind from freq1.labelcmb(:,1), set it to 1, and it works. So it seems that topoplotER plots 204 channel values (number of rows in .labelcmb and .crsspctrm) although there are 306 MEG channels in the frequency data. I guess in such a situation channel data is neglected in the topoplots without the user being aware and the values may not be plotted at the correct place. I hope this helps in the development and is not simply a user error from my side. Best to you, jan Jan Hirschmann MSc. Neuroscience Insititute of Clinical Neuroscience and Medical Psychology Heinrich Heine University Duesseldorf Universitaetsstr. 1 40225 Duesseldorf Tel: 0049 - (0)211 - 81 - 18415 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: topo1.jpg Type: image/jpeg Size: 23667 bytes Desc: topo1.jpg URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: topo2.jpg Type: image/jpeg Size: 17309 bytes Desc: topo2.jpg URL: From jm.horschig at donders.ru.nl Fri Mar 4 15:31:54 2011 From: jm.horschig at donders.ru.nl (=?ISO-8859-1?Q?=22J=F6rn_M=2E_Horschig=22?=) Date: Fri, 04 Mar 2011 15:31:54 +0100 Subject: [FieldTrip] ft_componentanalysis component timecourse In-Reply-To: References: Message-ID: <4D70F7DA.7050907@donders.ru.nl> Dear Eliezer, There seems to be some confusion. component.topo is actually NxM, where N is the number of sensors and M the number of components you computed. M is equal to N if your channels are independent from each other, thus your data is full rank (this may not be the case if there e.g. is a gel-bridge or channels did not record a signal - please correct me if I am wrong). Anyway, as you pointed out, [quote] "component.trials" is numTrials x sensors x time [/quote], actually it is numTrials x components x time, which means you get one time course for each component per trial. components.topo contains the (un)mixing matrix, i.e. the weighting of the individual channels per component (that is probably what you mean, when you referred to 'components'). So, dependent on what you want, these are the two field of interest. If you want to know your components, you have to use component.topo, if you want to look at the time courses, use component.trials. Hope this helps! Best regards, Jörn On 3/4/2011 3:10 PM, Kanal Eliezer wrote: > Hello - > > I'm trying to use the ft_componentanalysis function to remove a motion artifact in my dataset, but I'm confused as to how this function works. If called as > > component = ft_componentanalysis(cfg, data), > > the output seems to be in two fields, component.topo and component.trials. However, neither of these seems to contain the actual components. "component.topo" holds some an NxN matrix, where N is the number of sensors; I would expect the components to be "N x time". "component.trials" is numTrials x sensors x time, which seems to represent many more components than were actually calculated. How do I get the actual component timecourses? > > Thanks, > Eliezer > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Jörn M. Horschig PhD Student Donders Institute for Brain, Cognition and Behaviour Centre for Cognitive Neuroimaging Radboud University Nijmegen P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Contact: E-Mail: jm.horschig at donders.ru.nl Tel: +31-(0)24-36-68493 Web: http://www.ru.nl/fcdonders Visiting address: Trigon, room 2.30 Kapitelweg 29 NL-6525 EN Nijmegen The Netherlands From jan.schoffelen at donders.ru.nl Fri Mar 4 16:04:19 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Fri, 4 Mar 2011 16:04:19 +0100 Subject: [FieldTrip] potential problem with ft_topoplotER In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B023D41AC@Mail2-UKD.VMED.UKD> References: <72E993C35FB11743B79FF9286E5B6D8B023D41AC@Mail2-UKD.VMED.UKD> Message-ID: <6DDACA7B-2BFC-4F77-83C9-D57DBC4596DB@donders.ru.nl> Hi Jan, Which FT-version are you using? There have been quite some changes to the code recently, so let's be sure that you are working from the most recent version. Then, why do you specify a cohrefchannel in your configuration if you want to plot power? That probably does not have to do with it, but I'm just curious. If you are interested in plotting power at this stage, I would first call ft_freqdescriptives on your variable freq1. That should solve your problem, right? Best, Jan-Mathijs On Mar 4, 2011, at 3:27 PM, wrote: > Dear fieldtrip developers, > > I don’t know whether it is a bug or due to badly chosen settings, > but I have experienced a problem with ft_topoplotER. I suspect that > the function does not plot power values appropriately in the > presence of labelcmb field. I do frequency analysis with the output > powandcsd with the newest fieldtrip release: > > cfg=[]; > cfg.method='mtmfft'; > cfg.output='powandcsd'; > cfg.calcdof='yes'; > cfg.taper='hanning'; > cfg.channelcmb={'MEG***2',refchan;'MEG***3',refchan}; > cfg.foilim=[5 90]; > freq1=ft_freqanalysis(cfg,data1); > > What I get is a power spectrum matrix with all the channels of the > original data and a cross spectrum matrix according to my labelcmb. > > freq1 = > > label: {320x1 cell} > dimord: 'chan_freq' > freq: [1x88 double] > powspctrm: [320x88 double] > labelcmb: {204x2 cell} > crsspctrm: [204x88 double] > dof: [240x88 double] > cumtapcnt: [240x1 double] > grad: [1x1 struct] > cfg: [1x1 struct] > > After having some doubts about the power topoplots I set all but one > channel in the .powspctrm field to 0. > > freq1.powspctrm=zeros(size(freq1.powspctrm)); > ind=strmatch('MEG2222',freq1.label); > freq1.powspctrm(ind,:)=1; > > When plotting I don’t see the one channel that has power but > everything is 0 (see topo1.jpg) > > cfg=[]; > cfg.xparam='freq'; > cfg.zparam='powspctrm'; > cfg.cohrefchannel=refchan; > cfg.layout='/data/apps/fieldtrip/latest/template/neuromag306all.lay'; > ft_topoplotER(cfg,freq1) > > Yet, when I remove the labelcmb field from freq1 it works alright > (topo2.jpg) > > freq1=rmfield(freq1,'labelcmb'); > > Likewise, I may get the index ind from freq1.labelcmb(:,1), set it > to 1, and it works. So it seems that topoplotER plots 204 channel > values (number of rows in .labelcmb and .crsspctrm) although there > are 306 MEG channels in the frequency data. I guess in such a > situation channel data is neglected in the topoplots without the > user being aware and the values may not be plotted at the correct > place. I hope this helps in the development and is not simply a user > error from my side. > > Best to you, > jan > > > > > > Jan Hirschmann > MSc. Neuroscience > Insititute of Clinical Neuroscience and Medical Psychology > Heinrich Heine University Duesseldorf > Universitaetsstr. 1 > 40225 Duesseldorf > Tel: 0049 - (0)211 - 81 - 18415 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From smoratti at psi.ucm.es Fri Mar 4 16:06:51 2011 From: smoratti at psi.ucm.es (Stephan Moratti) Date: Fri, 04 Mar 2011 16:06:51 +0100 Subject: [FieldTrip] potential problem with ft_topoplotER In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B023D41AC@Mail2-UKD.VMED.UKD> References: <72E993C35FB11743B79FF9286E5B6D8B023D41AC@Mail2-UKD.VMED.UKD> Message-ID: <33C5D6BA-122B-4E4A-A085-1582DFDEF111@psi.ucm.es> what if you try topoplotTFR. topoplotER is for time series data, whereas topoplotTFR is for time-frequ data. Best, Stephan El 04/03/2011, a las 15:27, Jan.Hirschmann at med.uni-duesseldorf.de escribió: > Dear fieldtrip developers, > > I don’t know whether it is a bug or due to badly chosen settings, > but I have experienced a problem with ft_topoplotER. I suspect that > the function does not plot power values appropriately in the > presence of labelcmb field. I do frequency analysis with the output > powandcsd with the newest fieldtrip release: > > cfg=[]; > cfg.method='mtmfft'; > cfg.output='powandcsd'; > cfg.calcdof='yes'; > cfg.taper='hanning'; > cfg.channelcmb={'MEG***2',refchan;'MEG***3',refchan}; > cfg.foilim=[5 90]; > freq1=ft_freqanalysis(cfg,data1); > > What I get is a power spectrum matrix with all the channels of the > original data and a cross spectrum matrix according to my labelcmb. > > freq1 = > > label: {320x1 cell} > dimord: 'chan_freq' > freq: [1x88 double] > powspctrm: [320x88 double] > labelcmb: {204x2 cell} > crsspctrm: [204x88 double] > dof: [240x88 double] > cumtapcnt: [240x1 double] > grad: [1x1 struct] > cfg: [1x1 struct] > > After having some doubts about the power topoplots I set all but one > channel in the .powspctrm field to 0. > > freq1.powspctrm=zeros(size(freq1.powspctrm)); > ind=strmatch('MEG2222',freq1.label); > freq1.powspctrm(ind,:)=1; > > When plotting I don’t see the one channel that has power but > everything is 0 (see topo1.jpg) > > cfg=[]; > cfg.xparam='freq'; > cfg.zparam='powspctrm'; > cfg.cohrefchannel=refchan; > cfg.layout='/data/apps/fieldtrip/latest/template/neuromag306all.lay'; > ft_topoplotER(cfg,freq1) > > Yet, when I remove the labelcmb field from freq1 it works alright > (topo2.jpg) > > freq1=rmfield(freq1,'labelcmb'); > > Likewise, I may get the index ind from freq1.labelcmb(:,1), set it > to 1, and it works. So it seems that topoplotER plots 204 channel > values (number of rows in .labelcmb and .crsspctrm) although there > are 306 MEG channels in the frequency data. I guess in such a > situation channel data is neglected in the topoplots without the > user being aware and the values may not be plotted at the correct > place. I hope this helps in the development and is not simply a user > error from my side. > > Best to you, > jan > > > > > > Jan Hirschmann > MSc. Neuroscience > Insititute of Clinical Neuroscience and Medical Psychology > Heinrich Heine University Duesseldorf > Universitaetsstr. 1 > 40225 Duesseldorf > Tel: 0049 - (0)211 - 81 - 18415 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip ________________________________________________________ Stephan Moratti, PhD see also: http://web.me.com/smoratti/ Department of Basic Psychology Universidad Complutense de Madrid Centro de Tecnología Biomédica CBT, Universidad Politécnica de Madrid, en la actualidad (currently at) en el Centro de Magnetoencefalografía Dr. Perez Modrego, Universidad Complutense de Madrid, Faculdad de Medicina, Pabellón 8, Avda. Complutense, s/n, 28040 Madrid, Spain, email: smoratti at psi.ucm.es Tel.: +34 91 394 2186 Fax.: +34 91 394 2294 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Fri Mar 4 16:13:57 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Fri, 4 Mar 2011 16:13:57 +0100 Subject: [FieldTrip] potential problem with ft_topoplotER In-Reply-To: <33C5D6BA-122B-4E4A-A085-1582DFDEF111@psi.ucm.es> References: <72E993C35FB11743B79FF9286E5B6D8B023D41AC@Mail2-UKD.VMED.UKD> <33C5D6BA-122B-4E4A-A085-1582DFDEF111@psi.ucm.es> Message-ID: <6D9D86B8-FDB9-4977-8CE7-5222B0E45E1A@donders.ru.nl> Hi Stephan, As a matter of fact, ft_topoplotER can be also used for frequency domain data, when no time axis is present (i.e. non-TFR data). Best, Jan-Mathijs On Mar 4, 2011, at 4:06 PM, Stephan Moratti wrote: > > what if you try topoplotTFR. topoplotER is for time series data, > whereas topoplotTFR is for time-frequ data. > > Best, > > Stephan > > El 04/03/2011, a las 15:27, Jan.Hirschmann at med.uni-duesseldorf.de > escribió: > >> Dear fieldtrip developers, >> >> I don’t know whether it is a bug or due to badly chosen settings, >> but I have experienced a problem with ft_topoplotER. I suspect >> that the function does not plot power values appropriately in the >> presence of labelcmb field. I do frequency analysis with the output >> powandcsd with the newest fieldtrip release: >> >> cfg=[]; >> cfg.method='mtmfft'; >> cfg.output='powandcsd'; >> cfg.calcdof='yes'; >> cfg.taper='hanning'; >> cfg.channelcmb={'MEG***2',refchan;'MEG***3',refchan}; >> cfg.foilim=[5 90]; >> freq1=ft_freqanalysis(cfg,data1); >> >> What I get is a power spectrum matrix with all the channels of the >> original data and a cross spectrum matrix according to my labelcmb. >> >> freq1 = >> >> label: {320x1 cell} >> dimord: 'chan_freq' >> freq: [1x88 double] >> powspctrm: [320x88 double] >> labelcmb: {204x2 cell} >> crsspctrm: [204x88 double] >> dof: [240x88 double] >> cumtapcnt: [240x1 double] >> grad: [1x1 struct] >> cfg: [1x1 struct] >> >> After having some doubts about the power topoplots I set all but >> one channel in the .powspctrm field to 0. >> >> freq1.powspctrm=zeros(size(freq1.powspctrm)); >> ind=strmatch('MEG2222',freq1.label); >> freq1.powspctrm(ind,:)=1; >> >> When plotting I don’t see the one channel that has power but >> everything is 0 (see topo1.jpg) >> >> cfg=[]; >> cfg.xparam='freq'; >> cfg.zparam='powspctrm'; >> cfg.cohrefchannel=refchan; >> cfg.layout='/data/apps/fieldtrip/latest/template/neuromag306all.lay'; >> ft_topoplotER(cfg,freq1) >> >> Yet, when I remove the labelcmb field from freq1 it works alright >> (topo2.jpg) >> >> freq1=rmfield(freq1,'labelcmb'); >> >> Likewise, I may get the index ind from freq1.labelcmb(:,1), set it >> to 1, and it works. So it seems that topoplotER plots 204 channel >> values (number of rows in .labelcmb and .crsspctrm) although there >> are 306 MEG channels in the frequency data. I guess in such a >> situation channel data is neglected in the topoplots without the >> user being aware and the values may not be plotted at the correct >> place. I hope this helps in the development and is not simply a >> user error from my side. >> >> Best to you, >> jan >> >> >> >> >> >> Jan Hirschmann >> MSc. Neuroscience >> Insititute of Clinical Neuroscience and Medical Psychology >> Heinrich Heine University Duesseldorf >> Universitaetsstr. 1 >> 40225 Duesseldorf >> Tel: 0049 - (0)211 - 81 - 18415 >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > ________________________________________________________ > Stephan Moratti, PhD > > see also: http://web.me.com/smoratti/ > > Department of Basic Psychology > Universidad Complutense de Madrid > > Centro de Tecnología Biomédica CBT, > Universidad Politécnica de Madrid, > > en la actualidad (currently at) en el > Centro de Magnetoencefalografía Dr. Perez Modrego, > Universidad Complutense de Madrid, > Faculdad de Medicina, > Pabellón 8, > Avda. Complutense, s/n, > 28040 Madrid, > Spain, > > email: smoratti at psi.ucm.es > Tel.: +34 91 394 2186 > Fax.: +34 91 394 2294 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From smoratti at psi.ucm.es Fri Mar 4 16:28:20 2011 From: smoratti at psi.ucm.es (Stephan Moratti) Date: Fri, 04 Mar 2011 16:28:20 +0100 Subject: [FieldTrip] potential problem with ft_topoplotER In-Reply-To: <6D9D86B8-FDB9-4977-8CE7-5222B0E45E1A@donders.ru.nl> References: <72E993C35FB11743B79FF9286E5B6D8B023D41AC@Mail2-UKD.VMED.UKD> <33C5D6BA-122B-4E4A-A085-1582DFDEF111@psi.ucm.es> <6D9D86B8-FDB9-4977-8CE7-5222B0E45E1A@donders.ru.nl> Message-ID: <90257F8A-13CE-41D6-B6CE-A7B9F4F8E54F@psi.ucm.es> I was not aware of that! Thanks for the hint, and sorry for my former comment that was kind of useless, Best, Stephan El 04/03/2011, a las 16:13, jan-mathijs schoffelen escribió: > Hi Stephan, > > As a matter of fact, ft_topoplotER can be also used for frequency > domain data, when no time axis is present (i.e. non-TFR data). > > Best, > > Jan-Mathijs > > On Mar 4, 2011, at 4:06 PM, Stephan Moratti wrote: > >> >> what if you try topoplotTFR. topoplotER is for time series data, >> whereas topoplotTFR is for time-frequ data. >> >> Best, >> >> Stephan >> >> El 04/03/2011, a las 15:27, Jan.Hirschmann at med.uni-duesseldorf.de >> escribió: >> >>> Dear fieldtrip developers, >>> >>> I don’t know whether it is a bug or due to badly chosen settings, >>> but I have experienced a problem with ft_topoplotER. I suspect >>> that the function does not plot power values appropriately in the >>> presence of labelcmb field. I do frequency analysis with the >>> output powandcsd with the newest fieldtrip release: >>> >>> cfg=[]; >>> cfg.method='mtmfft'; >>> cfg.output='powandcsd'; >>> cfg.calcdof='yes'; >>> cfg.taper='hanning'; >>> cfg.channelcmb={'MEG***2',refchan;'MEG***3',refchan}; >>> cfg.foilim=[5 90]; >>> freq1=ft_freqanalysis(cfg,data1); >>> >>> What I get is a power spectrum matrix with all the channels of the >>> original data and a cross spectrum matrix according to my labelcmb. >>> >>> freq1 = >>> >>> label: {320x1 cell} >>> dimord: 'chan_freq' >>> freq: [1x88 double] >>> powspctrm: [320x88 double] >>> labelcmb: {204x2 cell} >>> crsspctrm: [204x88 double] >>> dof: [240x88 double] >>> cumtapcnt: [240x1 double] >>> grad: [1x1 struct] >>> cfg: [1x1 struct] >>> >>> After having some doubts about the power topoplots I set all but >>> one channel in the .powspctrm field to 0. >>> >>> freq1.powspctrm=zeros(size(freq1.powspctrm)); >>> ind=strmatch('MEG2222',freq1.label); >>> freq1.powspctrm(ind,:)=1; >>> >>> When plotting I don’t see the one channel that has power but >>> everything is 0 (see topo1.jpg) >>> >>> cfg=[]; >>> cfg.xparam='freq'; >>> cfg.zparam='powspctrm'; >>> cfg.cohrefchannel=refchan; >>> cfg.layout='/data/apps/fieldtrip/latest/template/ >>> neuromag306all.lay'; >>> ft_topoplotER(cfg,freq1) >>> >>> Yet, when I remove the labelcmb field from freq1 it works alright >>> (topo2.jpg) >>> >>> freq1=rmfield(freq1,'labelcmb'); >>> >>> Likewise, I may get the index ind from freq1.labelcmb(:,1), set it >>> to 1, and it works. So it seems that topoplotER plots 204 channel >>> values (number of rows in .labelcmb and .crsspctrm) although there >>> are 306 MEG channels in the frequency data. I guess in such a >>> situation channel data is neglected in the topoplots without the >>> user being aware and the values may not be plotted at the correct >>> place. I hope this helps in the development and is not simply a >>> user error from my side. >>> >>> Best to you, >>> jan >>> >>> >>> >>> >>> >>> Jan Hirschmann >>> MSc. Neuroscience >>> Insititute of Clinical Neuroscience and Medical Psychology >>> Heinrich Heine University Duesseldorf >>> Universitaetsstr. 1 >>> 40225 Duesseldorf >>> Tel: 0049 - (0)211 - 81 - 18415 >>> >>> >>> _______________________________________________ >>> fieldtrip mailing list >>> fieldtrip at donders.ru.nl >>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> ________________________________________________________ >> Stephan Moratti, PhD >> >> see also: http://web.me.com/smoratti/ >> >> Department of Basic Psychology >> Universidad Complutense de Madrid >> >> Centro de Tecnología Biomédica CBT, >> Universidad Politécnica de Madrid, >> >> en la actualidad (currently at) en el >> Centro de Magnetoencefalografía Dr. Perez Modrego, >> Universidad Complutense de Madrid, >> Faculdad de Medicina, >> Pabellón 8, >> Avda. Complutense, s/n, >> 28040 Madrid, >> Spain, >> >> email: smoratti at psi.ucm.es >> Tel.: +34 91 394 2186 >> Fax.: +34 91 394 2294 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip ________________________________________________________ Stephan Moratti, PhD see also: http://web.me.com/smoratti/ Department of Basic Psychology Universidad Complutense de Madrid Centro de Tecnología Biomédica CBT, Universidad Politécnica de Madrid, en la actualidad (currently at) en el Centro de Magnetoencefalografía Dr. Perez Modrego, Universidad Complutense de Madrid, Faculdad de Medicina, Pabellón 8, Avda. Complutense, s/n, 28040 Madrid, Spain, email: smoratti at psi.ucm.es Tel.: +34 91 394 2186 Fax.: +34 91 394 2294 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Fri Mar 4 17:15:45 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Fri, 4 Mar 2011 17:15:45 +0100 Subject: [FieldTrip] potential problem with ft_topoplotER In-Reply-To: <6DDACA7B-2BFC-4F77-83C9-D57DBC4596DB@donders.ru.nl> References: <72E993C35FB11743B79FF9286E5B6D8B023D41AC@Mail2-UKD.VMED.UKD> <6DDACA7B-2BFC-4F77-83C9-D57DBC4596DB@donders.ru.nl> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B023D41BD@Mail2-UKD.VMED.UKD> Hi JM, I am using yesterday's release. I am specifying cfg.cohrefchannel because I get an error otherwise: Error using ==> ft_topoplotER at 454 no reference channel is specified Indeed, calling freqdescriptives solves the problem. Best, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Freitag, 4. März 2011 16:04 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] potential problem with ft_topoplotER Hi Jan, Which FT-version are you using? There have been quite some changes to the code recently, so let's be sure that you are working from the most recent version. Then, why do you specify a cohrefchannel in your configuration if you want to plot power? That probably does not have to do with it, but I'm just curious. If you are interested in plotting power at this stage, I would first call ft_freqdescriptives on your variable freq1. That should solve your problem, right? Best, Jan-Mathijs On Mar 4, 2011, at 3:27 PM, wrote: Dear fieldtrip developers, I don't know whether it is a bug or due to badly chosen settings, but I have experienced a problem with ft_topoplotER. I suspect that the function does not plot power values appropriately in the presence of labelcmb field. I do frequency analysis with the output powandcsd with the newest fieldtrip release: cfg=[]; cfg.method='mtmfft'; cfg.output='powandcsd'; cfg.calcdof='yes'; cfg.taper='hanning'; cfg.channelcmb={'MEG***2',refchan;'MEG***3',refchan}; cfg.foilim=[5 90]; freq1=ft_freqanalysis(cfg,data1); What I get is a power spectrum matrix with all the channels of the original data and a cross spectrum matrix according to my labelcmb. freq1 = label: {320x1 cell} dimord: 'chan_freq' freq: [1x88 double] powspctrm: [320x88 double] labelcmb: {204x2 cell} crsspctrm: [204x88 double] dof: [240x88 double] cumtapcnt: [240x1 double] grad: [1x1 struct] cfg: [1x1 struct] After having some doubts about the power topoplots I set all but one channel in the .powspctrm field to 0. freq1.powspctrm=zeros(size(freq1.powspctrm)); ind=strmatch('MEG2222',freq1.label); freq1.powspctrm(ind,:)=1; When plotting I don't see the one channel that has power but everything is 0 (see topo1.jpg) cfg=[]; cfg.xparam='freq'; cfg.zparam='powspctrm'; cfg.cohrefchannel=refchan; cfg.layout='/data/apps/fieldtrip/latest/template/neuromag306all.lay'; ft_topoplotER(cfg,freq1) Yet, when I remove the labelcmb field from freq1 it works alright (topo2.jpg) freq1=rmfield(freq1,'labelcmb'); Likewise, I may get the index ind from freq1.labelcmb(:,1), set it to 1, and it works. So it seems that topoplotER plots 204 channel values (number of rows in .labelcmb and .crsspctrm) although there are 306 MEG channels in the frequency data. I guess in such a situation channel data is neglected in the topoplots without the user being aware and the values may not be plotted at the correct place. I hope this helps in the development and is not simply a user error from my side. Best to you, jan Jan Hirschmann MSc. Neuroscience Insititute of Clinical Neuroscience and Medical Psychology Heinrich Heine University Duesseldorf Universitaetsstr. 1 40225 Duesseldorf Tel: 0049 - (0)211 - 81 - 18415 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ekanal at cmu.edu Fri Mar 4 19:55:43 2011 From: ekanal at cmu.edu (Kanal Eliezer) Date: Fri, 4 Mar 2011 13:55:43 -0500 Subject: [FieldTrip] ft_componentanalysis component timecourse In-Reply-To: <4D70F7DA.7050907@donders.ru.nl> References: <4D70F7DA.7050907@donders.ru.nl> Message-ID: <51F48C6C-E6A5-480D-A65A-6A7A2BC6CBD9@cmu.edu> Hello Jörn - Thank you for your detailed response. I just spent a while discussing this with a coworker, and I think my confusion stems from how these components are represented in the data. It looks like the ft_componentanalysis function looks for components in the *sensor* space; i.e., which weighting of sensor configurations provide the components with the largest power. These configurations are visible with ft_topoplotIC, or alongside the trial data using ft_componentbrowser. My question is now, though, what if my data (or noise) is not represented as a pattern in "channel space," but rather as a temporal pattern? Is it possible to use ft_componentanalysis to obtain temporal components as well? I think this question makes more sense phrased mathematically. Currently, we seem to be doing the following (note comp = components for berevity): [(time * trials) x comp] [comp x chan] = (time * trials) x chan, || || || comp.trials X comp.topo = data where (time * trials) represents a concatenation of all timeseries for all trials for a given channel. Why can't this be rearranged to have [(chan * trials) x comp] [comp x time] = (chan * trials) x time, where the components represent temporal features of the data? (As a separate question, we could also find the components for a single trial at a time, [chan x comp] [comp x time] = chan x time, and then examine the different components that arise across trials for similarities? At least for noise reduction, it's much more likely that a particularly strong within-trial signal will be a noise signal - e.g., heartbeat, eyeblink, muscle motion - than anything else.) This has gotten long, so just to reiterate, my main questions is: can ft_componentanalysis be used to find temporal components as well as sensor ones? Thanks - Elli On Mar 4, 2011, at 9:31 AM, Jörn M. Horschig wrote: > Dear Eliezer, > > There seems to be some confusion. component.topo is actually NxM, where N is the number of sensors and M the number of components you computed. M is equal to N if your channels are independent from each other, thus your data is full rank (this may not be the case if there e.g. is a gel-bridge or channels did not record a signal - please correct me if I am wrong). > Anyway, as you pointed out, [quote] "component.trials" is numTrials x sensors x time [/quote], actually it is numTrials x components x time, which means you get one time course for each component per trial. components.topo contains the (un)mixing matrix, i.e. the weighting of the individual channels per component (that is probably what you mean, when you referred to 'components'). > So, dependent on what you want, these are the two field of interest. If you want to know your components, you have to use component.topo, if you want to look at the time courses, use component.trials. > > Hope this helps! > Best regards, > Jörn > > On 3/4/2011 3:10 PM, Kanal Eliezer wrote: >> Hello - >> >> I'm trying to use the ft_componentanalysis function to remove a motion artifact in my dataset, but I'm confused as to how this function works. If called as >> >> component = ft_componentanalysis(cfg, data), >> >> the output seems to be in two fields, component.topo and component.trials. However, neither of these seems to contain the actual components. "component.topo" holds some an NxN matrix, where N is the number of sensors; I would expect the components to be "N x time". "component.trials" is numTrials x sensors x time, which seems to represent many more components than were actually calculated. How do I get the actual component timecourses? >> >> Thanks, >> Eliezer >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > -- > Jörn M. Horschig > PhD Student > Donders Institute for Brain, Cognition and Behaviour > Centre for Cognitive Neuroimaging > Radboud University Nijmegen > > P.O. Box 9101 > NL-6500 HB Nijmegen > The Netherlands > > Contact: > E-Mail: jm.horschig at donders.ru.nl > Tel: +31-(0)24-36-68493 > Web: http://www.ru.nl/fcdonders > > Visiting address: > Trigon, room 2.30 > Kapitelweg 29 > NL-6525 EN Nijmegen > The Netherlands > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From jenwhitman at gmail.com Mon Mar 7 01:46:15 2011 From: jenwhitman at gmail.com (Jen Whitman) Date: Sun, 6 Mar 2011 16:46:15 -0800 Subject: [FieldTrip] difficulty with nifti format and ft_write_volume In-Reply-To: <20E2353C-12A6-477F-A677-2BC279C7B752@donders.ru.nl> References: <1F0F0930-4606-4EE0-B2D6-3D379B2DC9B4@donders.ru.nl> <676C9A29-2C90-4E02-9B3E-865BCDC5E28F@donders.ru.nl> <7F6275BA-C597-4E11-958C-9E944F27F6C4@donders.ru.nl> <20E2353C-12A6-477F-A677-2BC279C7B752@donders.ru.nl> Message-ID: Hello Jan, I agree that the source of the problem is not the nifti_img filetype, as I get the same problem in spm8 with the nifti filetype. I followed your suggestion of running a parallel analysis in spm2, on the same version of FieldTrip (my previous successful spm2 analysis was performed with a much earlier version of FieldTrip). I of course ensured that spm2 was the only spm version in the matlab path before running this. The plot for the volume segmentation in spm2 looked fine, and as shown in the attached plot, the output of ft_sourceinterpolate (and then ft_sourceplot) appears to be fine. However, with this version of FieldTrip I now encounter an error calling ft_volumenormalise. Below is the output. As the errror message suggests, there are indeed NaNs in the locations of sourcetemp.avg.pow corresponding to grid.outside. What solution do you suggest? Thanks as always, Jen >> cfg = []; cfg.coordinates = 'ctf'; cfg.nonlinear = 'no'; cfg.spmversion='spm2'; cfg.template ='/home/woodwardlab/spm2FieldTrip/fieldtrip-20110224/external/spm2/templates/T1.mnc'; sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); the input is volume data with dimensions [256 256 256] not downsampling anatomy not downsampling avg.pow not downsampling inside converting input coordinates from CTF into approximate SPM coordinates ??? NaN's cannot be converted to logicals. Error in ==> spm_create_vol>create_vol at 102 if swapped, Error in ==> spm_create_vol at 14 v = create_vol(V(i)); Error in ==> volumewrite_spm at 67 Va = spm_create_vol(Va); Error in ==> ft_write_volume at 61 V = volumewrite_spm(filename, dat, transform, spmversion); Error in ==> ft_volumenormalise at 219 ft_write_volume([cfg.intermediatename,'_' tmp '.img'], data, 'transform', interp.transform, 'spmversion', cfg.spmversion); On Thu, Mar 3, 2011 at 5:33 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: > Dear Jen, > > You still did not manage to convince me that this is a file-format writing > issue. > > I am willing to believe that this is the case if you have done the > following: > > Perform source analysis. > Interpolate the results onto the corresponding anatomy. > Write the resulting file to disk, either using spm2, or using spm8. > Importantly, you need to use the same matlab-variable, i.e. the output of > ft_sourceinterpolate and not two results which may have come from two > slightly different processing pipelines. > > From the e-mail conversation so far, I did not yet get the impression that > you made this critical comparison. You may have done so, but in that case > you did not manage to communicate that clearly enough (at least not to me). > > One other possible cause for your problem could be that Mricro is treating > the different file-formats in a different way. When I read in the different > file formats in fieldtrip I don't find a difference. > > Best wishes, > > Jan-Mathijs > > On Mar 3, 2011, at 2:17 AM, Jen Whitman wrote: > > Hi Jan, > > While I now have the segmented volumes lining up properly using the spm8 > template, the final beamformed images are still not producing the expected > results (i.e. those I obtained when writing to spm2-analyze format). I've > been using the new 'nifti_img' filetype for ft_volumewrite, so maybe that's > the source of the problem. Is it possible that the coordinates are off for > the new nifti_img format? > > As for the coordinates specified in the cfg, I first tried specifying 'ctf' > as the input for ft_volumenormalise and 'spm' as the coordinates to be used > by ft_volumewrite when writing images (also with cfg.spmversion='SPM8'). > When that didn't work, I started changing whether coordinates were 'ctf' or > 'spm' for ft_volumewrite, ft_volumenormalise, and even ft_sourceinterpolate, > but still fail to produce the expected results previously found with spm2 > analyze format images. Perhaps a tutorial analogous to this one ( > http://fieldtrip.fcdonders.nl/tutorial/beamformer) but writing beamformed > images to nifti_img format would be useful? > > Thanks for all your help so far, > > Jen > > On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < > jan.schoffelen at donders.ru.nl> wrote: > >> Hi Jen, >> >> At first glance I have a comment on your script. You may need to >> explicitly check the alignment of your segmented volume and the original >> anatomy. A while a go some changes were made to ft_volumesegment, taking >> away the need to do the flipdim(flipdim... operations. I have posted this >> on the discussion list last January, but you may not have noticed. >> Anyway, if you now have used a recent version of FieldTrip for your >> segmentation both the location of your dipole grid, and the volume conductor >> model will not be adequately coregistered with the data, which may lead to >> funky results to begin with. That's most likely not related to the filetype >> in which the volumes are saved for later use. >> >> Best wishes, >> >> Jan-Mathijs >> >> >> >> On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: >> >> Hello Jan, >> >> When calling volumesegment, I specified 'ctf' as the coordinate system. >> The function I wrote to call volumesegment and prepare_singleshell for each >> subject and save the results is pasted below, with a couple of comments >> added for clarity. >> Over the weekend I tried specifying the coordinate system in the call to >> ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the >> lines that said cfg.spmversion = 'spm8'; before calling a function. However, >> that created worse results, as each plot involved stripes of activation and >> empty voxels, suggesting that 'ctf' was not the correct coordinate system to >> specify. >> >> Thanks for the attached script. Looking in that the comments in that, I >> suspect that the solution to my problems will be to specify my filetype as >> nifti_img rather than nifti. I'll let you know how that goes. >> >> Jen >> >> >> ------------------------------------------------------------------------------------------------------------ >> % the variable subj is simply a string consisting of a subject number >> (e.g. 's05') which can be a folder name or part of a filename >> function [vol mri segmentedmri >> segmentedmriF]=call_volume_segment_function_spm8(subj) >> cfg.spmversion = 'spm8'; >> cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; >> %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; >> cfg.name=[subj '_volseg']; >> cfg.write='yes'; >> cfg.smooth='no'; >> cfg.coordinates='ctf'; >> mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter >> and mriViewer software, after fiducials were marked >> segmentedmri = volumesegment(cfg, mri); >> segmentedmriF = segmentedmri; >> segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); >> segmentedmriF.white = >> flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); >> segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); >> segmentedmriF.transform = mri.transform; >> segmentedmriF.anatomy = mri.anatomy; >> cfg = []; >> cfg.spmversion = 'spm8'; >> vol = prepare_singleshell(cfg, segmentedmriF); >> eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF >> vol']) >> >> >> >> On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < >> jan.schoffelen at donders.ru.nl> wrote: >> >>> Dear Jen, >>> >>> I do not manage to reproduce your issue, when only focussing on the >>> ft_volumewrite and visualization part of your pipeline. See attached script, >>> and yet an updated version of ft_volumewrite which you need to (hopefully) >>> draw the same conclusion as I did. >>> Yet, I only now realize that your question may pertain to the entire >>> pipeline. It could be that something is going wrong there. >>> I only see now that in the part of your script of which you reported that >>> it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling >>> ft_volumenormalise. I assume this is correct, because the coordinate system >>> your source-reconstructed data lives in, is according to the CTF-convention, >>> and not according to the SPM-convention. On the other hand, the template for >>> the spatial normalization lives in the SPM-coordinate system. In order for >>> the spatial normalization to work OK, Fieldtrip tries to convert from one >>> coordinate system to the other (once again, this is appropriate behaviour), >>> before doing the actual normalization. It seems that at least in the script >>> you sent along, in the final (not working version), you specified >>> cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is >>> probably wrong. >>> Another important point that should be mentioned, is that the coordinate >>> systems in which the functional data and the anatomical data live should be >>> the same for the ft_sourceinterpolate to make sense. In other words, if your >>> source reconstructed images are defined on a 3D grid of positions in >>> CTF-space, the mri.transform of your anatomy should describe a >>> transformation from voxel to CTF-space. >>> I think you may want to revisit step by step this part of the pipeline; I >>> don't think the problem lies in the writing. >>> A final possibility of course is that Mricron is misbehaving... >>> >>> Best, >>> >>> Jan-Mathijs >>> >>> >>> >>> >>> >>> >>> On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: >>> >>> Hi Jan, >>> >>> I tried re-running the analysis with the new script you sent me, and the >>> latest version of fieldtrip (since I needed ft_get_opt as well), but the >>> spm8 images being written are still producing flawed results. It's the same >>> problem as I mentioned briefly in my previous post. I am not getting any >>> error messages when writing these images. Rather, my problem is that the >>> spm8 and spm2 results from the same data ought to be identical when viewed >>> in mricron, but they're far from it. When I use mricron to look at the >>> results from the spm8-format images, combined across participants to create >>> a t-image, I just get a single 'blob' spanning roughly half the brain. In >>> contrast, when I used spm2-format previously on the same data, the t-image >>> was much more meaningful; a posterior alpha power decrease in a set of >>> regions corresponding to the 'task-positive network' (a network found in the >>> results of an fMRI version of my experiment, and widely reported in the fMRI >>> literature). >>> >>> This failure to replicate the spm2 results when using spm8 images from >>> the same data leads me to suspect that something is wrong with the >>> coordinates for spm8 format. However, after experimenting extensively with >>> different cfg options I still haven't identified the problem. If I my >>> structural MRIs have been saved to .mri files using CTF's MRIConverter >>> program, which cfg options, particularly for coordinates, template images, >>> and filetypes, should I specify before calling the ft_volumesegment, >>> ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and >>> ft_volumewrite functions? Or should I be calling a different set of >>> functions now? >>> >>> Thanks again for your help, >>> >>> Jen >>> >>> On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: >>> >>>> Great, thanks! >>>> >>>> I'll start the analysis with your new script today and will let you know >>>> how it works out. >>>> >>>> Jen >>>> >>>> On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < >>>> jan.schoffelen at donders.ru.nl> wrote: >>>> >>>>> Dear Jen, >>>>> >>>>> I managed to reproduce your problem. The code was rather buggy and >>>>> indeed ft_volumewrite did not behave as it should have. I now fixed it in >>>>> the code and it should run fine now. Please find the updated file attached. >>>>> It will be available on our ftp-server as of tonight. Please note that I >>>>> updated the documentation, and changed the names of some of the options a >>>>> bit. If you want to save your data in analyze-format, you should specify >>>>> cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it >>>>> should write out a volume to nifti-format, using SPM8. >>>>> >>>>> Best wishes, >>>>> >>>>> Jan-Mathijs >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: >>>>> >>>>> >>>>> Dear Jan, >>>>> >>>>> Thanks for the quick reply. Yes, I have tried it out quite a few times >>>>> now, experimenting with different settings in the cfgs. Below I'll paste the >>>>> code I've been using to write images - first the code that successfully >>>>> created spm2 images that produced good results, then the code used for >>>>> creating nifti format images from the same data. The comments in this second >>>>> part are at this point a bit of a maze of cfg options I've been changing >>>>> back & forth. Any insights/suggestions regarding how to set up my cfgs to >>>>> make this work would be greatly appreciated. >>>>> >>>>> Jen >>>>> >>>>> >>>>> %%%%%%%% this code generated spm2-compatible images which did work >>>>> (producing results that made sense). >>>>> >>>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>>> >>>>> sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ >>>>> sourcePre.avg.pow; >>>>> >>>>> cfg = []; >>>>> cfg.downsample = 2; >>>>> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); >>>>> >>>>> % projecting the plot onto a surface... >>>>> cfg = []; >>>>> cfg.coordinates = 'ctf'; >>>>> cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; >>>>> %this template is in MNI coordinates >>>>> sourcetempIntN = volumenormalise(cfg, sourcetempInt); >>>>> >>>>> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) >>>>> 'HzWin' int2str(win) 'width750ms']; >>>>> cfg=[]; >>>>> cfg.parameter = 'avg.pow'; % string, describing the functional >>>>> data to be processed, e.g. 'pow', 'coh' or 'nai' >>>>> cfg.filename = [filename '.img']; >>>>> %'testimageoutput_alphafreq'; % filename without the extension >>>>> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' >>>>> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive >>>>> (default = []) >>>>> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', >>>>> 'int16', 'int32', 'float' or 'double' >>>>> >>>>> volumewrite(cfg, sourcetempIntN) >>>>> >>>>> >>>>> >>>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>>> >>>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>>> >>>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>>> >>>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>>> %%%%% this code below hasn't worked yet... >>>>> >>>>> % I added cfg.spmversion = 'spm8'; >>>>> % in the cfgs for the calls to ft_prepare_leadfield and >>>>> ft_sourceanalysis, >>>>> % and in the call to prepare_singleshell after calling volumesegment >>>>> >>>>> % I've also ensured that spm8 is the only spm version in my path, even >>>>> in >>>>> % the fieldtrip/external folder, and ensured that spm8 is installed >>>>> properly >>>>> % (files compiled correctly, etc..) >>>>> >>>>> sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ >>>>> sourcePre.avg.pow; >>>>> >>>>> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) >>>>> 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; >>>>> >>>>> cfg = []; >>>>> % cfg.coordinates = 'spm'; % changed for version 5 >>>>> % cfg.spmversion = 'spm8'; % changed for version 5 >>>>> cfg.downsample = 4; >>>>> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); >>>>> >>>>> >>>>> % projecting the plot onto a surface... >>>>> cfg = []; >>>>> %cfg.coordinates = 'spm'; % changed for version 5 >>>>> %cfg.coordinates = 'ctf'; % changed for version 5 >>>>> cfg.coordinates = 'spm'; % changed back to spm for version 9 >>>>> cfg.downsample = 4; >>>>> %cfg.spmversion = 'spm8'; % changed for version 6 (because this >>>>> gets specified in volumewrite) >>>>> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to >>>>> using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) >>>>> has the desired voxel size >>>>> % cfg.name = [filename]; % changed for version 6 >>>>> %cfg.write= 'yes'; % changed for version 6 (when this was set to >>>>> 'yes' there was no subsequent call to volumewrite) >>>>> cfg.write= 'no'; % changed for version 6 >>>>> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); >>>>> >>>>> % this whole cfg and function call added for version 6 >>>>> cfg=[]; >>>>> % cfg.parameter = string, describing the functional data to >>>>> be processed, e.g. 'pow', 'coh' or 'nai' >>>>> % cfg.filename = filename without the extension >>>>> % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' >>>>> % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to >>>>> use >>>>> % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = >>>>> []) >>>>> cfg.parameter='pow'; >>>>> cfg.filename=filename; >>>>> cfg.filetype = 'spm'; >>>>> cfg.spmversion = 'SPM8'; % capitalized after first error message >>>>> from vers 6 >>>>> % cfg.dataformat='nifti'; % added after first error message from >>>>> vers 6 >>>>> % commented out after 2nd error >>>>> message from vers 6 >>>>> %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to >>>>> specify unless cfg.filetyp='vmp' >>>>> cfg.coordinates='spm'; >>>>> ft_volumewrite(cfg,sourcetempIntN); >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen < >>>>> jan.schoffelen at donders.ru.nl> wrote: >>>>> >>>>>> Dear Jen, >>>>>> >>>>>> I notice that indeed in the documentation section of ft_write_volume >>>>>> there is a FIXME behind nifti. Yet, nifti format seems to be supported by >>>>>> ft_write_volume (at least in a recent version of fieldtrip). Did you try it >>>>>> at all (and ran into problems) or were you held back by the FIXME statement? >>>>>> Could you just try it out using a recent fieldtrip function? >>>>>> >>>>>> Thanks and best wishes >>>>>> >>>>>> Jan-Mathijs >>>>>> >>>>>> >>>>>> >>>>>> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: >>>>>> >>>>>> Hello, >>>>>>> >>>>>>> While writing beamformed images to spm2 format in a previous version >>>>>>> of fieldtrip (now lost due to a computer crash), I was able to get >>>>>>> nice-looking results; networks of brain regions consistent with existing >>>>>>> literature. When I try to write images from the same dataset and the same >>>>>>> analysis to spm8 format, my results (t-images computed across subjects) end >>>>>>> up being single clusters spanning large sections of the brain (e.g. a 'blob' >>>>>>> spanning all of one hemisphere but not the other). Unfortunately, some >>>>>>> aspects of my planned data analyses cannot be performed on spm2 images, so I >>>>>>> have to find a way of writing to successfully to nifti format. >>>>>>> >>>>>>> I just noticed that in the comments in the ft_write_volume function, >>>>>>> which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under >>>>>>> the list of supported dataformats. Is there by any chance a patch out there >>>>>>> for writing nifti images? >>>>>>> >>>>>>> Thanks! >>>>>>> >>>>>>> _______________________________________________ >>>>>>> fieldtrip mailing list >>>>>>> fieldtrip at donders.ru.nl >>>>>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >>>>>>> >>>>>> >>>>>> Dr. J.M. (Jan-Mathijs) Schoffelen >>>>>> Donders Institute for Brain, Cognition and Behaviour, >>>>>> Centre for Cognitive Neuroimaging, >>>>>> Radboud University Nijmegen, The Netherlands >>>>>> J.Schoffelen at donders.ru.nl >>>>>> Telephone: 0031-24-3614793 >>>>>> >>>>>> _______________________________________________ >>>>>> fieldtrip mailing list >>>>>> fieldtrip at donders.ru.nl >>>>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >>>>>> >>>>> >>>>> _______________________________________________ >>>>> fieldtrip mailing list >>>>> fieldtrip at donders.ru.nl >>>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >>>>> >>>>> >>>>> Dr. J.M. (Jan-Mathijs) Schoffelen >>>>> Donders Institute for Brain, Cognition and Behaviour, >>>>> Centre for Cognitive Neuroimaging, >>>>> Radboud University Nijmegen, The Netherlands >>>>> J.Schoffelen at donders.ru.nl >>>>> Telephone: 0031-24-3614793 >>>>> >>>>> >>>>> _______________________________________________ >>>>> fieldtrip mailing list >>>>> fieldtrip at donders.ru.nl >>>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >>>>> >>>> >>>> >>> _______________________________________________ >>> fieldtrip mailing list >>> fieldtrip at donders.ru.nl >>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >>> >>> >>> Dr. J.M. (Jan-Mathijs) Schoffelen >>> Donders Institute for Brain, Cognition and Behaviour, >>> Centre for Cognitive Neuroimaging, >>> Radboud University Nijmegen, The Netherlands >>> J.Schoffelen at donders.ru.nl >>> Telephone: 0031-24-3614793 >>> >>> >>> _______________________________________________ >>> fieldtrip mailing list >>> fieldtrip at donders.ru.nl >>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >>> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: spm2_T1mnctemplate_nodownsample_sourceplot.png Type: image/png Size: 284852 bytes Desc: not available URL: From ndavid at uke.de Mon Mar 7 16:57:02 2011 From: ndavid at uke.de (Nicole David) Date: Mon, 7 Mar 2011 16:57:02 +0100 Subject: [FieldTrip] Job Announcement (PhD Position) Message-ID: <03750F99-88BD-42D6-9133-8E4B4814E133@uke.de> Dear FieldTrip list, I would like to announce an open PhD position with Prof. Andreas Engel at the Dept. of Neurophysiology and Pathophysiology, University Medical Center Hamburg-Eppendorf. For details, see below. Best, Nicole ------------------------------- The Department of Neurophysiology and Pathophysiology at the University Medical Center Hamburg-Eppendorf (Director: Prof. Dr. Andreas K. Engel) invites applications for a PhD student position. The position is available with immediate start. The appointment will be for 3 years. The position is at the intersection of psychology, cognitive neuroscience and philosophy. More specifically, experiments investigating the sense of agency shall be carried out, using neuroscience techniques such as magnetoencephalography (MEG) and functional magnetic resonance imaging (fMRI). The sense of agency refers to the monitoring of actions and the experience, or awareness, of such as self- or other-generated. Applicants should have experience in analyzing human EEG or MEG and/ or fMRI studies. Programming experience (Matlab, Presentation) is considered mandatory. Applicants will be responsible for the management and implementation of research paradigms, data acquisition and analysis. Knowledge in theories of action and perception, multisensory processing, awareness and a basic understanding of information processing in the human brain would be preferred. The successful candidate will be member of the European collaborative project “Extending Sensorimotor Contingencies to Cognition – eSMCs” that has started in January 2011. The main objective of the project is to extend the Sensorimotor Contingency Theory as an action-based approach to perception and cognition, and to investigate its implications in studies of natural and artificial agents. More information on the project is to appear at http://eSMCs.eu. Information on the Dept. of Neurophysiology and Pathophysiology is available at http://www.uke.de/neurophysiologie and at http://www.40hz.de . Please send your application (including a CV) to Dr. Nicole David or Prof. Dr. Andreas K. Engel Dept. of Neurophysiology and Pathophysiology University Medical Center Hamburg-Eppendorf Martinistrasse 52 20246 Hamburg Germany Submission of applications through email (ndavid at uke.de, ak.engel at uke.de) is encouraged. -- Pflichtangaben gemäß Gesetz über elektronische Handelsregister und Genossenschaftsregister sowie das Unternehmensregister (EHUG): Universitätsklinikum Hamburg-Eppendorf Körperschaft des öffentlichen Rechts Gerichtsstand: Hamburg Vorstandsmitglieder: Prof. Dr. Jörg F. Debatin (Vorsitzender) Dr. Alexander Kirstein Joachim Prölß Prof. Dr. Dr. Uwe Koch-Gromus -------------- next part -------------- An HTML attachment was scrubbed... URL: From v.litvak at ion.ucl.ac.uk Tue Mar 8 13:11:22 2011 From: v.litvak at ion.ucl.ac.uk (Vladimir Litvak) Date: Tue, 8 Mar 2011 12:11:22 +0000 Subject: [FieldTrip] Statistical Parametric Mapping for MEG/EEG 2011 course In-Reply-To: References: Message-ID: Dear colleagues, We are happy to advertise the 2011 Statistical Parametric Mapping for MEG/EEG course presented by the Wellcome Trust Centre for Neuroimaging. The course will take place on Monday 9th May –Wednesday 11th May 2011 at the Wellcome Trust Centre for Neuroimaging in London. This course will present instruction on the analysis of EEG and MEG data.  The first two days will combine theoretical presentations with practical demonstrations of the different data analysis methods implemented in SPM.  On the last day participants will have the opportunity to work on SPM tutorial data sets under the supervision of the course faculty.  We also invite students to bring their own data for analysis.  The course will cover (1) data pre-processing, (2) statistical analysis of sensor-space maps using GLMs and Random Field theory, (3) source reconstruction and (4) Dynamic Causal Modelling for EEG/MEG. The course will be followed by the long-established three-day course on ‘SPM for fMRI’ so it is possible to attend both courses. The course is suitable for beginners and more advanced users. We advise students to gain at least minimal familiarity with the methodology, for example, from reading the recently published special issue paper available at http://www.hindawi.com/journals/cin/2011/852961/ and other introductory articles listed at the SPM website or by following data analysis examples in the SPM manual. For the practical part of the course please bring a laptop that can run Matlab (7.1 or later, no toolboxes are required) and is powerful enough to analyse your data. The detailed schedule and booking forms can be found at http://www.ion.ucl.ac.uk/articles/events/SPM . For further details and registration please contact Jean Reynolds (j.reynolds at ion.ucl.ac.uk). Please do not postpone registering as the course is already close to being full. With best wishes, Vladimir Litvak Ph.D. Lecturer Wellcome Trust Centre for Neuroimaging -------------------------------------------------------------------------------------------------- SPM (http://www.fil.ion.ucl.ac.uk/spm/) is free and open source software written in MATLAB (The MathWorks, Inc.). In addition to standard M/EEG pre-processing, we presently offer three main analysis tools: (i) statistical analysis of scalp-maps, time-frequency images and volumetric 3D source reconstruction images based on the general linear model, with correction for multiple comparisons using random field theory; (ii) Bayesian M/EEG source reconstruction, including support for group studies, simultaneous EEG and MEG, and fMRI priors; (iii) Dynamic Causal Modelling (DCM), an approach combining neural modelling with data analysis for which there are several variants dealing with evoked responses, steady state responses (power spectra and cross-spectra), induced responses and phase coupling. SPM8 is integrated with the FieldTrip toolbox (http://fieldtrip.fcdonders.nl/), making it possible for users to combine a variety of standard analysis methods with new schemes implemented in SPM and build custom analysis tools using powerful graphical user interface (GUI) and batching tools. From fredericroux at hotmail.de Tue Mar 8 17:44:48 2011 From: fredericroux at hotmail.de (Frederic Roux) Date: Tue, 8 Mar 2011 17:44:48 +0100 Subject: [FieldTrip] problem using dpss In-Reply-To: References: Message-ID: Dear fieldtrip users, I have encountered a problem when using dpss to calculate spectras for my data and I was wondering if anyone could help me to determine the origin of this problem. The figure in the attachement shows the single trial MEG spectrograms for channel 'MLC11'. I have used fieldtrip, custom code and an equivalent function from the chronux toolbox to compute these spectrograms. The upper row of the figure shows the PSD and the spectrograms calculated with the different functions for trial n°1. The lower row of the figure shows the PSD and the spectrograms calculated with the different functions for trial n°2. As you can see, for trial n°2 the results show strange artifacts. The parameters I used across all computations are: window length = 0.5 Sec time steps = 0.025 Sec spectral smoothing = 10 Hz number of tapers = 2*(.5*10)-1 = 9 Here is the fieldtrip code I used: cfg = []; cfg.method = 'mtmconvol'; cfg.output = 'pow'; cfg.taper = 'dpss'; cfg.foi = [20:100]; cfg.t_ftimwin = .5*ones(1,length(cfg.foi)); cfg.tapsmofrq = 10*ones(1,length(cfg.foi)); cfg.toi = data.time{1}(1):0.025:data.time{1}(end); SPECGRAM = freqanalysis(cfg,data); Has anyone ever encountered similar artifacts? Does anyone know the origin of such artifacts? Any help would as always be greatly appreciated. Frederic -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: codecheck2.jpg Type: image/jpeg Size: 346932 bytes Desc: not available URL: From jan.schoffelen at donders.ru.nl Tue Mar 8 17:53:18 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Tue, 8 Mar 2011 17:53:18 +0100 Subject: [FieldTrip] problem using dpss In-Reply-To: References: Message-ID: <5D4D70D2-B672-48FC-9AC2-FD9CA69B4F31@donders.ru.nl> Dear Frederic, You may want to have a look at: http://fieldtrip.fcdonders.nl/faq/why_does_my_tfr_look_strange Cheers, JM On Mar 8, 2011, at 5:44 PM, Frederic Roux wrote: > > Dear fieldtrip users, > > I have encountered a problem when using dpss to calculate spectras > for my data > and I was wondering if anyone could help me to determine the origin > of this problem. > > The figure in the attachement shows the single trial MEG > spectrograms for channel 'MLC11'. > I have used fieldtrip, custom code and an equivalent function from > the chronux toolbox to compute > these spectrograms. > > The upper row of the figure shows the PSD and the spectrograms > calculated with the different functions > for trial n°1. > > The lower row of the figure shows the PSD and the spectrograms > calculated with the different functions > for trial n°2. > > As you can see, for trial n°2 the results show strange artifacts. > > The parameters I used across all computations are: > > window length = 0.5 Sec > time steps = 0.025 Sec > spectral smoothing = 10 Hz > number of tapers = 2*(.5*10)-1 = 9 > > Here is the fieldtrip code I used: > > cfg = []; > cfg.method = 'mtmconvol'; > cfg.output = 'pow'; > cfg.taper = 'dpss'; > cfg.foi = [20:100]; > cfg.t_ftimwin = .5*ones(1,length(cfg.foi)); > cfg.tapsmofrq = 10*ones(1,length(cfg.foi)); > cfg.toi = data.time{1}(1):0.025:data.time{1}(end); > > SPECGRAM = freqanalysis(cfg,data); > > Has anyone ever encountered similar artifacts? > Does anyone know the origin of such artifacts? > > Any help would as always be greatly appreciated. > > Frederic > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredericroux at hotmail.de Wed Mar 9 12:19:24 2011 From: fredericroux at hotmail.de (Frederic Roux) Date: Wed, 9 Mar 2011 12:19:24 +0100 Subject: [FieldTrip] problem with dpss In-Reply-To: References: Message-ID: Dear JM, thank you for the hint. I was not aware of this thread in the faqs. Removing the DC offset seems to solve the problem indeed. It's funny though, that using cfg.demean = 'yes'; data = preprocessing(cfg,data); did not do the job. I had to manually remove the DC with data.trial{1} = data.trial{1} - mean(data.trial{1},2); to get rid of the problem (see attached figure). But maybe that's because the fieldtrip version I am using is outdated? In any case, many thanks for the fast and efficient help. Frederic -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: codecheck3.jpg Type: image/jpeg Size: 113989 bytes Desc: not available URL: From jan.schoffelen at donders.ru.nl Wed Mar 9 12:39:37 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Wed, 9 Mar 2011 12:39:37 +0100 Subject: [FieldTrip] problem with dpss In-Reply-To: References: Message-ID: <75C32762-BC90-4614-9432-AC4DE095FD54@donders.ru.nl> Dear Frederic, > cfg.demean = 'yes'; > data = preprocessing(cfg,data); > > did not do the job. At some point we changed the name of the option "cfg.blc" into "cfg.demean". If your fieldtrip version pre-dates this change, then I can imagine that it did not work. I am fairly positive that it will just work if you use a recent FT-version. Best wishes, Jan-Mathijs -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivano_triggiani at yahoo.it Wed Mar 9 17:39:30 2011 From: ivano_triggiani at yahoo.it (Ivano Triggiani) Date: Wed, 9 Mar 2011 16:39:30 +0000 (GMT) Subject: [FieldTrip] Reading a Trigger Channel Message-ID: <518755.77376.qm@web28606.mail.ukl.yahoo.com> Hi, I'm a new user and I don't understand how to read from a specific channel my event. Basically I have a .edf file with 25 EEG channel (they are all sampled at the same f) and the 25th one is my TRIGGER (a simple square wave). What must I do to read from that channel ? What is my cfg.trialdef.eventtype ? And my cfg.trialdef.eventvalue? (I've read all documentation about it) Thanks a lot, Ivano -------------- next part -------------- An HTML attachment was scrubbed... URL: From psymatthew at gmail.com Thu Mar 10 03:54:09 2011 From: psymatthew at gmail.com (Matthew Davidson) Date: Wed, 9 Mar 2011 21:54:09 -0500 Subject: [FieldTrip] Intracranial EEG position at NYU School of Medicine Message-ID: ---------- Forwarded message ---------- From: Thesen, Thomas Date: Wed, Mar 9, 2011 at 3:41 PM Subject: intracranial EEG position at NYU School of Medicine To: Matthew Davidson Research Assistant Position in Cognitive Neuroscience Department of Neurology, School of Medicine, New York University We are seeking a full-time Research Assistant to assist with cognitive neuroscience experiments involving human intracranial EEG. Main topics of investigation are language, memory, multisensory, brain-computer interface, seizures and others. Responsibilities include, but are not limited to, recruiting and scheduling of control subjects and patients, testing and recording from intracranial patients, maintenance of equipment, databases and files, as well as data analysis and manuscript preparation. Candidates who have experience with neuroimaging data collection and analysis are especially encouraged to apply. Other neuroimaging methods employed by the lab include fMRI and MEG. The laboratory provides a unique exposure to both basic research and clinical neuroscience. The position requires interaction with patients and hospital staff and therefore excellent verbal and interpersonal skills are required. Must be well-organized and detail oriented; extensive computer experience strongly preferred, with programming highly desirable. B.A. or B.S. required, such as in neuroscience, psychology, biology, computer science or biomedical engineering. The position is ideal for exceptional candidates seeking to pursue an advanced research degree in neuroscience or a related field. The position is available for 2-4 years and includes benefits. Start date can be immediately or later upon agreement. Please visit our web lab page for more information: http://www.med.nyu.edu/thesenlab Please send resume and cover letter to: Thomas Thesen, Ph.D. Assistant Professor of Neurology New York University School of Medicine thomas.thesen at med.nyu.edu ------------------------------------------------------------ This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. ================================= -------------- next part -------------- A non-text attachment was scrubbed... Name: Research_Assistant_position_NYU.pdf Type: application/pdf Size: 160426 bytes Desc: not available URL: From mcoskun at mail.uh.edu Thu Mar 10 06:36:01 2011 From: mcoskun at mail.uh.edu (Mehmet-Akif Coskun) Date: Wed, 09 Mar 2011 23:36:01 -0600 Subject: [FieldTrip] 4d data reading (248 sensor MEG system) Message-ID: <72b0a98457970.4d780ee1@mail.uh.edu> Hello Dear Fieldtrip users,        I am a newbie in fieldtrip. I am having trouble reading the 4d data in fieldtrip. We are using a 248 sensor 4D MEG system. I have followed the discussion list and tried the suggestions but haven't succeeded reading the data. As far as i understand, i need some files (.xyz and .m4d) to be able to read the data but i don't also know how to obtain these files. Can anyone explain me the steps that i need to follow? Thanks in advance, Mehmet -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Thu Mar 10 09:20:08 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 10 Mar 2011 09:20:08 +0100 Subject: [FieldTrip] 4d data reading (248 sensor MEG system) In-Reply-To: <72b0a98457970.4d780ee1@mail.uh.edu> References: <72b0a98457970.4d780ee1@mail.uh.edu> Message-ID: <922F1E2A-642B-461A-B54B-EE72A1286016@donders.ru.nl> Hi Mehmet, Please have a look at http://fieldtrip.fcdonders.nl/getting_started/bti. I would not recommend the .xyz/.m4d variant, but would directly read from the raw data files. Support for .xyz/.m4d files (these files contain relevant header information) is implemented in fieldtrip just for backward compatibility. These need to be created from the raw data (using the pdf2set command (see the software manual of the MEG-system for reference)), but contain only limited header information (e.g. the balancing coefficients are not extracted). To me this sounds like double work, because FieldTrip can read the header information from the raw files directly. Good luck, Jan-Mathijs On Mar 10, 2011, at 6:36 AM, Mehmet-Akif Coskun wrote: > Hello Dear Fieldtrip users, > > > I am a newbie in fieldtrip. I am having trouble reading the > 4d data in fieldtrip. We are using a 248 sensor 4D MEG system. I > have followed the discussion list and tried the suggestions but > haven't succeeded reading the data. As far as i understand, i need > some files (.xyz and .m4d) to be able to read the data but i don't > also know how to obtain these files. Can anyone explain me the steps > that i need to follow? > > > Thanks in advance, > Mehmet > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From eelke.spaak at donders.ru.nl Thu Mar 10 09:44:54 2011 From: eelke.spaak at donders.ru.nl (Eelke Spaak) Date: Thu, 10 Mar 2011 09:44:54 +0100 Subject: [FieldTrip] Reading a Trigger Channel In-Reply-To: <518755.77376.qm@web28606.mail.ukl.yahoo.com> References: <518755.77376.qm@web28606.mail.ukl.yahoo.com> Message-ID: Hi Ivano, The cfg.trialdef.eventtype and cfg.trialdef.eventvalue are used by the so-called "trialfun", a function that selects interesting pieces of the data (i.e., trials). If you do not explicitly specify a trialfun (with cfg.trialfun = 'mytrialfun'), ft_definetrial will by default use 'trialfun_general'. This default function looks in the channel specified by cfg.trialdef.eventtype for values equal to the cfg.trialdef.eventvalue you specified. So, in your case (assuming your trigger channel is indeed labelled 'TRIGGER'), you would use something like: cfg.trialdef.eventtype = 'TRIGGER'; cfg.trialdef.eventvalue = 1; % (or whatever is the value in your trigger channel that corresponds to the trigger you are interested in) Note that you can get an overview of the event channels present in your data, along with their possible values, by executing: cfg = []; cfg.trialdef.eventtype = '?'; cfg.dataset = 'mydataset.edf'; ft_definetrial(cfg); Hope this helps. Best, Eelke 2011/3/9 Ivano Triggiani : > Hi, > > I'm a new user and I don't understand how to read from a specific channel my > event. Basically I have a .edf file with 25 EEG channel (they are all > sampled at the same f) and the 25th one is my TRIGGER (a simple square > wave). What must I do to read from that channel ? > What is my cfg.trialdef.eventtype ? And my cfg.trialdef.eventvalue? > (I've read all documentation about it) > Thanks a lot, > Ivano > > > > > > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > From fredericroux at hotmail.de Thu Mar 10 16:23:24 2011 From: fredericroux at hotmail.de (Frederic Roux) Date: Thu, 10 Mar 2011 16:23:24 +0100 Subject: [FieldTrip] question regarding baseline correction Message-ID: Dear fieldtrip community, can any one suggest/recommend me which is the best way to compute baseline correction over time-frequency data: 1) first baseline correction over each single trial and then averaging across trials? 2) first averaging across trials and then baseline correction? Any help would as always be greatly appreciated! Frederic -------------- next part -------------- An HTML attachment was scrubbed... URL: From mcoskun at mail.uh.edu Thu Mar 10 19:35:39 2011 From: mcoskun at mail.uh.edu (Mehmet-Akif Coskun) Date: Thu, 10 Mar 2011 12:35:39 -0600 Subject: [FieldTrip] 4d data reading (248 sensor MEG system) In-Reply-To: <922F1E2A-642B-461A-B54B-EE72A1286016@donders.ru.nl> References: <72b0a98457970.4d780ee1@mail.uh.edu> <922F1E2A-642B-461A-B54B-EE72A1286016@donders.ru.nl> Message-ID: <72809ab0574c6.4d78c59b@mail.uh.edu> Hi Jan,    Thanks for the reply. I tried reading from the raw data as suggested in the link and i always getting an error like below. hdr=ft_read_header('E:\fieldtrip_data\c,rfhp0.1Hz') ?? Error using ==> fseek Offset must be of class double Error in==> fileio\private\read_4d_hdr_at_183          fseek(fid,nbytes2 - 32, 'cof'); Error in ==> ft_read_header_at_246        orig                   = read_4d_hdr(datafile,configfile) the data that i try to read is raw data (unprocessed) but still i can't read. Previously i was trying the data that has been processed to remove environmental noise in 4d meg system sofware, and that didnt work too. Which part i am missing? Thanks Mehmet ----- Original Message ----- From: jan-mathijs schoffelen Date: Thursday, March 10, 2011 2:46 am Subject: Re: [FieldTrip] 4d data reading (248 sensor MEG system) To: Email discussion list for the FieldTrip project ----------------------------------------------------------- > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip| > Hi Mehmet, > Please have a look at http://fieldtrip.fcdonders.nl/getting_started/bti. > > I would not recommend the .xyz/.m4d variant, but would directly read from the raw data files. Support for .xyz/.m4d files (these files contain relevant header information) is implemented in fieldtrip just for backward compatibility. These need to be created from the raw data (using the pdf2set command (see the software manual of the MEG-system for reference)), but contain only limited header information (e.g. the balancing coefficients are not extracted). To me this sounds like double work, because FieldTrip can read the header information from the raw files directly. > > Good luck, > > Jan-Mathijs > > > > > On Mar 10, 2011, at 6:36 AM, Mehmet-Akif Coskun wrote:> > Hello Dear Fieldtrip users, > > >        I am a newbie in fieldtrip. I am having trouble reading the 4d data in fieldtrip. We are using a 248 sensor 4D MEG system. I have followed the discussion list and tried the suggestions but haven't succeeded reading the data. As far as i understand, i need some files (.xyz and .m4d) to be able to read the data but i don't also know how to obtain these files. Can anyone explain me the steps that i need to follow? > > > Thanks in advance, > Mehmet > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen  > Donders Institute for Brain, Cognition and Behaviour,  > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793> > |----------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Thu Mar 10 20:09:55 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 10 Mar 2011 20:09:55 +0100 Subject: [FieldTrip] 4d data reading (248 sensor MEG system) In-Reply-To: <72809ab0574c6.4d78c59b@mail.uh.edu> References: <72b0a98457970.4d780ee1@mail.uh.edu> <922F1E2A-642B-461A-B54B-EE72A1286016@donders.ru.nl> <72809ab0574c6.4d78c59b@mail.uh.edu> Message-ID: <0E6EB8D2-5775-4C02-98AC-76DE32AC3131@donders.ru.nl> Hi Mehmet, It looks like you are working on a windows-machine. I have never tried to read in 4D-data on a windows machine, but it looks like a windows matlab thing. The error message states that the second input argument to fseek (i.e. nbytes2-32) needs to be of class double, whereas it is represented in the file as e 4 byte integer. Could you try if the following works: change the end of line 176 from 'uint32=>double' and report back to me whether this works (just send it to me personally; not to the whole list)? I will then test whether this change also works on linux/mac and will commit this change to the release version of FieldTrip. I noticed in the past that indeed the 'noise-reduced' files cannot be directly read (mainly due to sparse documentation of the file format). However, fieldtrip contains a function "ft_denoise_pca", which is doing exactly the same as the 4D command-line programs "cfw" and "afw". I hope this helps, Jan-Mathijs On Mar 10, 2011, at 7:35 PM, Mehmet-Akif Coskun wrote: > Hi Jan, > > > Thanks for the reply. I tried reading from the raw data as > suggested in the link and i always getting an error like below. > > > hdr=ft_read_header('E:\fieldtrip_data\c,rfhp0.1Hz') > > > ?? Error using ==> fseek > Offset must be of class double > > > Error in==> fileio\private\read_4d_hdr_at_183 > fseek(fid,nbytes2 - 32, 'cof'); > > > Error in ==> ft_read_header_at_246 > orig = read_4d_hdr(datafile,configfile) > > > > > the data that i try to read is raw data (unprocessed) but still i > can't read. Previously i was trying the data that has been processed > to remove environmental noise in 4d meg system sofware, and that > didnt work too. > > > Which part i am missing? > > > Thanks > Mehmet > > ----- Original Message ----- > From: jan-mathijs schoffelen > Date: Thursday, March 10, 2011 2:46 am > Subject: Re: [FieldTrip] 4d data reading (248 sensor MEG system) > To: Email discussion list for the FieldTrip project > > > > Hi Mehmet, > > > > > > Please have a look at http://fieldtrip.fcdonders.nl/getting_started/bti > . > > > > > I would not recommend the .xyz/.m4d variant, but would directly > read from the raw data files. Support for .xyz/.m4d files (these > files contain relevant header information) is implemented in > fieldtrip just for backward compatibility. These need to be created > from the raw data (using the pdf2set command (see the software > manual of the MEG-system for reference)), but contain only limited > header information (e.g. the balancing coefficients are not > extracted). To me this sounds like double work, because FieldTrip > can read the header information from the raw files directly. > > > > > Good luck, > > > > > Jan-Mathijs > > > > > > > > > > > > > > > On Mar 10, 2011, at 6:36 AM, Mehmet-Akif Coskun wrote:> >> > Hello Dear Fieldtrip users, >> > >> > >> > I am a newbie in fieldtrip. I am having trouble reading >> the 4d data in fieldtrip. We are using a 248 sensor 4D MEG system. >> I have followed the discussion list and tried the suggestions but >> haven't succeeded reading the data. As far as i understand, i need >> some files (.xyz and .m4d) to be able to read the data but i don't >> also know how to obtain these files. Can anyone explain me the >> steps that i need to follow? >> > >> > >> > Thanks in advance, >> > Mehmet >> >> > _______________________________________________ >> > fieldtrip mailing list >> > fieldtrip at donders.ru.nl >> > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > > Donders Institute for Brain, Cognition and Behaviour, > > Centre for Cognitive Neuroimaging, > > Radboud University Nijmegen, The Netherlands > > > J.Schoffelen at donders.ru.nl > > > Telephone: 0031-24-3614793> > > > > _______________________________________________ > > fieldtrip mailing list > > fieldtrip at donders.ru.nl > > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From yuvharpaz at gmail.com Thu Mar 10 20:20:37 2011 From: yuvharpaz at gmail.com (Yuval Harpaz) Date: Thu, 10 Mar 2011 21:20:37 +0200 Subject: [FieldTrip] 4d data reading (248 sensor MEG system) In-Reply-To: <72809ab0574c6.4d78c59b@mail.uh.edu> References: <72b0a98457970.4d780ee1@mail.uh.edu> <922F1E2A-642B-461A-B54B-EE72A1286016@donders.ru.nl> <72809ab0574c6.4d78c59b@mail.uh.edu> Message-ID: do you have the config file near the data? On 10 March 2011 20:35, Mehmet-Akif Coskun wrote: > Hi Jan, > > > Thanks for the reply. I tried reading from the raw data as suggested in > the link and i always getting an error like below. > > > hdr=ft_read_header('E:\fieldtrip_data\c,rfhp0.1Hz') > > > ?? Error using ==> fseek > Offset must be of class double > > > Error in==> fileio\private\read_4d_hdr_at_183 > fseek(fid,nbytes2 - 32, 'cof'); > > > Error in ==> ft_read_header_at_246 > orig = read_4d_hdr(datafile,configfile) > > > > > the data that i try to read is raw data (unprocessed) but still i can't > read. Previously i was trying the data that has been processed to remove > environmental noise in 4d meg system sofware, and that didnt work too. > > > Which part i am missing? > > > Thanks > Mehmet > > > ----- Original Message ----- > From: jan-mathijs schoffelen > Date: Thursday, March 10, 2011 2:46 am > Subject: Re: [FieldTrip] 4d data reading (248 sensor MEG system) > To: Email discussion list for the FieldTrip project < > fieldtrip at donders.ru.nl> > > > Hi Mehmet, > > > > > Please have a look at http://fieldtrip.fcdonders.nl/getting_started/bti. > > > > > I would not recommend the .xyz/.m4d variant, but would directly read > from the raw data files. Support for .xyz/.m4d files (these files contain > relevant header information) is implemented in fieldtrip just for backward > compatibility. These need to be created from the raw data (using the pdf2set > command (see the software manual of the MEG-system for reference)), but > contain only limited header information (e.g. the balancing coefficients are > not extracted). To me this sounds like double work, because FieldTrip can > read the header information from the raw files directly. > > > > > Good luck, > > > > > Jan-Mathijs > > > > > > > > > > > > > > > On Mar 10, 2011, at 6:36 AM, Mehmet-Akif Coskun wrote:> > > > Hello Dear Fieldtrip users, > > > > > > I am a newbie in fieldtrip. I am having trouble reading the 4d > data in fieldtrip. We are using a 248 sensor 4D MEG system. I have followed > the discussion list and tried the suggestions but haven't succeeded reading > the data. As far as i understand, i need some files (.xyz and .m4d) to be > able to read the data but i don't also know how to obtain these files. Can > anyone explain me the steps that i need to follow? > > > > > > Thanks in advance, > > Mehmet > > _______________________________________________ > > fieldtrip mailing list > > fieldtrip at donders.ru.nl > > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > > Donders Institute for Brain, Cognition and Behaviour, > > Centre for Cognitive Neuroimaging, > > Radboud University Nijmegen, The Netherlands > > > J.Schoffelen at donders.ru.nl > > > Telephone: 0031-24-3614793> > > > > _______________________________________________ > > fieldtrip mailing list > > fieldtrip at donders.ru.nl > > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -- Y.Harpaz a link to the BIU MEG lab: http://faculty.biu.ac.il/~goldsa/index.html " Why, Dan," ask the people in Artificial Intelligence, "do you waste your time conferring with those neuroscientists? They wave their hands about information processing and worry about where it happens, and which neurotransmitters are involved, and all those boring facts, but they haven't a clue about the computational requirements of higher cognitive functions." "Why," ask the neuroscientists, "do you waste your time on the fantasies of Artificial Intelligence? They just invent whatever machinery they want, and say unpardonably ignorant things about the brain." The cognitive psychologists, meanwhile, are accused of concocting models with neither biological plausibility nor proven computational powers; the anthropologists wouldn't know a model if they saw one, and the philosophers, as we all know, just take in each other's laundry, warning about confusions they themselves have created, in an arena bereft of both data and empirically testable theories. With so many idiots working on the problem, no wonder consciousness is still a mystery.* Philosopher Daniel Dennet, consciousness explained, pp. 225* -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivano_triggiani at yahoo.it Fri Mar 11 10:37:19 2011 From: ivano_triggiani at yahoo.it (Ivano Triggiani) Date: Fri, 11 Mar 2011 09:37:19 +0000 (GMT) Subject: [FieldTrip] Still Reading a Trigger Channel Message-ID: <156946.24329.qm@web28608.mail.ukl.yahoo.com> Dear Eelke, thanks for the aswer. but I'm not sure what does it mean for 'value' ? Value of what? Order of comparison, value of voltage of wave, or what? I have this trigger channel and I have 120 triggers... I want to evaluate my EEG 2 seconds prestim, 2 seconds poststim for every trigger! And when I use eventtype "TRIGGER" (yes, it is labelled so), It ask me for a trialfun... and told me it have found 201 events (they were just 120...) Ivano ------------------------------------------------------- Hi Ivano, The cfg.trialdef.eventtype and cfg.trialdef.eventvalue are used by the so-called "trialfun", a function that selects interesting pieces of the data (i.e., trials). If you do not explicitly specify a trialfun (with cfg.trialfun = 'mytrialfun'), ft_definetrial will by default use 'trialfun_general'. This default function looks in the channel specified by cfg.trialdef.eventtype for values equal to the cfg.trialdef.eventvalue you specified. So, in your case (assuming your trigger channel is indeed labelled 'TRIGGER'), you would use something like: cfg.trialdef.eventtype = 'TRIGGER'; cfg.trialdef.eventvalue = 1; % (or whatever is the value in your trigger channel that corresponds to the trigger you are interested in) Note that you can get an overview of the event channels present in your data, along with their possible values, by executing: cfg = []; cfg.trialdef.eventtype = '?'; cfg.dataset = 'mydataset.edf'; ft_definetrial(cfg); Hope this helps. Best, Eelke 2011/3/9 Ivano Triggiani : > Hi, > > I'm a new user and I don't understand how to read from a specific channel my > event. Basically I have a .edf file with 25 EEG channel (they are all > sampled at the same f) and the 25th one is my TRIGGER (a simple square > wave). What must I do to read from that channel ? > What is my cfg.trialdef.eventtype ? And my cfg.trialdef.eventvalue? > (I've read all documentation about it) > Thanks a lot, > Ivano > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Fri Mar 11 11:49:29 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Fri, 11 Mar 2011 11:49:29 +0100 Subject: [FieldTrip] Still Reading a Trigger Channel In-Reply-To: <156946.24329.qm@web28608.mail.ukl.yahoo.com> References: <156946.24329.qm@web28608.mail.ukl.yahoo.com> Message-ID: Dear Ivano, I would first check what 'triggers' fieldtrip automatically detects from your data. As far as I am aware, there is no default reading of a 'trigger' channel for .edf data, but I am not sure. You can get an idea bout the event-info, by specifying cfg = []; cfg.dataset = ... cfg.trialdef.eventtyp = '?'; ft_definetrial(cfg); This outputs some info to your screen, about which events are in the data. Each event is of a certain type 'type' , and may have a value 'value', e.g. when the acquisition system has an explicit trigger channel to which your stimulus presentation program, or response device sends discrete trigger pulses of varying height. In your case, I suspect that something else needs to be done (in case definetrial does not show triggers related to your trigger channel), i.e. you need to write your own 'trialfun'. Rather than using cfg.trialdef.eventtype/eventvalue, you need to specify cfg.trialfun = 'ivanoscooltrialfun', and you need to write your own file: trialfun_ivanoscooltrialfun which defines your segments of interest based on some feature in your trigger channel. Here's an example which uses an EMG-channel as epoch-defining signal. Of course your trigger channel needs to be processed in a different way but at least it gives you an impression. http://fieldtrip.fcdonders.nl/example/detect_the_muscle_activity_in_an_emg_channel_and_use_that_as_trial_definition?s []=trialfun Good luck Jan-Mathijs On Mar 11, 2011, at 10:37 AM, Ivano Triggiani wrote: > Dear Eelke, > > thanks for the aswer. but I'm not sure what does it mean for > 'value' ? Value of what? Order of comparison, value of voltage of > wave, or what? > I have this trigger channel and I have 120 triggers... I want to > evaluate my EEG 2 seconds prestim, 2 seconds poststim for every > trigger! > And when I use eventtype "TRIGGER" (yes, it is labelled so), It ask > me for a trialfun... and told me it have found 201 events (they were > just 120...) > Ivano > > ------------------------------------------------------- > > Hi Ivano, > > The cfg.trialdef.eventtype and cfg.trialdef.eventvalue are used by the > so-called "trialfun", a function that selects interesting pieces of > the data (i.e., trials). If you do not explicitly specify a trialfun > (with cfg.trialfun = 'mytrialfun'), ft_definetrial will by default use > 'trialfun_general'. This default function looks in the channel > specified by cfg.trialdef.eventtype for values equal to the > cfg.trialdef.eventvalue you specified. So, in your case (assuming your > trigger channel is indeed labelled 'TRIGGER'), you would use something > like: > > cfg.trialdef.eventtype = 'TRIGGER'; > cfg.trialdef.eventvalue = 1; % (or whatever is the value in your > trigger channel that corresponds to the trigger you are interested in) > > Note that you can get an overview of the event channels present in > your data, along with their possible values, by executing: > > cfg = []; > cfg.trialdef.eventtype = '?'; > cfg.dataset = 'mydataset.edf'; > ft_definetrial(cfg); > > Hope this helps. > > Best, > Eelke > > 2011/3/9 Ivano Triggiani : > > Hi, > > > > I'm a new user and I don't understand how to read from a specific > channel my > > event. Basically I have a .edf file with 25 EEG channel (they are > all > > sampled at the same f) and the 25th one is my TRIGGER (a simple > square > > wave). What must I do to read from that channel ? > > What is my cfg.trialdef.eventtype ? And my cfg.trialdef.eventvalue? > > (I've read all documentation about it) > > Thanks a lot, > > Ivano > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From aglaia.jankoli at gmx.de Fri Mar 11 12:24:45 2011 From: aglaia.jankoli at gmx.de (Lydia Elshoff) Date: Fri, 11 Mar 2011 12:24:45 +0100 Subject: [FieldTrip] question about template brain in SPM-EEG Message-ID: <20110311112445.49530@gmx.net> Hello! We are a research group at the Neuropaediatrics Department in Kiel and started working with EEG Analysis in fieldtrip. We now face several questions: Could you please tell us how to or send us a matlab code for the using template brain and the standard EEG-Electrodes in DICS analysis in fieldtrip? Thank you very much!!! Sincerely, Dr. Lydia Elshoff -- Schon gehört? GMX hat einen genialen Phishing-Filter in die Toolbar eingebaut! http://www.gmx.net/de/go/toolbar -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone From jan.schoffelen at donders.ru.nl Fri Mar 11 16:33:01 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Fri, 11 Mar 2011 16:33:01 +0100 Subject: [FieldTrip] 4d data reading (248 sensor MEG system) In-Reply-To: <72b0ef1054709.4d79ea4b@mail.uh.edu> References: <72b0ef1054709.4d79ea4b@mail.uh.edu> Message-ID: Dear Mehmet, > I changed the end of line 176 to 'uint21=>double'. Now there is an other error as below. > > > ??? Error using==>fileio\private\read_4d_hdr > Cannot open config file > > > Error in ==> ft_read_header_at_246 > orig =read_4d_hdr(datafile,configfile); > As already pointed out by Yuval, it seems that the config-file is not at the location where fieldtrip expects it. Please make sure that the run config-file (the one called 'config') is at the same location as your data file and try again. Jan-Mathijs On Mar 11, 2011, at 4:24 PM, Mehmet-Akif Coskun wrote: > Hi Jan, > > Could you get a solution for the error that i have sent to you. > I desperately need to use fieldtrip for obtaining a SWF from dipole > fitting but i am not able even reading the data in fieldtrip. > > > > > Thanks > Mehmet Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From e.maris at donders.ru.nl Fri Mar 11 22:23:55 2011 From: e.maris at donders.ru.nl (Eric Maris) Date: Fri, 11 Mar 2011 22:23:55 +0100 Subject: [FieldTrip] ft_selectdata in ft_freqanalysis Message-ID: <00e201cbe032$a345fa50$e9d1eef0$@maris@donders.ru.nl> Dear developers, Can it be that, recently, a change has made in either ft_freqanalysis or ft_selectdata such that at line 68 in ft_selectdata a dimord is evaluated that may not be in the data structure (at least, in my case it is not)? Best, Eric Maris -------------- next part -------------- An HTML attachment was scrubbed... URL: From jm.horschig at donders.ru.nl Sat Mar 12 09:33:39 2011 From: jm.horschig at donders.ru.nl (=?ISO-8859-1?Q?=22J=F6rn_M=2E_Horschig=22?=) Date: Sat, 12 Mar 2011 09:33:39 +0100 Subject: [FieldTrip] ft_selectdata in ft_freqanalysis In-Reply-To: <00e201cbe032$a345fa50$e9d1eef0$@maris@donders.ru.nl> References: <00e201cbe032$a345fa50$e9d1eef0$@maris@donders.ru.nl> Message-ID: <4D7B2FE3.6050400@donders.ru.nl> Dear Eric, indeed ft_selectdata has been changed and checks data dimord (for not raw data), though I assumed to have removed the bug yesterday morning (so it should be in the ftp version today). In case you used your own repository, could you specify the error (maybe send a personal mail, to one the discussion list)? I would need to know what kind of data you put in, and what fields the data-structure has. Best, Jörn On 3/11/2011 10:23 PM, Eric Maris wrote: > > Dear developers, > > Can it be that, recently, a change has made in either ft_freqanalysis > or ft_selectdata such that at line 68 in ft_selectdata a dimord is > evaluated that may not be in the data structure (at least, in my case > it is not)? > > Best, > > Eric Maris > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Jörn M. Horschig PhD Student Donders Institute for Brain, Cognition and Behaviour Centre for Cognitive Neuroimaging Radboud University Nijmegen P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Contact: E-Mail: jm.horschig at donders.ru.nl Tel: +31-(0)24-36-68493 Web: http://www.ru.nl/donders Visiting address: Trigon, room 2.30 Kapitelweg 29 NL-6525 EN Nijmegen The Netherlands -------------- next part -------------- An HTML attachment was scrubbed... URL: From Gregor.Volberg at psychologie.uni-regensburg.de Tue Mar 15 20:15:32 2011 From: Gregor.Volberg at psychologie.uni-regensburg.de (Gregor Volberg) Date: Tue, 15 Mar 2011 20:15:32 +0100 Subject: [FieldTrip] Source mapping for ITC / PLV Message-ID: <4D7FC8E40200005700008D18@gwsmtp1.uni-regensburg.de> Dear fieldtrippers, I have a question on source reconstructions related to inter-trial coherence (or "phase-locking factor" the extent to which the phase of oscillations are locked to the onset of the evoking stimulus across multiple trials). For an ITC effect that I found on the sensor level, I did a source reconstruction for which I (1) computed an LCMV beamformer, (2) multiplied my sensor single trials with the beamformer filter to get the source single trials, and then (3) computed ITC for each single source position, over the source single trials. I hoped to see that the ITC is stronger at some source location than at others. But instead, the ITC was identical at every source position. After unsuccessfully searching for an error in my code, I now wonder whether my strategy is valid at all, or whether my results (constant ITCs) are somewhat a consequence of how the beamformer filters the sensor data. If yes, is there a better strategy to do source reconstructions on indices that rely on phase consistency, like ITC or PLV? By saying "source" reconstruction of phase-locking indices, I do not mean to find a source of phase resetting or so, just phase-locking on the source signal level. Any comments are welcome, thanks a lot in advance, Gregor -- Dr. rer. nat. Gregor Volberg ( mailto:gregor.volberg at psychologie.uni-regensburg.de ) University of Regensburg Institute for Experimental Psychology 93040 Regensburg, Germany Tel: +49 941 943 3862 Fax: +49 941 943 3233 http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html From nathanweisz at mac.com Tue Mar 15 22:21:50 2011 From: nathanweisz at mac.com (Nathan Weisz) Date: Tue, 15 Mar 2011 22:21:50 +0100 Subject: [FieldTrip] Source mapping for ITC / PLV In-Reply-To: <4D7FC8E40200005700008D18@gwsmtp1.uni-regensburg.de> References: <4D7FC8E40200005700008D18@gwsmtp1.uni-regensburg.de> Message-ID: hi gregor, it should basically work. you may want to look at this paper: http://www.ncbi.nlm.nih.gov/pubmed/18511307 just a Bardouille & Ross I would beam the complex FFT-coefficients using your spatial filter. that should be faster. we recently did something very similar to localize the auditory steady state and it works nicely. steps: - calculate single trial FFT coefficients for the time / frequency period in which you see nice sensor level ITC - calculate spatial filter (perhaps using a fixed orientation) - multiply the coefficients with your filter - convert to angles - calculate ITC - generate something that looks like sourceanalysis structure good luck, n On 15.03.2011, at 20:15, Gregor Volberg wrote: > Dear fieldtrippers, > > I have a question on source reconstructions related to inter-trial coherence (or "phase-locking factor" the extent to which the phase of oscillations are locked to the onset of the evoking stimulus across multiple trials). For an ITC effect that I found on the sensor level, I did a source reconstruction for which I (1) computed an LCMV beamformer, (2) multiplied my sensor single trials with the beamformer filter to get the source single trials, and then (3) computed ITC for each single source position, over the source single trials. I hoped to see that the ITC is stronger at some source location than at others. But instead, the ITC was identical at every source position. > > After unsuccessfully searching for an error in my code, I now wonder whether my strategy is valid at all, or whether my results (constant ITCs) are somewhat a consequence of how the beamformer filters the sensor data. If yes, is there a better strategy to do source reconstructions on indices that rely on phase consistency, like ITC or PLV? By saying "source" reconstruction of phase-locking indices, I do not mean to find a source of phase resetting or so, just phase-locking on the source signal level. > > Any comments are welcome, thanks a lot in advance, > Gregor > > > > > > -- > Dr. rer. nat. Gregor Volberg ( mailto:gregor.volberg at psychologie.uni-regensburg.de ) > University of Regensburg > Institute for Experimental Psychology > 93040 Regensburg, Germany > Tel: +49 941 943 3862 > Fax: +49 941 943 3233 > http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From marco.dahmane at gmail.com Wed Mar 16 01:43:18 2011 From: marco.dahmane at gmail.com (Marco Dahmane) Date: Wed, 16 Mar 2011 01:43:18 +0100 Subject: [FieldTrip] Working with own data format - events Message-ID: Dear FieldTrippers, I have a question that will probably sound trivial to you, but I haven't been able to find the answer anywhere so I will ask it here. Please bear with me as I am all new to FieldTrip and EEG/MEG analysis. The data I am working with is in a format that is not recognized natively by FT. I do however possess a MATLAB routine that allows me to read it and store it in a .mat file. I have followed the steps described in the FAQ, and reformatted that data within Matlab into a datastructure that is compatible with FieldTrip, first as one big trial then split it with ft_redefinetrial. So far so good, as I can visualize my data trial by trial with no problem. Now however, I would like to create my own events relative to a set condition. My data is not marked at all so I have to do it "by hand". I actually have 6 different experimental conditions and each one of the trials corresponds to the MEG response under one of those conditions. How exactly would I go about setting that up in FT ? How do I create events that do not exist in my data? In other words, how do I give a value to each trial (assuming I know which trial number relates to which condition)? It wasn't clear from the tutorials since all the data used always possesses event data beforehand. Thank you in advance, Marco -------------- next part -------------- An HTML attachment was scrubbed... URL: From matt.mollison at gmail.com Wed Mar 16 02:01:46 2011 From: matt.mollison at gmail.com (Matt Mollison) Date: Tue, 15 Mar 2011 19:01:46 -0600 Subject: [FieldTrip] PLV analysis clarification Message-ID: Hi FieldTrippers, I know there have been quite a few PLV/coherence emails on this list. I've searched the archives extensively and have attempted this on my own for a while now, but even using all the info I gathered from the archives I haven't succeeded in running any PLV (or coherence) analyses. Here's what I'm hoping to accomplish by posting here: I'd appreciate any advice about how to correctly run analyses for a within-subjects (32 subj) experiment comparing PLV between 2 conditions that every subject ran in, looking at specific times and frequencies (and/or using cluster stats—though I have no idea how to deal with so many pairwise cohrefchannel+channel combinations, but I'm re-reading Maris et al., 2007 tonight). Here's my issue: I've had a difficult time implementing PLV analyses, particularly stats, and I don't know if/where I should z-transform PLV. I can calculate PLV by running ft_freqanalysis and then ft_connectivityanalysis, but I can't do anything with the output. Well, I shouldn't say I can't do *anything* with the output: if I run ft_freqanalysis with cfg.method='mtmconvol' I can plot the data for one channel and a cohrefchannel using ft_singleplotTFR, but I can't run the PLV data through ft_freqstatistics. Also, I've found that cfg.method='wavelet' does not produce any cases where I can plot PLV (using both powandcsd and fourier; I feel like I know the technical difference between the powandcsd and fourier options, but I don't know how they functionally differ for running analyses in FT). To be more specific about these cases where I've been able to plot PLV, I've used these options for ft_freqanalysis (plus specifics for each method like toi, foi, etc.), and then ran it through ft_connectivityanalysis with cfg.method='plv': cfg_freq = []; cfg_freq.method='mtmconvol'; cfg_freq.output = 'fourier'; cfg_freq.keeptrials = 'yes'; cfg_freq.keeptapers = 'yes'; cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; % when debugging, only calculate for a few channels and cfg_freq = []; cfg_freq.method='mtmconvol'; cfg_freq.output = 'powandcsd'; cfg_freq.keeptrials = 'no'; cfg_freq.keeptapers = 'no'; cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; % when debugging, only calculate for a few channels I can't tell if I'm doing something wrong or if there are bugs in the FT scripts when processing the label, labelcmb, and dimord fields. I posted about errors/crashes regarding these fields on bugzilla a few weeks ago < http://bugzilla.fcdonders.nl/show_bug.cgi?id=480> when I was a little less educated about these analyses, but I haven't progressed in coding up my own analyses; I've only made a lot of fruitless attempts. People on this list seem to be successfully running PLV/coherence analyses, so I can only guess that the problem is on my end. Once I get it figured out I'd be happy to write a baseic tutorial for the FT wiki. TL;DR: any advice on a viable PLV/coherence within-subjects workflow would be much appreciated. Thanks, Matt P.S. I'm attaching a text file noting success and failures of FT functions for iterations of wavelet/mtmconvol and powandcsd/fourier and keeptrials/keeptapers=yes/no. It's a lot of details, and you probably shouldn't feel the need to read though it unless you're debugging. I've tried to visually separate the iterations with equals signs, and the functions within an iteration with hyphens. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- ================================================================= cfg_freq.method = 'wavelet'; cfg_freq.output = 'powandcsd'; cfg_freq.channelcmb = {'all','all'}; % 129 channels -------------------------------------- ft_freqanalysis data_freq = label: {129x1 cell} dimord: 'chan_freq_time' freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 8.8889] time: [1x33 double] powspctrm: [129x9x33 double] labelcmb: {8256x2 cell} crsspctrm: [8256x9x33 double] cfg: [1x1 struct] ft_connectivityanalysis with 'plv' data_conn = labelcmb: {8256x2 cell} dimord: 'chan_freq_time' plvspctrm: [8256x9x33 double] freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 8.8889] time: [1x33 double] cfg: [1x1 struct] -------------------------------------- FAILURE: can't run ft_freqgrandaverage on data_conn because there is no label field -------------------------------------- FAILURE: can't run ft_singleplotTFR on data_conn cfg_ft.cohrefchannel = 'E3'; cfg_ft.channel = 'E60'; selected 1408 channels for plvspctrm ??? Error using ==> ft_channelselection at 72 data with non-unique channel names is not supported Error in ==> ft_singleplotTFR at 290 selchannel = ft_channelselection(cfg.channel, data.label); -------------------------------------- FAILURE: can't run ft_topoplotTFR on data_conn creating layout from data.elec creating layout for egi128 system selected 1408 channels for plvspctrm Warning: Duplicate x-y data points detected: using average of the z values. > In griddata at 108 In ft_plot_topo at 146 In ft_topoplotER at 747 In ft_topoplotTFR at 116 ??? Error using ==> griddata at 122 Not enough unique sample points specified. Error in ==> ft_plot_topo at 146 [Xi,Yi,Zi] = griddata(chanX', chanY, dat, xi', yi, interpmethod); % interpolate the topographic data Error in ==> ft_topoplotER at 747 ft_plot_topo(chanX,chanY,datavector,'interpmethod',cfg.interpolation,... Error in ==> ft_topoplotTFR at 116 cfg=ft_topoplotER(cfg, varargin{:}); ================================================================= ================================================================= ================================================================= cfg_freq.method = 'wavelet'; cfg_freq.output = 'fourier' cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; cfg_freq.channel = unique(cfg_freq.channelcmb); have to set keeptapers to 'no' even though (as far as I know) there are no tapers used in wavelets (see ft_freqanalysis line 313) cfg_freq.keeptrials = 'no'; cfg_freq.keeptapers = 'no'; -------------------------------------- ft_freqanalysis data_freq = label: {4x1 cell} dimord: 'chan_freq_time' freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 8.8889] time: [1x33 double] fourierspctrm: [4x9x33 double] cfg: [1x1 struct] -------------------------------------- FAILURE: can't run ft_connectivityanalysis on data_freq because there is no cumtapcnt field ??? Reference to non-existent field 'cumtapcnt'. Error in ==> ft_checkdata>fixcsd at 844 sumtapcnt = [0;cumsum(data.cumtapcnt(:))]; Error in ==> ft_checkdata at 594 data = fixcsd(data, cmbrepresentation, channelcmb); Error in ==> univariate2bivariate at 29 data = ft_checkdata(data, 'cmbrepresentation', 'full'); Error in ==> ft_connectivityanalysis at 234 [data, powindx, hasrpt] = univariate2bivariate(data, 'fourierspctrm', 'crsspctrm', dtype, 'cmb', cfg.channelcmb); ================================================================= ================================================================= ================================================================= cfg_freq.method = 'mtmconvol'; cfg_freq.output = 'powandcsd'; cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; cfg_freq.channel = unique(cfg_freq.channelcmb); cfg_freq.keeptrials = 'no'; cfg_freq.keeptapers = 'no'; cfg_freq.taper = 'hanning'; -------------------------------------- ft_freqanalysis data_freq = label: {4x1 cell} dimord: 'chan_freq_time' freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 8.8889] time: [1x33 double] powspctrm: [4x9x33 double] labelcmb: {4x2 cell} crsspctrm: [4x9x33 double] cumtapcnt: [173x9 double] cfg: [1x1 struct] ft_connectivityanalysis with 'plv' data_conn = labelcmb: {4x2 cell} dimord: 'chan_freq_time' plvspctrm: [4x9x33 double] freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 8.8889] time: [1x33 double] cfg: [1x1 struct] -------------------------------------- FAILURE: can't run ft_freqgrandaverage on data_conn because there is no label field -------------------------------------- SUCCESS: ft_singleplotTFR successfully makes a plot -------------------------------------- FAILURE: can't run ft_freqstatistics on data_conn because there's no label field ??? Reference to non-existent field 'label'. Error in ==> prepare_timefreq_data>forcedimord at 509 output.label = input.label; Error in ==> prepare_timefreq_data at 87 [remember{c}, hascrsspctrm] = forcedimord(varargin{c}); Error in ==> statistics_wrapper at 217 [cfg, data] = prepare_timefreq_data(cfg, varargin{:}); Error in ==> ft_freqstatistics at 127 [stat, cfg] = statistics_wrapper(cfg, varargin{:}); ================================================================= ================================================================= ================================================================= cfg_freq.method = 'mtmconvol'; cfg_freq.output = 'fourier'; cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; cfg_freq.channel = unique(cfg_freq.channelcmb); cfg_freq.keeptrials = 'no'; cfg_freq.keeptapers = 'no'; cfg_freq.taper = 'hanning'; -------------------------------------- ft_freqanalysis data_freq = label: {4x1 cell} dimord: 'chan_freq_time' freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 8.8889] time: [1x33 double] fourierspctrm: [4x9x33 double] cumtapcnt: [173x9 double] cfg: [1x1 struct] -------------------------------------- FAILURE: can't run ft_connectivityanalysis on data_freq ??? Subscripted assignment dimension mismatch. Error in ==> ft_checkdata>fixcsd at 851 crsspctrm(p,:,:,m,k) = (tmpdat*tmpdat')./data.cumtapcnt(p); Error in ==> ft_checkdata at 594 data = fixcsd(data, cmbrepresentation, channelcmb); Error in ==> univariate2bivariate at 29 data = ft_checkdata(data, 'cmbrepresentation', 'full'); Error in ==> ft_connectivityanalysis at 234 [data, powindx, hasrpt] = univariate2bivariate(data, 'fourierspctrm', 'crsspctrm', dtype, 'cmb', cfg.channelcmb); ================================================================= ================================================================= ================================================================= cfg_freq.method = 'mtmconvol'; cfg_freq.output = 'fourier'; cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; cfg_freq.channel = unique(cfg_freq.channelcmb); cfg_freq.keeptrials = 'yes'; cfg_freq.keeptapers = 'yes'; cfg_freq.taper = 'hanning'; -------------------------------------- ft_freqanalysis data_freq = label: {4x1 cell} dimord: 'rpttap_chan_freq_time' freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 8.8889] time: [1x33 double] fourierspctrm: [4-D double] cumtapcnt: [173x9 double] cfg: [1x1 struct] ft_connectivityanalysis with 'plv' data_conn = label: {4x1 cell} dimord: 'chan_chan_freq_time' plvspctrm: [4-D double] freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 8.8889] time: [1x33 double] dof: [173 173 173 173 173 173 173 173 173] cfg: [1x1 struct] -------------------------------------- FAILURE: can't run ft_freqgrandaverage on data_conn ??? Error using ==> ft_freqgrandaverage at 170 unsupported dimord -------------------------------------- SUCCESS: ft_singleplotTFR makes a plot -------------------------------------- FAILURE: can't do ft_freqstatistics on data_conn because of chan_chan in dimord ??? Error using ==> size Dimension argument must be a positive integer scalar within indexing range. Error in ==> prepare_timefreq_data>forcedimord at 540 Nchan = size(output.dat, chandim); Error in ==> prepare_timefreq_data at 87 [remember{c}, hascrsspctrm] = forcedimord(varargin{c}); Error in ==> statistics_wrapper at 217 [cfg, data] = prepare_timefreq_data(cfg, varargin{:}); Error in ==> ft_freqstatistics at 127 [stat, cfg] = statistics_wrapper(cfg, varargin{:}); Error in ==> mm_ft_ttestTFR at 228 cfg_ana.(vs_str) = eval(sprintf('ft_freqstatistics(cfg_ft,%s);',subj_str)); ================================================================= From Gregor.Volberg at psychologie.uni-regensburg.de Wed Mar 16 06:55:31 2011 From: Gregor.Volberg at psychologie.uni-regensburg.de (Gregor Volberg) Date: Wed, 16 Mar 2011 06:55:31 +0100 Subject: [FieldTrip] Antw: Re: Source mapping for ITC / PLV Message-ID: <4D805EE30200005700008D20@gwsmtp1.uni-regensburg.de> Hi Nathan, thanks a lot again. I will try this procedure. Cheers, Gregor -- Dr. rer. nat. Gregor Volberg ( mailto:gregor.volberg at psychologie.uni-regensburg.de ) University of Regensburg Institute for Experimental Psychology 93040 Regensburg, Germany Tel: +49 941 943 3862 Fax: +49 941 943 3233 http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html >>> Nathan Weisz 15.03.11 23.07 Uhr >>> hi gregor, it should basically work. you may want to look at this paper: http://www.ncbi.nlm.nih.gov/pubmed/18511307 just a Bardouille & Ross I would beam the complex FFT-coefficients using your spatial filter. that should be faster. we recently did something very similar to localize the auditory steady state and it works nicely. steps: - calculate single trial FFT coefficients for the time / frequency period in which you see nice sensor level ITC - calculate spatial filter (perhaps using a fixed orientation) - multiply the coefficients with your filter - convert to angles - calculate ITC - generate something that looks like sourceanalysis structure good luck, n On 15.03.2011, at 20:15, Gregor Volberg wrote: > Dear fieldtrippers, > > I have a question on source reconstructions related to inter-trial coherence (or "phase-locking factor" the extent to which the phase of oscillations are locked to the onset of the evoking stimulus across multiple trials). For an ITC effect that I found on the sensor level, I did a source reconstruction for which I (1) computed an LCMV beamformer, (2) multiplied my sensor single trials with the beamformer filter to get the source single trials, and then (3) computed ITC for each single source position, over the source single trials. I hoped to see that the ITC is stronger at some source location than at others. But instead, the ITC was identical at every source position. > > After unsuccessfully searching for an error in my code, I now wonder whether my strategy is valid at all, or whether my results (constant ITCs) are somewhat a consequence of how the beamformer filters the sensor data. If yes, is there a better strategy to do source reconstructions on indices that rely on phase consistency, like ITC or PLV? By saying "source" reconstruction of phase-locking indices, I do not mean to find a source of phase resetting or so, just phase-locking on the source signal level. > > Any comments are welcome, thanks a lot in advance, > Gregor > > > > > > -- > Dr. rer. nat. Gregor Volberg ( mailto:gregor.volberg at psychologie.uni-regensburg.de ) > University of Regensburg > Institute for Experimental Psychology > 93040 Regensburg, Germany > Tel: +49 941 943 3862 > Fax: +49 941 943 3233 > http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From jan.schoffelen at donders.ru.nl Wed Mar 16 08:56:45 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Wed, 16 Mar 2011 08:56:45 +0100 Subject: [FieldTrip] Working with own data format - events In-Reply-To: References: Message-ID: <98AA05BC-FDA7-48F6-AA0B-26BA90CFDA1F@donders.ru.nl> Dear Marco, I am glad to hear that your efforts so far were successful. Sorry to hear that you got stuck but it sounds as if you're really almost there. I will update the documentation shortly, but this is what you need to do: You can create a field called 'trialinfo', i.e. data.trialinfo in which you can store trial-specific information in a NxM matrix, N being the number of trials, M can be an arbitrary number of columns. In your case you can specify a column vector with the condition numbers per trial. No need to create an event structure or so. I hope this helps. BW, Jan-Mathijs On Mar 16, 2011, at 1:43 AM, Marco Dahmane wrote: > Dear FieldTrippers, > > I have a question that will probably sound trivial to you, but I > haven't been able to find the answer anywhere so I will ask it here. > Please bear with me as I am all new to FieldTrip and EEG/MEG analysis. > > The data I am working with is in a format that is not recognized > natively by FT. I do however possess a MATLAB routine that allows me > to read it and store it in a .mat file. > > I have followed the steps described in the FAQ, and reformatted that > data within Matlab into a datastructure that is compatible with > FieldTrip, first as one big trial then split it with ft_redefinetrial. > > So far so good, as I can visualize my data trial by trial with no > problem. > > Now however, I would like to create my own events relative to a set > condition. My data is not marked at all so I have to do it "by hand". > > I actually have 6 different experimental conditions and each one of > the trials corresponds to the MEG response under one of those > conditions. > > How exactly would I go about setting that up in FT ? How do I create > events that do not exist in my data? > > In other words, how do I give a value to each trial (assuming I know > which trial number relates to which condition)? > > It wasn't clear from the tutorials since all the data used always > possesses event data beforehand. > > Thank you in advance, > Marco > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From jan.schoffelen at donders.ru.nl Wed Mar 16 09:00:14 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Wed, 16 Mar 2011 09:00:14 +0100 Subject: [FieldTrip] Fwd: Dipole time course References: <706096fd5690a.4d7fb80f@mail.uh.edu> Message-ID: <151E1504-1607-40CA-928C-C873B620DCFF@donders.ru.nl> Hi Mehmet, I am forwarding you question to the list; somebody may have an answer or some pointers for you to proceed. Best wishes, Jan-Mathijs Begin forwarded message: > From: Mehmet-Akif Coskun > Date: March 16, 2011 1:03:43 AM GMT+01:00 > To: jan-mathijs schoffelen > Subject: Dipole time course > > Hi Jan, > > > Sorry, if i am being to much and disturbing you. i need to fit > dipoles to M50 and M100 component of my ERPs and get the dipole time > course (and also i will need the leadfields because i want to > project leadfields of one source to another ERP). > > > I don't have any MRI data. All i have is the raw data, config and > headshape files. I have been told that without any MRI, i can still > do this in fieldtrip. > > > As i said i am a beginner in fieldtrip, and it seems confusing to me > because it has lots of settings for cfg. I have no idea what to set > for: > > > cfg.headshape > cfg.vol > cfg.hdmfile > > > Can you please guide to me to the steps that i need to follow? > if you dont mind, a simple matlab script will be so helpful. > > > Thanks again for your interest > Mehmet > Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Wed Mar 16 09:25:03 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Wed, 16 Mar 2011 09:25:03 +0100 Subject: [FieldTrip] PLV analysis clarification In-Reply-To: References: Message-ID: <00F172BC-AB16-4BE2-8BCE-1A22A78AB595@donders.ru.nl> Dear Matt, As usual, thanks for your detailed report (although one also shouldn't exaggerate ;o) ). Reading your mail and attachment, it seems there are several features/ problems in the code that restrict your analysis. In the following, I pasted your script and will provide some comments > ================================================================= > cfg_freq.method = 'wavelet'; > cfg_freq.output = 'powandcsd'; > cfg_freq.channelcmb = {'all','all'}; % 129 channels > > -------------------------------------- > ft_freqanalysis > data_freq = > label: {129x1 cell} > dimord: 'chan_freq_time' > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > powspctrm: [129x9x33 double] > labelcmb: {8256x2 cell} > crsspctrm: [8256x9x33 double] > cfg: [1x1 struct] > > ft_connectivityanalysis with 'plv' > data_conn = > labelcmb: {8256x2 cell} > dimord: 'chan_freq_time' > plvspctrm: [8256x9x33 double] > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > cfg: [1x1 struct] > > -------------------------------------- > FAILURE: can't run ft_freqgrandaverage on data_conn because there is > no label field This has indeed been noted by you and posted on bugzilla. We didn't find time to work on it yet, but as a general remark ft_freqgrandaverage (and ft_timelockgrandaverage and ft_sourcegrandaverage) were designed to work on univariate data only, i.e. it fails on data which comes out of ft_connectivityanalysis. As such there is no other reason for it than a historical one (the averaging functions were there long before we started doing serious connectivity stuff). Of course it should be possible to combine the data into one structure and do statistics later on, although I guess the clustering in the channel dimension becomes really complicated. Note, also that I pointed out to you that as such ft_XXXgrandaverage is not mandatory before calling ft_XXXstatistics, you can also input a cell-array of data structures. Yet, this will not help you because then you probably encounter a crash later on. SOLUTION for now: rename plvspctrm into powspctrm and create a label- field, e.g. by for i =1:size(data_conn.labelcmb,1) data_conn.label{k} = [data_conn.labelcmb{i,1},'_',data_conn.labelcmb{i, 2}]; end (and remove the labelcmb field) > > -------------------------------------- > FAILURE: can't run ft_singleplotTFR on data_conn > > cfg_ft.cohrefchannel = 'E3'; > cfg_ft.channel = 'E60'; > selected 1408 channels for plvspctrm > ??? Error using ==> ft_channelselection at 72 > data with non-unique channel names is not supported > > Error in ==> ft_singleplotTFR at 290 > selchannel = ft_channelselection(cfg.channel, data.label); The plotting functions keep haunting me. I thought that with my recent overhaul I made them somewhat more robust for plotting connectivity data. It would be helpful if you create a bug out of this specific section, and add an attachment containing data_conn, and cfg_ft) > -------------------------------------- > FAILURE: can't run ft_topoplotTFR on data_conn > > creating layout from data.elec > creating layout for egi128 system > selected 1408 channels for plvspctrm > Warning: Duplicate x-y data points detected: using average of the z > values. > > In griddata at 108 > In ft_plot_topo at 146 > In ft_topoplotER at 747 > In ft_topoplotTFR at 116 > ??? Error using ==> griddata at 122 > Not enough unique sample points specified. > > Error in ==> ft_plot_topo at 146 > [Xi,Yi,Zi] = griddata(chanX', chanY, dat, xi', yi, interpmethod); % > interpolate the topographic data > > Error in ==> ft_topoplotER at 747 > > ft_plot_topo > (chanX,chanY,datavector,'interpmethod',cfg.interpolation,... > > Error in ==> ft_topoplotTFR at 116 > cfg=ft_topoplotER(cfg, varargin{:}); > ================================================================= > ================================================================= You requested only a single pair to be plotted (1 cohrefchannel and 1 channel). A topography does not makes sense. FieldTrip does not detect this, but the low-level interpolation function starts complaining. SOLUTION: don't call ft_topoplotTFR if you want to look at 1 TFR only, as specified by the cfg. In that case it should be possible to specify cfg.interactive = 'yes', allowing you to toggle back and forth between topographies and selected sensors. > ================================================================= > cfg_freq.method = 'wavelet'; > cfg_freq.output = 'fourier' > cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; > cfg_freq.channel = unique(cfg_freq.channelcmb); > > have to set keeptapers to 'no' even though (as far as I know) there > are no tapers used in wavelets (see ft_freqanalysis line 313) > cfg_freq.keeptrials = 'no'; > cfg_freq.keeptapers = 'no'; > > -------------------------------------- > ft_freqanalysis > data_freq = > label: {4x1 cell} > dimord: 'chan_freq_time' > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > fourierspctrm: [4x9x33 double] > cfg: [1x1 struct] > > -------------------------------------- > FAILURE: can't run ft_connectivityanalysis on data_freq because > there is no cumtapcnt field > > ??? Reference to non-existent field 'cumtapcnt'. > > Error in ==> ft_checkdata>fixcsd at 844 > sumtapcnt = [0;cumsum(data.cumtapcnt(:))]; > > Error in ==> ft_checkdata at 594 > data = fixcsd(data, cmbrepresentation, channelcmb); > > Error in ==> univariate2bivariate at 29 > data = ft_checkdata(data, 'cmbrepresentation', 'full'); > > Error in ==> ft_connectivityanalysis at 234 > [data, powindx, hasrpt] = univariate2bivariate(data, > 'fourierspctrm', 'crsspctrm', dtype, 'cmb', cfg.channelcmb); > ================================================================= > ================================================================= Thanks for noticing this. I never considered anybody to use the wavelet method before calling ft_connectivityanalysis. Why would you want to use it in the first place if there's mtmconvol ;o) ? SOLUTION: Don't use wavelet (and post a bug on bugzilla stating this specific problem: output to waveletanalysis cannot be processed by ft_connectivityanalysis). > ================================================================= > cfg_freq.method = 'mtmconvol'; > cfg_freq.output = 'powandcsd'; > cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; > cfg_freq.channel = unique(cfg_freq.channelcmb); > > cfg_freq.keeptrials = 'no'; > cfg_freq.keeptapers = 'no'; > cfg_freq.taper = 'hanning'; > > -------------------------------------- > ft_freqanalysis > data_freq = > label: {4x1 cell} > dimord: 'chan_freq_time' > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > powspctrm: [4x9x33 double] > labelcmb: {4x2 cell} > crsspctrm: [4x9x33 double] > cumtapcnt: [173x9 double] > cfg: [1x1 struct] > > ft_connectivityanalysis with 'plv' > data_conn = > labelcmb: {4x2 cell} > dimord: 'chan_freq_time' > plvspctrm: [4x9x33 double] > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > cfg: [1x1 struct] > -------------------------------------- > FAILURE: can't run ft_freqgrandaverage on data_conn because there is > no label field > See above. > -------------------------------------- > SUCCESS: ft_singleplotTFR successfully makes a plot > Hurrah > -------------------------------------- > FAILURE: can't run ft_freqstatistics on data_conn because there's no > label field > > ??? Reference to non-existent field 'label'. > > Error in ==> prepare_timefreq_data>forcedimord at 509 > output.label = input.label; > > Error in ==> prepare_timefreq_data at 87 > [remember{c}, hascrsspctrm] = forcedimord(varargin{c}); > > Error in ==> statistics_wrapper at 217 > [cfg, data] = prepare_timefreq_data(cfg, varargin{:}); > > Error in ==> ft_freqstatistics at 127 > [stat, cfg] = statistics_wrapper(cfg, varargin{:}); > ================================================================= > ================================================================= See above > ================================================================= > cfg_freq.method = 'mtmconvol'; > cfg_freq.output = 'fourier'; > cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; > cfg_freq.channel = unique(cfg_freq.channelcmb); > > cfg_freq.keeptrials = 'no'; > cfg_freq.keeptapers = 'no'; > cfg_freq.taper = 'hanning'; > > -------------------------------------- > ft_freqanalysis > data_freq = > label: {4x1 cell} > dimord: 'chan_freq_time' > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > fourierspctrm: [4x9x33 double] > cumtapcnt: [173x9 double] > cfg: [1x1 struct] > > -------------------------------------- > FAILURE: can't run ft_connectivityanalysis on data_freq > > ??? Subscripted assignment dimension mismatch. > > Error in ==> ft_checkdata>fixcsd at 851 > crsspctrm(p,:,:,m,k) = (tmpdat*tmpdat')./data.cumtapcnt(p); > > Error in ==> ft_checkdata at 594 > data = fixcsd(data, cmbrepresentation, channelcmb); > > Error in ==> univariate2bivariate at 29 > data = ft_checkdata(data, 'cmbrepresentation', 'full'); > > Error in ==> ft_connectivityanalysis at 234 > [data, powindx, hasrpt] = univariate2bivariate(data, > 'fourierspctrm', 'crsspctrm', dtype, 'cmb', cfg.channelcmb); > ================================================================= This seems to be a bug in ft_freqanalysis. It should be very forbidden to run ft_freqanalysis with cfg.keeptrials = 'no' and cfg.output = 'fourier'. Just doesn't make sense. Could you file this as a bug please? > ================================================================= > ================================================================= > cfg_freq.method = 'mtmconvol'; > cfg_freq.output = 'fourier'; > cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; > cfg_freq.channel = unique(cfg_freq.channelcmb); > > cfg_freq.keeptrials = 'yes'; > cfg_freq.keeptapers = 'yes'; > cfg_freq.taper = 'hanning'; > > -------------------------------------- > ft_freqanalysis > data_freq = > label: {4x1 cell} > dimord: 'rpttap_chan_freq_time' > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > fourierspctrm: [4-D double] > cumtapcnt: [173x9 double] > cfg: [1x1 struct] > > ft_connectivityanalysis with 'plv' > data_conn = > label: {4x1 cell} > dimord: 'chan_chan_freq_time' > plvspctrm: [4-D double] > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > dof: [173 173 173 173 173 173 173 173 173] > cfg: [1x1 struct] > > -------------------------------------- > FAILURE: can't run ft_freqgrandaverage on data_conn > > ??? Error using ==> ft_freqgrandaverage at 170 > unsupported dimord > > -------------------------------------- > SUCCESS: ft_singleplotTFR makes a plot > > -------------------------------------- > FAILURE: can't do ft_freqstatistics on data_conn because of > chan_chan in dimord > > ??? Error using ==> size > Dimension argument must be a positive integer scalar within indexing > range. > > Error in ==> prepare_timefreq_data>forcedimord at 540 > Nchan = size(output.dat, chandim); > > Error in ==> prepare_timefreq_data at 87 > [remember{c}, hascrsspctrm] = forcedimord(varargin{c}); > > Error in ==> statistics_wrapper at 217 > [cfg, data] = prepare_timefreq_data(cfg, varargin{:}); > > Error in ==> ft_freqstatistics at 127 > [stat, cfg] = statistics_wrapper(cfg, varargin{:}); > > Error in ==> mm_ft_ttestTFR at 228 > cfg_ana.(vs_str) = eval(sprintf('ft_freqstatistics(cfg_ft, > %s);',subj_str)); > ================================================================= Let's keep this one for the next time... Best, Jan-Mathijs From marco.dahmane at gmail.com Wed Mar 16 11:46:38 2011 From: marco.dahmane at gmail.com (Marco Dahmane) Date: Wed, 16 Mar 2011 11:46:38 +0100 Subject: [FieldTrip] Working with own data format - events In-Reply-To: References: Message-ID: Dear Jan-Mathijs, Thank you for your kind answer. I have now created a trialinfo field, but that raises two other questions : 1) How would I go about if I want to perform an action on one trial-type only? 2) And now say that within these condition-specific trials, I want to define smaller events. Would I need to proceed the same way as I did with ft_redefinetrials in the first steps? (That is, does FT consider events and trials to be the same thing?) Thank you again, Marco PS : it would be nice indeed to have a tutorial on how to work with one's own dataformat (or to slightly expand the How can I import my own dataformat section in the FAQ) -------------- next part -------------- An HTML attachment was scrubbed... URL: From eelke.spaak at donders.ru.nl Wed Mar 16 12:16:45 2011 From: eelke.spaak at donders.ru.nl (Eelke Spaak) Date: Wed, 16 Mar 2011 12:16:45 +0100 Subject: [FieldTrip] Working with own data format - events In-Reply-To: References: Message-ID: Dear Marco, 1) You can use Matlab's find-function for this, for instance, use something like cfg.trials = find(data.trialinfo(:,1) == 1); to select all trials for which the first row in your trialinfo-matrix equals 1. The subsequent FT function you call with cfg as its argument will limit its processing only to the trials you specified. 2) The answer to this question depends a bit on what *you* define 'events' to be. In general, I would say events and trials are not the same; an event is something like a trigger that might occur in your data (i.e., something "pinpointable" in time), whereas a trial is a segment of data (i.e., something that has a duration). Since I do not know exactly what you mean by 'event' in your question, I cannot answer it with certainty. However, a possible answer could be: yes, you could just use ft_redefinetrials again :) Do not hesitate to rephrase your question 2, I might be able to give you some more detailed help. Best, Eelke 2011/3/16 Marco Dahmane : > Dear Jan-Mathijs, > Thank you for your kind answer. I have now created a trialinfo field, but > that raises two other questions : > 1) How would I go about if I want to perform an action on one trial-type > only? > 2) And now say that within these condition-specific trials, I want to define > smaller events. Would I need to proceed the same way as I did with > ft_redefinetrials in the first steps? (That is, does FT consider events and > trials to be the same thing?) > Thank you again, > Marco > PS : it would be nice indeed to have a tutorial on how to work with one's > own dataformat (or to slightly expand the How can I import my own > dataformat section in the FAQ) > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > From jan.schoffelen at donders.ru.nl Wed Mar 16 12:26:16 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Wed, 16 Mar 2011 12:26:16 +0100 Subject: [FieldTrip] Working with own data format - events In-Reply-To: References: Message-ID: Dear Marco, > 1) How would I go about if I want to perform an action on one trial- > type only? > Most FieldTrip functions support the option cfg.trials = X, with X being a vector containing indices to the trials on which the computations need to be done. You can then specify, cfg.trials = find(data.trialinfo(:,1)==a), a being the condition number you are interested in. > 2) And now say that within these condition-specific trials, I want > to define smaller events. Would I need to proceed the same way as I > did with ft_redefinetrials in the first steps? (That is, does FT > consider events and trials to be the same thing?) Hmm, you could of course call ft_redefinetrial again, but in that case you need to manually update your trialinfo field again. If your question pertains to whether you can use information in the trialinfo field to redefine your trials, the answer would be that this is tricky, but possible. A prerequisite of course is that the information needs to be present in trialinfo to begin with. What I sometimes do is create additional columns coding (expressed in samples from the beginning of the respective trials) for potentially relevant other events. You could subsequently use this column of the trialinfo matrix to redefine your trials with ft_redefinetrial, using cfg.begsample and cfg.endsample. Hope this helps, Jan-Mathijs > Thank you again, > Marco > > PS : it would be nice indeed to have a tutorial on how to work with > one's own dataformat (or to slightly expand the How can I import my > own dataformat section in the FAQ) > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivano_triggiani at yahoo.it Wed Mar 16 12:55:29 2011 From: ivano_triggiani at yahoo.it (Ivano Triggiani) Date: Wed, 16 Mar 2011 11:55:29 +0000 (GMT) Subject: [FieldTrip] [fieldtrip] Re: Still Reading a Trigger Channel Message-ID: <245929.94453.qm@web28616.mail.ukl.yahoo.com> Hi Dear, Jan had a good idea... it seems that .edf files are not good to be read automatically for a trigger channel... but writing a simple function on my own I found some error (of course...): evaluating trialfunction 'fun2' error opening file: pippo.edf ??? One or more output arguments not assigned during call to "read_16bit". Error in ==> read_edf>readLowLevel at 374 buf = read_16bit(filename, offset, numwords); Error in ==> read_edf at 334 buf = readLowLevel(filename, offset, epochlength); % see below in subfunction Error in ==> ft_read_data at 562 dat = read_edf(filename, hdr, begsample, endsample, chanindx); Error in ==> fun2 at 13 trg = ft_read_data(cfg.datafile, 'header', hdr, ... Error in ==> ft_definetrial at 123 trl = feval(cfg.trialfun, cfg); Error in ==> program1 at 11 cfg = ft_definetrial(cfg); have anyone some ideas about it ? Ivano -------------------------------------------------------------------------------- Dear Ivano, I would first check what 'triggers' fieldtrip automatically detects from your data. As far as I am aware, there is no default reading of a 'trigger' channel for .edf data, but I am not sure. You can get an idea bout the event-info, by specifying cfg = []; cfg.dataset = ... cfg.trialdef.eventtyp = '?'; ft_definetrial(cfg); This outputs some info to your screen, about which events are in the data. Each event is of a certain type 'type' , and may have a value 'value', e.g. when the acquisition system has an explicit trigger channel to which your stimulus presentation program, or response device sends discrete trigger pulses of varying height. In your case, I suspect that something else needs to be done (in case definetrial does not show triggers related to your trigger channel), i.e. you need to write your own 'trialfun'. Rather than using cfg.trialdef.eventtype/eventvalue, you need to specify cfg.trialfun = 'ivanoscooltrialfun', and you need to write your own file: trialfun_ivanoscooltrialfun which defines your segments of interest based on some feature in your trigger channel. Here's an example which uses an EMG-channel as epoch-defining signal. Of course your trigger channel needs to be processed in a different way but at least it gives you an impression. http://fieldtrip.fcdonders.nl/example/detect_the_muscle_activity_in_an_emg_channel_and_use_that_as_trial_definition?s []=trialfun Good luck Jan-Mathijs -------------- next part -------------- An HTML attachment was scrubbed... URL: From marco.dahmane at gmail.com Wed Mar 16 14:36:38 2011 From: marco.dahmane at gmail.com (Marco Dahmane) Date: Wed, 16 Mar 2011 14:36:38 +0100 Subject: [FieldTrip] Working with own data format - events In-Reply-To: References: Message-ID: > Dear Marco, > 1) You can use Matlab's find-function for this, for instance, use something like cfg.trials = find(data.trialinfo(:,1) == 1); to select all trials for which the first row in your trialinfo-matrix equals 1. The subsequent FT function you call with cfg as its argument will limit its processing only to the trials you specified. OK thank you that is exactly what I needed. > 2) The answer to this question depends a bit on what *you* define 'events' to be. In general, I would say events and trials are not the same; an event is something like a trigger that might occur in your data (i.e., something "pinpointable" in time), whereas a trial is a segment of data (i.e., something that has a duration). Since I do not know exactly what you mean by 'event' in your question, I cannot answer it with certainty. However, a possible answer could be: yes, you could just use ft_redefinetrials again :) > Do not hesitate to rephrase your question 2, I might be able to give you some more detailed help. > Best, Eelke Well it seems we agree on the difference trial/event. For me a trial is the time from one trigger to the next (hence every trial is associated to a given condition) . Events, for me, can be anything happening within a trial (for instance, a sub-portion of a given trial that I find interesting). Therefore, I would like to be able to "mark" specific points in one or more given trials, and use the data delimited by those "marker points" to perform a given calculation on them. A (very) simple example of what I want to do would be : given that my trials are each about 8 seconds long, let's say the region of interest for me spans from 3s to 6s in every trial subset. How would I write that in FT ? And what if on certain trials only, I spot a very interesting spike. Does FT allow me to put an event marker on that specific spike ? If yes, how so? Am I being any clearer now? BW, Marco -------------- next part -------------- An HTML attachment was scrubbed... URL: From eelke.spaak at donders.ru.nl Wed Mar 16 15:59:09 2011 From: eelke.spaak at donders.ru.nl (Eelke Spaak) Date: Wed, 16 Mar 2011 15:59:09 +0100 Subject: [FieldTrip] Working with own data format - events In-Reply-To: References: Message-ID: 2011/3/16 Marco Dahmane : > > A (very) simple example of what I want to do would be : given that my trials > are each about 8 seconds long, let's say the region of interest for me spans > from 3s to 6s in every trial subset. How would I write that in FT ? This could indeed best be achieved by using ft_redefinetrial, just specifying as time limit from 3s to 6s and then conducting your analyses on the resulting data slices. > And what if on certain trials only, I spot a very interesting spike. Does FT > allow me to put an event marker on that specific spike ? If yes, how so? > Am I being any clearer now? If you want to mark the trial in which that interesting spike occurred, you could dedicate an extra column in your data.trialinfo matrix to this, e.g., place a 1 there for every trial that contains such an interesting spike. Then, just use cfg.trials = find(...) again in subsequent steps to limit analysis to trials containing interesting spikes. Or, if you want to mark the exact time at which such a spike occurs (relative to the trial), you could use Jan-Mathijs' suggestion and have a column in your data.trialinfo correspond to the sample index of the spike, relative to the trial. ft_redefinetrial could then slice out the interesting parts, if you specify cfg.begsample and cfg.endsample. Best, Eelke From julian.keil at gmail.com Wed Mar 16 16:31:00 2011 From: julian.keil at gmail.com (Julian Keil) Date: Wed, 16 Mar 2011 16:31:00 +0100 Subject: [FieldTrip] ft_databrowser and multiplot Message-ID: <94474ED2-0FE0-4C15-81BB-0EA58CB59B74@gmail.com> Hi everyone, when looking at the help file for ft_databrowser.m, I saw the option cfg.selectmode which, when set to 'eval' calls the multiplotER-function. Unfortunately, the databrowser then crashes as no layout has been specified. Is there any way to specify a layout so that the multiplotER can be successfully executed? I tried cfg.layout='4D148.lay', but without any luck. Thanks a lot Julian Dipl. Psych. Julian Keil OBOB-Lab University of Konstanz Department of Psychology P.O. Box D25 78457 Konstanz Germany Tel: ++49 - (0)7531 - 88 42 50 Fax: ++49 - (0)7531 - 88 28 91 Email: julian.keil at uni-konstanz.de Homepage: http://www.uni-konstanz.de/obob -------------- next part -------------- An HTML attachment was scrubbed... URL: From eelke.spaak at donders.ru.nl Wed Mar 16 16:57:00 2011 From: eelke.spaak at donders.ru.nl (Eelke Spaak) Date: Wed, 16 Mar 2011 16:57:00 +0100 Subject: [FieldTrip] ft_databrowser and multiplot In-Reply-To: References: <94474ED2-0FE0-4C15-81BB-0EA58CB59B74@gmail.com> Message-ID: Hi Julian, Have you tried specifying cfg.selcfg? This is the cfg that will get passed to cfg.selfun. Best, Eelke 2011/3/16 Julian Keil : > Hi everyone, > when looking at the help file for ft_databrowser.m, I saw the option > cfg.selectmode which, when set to 'eval' calls the multiplotER-function. > Unfortunately, the databrowser then crashes as no layout has been specified. > Is there any way to specify a layout so that the multiplotER can be > successfully executed? > I tried cfg.layout='4D148.lay', but without any luck. > Thanks a lot > Julian > > > Dipl. Psych. Julian Keil > OBOB-Lab > University of Konstanz > Department of Psychology > P.O. Box D25 > 78457 Konstanz > Germany > Tel: ++49 - (0)7531 - 88 42 50 > Fax: ++49 - (0)7531 - 88 28 91 > Email: julian.keil at uni-konstanz.de > Homepage: http://www.uni-konstanz.de/obob > > > > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > From r.oostenveld at donders.ru.nl Wed Mar 16 16:59:31 2011 From: r.oostenveld at donders.ru.nl (Robert Oostenveld) Date: Wed, 16 Mar 2011 16:59:31 +0100 Subject: [FieldTrip] ft_databrowser and multiplot In-Reply-To: <94474ED2-0FE0-4C15-81BB-0EA58CB59B74@gmail.com> References: <94474ED2-0FE0-4C15-81BB-0EA58CB59B74@gmail.com> Message-ID: <40D5B35F-FFE1-407F-AEF1-5D292A296516@donders.ru.nl> Hi Julian cfg.selectmode=eval causes cfg.selfun to be evaluated with feval. The default function to be evaluated is browse_multiplotER, which is located in fieldtrip/private. Other functions that are supplied for this purpose in fieldtrip are browse_movieplotER.m browse_topoplotER.m browse_topoplotVAR.m Each of those functions takes a cfg and a "raw data" structure as input. The raw data structure that it gets contains one trial, corresponding with the selection that you just clicked. The cfg that it gets is the cfg.selcfg field from the cfg that you specify to ft_databrowser. I suggest you have a look at the code of those functions, they are really simple. So specifying (to ft_databorwser) cfg.selectmode = 'eval' cfg.selcfg.layout = '4D148.lay' should solve your problem. Please note that the idea is that people make their own "browsefuns/ selfuns", just like trialfuns. E.g. depending on your data, you might want to baselinecorrect, filter or do something else. You could also to a (one-trial) mtmfft and then use multiplotER to plot the power spectrum. best Robert PS I just detected an error with the layout in browse_movieplotER, I'll fix that and make some updates to the other browse_xxx functions. If you want to follow up on them, I suggest you do an update of fieldtrip tomorrow. PS2 specifying cfg.layout at the main level for ft_databrowser is for visualising independent components, i.e. data that is the output of ft_componentanalysis On 16 Mar 2011, at 16:31, Julian Keil wrote: > Hi everyone, > > when looking at the help file for ft_databrowser.m, I saw the option > cfg.selectmode which, when set to 'eval' calls the multiplotER- > function. > Unfortunately, the databrowser then crashes as no layout has been > specified. > Is there any way to specify a layout so that the multiplotER can be > successfully executed? > I tried cfg.layout='4D148.lay', but without any luck. > > Thanks a lot > > Julian From r.oostenveld at donders.ru.nl Wed Mar 16 17:05:27 2011 From: r.oostenveld at donders.ru.nl (Robert Oostenveld) Date: Wed, 16 Mar 2011 17:05:27 +0100 Subject: [FieldTrip] [fieldtrip] Re: Still Reading a Trigger Channel In-Reply-To: <245929.94453.qm@web28616.mail.ukl.yahoo.com> References: <245929.94453.qm@web28616.mail.ukl.yahoo.com> Message-ID: <7408CA1A-4684-44A0-A7C6-BA49100E066F@donders.ru.nl> Dear Ivano EDF and triggers indeed don't go together that well. The formal "EDF+ standard" specifies how annotations can be added to a pseudo-channel, but it is very awkward and does not wotk thaht well for triggers. The problem you descibe below suggests an incompatibility of your edf file with fieldtrip. Either the file is corrupt, or there is a problem with some fieldtrip code. Could you post the problem below with the edf file (which hopefully is not too large) to http://bugzilla.fcdonders.nl? See http://fieldtrip.fcdonders.nl/bugzilla for more details best regards Robert On 16 Mar 2011, at 12:55, Ivano Triggiani wrote: > Hi Dear, > > Jan had a good idea... it seems that .edf files are not good to be > read automatically for a trigger channel... but writing a simple > function on my own I found some error (of course...): > > evaluating trialfunction 'fun2' > error opening file: pippo.edf > ??? One or more output arguments not assigned during call to > "read_16bit". > > Error in ==> read_edf>readLowLevel at 374 > buf = read_16bit(filename, offset, numwords); > > Error in ==> read_edf at 334 > buf = readLowLevel(filename, offset, epochlength); % see below > in subfunction > > Error in ==> ft_read_data at 562 > dat = read_edf(filename, hdr, begsample, endsample, chanindx); > > Error in ==> fun2 at 13 > trg = ft_read_data(cfg.datafile, 'header', hdr, ... > > Error in ==> ft_definetrial at 123 > trl = feval(cfg.trialfun, cfg); > > Error in ==> program1 at 11 > cfg = ft_definetrial(cfg); > > > have anyone some ideas about it ? > Ivano > > -------------------------------------------------------------------------------- > > Dear Ivano, > > I would first check what 'triggers' fieldtrip automatically detects > from your data. As far as I am aware, there is no default reading of a > 'trigger' channel for .edf data, but I am not sure. > > You can get an idea bout the event-info, by specifying > > cfg = []; > cfg.dataset = ... > cfg.trialdef.eventtyp = '?'; > ft_definetrial(cfg); > > This outputs some info to your screen, about which events are in the > data. Each event is of a certain type 'type' , and may have a value > 'value', e.g. when the acquisition system has an explicit trigger > channel to which your stimulus presentation program, or response > device sends discrete trigger pulses of varying height. > > In your case, I suspect that something else needs to be done (in case > definetrial does not show triggers related to your trigger channel), > i.e. you need to write your own 'trialfun'. Rather than using > cfg.trialdef.eventtype/eventvalue, you need to specify cfg.trialfun = > 'ivanoscooltrialfun', and you need to write your own file: > trialfun_ivanoscooltrialfun which defines your segments of interest > based on some feature in your trigger channel. Here's an example which > uses an EMG-channel as epoch-defining signal. Of course your trigger > channel needs to be processed in a different way but at least it gives > you an impression. > > http://fieldtrip.fcdonders.nl/example/detect_the_muscle_activity_in_an_emg_channel_and_use_that_as_trial_definition?s > []=trialfun > > Good luck > > Jan-Mathijs > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From mcoskun at mail.uh.edu Wed Mar 16 23:26:01 2011 From: mcoskun at mail.uh.edu (Mehmet-Akif Coskun) Date: Wed, 16 Mar 2011 17:26:01 -0500 Subject: [FieldTrip] Dipole time course Message-ID: <7220dc8e55401.4d80f2a9@mail.uh.edu> Dear FieldTrippers; I recently start using fieldtrip and so please tolerate if these issues are straightforward. i need to fit dipoles to M50 and M100 component of my ERPs and get the dipole time course (and also i will need the leadfields because i want to project leadfields of one source to another ERP). I don't have any MR data. All i have is the raw data, config and hsfiles ( I am using a 248 4D MEG system). I have been told that without any MR, i can still do this in fieldtrip. I tried using ft_dipolefitting and but since i don't have any volume conduction model, it doesnt work. So i wonder if there are any predefined models. If not, are there any functions to use to create a model from what i have?  Any help will be greatly appreciated and thanks all for your interest Mehmet -------------- next part -------------- An HTML attachment was scrubbed... URL: From aglaia.jankoli at gmx.de Thu Mar 17 08:12:19 2011 From: aglaia.jankoli at gmx.de (Lydia Elshoff) Date: Thu, 17 Mar 2011 08:12:19 +0100 Subject: [FieldTrip] template brain/standard EEG-Electrodes Message-ID: <20110317071219.9320@gmx.net> hello! We are a research group at the Neuropaediatrics Department in Kiel and started working with EEG Analysis in fieldtrip. We now face several questions: Could you please tell us how to or send us a matlab code for the using template brain and the standard EEG-Electrodes in DICS analysis in fieldtrip? Or perhaps show an example??? Thank you very much!!! Lydia Elshoff -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone From nathanweisz at mac.com Thu Mar 17 08:46:50 2011 From: nathanweisz at mac.com (Nathan Weisz) Date: Thu, 17 Mar 2011 08:46:50 +0100 Subject: [FieldTrip] template brain/standard EEG-Electrodes In-Reply-To: <20110317071219.9320@gmx.net> References: <20110317071219.9320@gmx.net> Message-ID: <334BA2E3-4E04-4CED-8814-289FC95133FC@mac.com> hi, somewhere on the firledtrip FTP there is a standard_BEM. i got mine from EEGlab, but it's fieldtrip stuff. it's ~11 MB so i won't send it over the list :-) anyway: this is a headmodel created by segmentation of a MNI-brain. if you follow the fieldtrip tutorial on DICS this contains the "vol"-structure you need. the only - and sometimes not trivial - issue you have is to get your electrodes aligned / co-registered onto the head surface. you have different options (i guess you don't have individual MRIs otherwise you wouldn't be asking), e.g.: - there are standard electrode positions in MNI space for 10/05 electrode placements somewhere in fieldtrip. you may find all / most electrodes of you EEG in this file. that's fast and no headache. - your EEG vendor may have such a file specific for your cap. we got one from our EEG supplier (ANT). even better than the option above, because then you are sure to have all electrodes (especially when the cap deviates from 10/20 or 10/05 placement). - digitize the electrode-positions in one subject and co-register it to the MNI template brain manually. this option is probably a pain since the head of any individual you choose won't fit exactly the MNI template. so you will have to play around until the electrodes are as much as possible on the head surface. [unless: if you can also get an MRI for that subject: then co-register electrodes with individual MRI; normalize individual MRI to MNI-template; take the resulting transformation matrix to recalculate your elec.pos field in MNI coordinates ... that would also be an easy option] in any case once your electrode data, headmodel and MRI (latter not strictly needed for the sourceanalysis, but you will want it for visualization) are in the same coordinate sytsem, then you can proceed as described in the tutorial. there is really no difference anymore whether you have individual or standard stuff, i.e. the sourceanalysis won't care as long as it gets the structures it wants. a word of consolation: if you want to use the standard headmodel / brain, then you need to solve this issue only one time :-) good luck, n On 17.03.2011, at 08:12, Lydia Elshoff wrote: > hello! > > We are a research group at the Neuropaediatrics Department in Kiel and started working with EEG Analysis in fieldtrip. We now face several questions: Could you please tell us how to or send us a matlab code for the using template brain and the standard EEG-Electrodes in DICS analysis in fieldtrip? Or perhaps show an example??? > Thank you very much!!! > > Lydia Elshoff > -- > NEU: FreePhone - kostenlos mobil telefonieren und surfen! > Jetzt informieren: http://www.gmx.net/de/go/freephone > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From aglaia.jankoli at gmx.de Thu Mar 17 10:47:48 2011 From: aglaia.jankoli at gmx.de (Lydia Elshoff) Date: Thu, 17 Mar 2011 10:47:48 +0100 Subject: [FieldTrip] template brain/standard EEG-Electrodes In-Reply-To: <334BA2E3-4E04-4CED-8814-289FC95133FC@mac.com> References: <20110317071219.9320@gmx.net> <334BA2E3-4E04-4CED-8814-289FC95133FC@mac.com> Message-ID: <20110317094748.256350@gmx.net> Hi Nathan! THank you very much -we´ll try that out and I hope it will work. Greets, Lydia -------- Original-Nachricht -------- > Datum: Thu, 17 Mar 2011 08:46:50 +0100 > Von: Nathan Weisz > An: Email discussion list for the FieldTrip project > Betreff: Re: [FieldTrip] template brain/standard EEG-Electrodes > hi, > > somewhere on the firledtrip FTP there is a standard_BEM. i got mine from > EEGlab, but it's fieldtrip stuff. it's ~11 MB so i won't send it over the > list :-) > > anyway: this is a headmodel created by segmentation of a MNI-brain. if you > follow the fieldtrip tutorial on DICS this contains the "vol"-structure > you need. > the only - and sometimes not trivial - issue you have is to get your > electrodes aligned / co-registered onto the head surface. you have different > options (i guess you don't have individual MRIs otherwise you wouldn't be > asking), e.g.: > - there are standard electrode positions in MNI space for 10/05 electrode > placements somewhere in fieldtrip. you may find all / most electrodes of > you EEG in this file. that's fast and no headache. > - your EEG vendor may have such a file specific for your cap. we got one > from our EEG supplier (ANT). even better than the option above, because then > you are sure to have all electrodes (especially when the cap deviates from > 10/20 or 10/05 placement). > - digitize the electrode-positions in one subject and co-register it to > the MNI template brain manually. this option is probably a pain since the > head of any individual you choose won't fit exactly the MNI template. so you > will have to play around until the electrodes are as much as possible on the > head surface. [unless: if you can also get an MRI for that subject: then > co-register electrodes with individual MRI; normalize individual MRI to > MNI-template; take the resulting transformation matrix to recalculate your > elec.pos field in MNI coordinates ... that would also be an easy option] > > in any case once your electrode data, headmodel and MRI (latter not > strictly needed for the sourceanalysis, but you will want it for visualization) > are in the same coordinate sytsem, then you can proceed as described in the > tutorial. there is really no difference anymore whether you have individual > or standard stuff, i.e. the sourceanalysis won't care as long as it gets > the structures it wants. > > a word of consolation: if you want to use the standard headmodel / brain, > then you need to solve this issue only one time :-) > > good luck, > n > > > On 17.03.2011, at 08:12, Lydia Elshoff wrote: > > > hello! > > > > We are a research group at the Neuropaediatrics Department in Kiel and > started working with EEG Analysis in fieldtrip. We now face several > questions: Could you please tell us how to or send us a matlab code for the using > template brain and the standard EEG-Electrodes in DICS analysis in > fieldtrip? Or perhaps show an example??? > > Thank you very much!!! > > > > Lydia Elshoff > > -- > > NEU: FreePhone - kostenlos mobil telefonieren und surfen! > > Jetzt informieren: http://www.gmx.net/de/go/freephone > > _______________________________________________ > > fieldtrip mailing list > > fieldtrip at donders.ru.nl > > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl From politzerahless at gmail.com Fri Mar 18 04:39:16 2011 From: politzerahless at gmail.com (Stephen Politzer-Ahles) Date: Thu, 17 Mar 2011 22:39:16 -0500 Subject: [FieldTrip] Importing epoched data into FieldTrip Message-ID: Hello everyone, I am a new FieldTrip user and am hoping to import already-epoched CTF data for some analysis. I was able to import and preprocess the raw data, but actually I have already epoched and artifact-rejected the data elsewhere and was hoping I could avoid redoing this step. Is there any way to import the data that was already epoched and artifact-rejected, such that it's in the format FieldTrip needs or functions like ft_timelockanalysis? Any suggestions or examples would be greatly appreciated. (Apologies for the novice question; I looked around on the website and mailing list archives but wasn't able to find any examples of this.) Thank you, Steve Politzer-Ahles -- Stephen Politzer-Ahles University of Kansas Linguistics Department http://www.linguistics.ku.edu/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From eelke.spaak at donders.ru.nl Fri Mar 18 13:08:25 2011 From: eelke.spaak at donders.ru.nl (Eelke Spaak) Date: Fri, 18 Mar 2011 13:08:25 +0100 Subject: [FieldTrip] Performing statistics based on phase/amplitude correlation Message-ID: Dear FieldTrip community, At the moment, I am analysing some data to see whether a correlation exists between phase and amplitude over different frequencies, and in different channels. Computing the signals of interest (i.e., the phase and amplitude time series) works fine, and computing the correlation is also easily done with Matlab's corrcoef function. Now comes the tricky part. I would like to use the FT statistics framework to assess the significance of the found correlation, and use clustering in frequency-frequency space to correct for multiple comparisons. I understand that this requires a statfun_correlationPearson (or something like it), and I do not think I'll encounter any problems implementing this. Before I start doing so, however, I am not sure how to pass the design and the data to the higher-level statistics functions, such as ft_freqstatistics. My data structure is custom-imported, and contains a single 100s-long trial, on which the phase/amplitude analysis should be conducted: data = hdr: [1x1 struct] fsample: 1000 trial: {[24x100000 double]} time: {[1x100000 double]} label: {24x1 cell} cfg: [1x1 struct] The phase and amplitude time series are generated by convolution with Morlet wavelets using ft_freqanalysis: % perform wavelet convolution for amplitude data cfg = []; cfg.channel = chansAmpl; cfg.method = 'wavelet'; cfg.output = 'fourier'; cfg.keeptrials = 'yes'; cfg.width = 7; cfg.gwidth = 4; cfg.foi = freqAmpl; cfg.toi = data.time{1}; % compute estimate for each sample tfr = ft_freqanalysis(cfg, data); % perform wavelet convolution for phase data cfg.channel = chansPh; cfg.foi = freqPh; tfrPh = ft_freqanalysis(cfg, data); where chansAmpl = {'CH10'}, chansPh = {'CH17'}, freqAmpl = 3:5:98, freqPh = 2:2:30. Simply computing the correlation of interest is done in the following manner: % extract freqs X samples matrices to compute correlations on phSig = real(squeeze(tfrPh.fourierspctrm(1,match_str(tfrPh.label, chansPh(k)), :, :))); amplSig = abs(squeeze(tfr.fourierspctrm(1,match_str(tfr.label, chansAmpl(l)), :, :))); % compute correlations r = corr(phSig', amplSig', 'rows', 'pairwise'); % use only non-NaN rows The correlation matrix r I get out of this nicely corresponds to the results I found by using algorithms implemented elsewhere: so far so good. My (unsuccessful) attempts to use the statistics framework have been variations on the following: % add amplitude spectrum to the TFR (which now only has fourierspctrm) tfr.amplspctrm = abs(tfr.fourierspctrm); cfg = []; cfg.method = 'montecarlo'; cfg.statistic = 'corr'; % I have made a (now empty) statfun_corr cfg.parameter = 'amplspctrm'; cfg.numrandomization = 100; cfg.design = real(tfrPh.fourierspctrm); stat = ft_freqstatistics(cfg, tfr); For your information, the tfr and cfg fields look like this before the call to ft_freqstatistics: cfg = method: 'montecarlo' statistic: 'corr' parameter: 'amplspctrm' numrandomization: 100 design: [4-D double] tfr = label: {'CH10'} dimord: 'rpttap_chan_freq_time' freq: [3 8 13 18 23 28 33 38 43 48 53 58 63 68 73 78 83 88 93 98] time: [1x100000 double] fourierspctrm: [4-D double] cumtapcnt: [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] cfg: [1x1 struct] amplspctrm: [4-D double] The statfun_corr gets a dat variable, that appears to be a column vector constructed by concatenating all the samples in the amplitude spectrum. How should my function treat this? I am aware that specifying a 4D design matrix is a bit odd, but it does contain my 15 regressors X 100000 samples (X 2 singleton dimensions that correspond to the 1 trial and 1 channel that I analysed). If I squeeze() the matrix before calling ft_freqstatistics, I get an error 'the size of the design matrix does not match the number of observations in the data'. I realize my question is a bit vague, but I am somewhat lost as to how to proceed. In short, what I want is this: (1) compute a correlation (across samples) for each phase time series with each amplitude time series (each time series corresponds to a single frequency); (2) shuffle the phase time series around, computing correlations on the shuffled data to assess significance of the observed correlation; (3) prune away correlations that are isolated in frequency-frequency space, retain only large clusters of correlations. All the documentation about the cluster-based statistics is focused on comparing variables that differ across trials and/or subjects, and my 'problem' might be that I only have a single trial. Chopping up the data into 100000 trials, each 1 sample long, is maybe a possibility? But it seems a bit artificial. (It would actually probably not be very difficult to implement my desired functionality 'by hand', but I guess it should be possble within FT's statistics framework. That would have quite some advantages.) Many thanks in advance for any input you can offer. Best, Eelke From eelke.spaak at donders.ru.nl Fri Mar 18 13:25:52 2011 From: eelke.spaak at donders.ru.nl (Eelke Spaak) Date: Fri, 18 Mar 2011 13:25:52 +0100 Subject: [FieldTrip] Performing statistics based on phase/amplitude correlation In-Reply-To: References: Message-ID: Hmm, actually my own suggestion of switching around the time and trial dimensions seems to be very promising (and makes intuitive sense I guess, having thought about it some more). Best, Eelke 2011/3/18 Eelke Spaak : > Dear FieldTrip community, > > At the moment, I am analysing some data to see whether a correlation > exists between phase and amplitude over different frequencies, and in > different channels. Computing the signals of interest (i.e., the phase > and amplitude time series) works fine, and computing the correlation > is also easily done with Matlab's corrcoef function. Now comes the > tricky part. I would like to use the FT statistics framework to assess > the significance of the found correlation, and use clustering in > frequency-frequency space to correct for multiple comparisons. I > understand that this requires a statfun_correlationPearson (or > something like it), and I do not think I'll encounter any problems > implementing this. Before I start doing so, however, I am not sure how > to pass the design and the data to the higher-level statistics > functions, such as ft_freqstatistics. > > My data structure is custom-imported, and contains a single 100s-long > trial, on which the phase/amplitude analysis should be conducted: > > data = >        hdr: [1x1 struct] >    fsample: 1000 >      trial: {[24x100000 double]} >       time: {[1x100000 double]} >      label: {24x1 cell} >        cfg: [1x1 struct] > > The phase and amplitude time series are generated by convolution with > Morlet wavelets using ft_freqanalysis: > >    % perform wavelet convolution for amplitude data >    cfg = []; >    cfg.channel = chansAmpl; >    cfg.method = 'wavelet'; >    cfg.output = 'fourier'; >    cfg.keeptrials = 'yes'; >    cfg.width = 7; >    cfg.gwidth = 4; >    cfg.foi = freqAmpl; >    cfg.toi = data.time{1}; % compute estimate for each sample >    tfr = ft_freqanalysis(cfg, data); > >    % perform wavelet convolution for phase data >    cfg.channel = chansPh; >    cfg.foi = freqPh; >    tfrPh = ft_freqanalysis(cfg, data); > > where chansAmpl = {'CH10'}, chansPh = {'CH17'}, freqAmpl = 3:5:98, > freqPh = 2:2:30. Simply computing the correlation of interest is done > in the following manner: > >    % extract freqs X samples matrices to compute correlations on >    phSig = real(squeeze(tfrPh.fourierspctrm(1,match_str(tfrPh.label, > chansPh(k)), :, :))); >    amplSig = abs(squeeze(tfr.fourierspctrm(1,match_str(tfr.label, > chansAmpl(l)), :, :))); > >    % compute correlations >    r = corr(phSig', amplSig', 'rows', 'pairwise'); % use only non-NaN rows > > The correlation matrix r I get out of this nicely corresponds to the > results I found by using algorithms implemented elsewhere: so far so > good. My (unsuccessful) attempts to use the statistics framework have > been variations on the following: > >    % add amplitude spectrum to the TFR (which now only has fourierspctrm) >    tfr.amplspctrm = abs(tfr.fourierspctrm); > >    cfg = []; >    cfg.method = 'montecarlo'; >    cfg.statistic = 'corr'; % I have made a (now empty) statfun_corr >    cfg.parameter = 'amplspctrm'; >    cfg.numrandomization = 100; >    cfg.design = real(tfrPh.fourierspctrm); >    stat = ft_freqstatistics(cfg, tfr); > > For your information, the tfr and cfg fields look like this before the > call to ft_freqstatistics: > > cfg = >              method: 'montecarlo' >           statistic: 'corr' >           parameter: 'amplspctrm' >    numrandomization: 100 >              design: [4-D double] > > tfr = >            label: {'CH10'} >           dimord: 'rpttap_chan_freq_time' >             freq: [3 8 13 18 23 28 33 38 43 48 53 58 63 68 73 78 83 88 93 98] >             time: [1x100000 double] >    fourierspctrm: [4-D double] >        cumtapcnt: [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] >              cfg: [1x1 struct] >       amplspctrm: [4-D double] > > The statfun_corr gets a dat variable, that appears to be a column > vector constructed by concatenating all the samples in the amplitude > spectrum. How should my function treat this? I am aware that > specifying a 4D design matrix is a bit odd, but it does contain my 15 > regressors X 100000 samples (X 2 singleton dimensions that correspond > to the 1 trial and 1 channel that I analysed). If I squeeze() the > matrix before calling ft_freqstatistics, I get an error 'the size of > the design matrix does not match the number of observations in the > data'. > > I realize my question is a bit vague, but I am somewhat lost as to how > to proceed. In short, what I want is this: (1) compute a correlation > (across samples) for each phase time series with each amplitude time > series (each time series corresponds to a single frequency); (2) > shuffle the phase time series around, computing correlations on the > shuffled data to assess significance of the observed correlation; (3) > prune away correlations that are isolated in frequency-frequency > space, retain only large clusters of correlations. > > All the documentation about the cluster-based statistics is focused on > comparing variables that differ across trials and/or subjects, and my > 'problem' might be that I only have a single trial. Chopping up the > data into 100000 trials, each 1 sample long, is maybe a possibility? > But it seems a bit artificial. > > (It would actually probably not be very difficult to implement my > desired functionality 'by hand', but I guess it should be possble > within FT's statistics framework. That would have quite some > advantages.) > > Many thanks in advance for any input you can offer. > > Best, > > Eelke > From Don.Rojas at ucdenver.edu Fri Mar 18 16:07:33 2011 From: Don.Rojas at ucdenver.edu (Rojas, Don) Date: Fri, 18 Mar 2011 09:07:33 -0600 Subject: [FieldTrip] Dipole time course In-Reply-To: <7220dc8e55401.4d80f2a9@mail.uh.edu> References: <7220dc8e55401.4d80f2a9@mail.uh.edu> Message-ID: <221977A8-BDED-44F5-9C42-5FC486C9BB82@ucdenver.edu> Mehmet, I'm sure there are many ways to do this, but one way would be to use the template MRI data from SPM8, co-registering your MEG data with it, and then using the fieldtrip functions to do the ECD analysis, either within SPM or directly in fieldtrip. We've done this many times (and with the same MEG system). I'm happy to provide a few code snippets to you if you are interested in this approach. Best, Don Rojas On Mar 16, 2011, at 4:26 PM, Mehmet-Akif Coskun wrote: Dear FieldTrippers; I recently start using fieldtrip and so please tolerate if these issues are straightforward. i need to fit dipoles to M50 and M100 component of my ERPs and get the dipole time course (and also i will need the leadfields because i want to project leadfields of one source to another ERP). I don't have any MR data. All i have is the raw data, config and hsfiles ( I am using a 248 4D MEG system). I have been told that without any MR, i can still do this in fieldtrip. I tried using ft_dipolefitting and but since i don't have any volume conduction model, it doesnt work. So i wonder if there are any predefined models. If not, are there any functions to use to create a model from what i have? Any help will be greatly appreciated and thanks all for your interest Mehmet _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From dgroppe at cogsci.ucsd.edu Fri Mar 18 16:54:41 2011 From: dgroppe at cogsci.ucsd.edu (David Groppe) Date: Fri, 18 Mar 2011 11:54:41 -0400 Subject: [FieldTrip] Summary of changes to Fieldtrip? Message-ID: Hi all, I just discovered that at some point in the past few weeks, Fieldtrip's cluster-based permutation test code was changed so that now the p-values in stats{#}.negclusters or stats{#}.posclusters are adjusted to reflect the tail of the test (before the p-values in those fields were always for one tailed tests and inaccurate for two-tailed tests). This came as a surprise and would have messed up some of my analysis scripts if I hadn't noticed. When I download a new version of Fieldtrip is there a good way to see what's changed since the last version I downloaded, so that I can avoid such surprises in the future? much thanks, -David -- David Groppe, Ph.D. Postdoctoral Researcher Kutaslab Dept. of Cognitive Science University of California, San Diego http://www.cogsci.ucsd.edu/~dgroppe/ From e.maris at donders.ru.nl Fri Mar 18 22:09:22 2011 From: e.maris at donders.ru.nl (Eric Maris) Date: Fri, 18 Mar 2011 22:09:22 +0100 Subject: [FieldTrip] Summary of changes to Fieldtrip? In-Reply-To: References: Message-ID: <003b01cbe5b0$c1526b40$43f741c0$@maris@donders.ru.nl> Dear David, We are currently working on a consistent way of calculating one- and two-sided p-values that is valid for all types of statistical tests that can be performed in Fieldtrip (cluster-based and non-cluster-based permutation tests, univariate tests, ...). Soon, you can expect a posting from us on the FT discussion list in which we will inform the users about how FT calculates the different types of p-values. Best, Eric Maris > -----Original Message----- > From: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip- > bounces at donders.ru.nl] On Behalf Of David Groppe > Sent: vrijdag 18 maart 2011 16:55 > To: Email discussion list for the FieldTrip project > Subject: [FieldTrip] Summary of changes to Fieldtrip? > > Hi all, > I just discovered that at some point in the past few weeks, > Fieldtrip's cluster-based permutation test code was changed so that > now the p-values in stats{#}.negclusters or stats{#}.posclusters are > adjusted to reflect the tail of the test (before the p-values in those > fields were always for one tailed tests and inaccurate for two-tailed > tests). This came as a surprise and would have messed up some of my > analysis scripts if I hadn't noticed. When I download a new version > of Fieldtrip is there a good way to see what's changed since the last > version I downloaded, so that I can avoid such surprises in the > future? > much thanks, > -David > > -- > David Groppe, Ph.D. > Postdoctoral Researcher > Kutaslab > Dept. of Cognitive Science > University of California, San Diego > http://www.cogsci.ucsd.edu/~dgroppe/ > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From karl.doron at gmail.com Sat Mar 19 03:40:38 2011 From: karl.doron at gmail.com (Karl Doron) Date: Fri, 18 Mar 2011 19:40:38 -0700 Subject: [FieldTrip] Performing statistics based on phase/amplitude correlation In-Reply-To: References: Message-ID: Eelke, I haven't used cfg.output = 'fourier'; but if it returns complex numbers, your lines of code below won't give phase information. Matlab's real( ) function gives the real part of the complex pair --I believe it would be the signal filtered by the wavelet transform ( the a part of a + b*i ). *The angle( ) function will give phase angles. Maybe someone who thinks in polar coordinates (not my specialty) can comment? Once you get phase angles, you'll need a circular-linear correlation (phase is circular; amplitude is linear). Check out the CircStat toolbox for Matlab. * * % extract freqs X samples matrices to compute correlations on > phSig = real(squeeze(tfrPh.fourierspctrm(1,match_str(tfrPh.label, > chansPh(k)), :, :))); -karl doron On Fri, Mar 18, 2011 at 5:25 AM, Eelke Spaak wrote: > Hmm, actually my own suggestion of switching around the time and trial > dimensions seems to be very promising (and makes intuitive sense I > guess, having thought about it some more). > > Best, > Eelke > > 2011/3/18 Eelke Spaak : > > Dear FieldTrip community, > > > > At the moment, I am analysing some data to see whether a correlation > > exists between phase and amplitude over different frequencies, and in > > different channels. Computing the signals of interest (i.e., the phase > > and amplitude time series) works fine, and computing the correlation > > is also easily done with Matlab's corrcoef function. Now comes the > > tricky part. I would like to use the FT statistics framework to assess > > the significance of the found correlation, and use clustering in > > frequency-frequency space to correct for multiple comparisons. I > > understand that this requires a statfun_correlationPearson (or > > something like it), and I do not think I'll encounter any problems > > implementing this. Before I start doing so, however, I am not sure how > > to pass the design and the data to the higher-level statistics > > functions, such as ft_freqstatistics. > > > > My data structure is custom-imported, and contains a single 100s-long > > trial, on which the phase/amplitude analysis should be conducted: > > > > data = > > hdr: [1x1 struct] > > fsample: 1000 > > trial: {[24x100000 double]} > > time: {[1x100000 double]} > > label: {24x1 cell} > > cfg: [1x1 struct] > > > > The phase and amplitude time series are generated by convolution with > > Morlet wavelets using ft_freqanalysis: > > > > % perform wavelet convolution for amplitude data > > cfg = []; > > cfg.channel = chansAmpl; > > cfg.method = 'wavelet'; > > cfg.output = 'fourier'; > > cfg.keeptrials = 'yes'; > > cfg.width = 7; > > cfg.gwidth = 4; > > cfg.foi = freqAmpl; > > cfg.toi = data.time{1}; % compute estimate for each sample > > tfr = ft_freqanalysis(cfg, data); > > > > % perform wavelet convolution for phase data > > cfg.channel = chansPh; > > cfg.foi = freqPh; > > tfrPh = ft_freqanalysis(cfg, data); > > > > where chansAmpl = {'CH10'}, chansPh = {'CH17'}, freqAmpl = 3:5:98, > > freqPh = 2:2:30. Simply computing the correlation of interest is done > > in the following manner: > > > > % extract freqs X samples matrices to compute correlations on > > phSig = real(squeeze(tfrPh.fourierspctrm(1,match_str(tfrPh.label, > > chansPh(k)), :, :))); > > amplSig = abs(squeeze(tfr.fourierspctrm(1,match_str(tfr.label, > > chansAmpl(l)), :, :))); > > > > % compute correlations > > r = corr(phSig', amplSig', 'rows', 'pairwise'); % use only non-NaN > rows > > > > The correlation matrix r I get out of this nicely corresponds to the > > results I found by using algorithms implemented elsewhere: so far so > > good. My (unsuccessful) attempts to use the statistics framework have > > been variations on the following: > > > > % add amplitude spectrum to the TFR (which now only has fourierspctrm) > > tfr.amplspctrm = abs(tfr.fourierspctrm); > > > > cfg = []; > > cfg.method = 'montecarlo'; > > cfg.statistic = 'corr'; % I have made a (now empty) statfun_corr > > cfg.parameter = 'amplspctrm'; > > cfg.numrandomization = 100; > > cfg.design = real(tfrPh.fourierspctrm); > > stat = ft_freqstatistics(cfg, tfr); > > > > For your information, the tfr and cfg fields look like this before the > > call to ft_freqstatistics: > > > > cfg = > > method: 'montecarlo' > > statistic: 'corr' > > parameter: 'amplspctrm' > > numrandomization: 100 > > design: [4-D double] > > > > tfr = > > label: {'CH10'} > > dimord: 'rpttap_chan_freq_time' > > freq: [3 8 13 18 23 28 33 38 43 48 53 58 63 68 73 78 83 88 93 > 98] > > time: [1x100000 double] > > fourierspctrm: [4-D double] > > cumtapcnt: [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] > > cfg: [1x1 struct] > > amplspctrm: [4-D double] > > > > The statfun_corr gets a dat variable, that appears to be a column > > vector constructed by concatenating all the samples in the amplitude > > spectrum. How should my function treat this? I am aware that > > specifying a 4D design matrix is a bit odd, but it does contain my 15 > > regressors X 100000 samples (X 2 singleton dimensions that correspond > > to the 1 trial and 1 channel that I analysed). If I squeeze() the > > matrix before calling ft_freqstatistics, I get an error 'the size of > > the design matrix does not match the number of observations in the > > data'. > > > > I realize my question is a bit vague, but I am somewhat lost as to how > > to proceed. In short, what I want is this: (1) compute a correlation > > (across samples) for each phase time series with each amplitude time > > series (each time series corresponds to a single frequency); (2) > > shuffle the phase time series around, computing correlations on the > > shuffled data to assess significance of the observed correlation; (3) > > prune away correlations that are isolated in frequency-frequency > > space, retain only large clusters of correlations. > > > > All the documentation about the cluster-based statistics is focused on > > comparing variables that differ across trials and/or subjects, and my > > 'problem' might be that I only have a single trial. Chopping up the > > data into 100000 trials, each 1 sample long, is maybe a possibility? > > But it seems a bit artificial. > > > > (It would actually probably not be very difficult to implement my > > desired functionality 'by hand', but I guess it should be possble > > within FT's statistics framework. That would have quite some > > advantages.) > > > > Many thanks in advance for any input you can offer. > > > > Best, > > > > Eelke > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.vandermeij at donders.ru.nl Sat Mar 19 05:59:50 2011 From: r.vandermeij at donders.ru.nl (Roemer van der Meij) Date: Fri, 18 Mar 2011 21:59:50 -0700 Subject: [FieldTrip] Performing statistics based on phase/amplitude correlation In-Reply-To: References: Message-ID: <4D843846.5060909@donders.ru.nl> Hi Eelke, This is how I would approach the problem: 1) compute the inner-product of the phase and amplitude vector per frequency pair, per trial /(element-wise product and sum)/ - resulting in a single complex number per frequency pair, per trial 2) divide this by the product of the norms of both vectors: this will make sure the magnitude is normalized and goes from 0 to 1 2b) average over trials /(you could also do this before step 2)/ 3) shuffle the trials of the amplitude and the trials of phase vector, and compute the above for each 'randomly paired trail' /(phase of one trial, amp of another)/ 4) do this, say a 100 times or so, collecting the magnitudes of the complex numbers. This way, you will have 100 numbers per frequency pair, comprising a surrogate distribution of coupling 5) pick the highest number per frequency pair of the surrogate distribution, the 100th percentile, or estimate a normal distribution to pick a higher percentile 6) use this number per frequency pair to threshold your averaged-over-trials coupling, anything above threshold could be considered non-random coupling/(do keep an eye for evoked effects if your original trials are short, as these could be quite similar for the random coupled trials)/ This is the way Eric and I approach PAC. If I was in Nijmegen I could explain our approach in more detail, but I'm doing a series of lab-visits in the US (Seattle atm :)) If this doesn't work in your case, I would fake ft_freqstatistics in thinking your correlation data was freqdata, after doing a Fisher Z-transform on them. Hope it helps! Roemer On 18-Mar-11 05:25, Eelke Spaak wrote: > Hmm, actually my own suggestion of switching around the time and trial > dimensions seems to be very promising (and makes intuitive sense I > guess, having thought about it some more). > > Best, > Eelke > > 2011/3/18 Eelke Spaak: >> Dear FieldTrip community, >> >> At the moment, I am analysing some data to see whether a correlation >> exists between phase and amplitude over different frequencies, and in >> different channels. Computing the signals of interest (i.e., the phase >> and amplitude time series) works fine, and computing the correlation >> is also easily done with Matlab's corrcoef function. Now comes the >> tricky part. I would like to use the FT statistics framework to assess >> the significance of the found correlation, and use clustering in >> frequency-frequency space to correct for multiple comparisons. I >> understand that this requires a statfun_correlationPearson (or >> something like it), and I do not think I'll encounter any problems >> implementing this. Before I start doing so, however, I am not sure how >> to pass the design and the data to the higher-level statistics >> functions, such as ft_freqstatistics. >> >> My data structure is custom-imported, and contains a single 100s-long >> trial, on which the phase/amplitude analysis should be conducted: >> >> data = >> hdr: [1x1 struct] >> fsample: 1000 >> trial: {[24x100000 double]} >> time: {[1x100000 double]} >> label: {24x1 cell} >> cfg: [1x1 struct] >> >> The phase and amplitude time series are generated by convolution with >> Morlet wavelets using ft_freqanalysis: >> >> % perform wavelet convolution for amplitude data >> cfg = []; >> cfg.channel = chansAmpl; >> cfg.method = 'wavelet'; >> cfg.output = 'fourier'; >> cfg.keeptrials = 'yes'; >> cfg.width = 7; >> cfg.gwidth = 4; >> cfg.foi = freqAmpl; >> cfg.toi = data.time{1}; % compute estimate for each sample >> tfr = ft_freqanalysis(cfg, data); >> >> % perform wavelet convolution for phase data >> cfg.channel = chansPh; >> cfg.foi = freqPh; >> tfrPh = ft_freqanalysis(cfg, data); >> >> where chansAmpl = {'CH10'}, chansPh = {'CH17'}, freqAmpl = 3:5:98, >> freqPh = 2:2:30. Simply computing the correlation of interest is done >> in the following manner: >> >> % extract freqs X samples matrices to compute correlations on >> phSig = real(squeeze(tfrPh.fourierspctrm(1,match_str(tfrPh.label, >> chansPh(k)), :, :))); >> amplSig = abs(squeeze(tfr.fourierspctrm(1,match_str(tfr.label, >> chansAmpl(l)), :, :))); >> >> % compute correlations >> r = corr(phSig', amplSig', 'rows', 'pairwise'); % use only non-NaN rows >> >> The correlation matrix r I get out of this nicely corresponds to the >> results I found by using algorithms implemented elsewhere: so far so >> good. My (unsuccessful) attempts to use the statistics framework have >> been variations on the following: >> >> % add amplitude spectrum to the TFR (which now only has fourierspctrm) >> tfr.amplspctrm = abs(tfr.fourierspctrm); >> >> cfg = []; >> cfg.method = 'montecarlo'; >> cfg.statistic = 'corr'; % I have made a (now empty) statfun_corr >> cfg.parameter = 'amplspctrm'; >> cfg.numrandomization = 100; >> cfg.design = real(tfrPh.fourierspctrm); >> stat = ft_freqstatistics(cfg, tfr); >> >> For your information, the tfr and cfg fields look like this before the >> call to ft_freqstatistics: >> >> cfg = >> method: 'montecarlo' >> statistic: 'corr' >> parameter: 'amplspctrm' >> numrandomization: 100 >> design: [4-D double] >> >> tfr = >> label: {'CH10'} >> dimord: 'rpttap_chan_freq_time' >> freq: [3 8 13 18 23 28 33 38 43 48 53 58 63 68 73 78 83 88 93 98] >> time: [1x100000 double] >> fourierspctrm: [4-D double] >> cumtapcnt: [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] >> cfg: [1x1 struct] >> amplspctrm: [4-D double] >> >> The statfun_corr gets a dat variable, that appears to be a column >> vector constructed by concatenating all the samples in the amplitude >> spectrum. How should my function treat this? I am aware that >> specifying a 4D design matrix is a bit odd, but it does contain my 15 >> regressors X 100000 samples (X 2 singleton dimensions that correspond >> to the 1 trial and 1 channel that I analysed). If I squeeze() the >> matrix before calling ft_freqstatistics, I get an error 'the size of >> the design matrix does not match the number of observations in the >> data'. >> >> I realize my question is a bit vague, but I am somewhat lost as to how >> to proceed. In short, what I want is this: (1) compute a correlation >> (across samples) for each phase time series with each amplitude time >> series (each time series corresponds to a single frequency); (2) >> shuffle the phase time series around, computing correlations on the >> shuffled data to assess significance of the observed correlation; (3) >> prune away correlations that are isolated in frequency-frequency >> space, retain only large clusters of correlations. >> >> All the documentation about the cluster-based statistics is focused on >> comparing variables that differ across trials and/or subjects, and my >> 'problem' might be that I only have a single trial. Chopping up the >> data into 100000 trials, each 1 sample long, is maybe a possibility? >> But it seems a bit artificial. >> >> (It would actually probably not be very difficult to implement my >> desired functionality 'by hand', but I guess it should be possble >> within FT's statistics framework. That would have quite some >> advantages.) >> >> Many thanks in advance for any input you can offer. >> >> Best, >> >> Eelke >> > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -- Roemer van der Meij M.Sc. PhD student Donders Institute for Brain, Cognition and Behaviour Centre for Cognition Radboud University Nijmegen P.O. Box 9104 6500 HE Nijmegen The Netherlands Tel: +31(0)24 3655932 E-mail: r.vandermeij at donders.ru.nl -------------- next part -------------- An HTML attachment was scrubbed... URL: From eelke.spaak at donders.ru.nl Sat Mar 19 09:07:52 2011 From: eelke.spaak at donders.ru.nl (Eelke Spaak) Date: Sat, 19 Mar 2011 09:07:52 +0100 Subject: [FieldTrip] Performing statistics based on phase/amplitude correlation In-Reply-To: <4D843846.5060909@donders.ru.nl> References: <4D843846.5060909@donders.ru.nl> Message-ID: Hi Karl and Roemer, Thanks for your replies. @Karl: I know that real() does not give me the phase information exclusively; sorry, I wasn't clear enough on this. As a first approach to analysing PAC, I was looking into a measure known in the literature as envelope-to-signal correlation, which is just the linear correlation between the amplitude envelope of a high-frequency signal and a single-frequency filtered low-frequency signal. Taking this as a first approach allows me to easily compare my algorithms with stuff that's implemented elsewhere. But you're right, using only the phase information by angle() would probably be more appropriate; this is something I'll look into in the future. @Roemer: thanks for your detailed recipe! I will see where this gets me, and I know where to find you if it turns out I could use some more detailed help. Also, enjoy Seattle and the rest of the US! :) Best, Eelke 2011/3/19 Roemer van der Meij : > Hi Eelke, > > This is how I would approach the problem: > 1) compute the inner-product of the phase and amplitude vector per frequency > pair, per trial (element-wise product and sum) > - resulting in a single complex number per frequency pair, per trial > 2) divide this by the product of the norms of both vectors: this will make > sure the magnitude is normalized and goes from 0 to 1 > 2b) average over trials (you could also do this before step 2) > 3) shuffle the trials of the amplitude and the trials of phase vector, and > compute the above for each 'randomly paired trail' (phase of one trial, amp > of another) > 4) do this, say a 100 times or so, collecting the magnitudes of the complex > numbers. This way, you will have 100 numbers per frequency pair, comprising > a surrogate distribution of coupling > 5) pick the highest number per frequency pair of the surrogate distribution, > the 100th percentile, or estimate a normal distribution to pick a higher > percentile > 6) use this number per frequency pair to threshold your averaged-over-trials > coupling, anything above threshold could be considered non-random coupling > (do keep an eye for evoked effects if your original trials are short, as > these could be quite similar for the random coupled trials) > > This is the way Eric and I approach PAC. If I was in Nijmegen I could > explain our approach in more detail, but I'm doing a series of lab-visits in > the US (Seattle atm :)) > > If this doesn't work in your case, I would fake ft_freqstatistics in > thinking your correlation data was freqdata, after doing a Fisher > Z-transform on them. > > Hope it helps! > > Roemer > > > On 18-Mar-11 05:25, Eelke Spaak wrote: > > Hmm, actually my own suggestion of switching around the time and trial > dimensions seems to be very promising (and makes intuitive sense I > guess, having thought about it some more). > > Best, > Eelke > > 2011/3/18 Eelke Spaak : > > Dear FieldTrip community, > > At the moment, I am analysing some data to see whether a correlation > exists between phase and amplitude over different frequencies, and in > different channels. Computing the signals of interest (i.e., the phase > and amplitude time series) works fine, and computing the correlation > is also easily done with Matlab's corrcoef function. Now comes the > tricky part. I would like to use the FT statistics framework to assess > the significance of the found correlation, and use clustering in > frequency-frequency space to correct for multiple comparisons. I > understand that this requires a statfun_correlationPearson (or > something like it), and I do not think I'll encounter any problems > implementing this. Before I start doing so, however, I am not sure how > to pass the design and the data to the higher-level statistics > functions, such as ft_freqstatistics. > > My data structure is custom-imported, and contains a single 100s-long > trial, on which the phase/amplitude analysis should be conducted: > > data = >        hdr: [1x1 struct] >    fsample: 1000 >      trial: {[24x100000 double]} >       time: {[1x100000 double]} >      label: {24x1 cell} >        cfg: [1x1 struct] > > The phase and amplitude time series are generated by convolution with > Morlet wavelets using ft_freqanalysis: > >    % perform wavelet convolution for amplitude data >    cfg = []; >    cfg.channel = chansAmpl; >    cfg.method = 'wavelet'; >    cfg.output = 'fourier'; >    cfg.keeptrials = 'yes'; >    cfg.width = 7; >    cfg.gwidth = 4; >    cfg.foi = freqAmpl; >    cfg.toi = data.time{1}; % compute estimate for each sample >    tfr = ft_freqanalysis(cfg, data); > >    % perform wavelet convolution for phase data >    cfg.channel = chansPh; >    cfg.foi = freqPh; >    tfrPh = ft_freqanalysis(cfg, data); > > where chansAmpl = {'CH10'}, chansPh = {'CH17'}, freqAmpl = 3:5:98, > freqPh = 2:2:30. Simply computing the correlation of interest is done > in the following manner: > >    % extract freqs X samples matrices to compute correlations on >    phSig = real(squeeze(tfrPh.fourierspctrm(1,match_str(tfrPh.label, > chansPh(k)), :, :))); >    amplSig = abs(squeeze(tfr.fourierspctrm(1,match_str(tfr.label, > chansAmpl(l)), :, :))); > >    % compute correlations >    r = corr(phSig', amplSig', 'rows', 'pairwise'); % use only non-NaN rows > > The correlation matrix r I get out of this nicely corresponds to the > results I found by using algorithms implemented elsewhere: so far so > good. My (unsuccessful) attempts to use the statistics framework have > been variations on the following: > >    % add amplitude spectrum to the TFR (which now only has fourierspctrm) >    tfr.amplspctrm = abs(tfr.fourierspctrm); > >    cfg = []; >    cfg.method = 'montecarlo'; >    cfg.statistic = 'corr'; % I have made a (now empty) statfun_corr >    cfg.parameter = 'amplspctrm'; >    cfg.numrandomization = 100; >    cfg.design = real(tfrPh.fourierspctrm); >    stat = ft_freqstatistics(cfg, tfr); > > For your information, the tfr and cfg fields look like this before the > call to ft_freqstatistics: > > cfg = >              method: 'montecarlo' >           statistic: 'corr' >           parameter: 'amplspctrm' >    numrandomization: 100 >              design: [4-D double] > > tfr = >            label: {'CH10'} >           dimord: 'rpttap_chan_freq_time' >             freq: [3 8 13 18 23 28 33 38 43 48 53 58 63 68 73 78 83 88 93 > 98] >             time: [1x100000 double] >    fourierspctrm: [4-D double] >        cumtapcnt: [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] >              cfg: [1x1 struct] >       amplspctrm: [4-D double] > > The statfun_corr gets a dat variable, that appears to be a column > vector constructed by concatenating all the samples in the amplitude > spectrum. How should my function treat this? I am aware that > specifying a 4D design matrix is a bit odd, but it does contain my 15 > regressors X 100000 samples (X 2 singleton dimensions that correspond > to the 1 trial and 1 channel that I analysed). If I squeeze() the > matrix before calling ft_freqstatistics, I get an error 'the size of > the design matrix does not match the number of observations in the > data'. > > I realize my question is a bit vague, but I am somewhat lost as to how > to proceed. In short, what I want is this: (1) compute a correlation > (across samples) for each phase time series with each amplitude time > series (each time series corresponds to a single frequency); (2) > shuffle the phase time series around, computing correlations on the > shuffled data to assess significance of the observed correlation; (3) > prune away correlations that are isolated in frequency-frequency > space, retain only large clusters of correlations. > > All the documentation about the cluster-based statistics is focused on > comparing variables that differ across trials and/or subjects, and my > 'problem' might be that I only have a single trial. Chopping up the > data into 100000 trials, each 1 sample long, is maybe a possibility? > But it seems a bit artificial. > > (It would actually probably not be very difficult to implement my > desired functionality 'by hand', but I guess it should be possble > within FT's statistics framework. That would have quite some > advantages.) > > Many thanks in advance for any input you can offer. > > Best, > > Eelke > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > -- > Roemer van der Meij M.Sc. > PhD student > Donders Institute for Brain, Cognition and Behaviour > Centre for Cognition > Radboud University Nijmegen > P.O. Box 9104 > 6500 HE Nijmegen > The Netherlands > Tel: +31(0)24 3655932 > E-mail: r.vandermeij at donders.ru.nl > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > From g.piantoni at nin.knaw.nl Sat Mar 19 15:04:37 2011 From: g.piantoni at nin.knaw.nl (Gio Piantoni) Date: Sat, 19 Mar 2011 15:04:37 +0100 Subject: [FieldTrip] Summary of changes to Fieldtrip? In-Reply-To: References: Message-ID: Hi David, The best way I found to keep track of the updates is to use the fieldtrip page on google code: http://code.google.com/p/fieldtrip/updates/list Take some time to explore it. Google code keeps all the updates and functions well organized. You can even subscribe to the RSS with all the updates (updated every night). Hope this helps, Gio On Fri, Mar 18, 2011 at 16:54, David Groppe wrote: > Hi all, >   I just discovered that at some point in the past few weeks, > Fieldtrip's cluster-based permutation test code was changed so that > now the p-values in stats{#}.negclusters or stats{#}.posclusters are > adjusted to reflect the tail of the test (before the p-values in those > fields were always for one tailed tests and inaccurate for two-tailed > tests).  This came as a surprise and would have messed up some of my > analysis scripts if I hadn't noticed.  When I download a new version > of Fieldtrip is there a good way to see what's changed since the last > version I downloaded, so that I can avoid such surprises in the > future? >     much thanks, >         -David > > -- > David Groppe, Ph.D. > Postdoctoral Researcher > Kutaslab > Dept. of Cognitive Science > University of California, San Diego > http://www.cogsci.ucsd.edu/~dgroppe/ > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > From ivano_triggiani at yahoo.it Sun Mar 20 13:24:09 2011 From: ivano_triggiani at yahoo.it (Ivano Triggiani) Date: Sun, 20 Mar 2011 12:24:09 +0000 (GMT) Subject: [FieldTrip] Trigger channel for edf Message-ID: <666077.74945.qm@web28614.mail.ukl.yahoo.com> Hi, just wanna tell you that changing MATLAB version now everything works!!! Actually I'm using a 2010 version (own by a friend of mine) and everything seems to work. However it coul be useful for other users to know that reading edf files, fieldtrip uses a particular field of the edf header called "number of data records" ( http://www.edfplus.info/specs/edf.html ) and another called " duration of data records" that not correspond (at least for my files...) at real number of events occurred. So in my trigger function I have to ignore those informations (or change header of my file!) Thanks to all. Ivano ------------------------------------------------------------------------ "No man can wear one face to himself and another to the multitude, without finally getting bewildered as to which one is true." Nathaniel Hawthorne -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at donders.ru.nl Sun Mar 20 14:36:19 2011 From: r.oostenveld at donders.ru.nl (Robert Oostenveld) Date: Sun, 20 Mar 2011 14:36:19 +0100 Subject: [FieldTrip] Summary of changes to Fieldtrip? In-Reply-To: References: Message-ID: <0A52995B-CC0F-4C08-A937-EC418277050C@donders.ru.nl> Hi David, Sorry to hear that the change caused confusion, but good that you noticed. I am aware that, with the daily updates and recent changes, that we (i.e. the whole fieldtrip team inside and outside Nijmegen) that can make changes to the code and commit them to the SVN version control system, are not always clearly communicating the relevant changes to the users. Important changes are usually discussed in our weekly fieldtrip meeting, and that is where we decide whether we shoudl send out an email to the list to explicitely make users aware of a particular change. This one slipped through. This particular change refers to http://code.google.com/p/fieldtrip/source/detail?r=2663 I think that internally (i.e. with the fieldtrip team) we should work on improving the communication about changes to the code to the users. We already use http://twitter.com/#!/fieldtriptoolbx, http://code.google.com/p/fieldtrip/source/list and at the bottom of the fieldtrip home page the changes are also shortly listed. But those short log messages often don't allow the users to distinguish whether it is a trivial or important change. The importance of the change should also be made clear and should reach the user. Perhaps we would compile changelists as text files and include them in the distribution, and/or post a weekly mail to the email list with the changes. The challenge for us is that it should not be too much work, otherwise it won't work out in the long run. Suggestions and ideas are welcome... best regards, Robert PS Eric and I are preparing a piece of documentation (probably a FAQ) in which we'll clarify some of the issues on the unclear cfg options, intrepretation of the montecarlo test results and the two-tailed testing. There are some conceptual issues that are confusing and we will try to clarify those soon. On 18 Mar 2011, at 16:54, David Groppe wrote: > Hi all, > I just discovered that at some point in the past few weeks, > Fieldtrip's cluster-based permutation test code was changed so that > now the p-values in stats{#}.negclusters or stats{#}.posclusters are > adjusted to reflect the tail of the test (before the p-values in those > fields were always for one tailed tests and inaccurate for two-tailed > tests). This came as a surprise and would have messed up some of my > analysis scripts if I hadn't noticed. When I download a new version > of Fieldtrip is there a good way to see what's changed since the last > version I downloaded, so that I can avoid such surprises in the > future? > much thanks, > -David > > -- > David Groppe, Ph.D. > Postdoctoral Researcher > Kutaslab > Dept. of Cognitive Science > University of California, San Diego > http://www.cogsci.ucsd.edu/~dgroppe/ > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From r.oostenveld at donders.ru.nl Sun Mar 20 14:41:41 2011 From: r.oostenveld at donders.ru.nl (Robert Oostenveld) Date: Sun, 20 Mar 2011 14:41:41 +0100 Subject: [FieldTrip] Trigger channel for edf In-Reply-To: <666077.74945.qm@web28614.mail.ukl.yahoo.com> References: <666077.74945.qm@web28614.mail.ukl.yahoo.com> Message-ID: <72AA1D0E-8CD5-47EA-8FE8-443502175BAA@donders.ru.nl> Hi Ivano Good that it works. The EDF format is written in blocks. Depending on the software that wrote the EDF file, those blocks might represent experimental trials or might represent subsequent segments from a continuous data stream (which usually contains triggers to indicate the timing of stimuli and responses). FieldTrip by default represents each EDF datablock as a trial, and that is reflected in the events (from ft_read_event). With the option cfg.continuous=yes you can tell fieldtrip that it is a continuous recording and that it should not care about the blocks. And you can indeed safely ignore the events of type 'trial' in the event structure. best Robert On 20 Mar 2011, at 13:24, Ivano Triggiani wrote: > Hi, > > just wanna tell you that changing MATLAB version now everything works!!! Actually I'm using a 2010 version (own by a friend of mine) and everything seems to work. > However it coul be useful for other users to know that reading edf files, fieldtrip uses a particular field of the edf header called "number of data records" ( http://www.edfplus.info/specs/edf.html ) and another called " duration of data records" that not correspond (at least for my files...) at real number of events occurred. So in my trigger function I have to ignore those informations (or change header of my file!) > Thanks to all. > Ivano > > > ------------------------------------------------------------------------ > > "No man can wear one face to himself > and another to the multitude, > without finally getting bewildered > as to which one is true." > > Nathaniel Hawthorne > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From dgroppe at cogsci.ucsd.edu Mon Mar 21 02:37:55 2011 From: dgroppe at cogsci.ucsd.edu (David Groppe) Date: Sun, 20 Mar 2011 21:37:55 -0400 Subject: [FieldTrip] Summary of changes to Fieldtrip? In-Reply-To: <0A52995B-CC0F-4C08-A937-EC418277050C@donders.ru.nl> References: <0A52995B-CC0F-4C08-A937-EC418277050C@donders.ru.nl> Message-ID: Thank you Eric, Gio, and Robert for your responses and suggestions. I will look at code.google.com and the twitter feed to see if this would help our lab keep our code consistent with Fieldtrip's. We'll also try to develop a set of analysis scripts to run every time we update fieldtrip to make sure our results aren't changing in any way they're not supposed to. That's probably the best way to make sure there aren't any serious inconsistencies. much appreciated, -David On Sun, Mar 20, 2011 at 9:36 AM, Robert Oostenveld wrote: > Hi David, > > Sorry to hear that the change caused confusion, but good that you noticed. > > I am aware that, with the daily updates and recent changes, that we (i.e. the whole fieldtrip team inside and outside Nijmegen) that can make changes to the code and commit them to the SVN version control system, are not always clearly communicating the relevant changes to the users. Important changes are usually discussed in our weekly fieldtrip meeting, and that is where we decide whether we shoudl send out an email to the list to explicitely make users aware of a particular change. This one slipped through. > > This particular change refers to http://code.google.com/p/fieldtrip/source/detail?r=2663 > > I think that internally (i.e. with the fieldtrip team) we should work on improving the communication about changes to the code to the users. We already use http://twitter.com/#!/fieldtriptoolbx, http://code.google.com/p/fieldtrip/source/list and at the bottom of the fieldtrip home page the changes are also shortly listed. But those short log messages often don't allow the users to distinguish whether it is a trivial or important change. The importance of the  change should also be made clear and should reach the user. Perhaps we would compile changelists as text files and include them in the distribution, and/or post a weekly mail to the email list with the changes. The challenge for us is that it should not be too much work, otherwise it won't work out in the long run. > > Suggestions and ideas are welcome... > > best regards, > Robert > > PS Eric and I are preparing a piece of documentation (probably a FAQ) in which we'll clarify some of the issues on the unclear cfg options, intrepretation of the montecarlo test results and the two-tailed testing. There are some conceptual issues that are confusing and we will try to clarify those soon. > > > On 18 Mar 2011, at 16:54, David Groppe wrote: > >> Hi all, >>   I just discovered that at some point in the past few weeks, >> Fieldtrip's cluster-based permutation test code was changed so that >> now the p-values in stats{#}.negclusters or stats{#}.posclusters are >> adjusted to reflect the tail of the test (before the p-values in those >> fields were always for one tailed tests and inaccurate for two-tailed >> tests).  This came as a surprise and would have messed up some of my >> analysis scripts if I hadn't noticed.  When I download a new version >> of Fieldtrip is there a good way to see what's changed since the last >> version I downloaded, so that I can avoid such surprises in the >> future? >>     much thanks, >>         -David >> >> -- >> David Groppe, Ph.D. >> Postdoctoral Researcher >> Kutaslab >> Dept. of Cognitive Science >> University of California, San Diego >> http://www.cogsci.ucsd.edu/~dgroppe/ >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -- David Groppe, Ph.D. Postdoctoral Researcher Kutaslab Dept. of Cognitive Science University of California, San Diego http://www.cogsci.ucsd.edu/~dgroppe/ From jean-michel.badier at univmed.fr Mon Mar 21 21:58:13 2011 From: jean-michel.badier at univmed.fr (Jean-Michel Badier) Date: Mon, 21 Mar 2011 21:58:13 +0100 Subject: [FieldTrip] Different way of calculating the covariance for LCM Message-ID: <4D87BBE5.2000806@univmed.fr> Dear fieldtrip users, There are different ways of estimating the covariance for LCMV calculation. If I am correct: 1. As suggested in one of the tutorial one can apply the calculation of the covariance directly on the average data (for the different periods of interest that are at least a base line and the period of interest). 2. Estimate the covariance from the average of the covariance rather than the covariance of the average using cfg.keeptrials = "yes" 3. Estimate the covariance from the whole trials concatenated together. Is there an easy way to do that in fieldtrip (beside create a new data set of one trial constituted of all the trials)? Thanks Jean-Michel -- Jean-Michel Badier PhD Laboratoire de MagnétoEncéphaloGraphie INSERM U751. Aix Marseille Université 33 (0)4 91 38 55 62 _jean-michel.badier at univmed.fr_ Service de Neurophysiologie Clinique. CHU Timone 264 Rue Saint-Pierre, 13005 Marseille-France -------------- next part -------------- An HTML attachment was scrubbed... URL: From yuvharpaz at gmail.com Tue Mar 22 05:47:38 2011 From: yuvharpaz at gmail.com (Yuval Harpaz) Date: Tue, 22 Mar 2011 06:47:38 +0200 Subject: [FieldTrip] Different way of calculating the covariance for LCM In-Reply-To: <4D87BBE5.2000806@univmed.fr> References: <4D87BBE5.2000806@univmed.fr> Message-ID: Dear Jean Michel As far as I know you can do it on an averaged data structure (item 1) or do the same with the data structure before averaging (3). I did not understand what you meant by 2. Yuval On 21 March 2011 22:58, Jean-Michel Badier wrote: > Dear fieldtrip users, > > There are different ways of estimating the covariance for LCMV calculation. > If I am correct: > > 1. As suggested in one of the tutorial one can apply the calculation of the > covariance directly on the average data (for the different periods of > interest that are at least a base line and the period of interest). > > 2. Estimate the covariance from the average of the covariance rather than > the covariance of the average using cfg.keeptrials = "yes" > > 3. Estimate the covariance from the whole trials concatenated together. > Is there an easy way to do that in fieldtrip (beside create a new data set > of one trial constituted of all the trials)? > > Thanks > > Jean-Michel > > -- Jean-Michel Badier PhD > Laboratoire de MagnétoEncéphaloGraphie INSERM U751. Aix > Marseille Université 33 (0)4 91 38 55 62 *jean-michel.badier at univmed.fr* > Service de Neurophysiologie Clinique. CHU Timone 264 Rue > Saint-Pierre, 13005 Marseille-France > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -- Y.Harpaz a link to the BIU MEG lab: http://faculty.biu.ac.il/~goldsa/index.html " Why, Dan," ask the people in Artificial Intelligence, "do you waste your time conferring with those neuroscientists? They wave their hands about information processing and worry about where it happens, and which neurotransmitters are involved, and all those boring facts, but they haven't a clue about the computational requirements of higher cognitive functions." "Why," ask the neuroscientists, "do you waste your time on the fantasies of Artificial Intelligence? They just invent whatever machinery they want, and say unpardonably ignorant things about the brain." The cognitive psychologists, meanwhile, are accused of concocting models with neither biological plausibility nor proven computational powers; the anthropologists wouldn't know a model if they saw one, and the philosophers, as we all know, just take in each other's laundry, warning about confusions they themselves have created, in an arena bereft of both data and empirically testable theories. With so many idiots working on the problem, no wonder consciousness is still a mystery.* Philosopher Daniel Dennet, consciousness explained, pp. 225* -------------- next part -------------- An HTML attachment was scrubbed... URL: From jean-michel.badier at univmed.fr Tue Mar 22 09:43:56 2011 From: jean-michel.badier at univmed.fr (Jean-Michel Badier) Date: Tue, 22 Mar 2011 09:43:56 +0100 Subject: [FieldTrip] Different way of calculating the covariance for LCM In-Reply-To: References: <4D87BBE5.2000806@univmed.fr> Message-ID: <4D88614C.8070200@univmed.fr> Dear Yuval, I have to admit that I did not look at the matlab routines. In item 2 I suppose that the covariance is calculated for each trial then averaged. In item 3 I would like to calculate the covariance from all the signal (the trials being concatenated). Jean-Michel Le 22/03/11 05:47, Yuval Harpaz a écrit : > Dear Jean Michel > As far as I know you can do it on an averaged data structure (item 1) > or do the same with the data structure before averaging (3). I did not > understand what you meant by 2. > > Yuval > > On 21 March 2011 22:58, Jean-Michel Badier > > > wrote: > > Dear fieldtrip users, > > There are different ways of estimating the covariance for LCMV > calculation. > If I am correct: > > 1. As suggested in one of the tutorial one can apply the > calculation of the covariance directly on the average data (for > the different periods of interest that are at least a base line > and the period of interest). > > 2. Estimate the covariance from the average of the covariance > rather than the covariance of the average using cfg.keeptrials = "yes" > > 3. Estimate the covariance from the whole trials concatenated > together. > Is there an easy way to do that in fieldtrip (beside create a new > data set of one trial constituted of all the trials)? > > Thanks > > Jean-Michel > > -- > > Jean-Michel Badier PhD > > > Laboratoire de MagnétoEncéphaloGraphie > > INSERM U751. Aix Marseille Université > > 33 (0)4 91 38 55 62 > > _jean-michel.badier at univmed.fr_ > > > Service de Neurophysiologie Clinique. CHU Timone > > 264 Rue Saint-Pierre, 13005 Marseille-France > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > > -- > Y.Harpaz > > a link to the BIU MEG lab: > http://faculty.biu.ac.il/~goldsa/index.html > > > " Why, Dan," ask the people in Artificial Intelligence, "do you waste > your time conferring with those neuroscientists? They wave their hands > about information processing and worry about where it happens, and > which neurotransmitters are involved, and all those boring facts, but > they haven't a clue about the computational requirements of higher > cognitive functions." "Why," ask the neuroscientists, "do you waste > your time on the fantasies of Artificial Intelligence? They just > invent whatever machinery they want, and say unpardonably ignorant > things about the brain." The cognitive psychologists, meanwhile, are > accused of concocting models with neither biological plausibility nor > proven computational powers; the anthropologists wouldn't know a model > if they saw one, and the philosophers, as we all know, just take in > each other's laundry, warning about confusions they themselves have > created, in an arena bereft of both data and empirically testable > theories. With so many idiots working on the problem, no wonder > consciousness is still a mystery./Philosopher Daniel Dennet, > consciousness explained, pp. 225/ > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From yuvharpaz at gmail.com Tue Mar 22 10:55:07 2011 From: yuvharpaz at gmail.com (Yuval Harpaz) Date: Tue, 22 Mar 2011 11:55:07 +0200 Subject: [FieldTrip] Different way of calculating the covariance for LCM In-Reply-To: <4D88614C.8070200@univmed.fr> References: <4D87BBE5.2000806@univmed.fr> <4D88614C.8070200@univmed.fr> Message-ID: So just run the commands on an unaveraged dataset. Another option to consider is the one used by Dr. Robinson when performing SAMerf (we have his tool here , works for our 4D machine). The idea is to calculate the covariance on all trials, calculate weights by this covariance (keep filter in LCMV) and then apply these weights on the averaged data. I found it useful because the covariance is better for longer datasets, and the averaging in the end increases the signal to noise ratio. I do not know exactly how to do it in fieldtrip. On 22 March 2011 10:43, Jean-Michel Badier wrote: > Dear Yuval, > > I have to admit that I did not look at the matlab routines. > In item 2 I suppose that the covariance is calculated for each trial then > averaged. In item 3 I would like to calculate the covariance from all the > signal (the trials being concatenated). > > Jean-Michel > > Le 22/03/11 05:47, Yuval Harpaz a écrit : > > Dear Jean Michel > As far as I know you can do it on an averaged data structure (item 1) or do > the same with the data structure before averaging (3). I did not understand > what you meant by 2. > > Yuval > > On 21 March 2011 22:58, Jean-Michel Badier wrote: > >> Dear fieldtrip users, >> >> There are different ways of estimating the covariance for LCMV >> calculation. >> If I am correct: >> >> 1. As suggested in one of the tutorial one can apply the calculation of >> the covariance directly on the average data (for the different periods of >> interest that are at least a base line and the period of interest). >> >> 2. Estimate the covariance from the average of the covariance rather than >> the covariance of the average using cfg.keeptrials = "yes" >> >> 3. Estimate the covariance from the whole trials concatenated together. >> Is there an easy way to do that in fieldtrip (beside create a new data set >> of one trial constituted of all the trials)? >> >> Thanks >> >> Jean-Michel >> >> -- Jean-Michel Badier PhD >> Laboratoire de MagnétoEncéphaloGraphie INSERM U751. Aix >> Marseille Université 33 (0)4 91 38 55 62 *jean-michel.badier at univmed.fr* >> Service de Neurophysiologie Clinique. CHU Timone 264 Rue >> Saint-Pierre, 13005 Marseille-France >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> > > > > -- > Y.Harpaz > > a link to the BIU MEG lab: > http://faculty.biu.ac.il/~goldsa/index.html > > " Why, Dan," ask the people in Artificial Intelligence, "do you waste > your time conferring with those neuroscientists? They wave their hands about > information processing and worry about where it happens, and > which neurotransmitters are involved, and all those boring facts, but > they haven't a clue about the computational requirements of higher > cognitive functions." "Why," ask the neuroscientists, "do you waste your > time on the fantasies of Artificial Intelligence? They just invent > whatever machinery they want, and say unpardonably ignorant things about the > brain." The cognitive psychologists, meanwhile, are accused of concocting > models with neither biological plausibility nor proven computational powers; > the anthropologists wouldn't know a model if they saw one, and the > philosophers, as we all know, just take in each other's laundry, warning > about confusions they themselves have created, in an arena bereft of both > data and empirically testable theories. With so many idiots working on the > problem, no wonder consciousness is still a mystery.* Philosopher Daniel > Dennet, consciousness explained, pp. 225* > > > _______________________________________________ > fieldtrip mailing listfieldtrip at donders.ru.nlhttp://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -- Y.Harpaz a link to the BIU MEG lab: http://faculty.biu.ac.il/~goldsa/index.html " Why, Dan," ask the people in Artificial Intelligence, "do you waste your time conferring with those neuroscientists? They wave their hands about information processing and worry about where it happens, and which neurotransmitters are involved, and all those boring facts, but they haven't a clue about the computational requirements of higher cognitive functions." "Why," ask the neuroscientists, "do you waste your time on the fantasies of Artificial Intelligence? They just invent whatever machinery they want, and say unpardonably ignorant things about the brain." The cognitive psychologists, meanwhile, are accused of concocting models with neither biological plausibility nor proven computational powers; the anthropologists wouldn't know a model if they saw one, and the philosophers, as we all know, just take in each other's laundry, warning about confusions they themselves have created, in an arena bereft of both data and empirically testable theories. With so many idiots working on the problem, no wonder consciousness is still a mystery.* Philosopher Daniel Dennet, consciousness explained, pp. 225* -------------- next part -------------- An HTML attachment was scrubbed... URL: From l.frei at psy.gla.ac.uk Tue Mar 22 12:37:08 2011 From: l.frei at psy.gla.ac.uk (Luisa Frei) Date: Tue, 22 Mar 2011 11:37:08 +0000 Subject: [FieldTrip] Different way of calculating the covariance for LCM In-Reply-To: <4D87BBE5.2000806@univmed.fr> References: <4D87BBE5.2000806@univmed.fr> Message-ID: I have used method 3 with fieldtrip. But I don't think there is an easy way, you'll have to create the concatenated dataset yourself and tweak some of the fields in your data structure. In my case it was better to use this method because I am only interested in a very short time window, if your time window is long enough, it's probably better to use the average method (check van Veen et al., 1997, if you haven't already done so). On 21 Mar 2011, at 20:58, Jean-Michel Badier wrote: > Dear fieldtrip users, > > There are different ways of estimating the covariance for LCMV > calculation. > If I am correct: > > 1. As suggested in one of the tutorial one can apply the > calculation of the covariance directly on the average data (for the > different periods of interest that are at least a base line and the > period of interest). > > 2. Estimate the covariance from the average of the covariance > rather than the covariance of the average using cfg.keeptrials = "yes" > > 3. Estimate the covariance from the whole trials concatenated > together. > Is there an easy way to do that in fieldtrip (beside create a new > data set of one trial constituted of all the trials)? > > Thanks > > Jean-Michel > > -- > Jean-Michel Badier PhD > > Laboratoire de MagnétoEncéphaloGraphie > INSERM U751. Aix Marseille Université > 33 (0)4 91 38 55 62 > jean-michel.badier at univmed.fr > > Service de Neurophysiologie Clinique. CHU Timone > 264 Rue Saint-Pierre, 13005 Marseille-France > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From jean-michel.badier at univmed.fr Wed Mar 23 09:42:53 2011 From: jean-michel.badier at univmed.fr (Jean-Michel Badier) Date: Wed, 23 Mar 2011 09:42:53 +0100 Subject: [FieldTrip] Different way of calculating the covariance for LCM In-Reply-To: References: <4D87BBE5.2000806@univmed.fr> <4D88614C.8070200@univmed.fr> Message-ID: <4D89B28D.8050107@univmed.fr> Thanks Yuval, Le 22/03/11 10:55, Yuval Harpaz a écrit : > So just run the commands on an unaveraged dataset. > Yes but that would be correct if there was only one trial in the data set (see the message from Luisa). > Another option to consider is the one used by Dr. Robinson when > performing SAMerf (we have his tool here > , works for our 4D machine). Thanks for it I will test it. > The idea is to calculate the covariance on all trials, calculate > weights by this covariance (keep filter in LCMV) and then apply these > weights on the averaged data. I found it useful because the covariance > is better for longer datasets, and the averaging in the end increases > the signal to noise ratio. I do not know exactly how to do it in > fieldtrip. > > On 22 March 2011 10:43, Jean-Michel Badier > > > wrote: > > Dear Yuval, > > I have to admit that I did not look at the matlab routines. > In item 2 I suppose that the covariance is calculated for each > trial then averaged. In item 3 I would like to calculate the > covariance from all the signal (the trials being concatenated). > > Jean-Michel > > Le 22/03/11 05:47, Yuval Harpaz a écrit : >> Dear Jean Michel >> As far as I know you can do it on an averaged data structure >> (item 1) or do the same with the data structure before averaging >> (3). I did not understand what you meant by 2. >> >> Yuval >> >> On 21 March 2011 22:58, Jean-Michel Badier >> > > wrote: >> >> Dear fieldtrip users, >> >> There are different ways of estimating the covariance for >> LCMV calculation. >> If I am correct: >> >> 1. As suggested in one of the tutorial one can apply the >> calculation of the covariance directly on the average data >> (for the different periods of interest that are at least a >> base line and the period of interest). >> >> 2. Estimate the covariance from the average of the covariance >> rather than the covariance of the average using >> cfg.keeptrials = "yes" >> >> 3. Estimate the covariance from the whole trials concatenated >> together. >> Is there an easy way to do that in fieldtrip (beside create a >> new data set of one trial constituted of all the trials)? >> >> Thanks >> >> Jean-Michel >> >> -- >> >> Jean-Michel Badier PhD >> >> >> Laboratoire de MagnétoEncéphaloGraphie >> >> INSERM U751. Aix Marseille Université >> >> 33 (0)4 91 38 55 62 >> >> _jean-michel.badier at univmed.fr_ >> >> >> >> Service de Neurophysiologie Clinique. CHU Timone >> >> 264 Rue Saint-Pierre, 13005 Marseille-France >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> >> -- >> Y.Harpaz >> >> a link to the BIU MEG lab: >> http://faculty.biu.ac.il/~goldsa/index.html >> >> >> " Why, Dan," ask the people in Artificial Intelligence, "do you >> waste your time conferring with those neuroscientists? They wave >> their hands about information processing and worry about where >> it happens, and which neurotransmitters are involved, and all >> those boring facts, but they haven't a clue about the >> computational requirements of higher cognitive functions." >> "Why," ask the neuroscientists, "do you waste your time on the >> fantasies of Artificial Intelligence? They just invent >> whatever machinery they want, and say unpardonably ignorant >> things about the brain." The cognitive psychologists, meanwhile, >> are accused of concocting models with neither biological >> plausibility nor proven computational powers; the anthropologists >> wouldn't know a model if they saw one, and the philosophers, as >> we all know, just take in each other's laundry, warning about >> confusions they themselves have created, in an arena bereft of >> both data and empirically testable theories. With so many idiots >> working on the problem, no wonder consciousness is still a >> mystery./Philosopher Daniel Dennet, consciousness explained, pp. 225/ >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > > -- > Y.Harpaz > > a link to the BIU MEG lab: > http://faculty.biu.ac.il/~goldsa/index.html > > > " Why, Dan," ask the people in Artificial Intelligence, "do you waste > your time conferring with those neuroscientists? They wave their hands > about information processing and worry about where it happens, and > which neurotransmitters are involved, and all those boring facts, but > they haven't a clue about the computational requirements of higher > cognitive functions." "Why," ask the neuroscientists, "do you waste > your time on the fantasies of Artificial Intelligence? They just > invent whatever machinery they want, and say unpardonably ignorant > things about the brain." The cognitive psychologists, meanwhile, are > accused of concocting models with neither biological plausibility nor > proven computational powers; the anthropologists wouldn't know a model > if they saw one, and the philosophers, as we all know, just take in > each other's laundry, warning about confusions they themselves have > created, in an arena bereft of both data and empirically testable > theories. With so many idiots working on the problem, no wonder > consciousness is still a mystery./Philosopher Daniel Dennet, > consciousness explained, pp. 225/ > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Jean-Michel Badier Laboratoire de MagnétoEncéphaloGraphie INSERM U751. Aix Marseille Université 33 (0)4 91 38 55 62 _jean-michel.badier at univmed.fr_ Service de Neurophysiologie Clinique. CHU Timone 264 Rue Saint-Pierre, 13005 Marseille-France -------------- next part -------------- An HTML attachment was scrubbed... URL: From jean-michel.badier at univmed.fr Wed Mar 23 09:49:58 2011 From: jean-michel.badier at univmed.fr (Jean-Michel Badier) Date: Wed, 23 Mar 2011 09:49:58 +0100 Subject: [FieldTrip] Different way of calculating the covariance for LCM In-Reply-To: References: <4D87BBE5.2000806@univmed.fr> Message-ID: <4D89B436.6090006@univmed.fr> Thanks Luisa, Le 22/03/11 12:37, Luisa Frei a écrit : > I have used method 3 with fieldtrip. But I don't think there is an > easy way, you'll have to create the concatenated dataset yourself and > tweak some of the fields in your data structure. I was going to do that waiting that there may be a hidden option in Fieldltrip and wanted to make sure I was using the toolbox correctly. > In my case it was better to use this method because I am only > interested in a very short time window, if your time window is long > enough, it's probably better to use the average method (check van Veen > et al., 1997, if you haven't already done so). > Yes I am in such a situation where I have to pick up pieces of signal of quite short duration. Yes I checked the paper from van Ven et al. and others like Brookes et al 2008 for example. -- Jean-Michel Badier Laboratoire de MagnétoEncéphaloGraphie INSERM U751. Aix Marseille Université 33 (0)4 91 38 55 62 _jean-michel.badier at univmed.fr_ Service de Neurophysiologie Clinique. CHU Timone 264 Rue Saint-Pierre, 13005 Marseille-France -------------- next part -------------- An HTML attachment was scrubbed... URL: From yuvharpaz at gmail.com Wed Mar 23 10:42:11 2011 From: yuvharpaz at gmail.com (Yuval Harpaz) Date: Wed, 23 Mar 2011 11:42:11 +0200 Subject: [FieldTrip] Different way of calculating the covariance for LCM In-Reply-To: <4D89B28D.8050107@univmed.fr> References: <4D87BBE5.2000806@univmed.fr> <4D88614C.8070200@univmed.fr> <4D89B28D.8050107@univmed.fr> Message-ID: I checked it again, I used a data structure 'D1st' which included 90 trials. I ran the following script and the result was a 'pre' structure. field pre.cov was a 90*248*248 matrix, i.e., the covariance was estimated for all the trials. cfg = []; cfg.covariance = 'yes'; cfg.removemean = 'no'; cfg.covariancewindow = [-0.1 0]; cfg.channel='MEG'; cfg.keeptrials = 'yes' ; pre=ft_timelockanalysis(cfg, D1st); you may find this script repository useful for LCMV analysis. it includes an older version of fieldtrip but this is the one we work with. http://yuval-harpaz.github.com/ft_BIU/ check the actual repository here (read the README) : https://github.com/yuval-harpaz/ft_BIU good luck there, yuval. On 23 March 2011 10:42, Jean-Michel Badier wrote: > Thanks Yuval, > > > Le 22/03/11 10:55, Yuval Harpaz a écrit : > > So just run the commands on an unaveraged dataset. > > Yes but that would be correct if there was only one trial in the data set > (see the message from Luisa). > > > Another option to consider is the one used by Dr. Robinson when > performing SAMerf (we have his tool here, > works for our 4D machine). > > > Thanks for it I will test it. > > The idea is to calculate the covariance on all trials, calculate weights > by this covariance (keep filter in LCMV) and then apply these weights on the > averaged data. I found it useful because the covariance is better for longer > datasets, and the averaging in the end increases the signal to noise ratio. > I do not know exactly how to do it in fieldtrip. > > On 22 March 2011 10:43, Jean-Michel Badier wrote: > >> Dear Yuval, >> >> I have to admit that I did not look at the matlab routines. >> In item 2 I suppose that the covariance is calculated for each trial then >> averaged. In item 3 I would like to calculate the covariance from all the >> signal (the trials being concatenated). >> >> Jean-Michel >> >> Le 22/03/11 05:47, Yuval Harpaz a écrit : >> >> Dear Jean Michel >> As far as I know you can do it on an averaged data structure (item 1) or >> do the same with the data structure before averaging (3). I did not >> understand what you meant by 2. >> >> Yuval >> >> On 21 March 2011 22:58, Jean-Michel Badier > > wrote: >> >>> Dear fieldtrip users, >>> >>> There are different ways of estimating the covariance for LCMV >>> calculation. >>> If I am correct: >>> >>> 1. As suggested in one of the tutorial one can apply the calculation of >>> the covariance directly on the average data (for the different periods of >>> interest that are at least a base line and the period of interest). >>> >>> 2. Estimate the covariance from the average of the covariance rather than >>> the covariance of the average using cfg.keeptrials = "yes" >>> >>> 3. Estimate the covariance from the whole trials concatenated together. >>> Is there an easy way to do that in fieldtrip (beside create a new data >>> set of one trial constituted of all the trials)? >>> >>> Thanks >>> >>> Jean-Michel >>> >>> -- Jean-Michel Badier PhD >>> Laboratoire de MagnétoEncéphaloGraphie INSERM U751. Aix >>> Marseille Université 33 (0)4 91 38 55 62 *jean-michel.badier at univmed.fr >>> * >>> Service de Neurophysiologie Clinique. CHU Timone 264 Rue >>> Saint-Pierre, 13005 Marseille-France >>> >>> >>> >>> _______________________________________________ >>> fieldtrip mailing list >>> fieldtrip at donders.ru.nl >>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >>> >> >> >> >> -- >> Y.Harpaz >> >> a link to the BIU MEG lab: >> http://faculty.biu.ac.il/~goldsa/index.html >> >> " Why, Dan," ask the people in Artificial Intelligence, "do you waste >> your time conferring with those neuroscientists? They wave their hands about >> information processing and worry about where it happens, and >> which neurotransmitters are involved, and all those boring facts, but >> they haven't a clue about the computational requirements of higher >> cognitive functions." "Why," ask the neuroscientists, "do you waste your >> time on the fantasies of Artificial Intelligence? They just invent >> whatever machinery they want, and say unpardonably ignorant things about the >> brain." The cognitive psychologists, meanwhile, are accused of concocting >> models with neither biological plausibility nor proven computational powers; >> the anthropologists wouldn't know a model if they saw one, and the >> philosophers, as we all know, just take in each other's laundry, warning >> about confusions they themselves have created, in an arena bereft of both >> data and empirically testable theories. With so many idiots working on the >> problem, no wonder consciousness is still a mystery.* Philosopher Daniel >> Dennet, consciousness explained, pp. 225* >> >> >> _______________________________________________ >> fieldtrip mailing listfieldtrip at donders.ru.nlhttp://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> > > > > -- > Y.Harpaz > > a link to the BIU MEG lab: > http://faculty.biu.ac.il/~goldsa/index.html > > " Why, Dan," ask the people in Artificial Intelligence, "do you waste > your time conferring with those neuroscientists? They wave their hands about > information processing and worry about where it happens, and > which neurotransmitters are involved, and all those boring facts, but > they haven't a clue about the computational requirements of higher > cognitive functions." "Why," ask the neuroscientists, "do you waste your > time on the fantasies of Artificial Intelligence? They just invent > whatever machinery they want, and say unpardonably ignorant things about the > brain." The cognitive psychologists, meanwhile, are accused of concocting > models with neither biological plausibility nor proven computational powers; > the anthropologists wouldn't know a model if they saw one, and the > philosophers, as we all know, just take in each other's laundry, warning > about confusions they themselves have created, in an arena bereft of both > data and empirically testable theories. With so many idiots working on the > problem, no wonder consciousness is still a mystery.* Philosopher Daniel > Dennet, consciousness explained, pp. 225* > > > _______________________________________________ > fieldtrip mailing listfieldtrip at donders.ru.nlhttp://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > -- > > Jean-Michel Badier > > > Laboratoire de MagnétoEncéphaloGraphie > > INSERM U751. Aix Marseille Université > > 33 (0)4 91 38 55 62 > > *jean-michel.badier at univmed.fr* > > > Service de Neurophysiologie Clinique. CHU Timone > > 264 Rue Saint-Pierre, 13005 Marseille-France > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -- Y.Harpaz a link to the BIU MEG lab: http://faculty.biu.ac.il/~goldsa/index.html " Why, Dan," ask the people in Artificial Intelligence, "do you waste your time conferring with those neuroscientists? They wave their hands about information processing and worry about where it happens, and which neurotransmitters are involved, and all those boring facts, but they haven't a clue about the computational requirements of higher cognitive functions." "Why," ask the neuroscientists, "do you waste your time on the fantasies of Artificial Intelligence? They just invent whatever machinery they want, and say unpardonably ignorant things about the brain." The cognitive psychologists, meanwhile, are accused of concocting models with neither biological plausibility nor proven computational powers; the anthropologists wouldn't know a model if they saw one, and the philosophers, as we all know, just take in each other's laundry, warning about confusions they themselves have created, in an arena bereft of both data and empirically testable theories. With so many idiots working on the problem, no wonder consciousness is still a mystery.* Philosopher Daniel Dennet, consciousness explained, pp. 225* -------------- next part -------------- An HTML attachment was scrubbed... URL: From marco.dahmane at gmail.com Wed Mar 23 17:28:16 2011 From: marco.dahmane at gmail.com (Marco Dahmane) Date: Wed, 23 Mar 2011 17:28:16 +0100 Subject: [FieldTrip] Possible bug in ft_databrowser... Message-ID: ... or possible bug in my brain ? Hello all, Since today I have an error when I call ft_databrowser to visualize my (raw) data. I can't really figure out what has changed in my code since yesterday though. Here's the error : > ??? Error using ==> horzcat > CAT arguments dimensions are not consistent. > > Error in ==> ft_databrowser at 161 >   trlorg = [data.sampleinfo data.offset]; Adding a single quote after data.offset in ft_databrowser however fixes the issue but I am afraid that all hell is going to break loose once I modify FT's code myself. Can you help me find what's wrong? > > ft_checkdata(newdata) > > ans = > trial: {1x140 cell} > time: {1x140 cell} > hdr: [1x1 struct] > label: {42x1 cell} > fsample: 400 > sampleinfo: [140x2 double] > cfg: [1x1 struct] Thanks a lot, Marco From jm.horschig at donders.ru.nl Wed Mar 23 18:06:20 2011 From: jm.horschig at donders.ru.nl (=?ISO-8859-1?Q?=22J=F6rn_M=2E_Horschig=22?=) Date: Wed, 23 Mar 2011 18:06:20 +0100 Subject: [FieldTrip] Possible bug in ft_databrowser... In-Reply-To: References: Message-ID: <4D8A288C.7070109@donders.ru.nl> Dear Marco, As you can see on line 78, the databrowser code hasn't been changed since March 9 (well, actually I just comitted a change which has nothing to do with your error). Can you get back to me personally? Could you then perform this command on your data: data = ft_checkdata(data, 'datatype', {'raw', 'comp'}, 'feedback', 'yes', 'hastrialdef', 'yes', 'hasoffset', 'yes'); and then copy the output of ft_checkdata(newdata) and send me that via mail? The first call should add an offset field to your data-structure of size 140x1. If that does not work, then something goes wrong in ft_checkdata, but I cannot see from the code what possibly might go wrong there (line 559 ff.) If you send the output to me, I might track down what is going wrong. The databrowser works fine for me and I have not heard complaints from others, so I am a bit worried by your problem ;) Best, Jörn On 3/23/2011 5:28 PM, Marco Dahmane wrote: > ... or possible bug in my brain ? > > Hello all, > > Since today I have an error when I call ft_databrowser to visualize my > (raw) data. I can't really figure out what has changed in my code > since yesterday though. > > Here's the error : > >> ??? Error using ==> horzcat >> CAT arguments dimensions are not consistent. >> >> Error in ==> ft_databrowser at 161 >> trlorg = [data.sampleinfo data.offset]; > Adding a single quote after data.offset in ft_databrowser however > fixes the issue but I am afraid that all hell is going to break loose > once I modify FT's code myself. > > Can you help me find what's wrong? > >>> ft_checkdata(newdata) >> ans = >> trial: {1x140 cell} >> time: {1x140 cell} >> hdr: [1x1 struct] >> label: {42x1 cell} >> fsample: 400 >> sampleinfo: [140x2 double] >> cfg: [1x1 struct] > Thanks a lot, > Marco > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Jörn M. Horschig PhD Student Donders Institute for Brain, Cognition and Behaviour Centre for Cognitive Neuroimaging Radboud University Nijmegen P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Contact: E-Mail: jm.horschig at donders.ru.nl Tel: +31-(0)24-36-68493 Web: http://www.ru.nl/donders Visiting address: Trigon, room 2.30 Kapitelweg 29 NL-6525 EN Nijmegen The Netherlands From michael.wibral at web.de Wed Mar 23 20:27:07 2011 From: michael.wibral at web.de (Michael Wibral) Date: Wed, 23 Mar 2011 20:27:07 +0100 (CET) Subject: [FieldTrip] Different way of calculating the covariance for LCM In-Reply-To: <4D89B28D.8050107@univmed.fr> References: <4D87BBE5.2000806@univmed.fr> <4D88614C.8070200@univmed.fr> , <4D89B28D.8050107@univmed.fr> Message-ID: <1295935147.505310.1300908427321.JavaMail.fmail@mwmweb087> Dear Fieldtrip users interested in covariance computation, dear Yuval, I would like to my opinion on covariance computation up for discussion here. Covariance is a (bi-)linear measure (like an inner (scalar) product) and should in principle be commutative mathematically with other linear procedures as long as you respect the distributative law from elementary math. Hence, (1) averaging single trial covariances or computing the covariance of concatenated trials should give the same result if a am not mistaken. In these two approaches samples from your two time course are in the end multiplied with each other one by one. Whichever route of these two you take does not matter at all. This holds as long as you treat baseline correction and filtering (!) exactly the same way in both cases - otherwise you'll additionally get the baseline covariance over trials as a term in the covariance matrix or filtering related differences. This latter point maybe important if you post hoc decide on a band width to confine your beamformer analysis to and do not go back to the raw data for the band pass filtering. (2) In contrast, when you compute covariance from a precomputed trial average then every sample at time t in one trial on channel A will in the course of the calculations be implicitely multiplied with samples at time t at EVERY other trial on channel B. So this covariances focuses on covariance structures that are consistent irrespective of the correct pairings of trials. It's a little bit like first computing the power spectrum and averaging to get total activity (induced+evoked) - this would correspond to procedure (1) , or first averaging and then computing spectral power in order to get the power of evoked activity alone - this would correspond to procedure (2). This said, when you're interested in the sources of all task related oscillatory activity - not only the activity phase locked to a stimulus you should pick option (1). Please let me know If I overlooked something important. Michael --------------------- Von: "Jean-Michel Badier" Gesendet: Mar 23, 2011 9:42:53 AM An: "Email discussion list for the FieldTrip project" Betreff: Re: [FieldTrip] Different way of calculating the covariance for LCM Thanks Yuval, Le 22/03/11 10:55, Yuval Harpaz a écrit : So just run the commands on an unaveraged dataset. Yes but that would be correct if there was only one trial in the data set (see the message from Luisa). Another option to consider is the one used by Dr. Robinson when performing SAMerf (we have his tool [here], works for our 4D machine). Thanks for it I will test it. The idea is to calculate the covariance on all trials, calculate weights by this covariance (keep filter in LCMV) and then apply these weights on the averaged data. I found it useful because the covariance is better for longer datasets, and the averaging in the end increases the signal to noise ratio. I do not know exactly how to do it in fieldtrip. On 22 March 2011 10:43, Jean-Michel Badier <[jean-michel.badier at univmed.fr]> wrote: Dear Yuval, I have to admit that I did not look at the matlab routines. In item 2 I suppose that the covariance is calculated for each trial then averaged. In item 3 I would like to calculate the covariance from all the signal (the trials being concatenated). Jean-Michel Le 22/03/11 05:47, Yuval Harpaz a écrit : Dear Jean Michel As far as I know you can do it on an averaged data structure (item 1) or do the same with the data structure before averaging (3). I did not understand what you meant by 2. Yuval On 21 March 2011 22:58, Jean-Michel Badier <[jean-michel.badier at univmed.fr]> wrote: Dear fieldtrip users, There are different ways of estimating the covariance for LCMV calculation. If I am correct: 1. As suggested in one of the tutorial one can apply the calculation of the covariance directly on the average data (for the different periods of interest that are at least a base line and the period of interest). 2. Estimate the covariance from the average of the covariance rather than the covariance of the average using cfg.keeptrials = "yes" 3. Estimate the covariance from the whole trials concatenated together. Is there an easy way to do that in fieldtrip (beside create a new data set of one trial constituted of all the trials)? Thanks Jean-Michel -- Jean-Michel Badier PhD Laboratoire de MagnétoEncéphaloGraphie INSERM U751. Aix Marseille Université 33 (0)4 91 38 55 62 [jean-michel.badier at univmed.fr] Service de Neurophysiologie Clinique. CHU Timone 264 Rue Saint-Pierre, 13005 Marseille-France _______________________________________________ fieldtrip mailing list [fieldtrip at donders.ru.nl] [http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] -- Y.Harpaz a link to the BIU MEG lab: [http://faculty.biu.ac.il/~goldsa/index.html] " Why, Dan," ask the people in Artificial Intelligence, "do you waste your time conferring with those neuroscientists? They wave their hands about information processing and worry about where it happens, and which neurotransmitters are involved, and all those boring facts, but they haven't a clue about the computational requirements of higher cognitive functions." "Why," ask the neuroscientists, "do you waste your time on the fantasies of Artificial Intelligence? They just invent whatever machinery they want, and say unpardonably ignorant things about the brain." The cognitive psychologists, meanwhile, are accused of concocting models with neither biological plausibility nor proven computational powers; the anthropologists wouldn't know a model if they saw one, and the philosophers, as we all know, just take in each other's laundry, warning about confusions they themselves have created, in an arena bereft of both data and empirically testable theories. With so many idiots working on the problem, no wonder consciousness is still a mystery. Philosopher Daniel Dennet, consciousness explained, pp. 225 _______________________________________________ fieldtrip mailing list [fieldtrip at donders.ru.nl] [http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] _______________________________________________ fieldtrip mailing list [fieldtrip at donders.ru.nl] [http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] -- Y.Harpaz a link to the BIU MEG lab: [http://faculty.biu.ac.il/~goldsa/index.html] " Why, Dan," ask the people in Artificial Intelligence, "do you waste your time conferring with those neuroscientists? They wave their hands about information processing and worry about where it happens, and which neurotransmitters are involved, and all those boring facts, but they haven't a clue about the computational requirements of higher cognitive functions." "Why," ask the neuroscientists, "do you waste your time on the fantasies of Artificial Intelligence? They just invent whatever machinery they want, and say unpardonably ignorant things about the brain." The cognitive psychologists, meanwhile, are accused of concocting models with neither biological plausibility nor proven computational powers; the anthropologists wouldn't know a model if they saw one, and the philosophers, as we all know, just take in each other's laundry, warning about confusions they themselves have created, in an arena bereft of both data and empirically testable theories. With so many idiots working on the problem, no wonder consciousness is still a mystery. Philosopher Daniel Dennet, consciousness explained, pp. 225 _______________________________________________ fieldtrip mailing list [fieldtrip at donders.ru.nl] [http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] -- Jean-Michel Badier Laboratoire de MagnétoEncéphaloGraphie INSERM U751. Aix Marseille Université 33 (0)4 91 38 55 62 [jean-michel.badier at univmed.fr] Service de Neurophysiologie Clinique. CHU Timone 264 Rue Saint-Pierre, 13005 Marseille-France -------------- next part -------------- A non-text attachment was scrubbed... Name: Michael Wibral.vcf Type: text/x-vcard Size: 637 bytes Desc: not available URL: From matt.mollison at gmail.com Wed Mar 23 23:30:58 2011 From: matt.mollison at gmail.com (Matt Mollison) Date: Wed, 23 Mar 2011 16:30:58 -0600 Subject: [FieldTrip] PLV analysis clarification In-Reply-To: <00F172BC-AB16-4BE2-8BCE-1A22A78AB595@donders.ru.nl> References: <00F172BC-AB16-4BE2-8BCE-1A22A78AB595@donders.ru.nl> Message-ID: Dear Jan-Mathijs, Thanks for your reply. I know my post was a large one. I have two further questions that are borne out in more detail below: 1) how would one do connectivity analyses with 'fourier' data (the issue for "next time")? and 2) what's the difference between using 'powandcsd' and 'fourier'? 1. I'm still confused about the last case that you said to keep for next time (cfg.method='mtmconvol', cfg.output='fourier'). How do FT users run ft_freqstatistics on ft_connectivityanalysis data (processed as output='fourier') in a within-subjects experiment if the stats throw an error because of "chan_chan" in dimord? It seems like one must reshape plvspctrm/cohspctrm and modify dimord. However, for me, reshaping plvspctrm produces a dimension that is more than twice as large as it should be. size(data_conn.plvspctrm)=129 129 9 33 (i.e., chan_chan_freq_time) If I then reshape with siz = size(data_conn.plvspctrm); size(reshape(data_conn.plvspctrm,siz(1)*siz(2),siz(3),siz(4))) = 16641 9 33 and (16641-129)/2 = 8256, which are the nchoosek(129,2)=8256 channel combinations that I *should* have. So it seems that ft_connectivityanalysis is producing duplicate channel combinations (i.e., 'E1_E2' and 'E2_E1' when those should be equal) plus auto-correlations ('E1_E1'), and making some imagesc plots of the data confirms this. People here are surely running PLV/coherence analyses (there have been questions about single-subject analyses with statfun_indepsamplesZcoh, which requires fourier input), so there must be a way to use fourier input. The only thing I can figure is to instead use cfg.output='powandcsd' and implement the label-field creation trick you suggested. However, this doesn't seem like it's the only option because statfun_indepsamplesZcoh requires 'fourier'. Nonetheless, I tried using 'powandcsd' with the label trick and I was able to run ft_freqstatistics (finally!! doing both a t-test and a clusteranalysis), but it seems like FT could/should deal with the issue more elegantly instead of needing the trick. Maybe all coh/plv analyses ever done with FT have required this hack and maybe the correct reshape for fourier data still needs to be implemented, both of which are completely fine with me, but in that case I'm curious what hacks other people are using. 2. Despite being successful with powandcsd data, I still can't figure out how to use fourier data. That leads me to ask, what's the functional different between fourier and powandcsd output? Or rather, what can/can't I do with complex Fourier spectra? Will FT perform "better" (faster?) with one or the other? Are they used in different situations (it seems like I should be able to use either for PLV/coherence, especially since statfun_indepsamplesZcoh requires fourier)? If I also want to look at power, can I calculate it from the complex Fourier spectra? Sorry for my lack of knowledge in this department. Thanks again for all the information. Matt On Wed, Mar 16, 2011 at 2:25 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: > Dear Matt, > > As usual, thanks for your detailed report (although one also shouldn't > exaggerate ;o) ). > Reading your mail and attachment, it seems there are several > features/problems in the code that restrict your analysis. > In the following, I pasted your script and will provide some comments > > ================================================================= >> cfg_freq.method = 'wavelet'; >> cfg_freq.output = 'powandcsd'; >> cfg_freq.channelcmb = {'all','all'}; % 129 channels >> >> -------------------------------------- >> ft_freqanalysis >> data_freq = >> label: {129x1 cell} >> dimord: 'chan_freq_time' >> freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 >> 8.8889] >> time: [1x33 double] >> powspctrm: [129x9x33 double] >> labelcmb: {8256x2 cell} >> crsspctrm: [8256x9x33 double] >> cfg: [1x1 struct] >> >> ft_connectivityanalysis with 'plv' >> data_conn = >> labelcmb: {8256x2 cell} >> dimord: 'chan_freq_time' >> plvspctrm: [8256x9x33 double] >> freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 >> 8.8889] >> time: [1x33 double] >> cfg: [1x1 struct] >> >> -------------------------------------- >> FAILURE: can't run ft_freqgrandaverage on data_conn because there is no >> label field >> > > This has indeed been noted by you and posted on bugzilla. We didn't find > time to work on it yet, but as a general remark ft_freqgrandaverage (and > ft_timelockgrandaverage and ft_sourcegrandaverage) were designed to work on > univariate data only, i.e. it fails on data which comes out of > ft_connectivityanalysis. As such there is no other reason for it than a > historical one (the averaging functions were there long before we started > doing serious connectivity stuff). Of course it should be possible to > combine the data into one structure and do statistics later on, although I > guess the clustering in the channel dimension becomes really complicated. > Note, also that I pointed out to you that as such ft_XXXgrandaverage is not > mandatory before calling ft_XXXstatistics, you can also input a cell-array > of data structures. Yet, this will not help you because then you probably > encounter a crash later on. > > SOLUTION for now: rename plvspctrm into powspctrm and create a label-field, > e.g. by for i =1:size(data_conn.labelcmb,1) data_conn.label{k} = > [data_conn.labelcmb{i,1},'_',data_conn.labelcmb{i,2}]; end (and remove the > labelcmb field) > > > >> -------------------------------------- >> FAILURE: can't run ft_singleplotTFR on data_conn >> >> cfg_ft.cohrefchannel = 'E3'; >> cfg_ft.channel = 'E60'; >> selected 1408 channels for plvspctrm >> ??? Error using ==> ft_channelselection at 72 >> data with non-unique channel names is not supported >> >> Error in ==> ft_singleplotTFR at 290 >> selchannel = ft_channelselection(cfg.channel, data.label); >> > > The plotting functions keep haunting me. I thought that with my recent > overhaul I made them somewhat more robust for plotting connectivity data. > It would be helpful if you create a bug out of this specific section, and > add an attachment containing data_conn, and cfg_ft) > > -------------------------------------- >> FAILURE: can't run ft_topoplotTFR on data_conn >> >> creating layout from data.elec >> creating layout for egi128 system >> selected 1408 channels for plvspctrm >> Warning: Duplicate x-y data points detected: using average of the z >> values. >> > In griddata at 108 >> In ft_plot_topo at 146 >> In ft_topoplotER at 747 >> In ft_topoplotTFR at 116 >> ??? Error using ==> griddata at 122 >> Not enough unique sample points specified. >> >> Error in ==> ft_plot_topo at 146 >> [Xi,Yi,Zi] = griddata(chanX', chanY, dat, xi', yi, interpmethod); % >> interpolate the topographic data >> >> Error in ==> ft_topoplotER at 747 >> >> ft_plot_topo(chanX,chanY,datavector,'interpmethod',cfg.interpolation,... >> >> Error in ==> ft_topoplotTFR at 116 >> cfg=ft_topoplotER(cfg, varargin{:}); >> ================================================================= >> ================================================================= >> > > You requested only a single pair to be plotted (1 cohrefchannel and 1 > channel). A topography does not makes sense. FieldTrip does not detect this, > but the low-level interpolation function starts complaining. > > SOLUTION: don't call ft_topoplotTFR if you want to look at 1 TFR only, as > specified by the cfg. In that case it should be possible to specify > cfg.interactive = 'yes', allowing you to toggle back and forth between > topographies and selected sensors. > > > ================================================================= >> cfg_freq.method = 'wavelet'; >> cfg_freq.output = 'fourier' >> >> cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; >> cfg_freq.channel = unique(cfg_freq.channelcmb); >> >> have to set keeptapers to 'no' even though (as far as I know) there are no >> tapers used in wavelets (see ft_freqanalysis line 313) >> >> cfg_freq.keeptrials = 'no'; >> cfg_freq.keeptapers = 'no'; >> >> -------------------------------------- >> ft_freqanalysis >> data_freq = >> label: {4x1 cell} >> dimord: 'chan_freq_time' >> freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 >> 8.8889] >> time: [1x33 double] >> fourierspctrm: [4x9x33 double] >> cfg: [1x1 struct] >> >> -------------------------------------- >> FAILURE: can't run ft_connectivityanalysis on data_freq because there is >> no cumtapcnt field >> >> ??? Reference to non-existent field 'cumtapcnt'. >> >> Error in ==> ft_checkdata>fixcsd at 844 >> sumtapcnt = [0;cumsum(data.cumtapcnt(:))]; >> >> Error in ==> ft_checkdata at 594 >> data = fixcsd(data, cmbrepresentation, channelcmb); >> >> Error in ==> univariate2bivariate at 29 >> data = ft_checkdata(data, 'cmbrepresentation', 'full'); >> >> Error in ==> ft_connectivityanalysis at 234 >> [data, powindx, hasrpt] = univariate2bivariate(data, >> 'fourierspctrm', 'crsspctrm', dtype, 'cmb', cfg.channelcmb); >> ================================================================= >> ================================================================= >> > > Thanks for noticing this. I never considered anybody to use the wavelet > method before calling ft_connectivityanalysis. Why would you want to use it > in the first place if there's mtmconvol ;o) ? > > SOLUTION: Don't use wavelet (and post a bug on bugzilla stating this > specific problem: output to waveletanalysis cannot be processed by > ft_connectivityanalysis). > > ================================================================= >> >> cfg_freq.method = 'mtmconvol'; >> cfg_freq.output = 'powandcsd'; >> cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; >> cfg_freq.channel = unique(cfg_freq.channelcmb); >> >> >> cfg_freq.keeptrials = 'no'; >> cfg_freq.keeptapers = 'no'; >> cfg_freq.taper = 'hanning'; >> >> -------------------------------------- >> ft_freqanalysis >> data_freq = >> label: {4x1 cell} >> dimord: 'chan_freq_time' >> freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 >> 8.8889] >> time: [1x33 double] >> powspctrm: [4x9x33 double] >> labelcmb: {4x2 cell} >> crsspctrm: [4x9x33 double] >> cumtapcnt: [173x9 double] >> cfg: [1x1 struct] >> >> ft_connectivityanalysis with 'plv' >> data_conn = >> labelcmb: {4x2 cell} >> dimord: 'chan_freq_time' >> plvspctrm: [4x9x33 double] >> freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 >> 8.8889] >> time: [1x33 double] >> cfg: [1x1 struct] >> -------------------------------------- >> FAILURE: can't run ft_freqgrandaverage on data_conn because there is no >> label field >> >> > See above. > > -------------------------------------- >> SUCCESS: ft_singleplotTFR successfully makes a plot >> >> > Hurrah > > > -------------------------------------- >> FAILURE: can't run ft_freqstatistics on data_conn because there's no label >> field >> >> ??? Reference to non-existent field 'label'. >> >> Error in ==> prepare_timefreq_data>forcedimord at 509 >> output.label = input.label; >> >> Error in ==> prepare_timefreq_data at 87 >> [remember{c}, hascrsspctrm] = forcedimord(varargin{c}); >> >> Error in ==> statistics_wrapper at 217 >> [cfg, data] = prepare_timefreq_data(cfg, varargin{:}); >> >> Error in ==> ft_freqstatistics at 127 >> [stat, cfg] = statistics_wrapper(cfg, varargin{:}); >> ================================================================= >> ================================================================= >> > > > See above > > ================================================================= >> >> cfg_freq.method = 'mtmconvol'; >> cfg_freq.output = 'fourier'; >> cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; >> cfg_freq.channel = unique(cfg_freq.channelcmb); >> >> >> cfg_freq.keeptrials = 'no'; >> cfg_freq.keeptapers = 'no'; >> cfg_freq.taper = 'hanning'; >> >> -------------------------------------- >> ft_freqanalysis >> data_freq = >> label: {4x1 cell} >> dimord: 'chan_freq_time' >> freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 >> 8.8889] >> time: [1x33 double] >> fourierspctrm: [4x9x33 double] >> cumtapcnt: [173x9 double] >> cfg: [1x1 struct] >> >> -------------------------------------- >> FAILURE: can't run ft_connectivityanalysis on data_freq >> >> ??? Subscripted assignment dimension mismatch. >> >> Error in ==> ft_checkdata>fixcsd at 851 >> crsspctrm(p,:,:,m,k) = (tmpdat*tmpdat')./data.cumtapcnt(p); >> >> Error in ==> ft_checkdata at 594 >> data = fixcsd(data, cmbrepresentation, channelcmb); >> >> Error in ==> univariate2bivariate at 29 >> data = ft_checkdata(data, 'cmbrepresentation', 'full'); >> >> Error in ==> ft_connectivityanalysis at 234 >> [data, powindx, hasrpt] = univariate2bivariate(data, >> 'fourierspctrm', 'crsspctrm', dtype, 'cmb', cfg.channelcmb); >> ================================================================= >> > > This seems to be a bug in ft_freqanalysis. It should be very forbidden to > run ft_freqanalysis with cfg.keeptrials = 'no' and cfg.output = 'fourier'. > Just doesn't make sense. Could you file this as a bug please? > > > ================================================================= >> ================================================================= >> >> cfg_freq.method = 'mtmconvol'; >> cfg_freq.output = 'fourier'; >> cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; >> cfg_freq.channel = unique(cfg_freq.channelcmb); >> >> >> cfg_freq.keeptrials = 'yes'; >> cfg_freq.keeptapers = 'yes'; >> cfg_freq.taper = 'hanning'; >> >> -------------------------------------- >> ft_freqanalysis >> data_freq = >> label: {4x1 cell} >> dimord: 'rpttap_chan_freq_time' >> freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 >> 8.8889] >> time: [1x33 double] >> fourierspctrm: [4-D double] >> cumtapcnt: [173x9 double] >> cfg: [1x1 struct] >> >> ft_connectivityanalysis with 'plv' >> data_conn = >> label: {4x1 cell} >> dimord: 'chan_chan_freq_time' >> plvspctrm: [4-D double] >> freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 8.1481 >> 8.8889] >> time: [1x33 double] >> dof: [173 173 173 173 173 173 173 173 173] >> cfg: [1x1 struct] >> >> -------------------------------------- >> FAILURE: can't run ft_freqgrandaverage on data_conn >> >> ??? Error using ==> ft_freqgrandaverage at 170 >> unsupported dimord >> >> -------------------------------------- >> SUCCESS: ft_singleplotTFR makes a plot >> >> -------------------------------------- >> FAILURE: can't do ft_freqstatistics on data_conn because of chan_chan in >> dimord >> >> ??? Error using ==> size >> Dimension argument must be a positive integer scalar within indexing >> range. >> >> Error in ==> prepare_timefreq_data>forcedimord at 540 >> Nchan = size(output.dat, chandim); >> >> Error in ==> prepare_timefreq_data at 87 >> [remember{c}, hascrsspctrm] = forcedimord(varargin{c}); >> >> Error in ==> statistics_wrapper at 217 >> [cfg, data] = prepare_timefreq_data(cfg, varargin{:}); >> >> Error in ==> ft_freqstatistics at 127 >> [stat, cfg] = statistics_wrapper(cfg, varargin{:}); >> >> Error in ==> mm_ft_ttestTFR at 228 >> cfg_ana.(vs_str) = >> eval(sprintf('ft_freqstatistics(cfg_ft,%s);',subj_str)); >> ================================================================= >> > > Let's keep this one for the next time... > > Best, > > Jan-Mathijs > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yuvharpaz at gmail.com Thu Mar 24 10:41:02 2011 From: yuvharpaz at gmail.com (Yuval Harpaz) Date: Thu, 24 Mar 2011 11:41:02 +0200 Subject: [FieldTrip] Different way of calculating the covariance for LCM In-Reply-To: <1295935147.505310.1300908427321.JavaMail.fmail@mwmweb087> References: <4D87BBE5.2000806@univmed.fr> <4D88614C.8070200@univmed.fr> <4D89B28D.8050107@univmed.fr> <1295935147.505310.1300908427321.JavaMail.fmail@mwmweb087> Message-ID: Dear Michael, Jean-Michel and FieldTrip users. To my experience and understanding it does matter if you first asses the covariance and then average or the other way around. First, as far as my understanding goes, if we have some brain activity such as alpha, which is not phase locked to the event then in the covariance will not 'catch' too much covariability there after averaging, compared to unaveraged data where it should. if the process of calculating covariance and averaging id linear then I must be wrong here. anyway, beamforming on averaged and unaveraged base covariance matrices give different results in fieldtrip. this is because the covariance matrices are not the same with or without averaging. I ran the following test to check it all. I took the same structure as in the example above, and I tested the covariance matrix after 1. running it with cfg.keeptrials='yes'; then I averaged (across trials) the 3d matrix to get 2d matrix. 2. running it without keeping trials; it gives a 2d covariance matrix. 3. averaging the data with this command: mD1st=ft_timelockanalysis([],D1st). no filters baseline correction or anything. then I ran timelockanalysis again to compute the covariance (no keeptrials of course). the result is that 1. and 2. gave the same result but not 3. It seems to me that the process is not linear, at least in fieldtrip, and that one doesn't need to specify keeptrials for unaveraged data because it calculates the covariance for every trial and then averages the cov matrices. If I am wrong here I will appreciate further help with this issue. thanks yuval On 23 March 2011 21:27, Michael Wibral wrote: > > Dear Fieldtrip users interested in covariance computation, > dear Yuval, > > I would like to my opinion on covariance computation up for discussion > here. > > Covariance is a (bi-)linear measure (like an inner (scalar) product) and > should in principle be commutative mathematically with other linear > procedures as long as you respect the distributative law from elementary > math. Hence, > > (1) averaging single trial covariances or computing the covariance of > concatenated trials should give the same result if a am not mistaken. In > these two approaches samples from your two time course are in the end > multiplied with each other one by one. Whichever route of these two you take > does not matter at all. > This holds as long as you treat baseline correction and filtering (!) > exactly the same way in both cases - otherwise you'll additionally get the > baseline covariance over trials as a term in the covariance matrix or > filtering related differences. This latter point maybe important if you post > hoc decide on a band width to confine your beamformer analysis to and do not > go back to the raw data for the band pass filtering. > > (2) In contrast, when you compute covariance from a precomputed trial > average then every sample at time t in one trial on channel A will in the > course of the calculations be implicitely multiplied with samples at time t > at EVERY other trial on channel B. So this covariances focuses on covariance > structures that are consistent irrespective of the correct pairings of > trials. > > It's a little bit like first computing the power spectrum and averaging to > get total activity (induced+evoked) - this would correspond to procedure (1) > , or first averaging and then computing spectral power in order to get the > power of evoked activity alone - this would correspond to procedure (2). > > This said, when you're interested in the sources of all task related > oscillatory activity - not only the activity phase locked to a stimulus you > should pick option (1). > > > Please let me know If I overlooked something important. > Michael > > > > > --------------------- > Von: "Jean-Michel Badier" > Gesendet: Mar 23, 2011 9:42:53 AM > An: "Email discussion list for the FieldTrip project" < > fieldtrip at donders.ru.nl> > Betreff: Re: [FieldTrip] Different way of calculating the covariance for > LCM > > > Thanks Yuval, > > > Le 22/03/11 10:55, Yuval Harpaz a écrit : > > So just run the commands on an unaveraged dataset. > > > > Yes but that would be correct if there was only one trial in the data > set (see the message from Luisa). > > > > Another option to consider is the one used by Dr. Robinson when > performing SAMerf (we have his tool [here], works for our 4D > machine). > > > Thanks for it I will test it. > > > The idea is to calculate the covariance on all trials, calculate > weights by this covariance (keep filter in LCMV) and then apply > these weights on the averaged data. I found it useful because the > covariance is better for longer datasets, and the averaging in the > end increases the signal to noise ratio. I do not know exactly how > to do it in fieldtrip. > > > On 22 March 2011 10:43, Jean-Michel Badier <[ > jean-michel.badier at univmed.fr]> wrote: > > > Dear Yuval, > > I have to admit that I did not look at the matlab routines. > In item 2 I suppose that the covariance is calculated for > each trial then averaged. In item 3 I would like to calculate > the covariance from all the signal (the trials being > concatenated). > > Jean-Michel > > Le 22/03/11 05:47, Yuval Harpaz a écrit : > > > > Dear Jean Michel > As far as I know you can do it on an averaged data > structure (item 1) or do the same with the data > structure before averaging (3). I did not understand > what you meant by 2. > > Yuval > > > On 21 March 2011 22:58, Jean-Michel Badier <[ > jean-michel.badier at univmed.fr]> wrote: > > > Dear fieldtrip users, > > There are different ways of estimating the > covariance for LCMV calculation. > If I am correct: > > 1. As suggested in one of the tutorial one > can apply the calculation of the covariance > directly on the average data (for the > different periods of interest that are at > least a base line and the period of interest). > > 2. Estimate the covariance from the average > of the covariance rather than the covariance > of the average using cfg.keeptrials = "yes" > > 3. Estimate the covariance from the whole > trials concatenated together. > Is there an easy way to do that in fieldtrip > (beside create a new data set of one trial > constituted of all the trials)? > > Thanks > > Jean-Michel > > > -- Jean-Michel Badier PhD > Laboratoire de > MagnétoEncéphaloGraphie INSERM U751. Aix > Marseille Université 33 (0)4 91 38 55 62 [ > jean-michel.badier at univmed.fr] > Service de Neurophysiologie > Clinique. CHU Timone 264 Rue > Saint-Pierre, 13005 > Marseille-France > > > > > > _______________________________________________ > fieldtrip mailing list > [fieldtrip at donders.ru.nl] > [http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] > > > > > > -- > > Y.Harpaz > > a link to the BIU MEG lab: > [http://faculty.biu.ac.il/~goldsa/index.html] > > > " Why, Dan," ask the people in Artificial > Intelligence, "do you waste your time > conferring with those neuroscientists? They > wave their hands about information processing > and worry about where it happens, and > which neurotransmitters are involved, and > all those boring facts, but they haven't a > clue about the computational requirements > of higher cognitive functions." "Why," > ask the neuroscientists, "do you waste > your time on the fantasies of Artificial > Intelligence? They just invent whatever > machinery they want, and say unpardonably > ignorant things about the brain." The > cognitive psychologists, meanwhile, are > accused of concocting models with neither > biological plausibility nor proven > computational powers; the anthropologists > wouldn't know a model if they saw one, and the > philosophers, as we all know, just take in > each other's laundry, warning about > confusions they themselves have created, > in an arena bereft of both data and > empirically testable theories. With so many > idiots working on the problem, no wonder > consciousness is still a mystery. Philosopher Daniel Dennet, consciousness > explained, pp. 225 > > > > > _______________________________________________ fieldtrip mailing list [ > fieldtrip at donders.ru.nl] [ > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] > > > > > > > > > > > _______________________________________________ > fieldtrip mailing list > [fieldtrip at donders.ru.nl] > [http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] > > > > > > -- > > Y.Harpaz > > a link to the BIU MEG lab: > [http://faculty.biu.ac.il/~goldsa/index.html] > > > " Why, Dan," ask the people in Artificial Intelligence, "do > you waste your time conferring with those neuroscientists? > They wave their hands about information processing and worry > about where it happens, and which neurotransmitters are > involved, and all those boring facts, but they haven't a clue > about the computational requirements of higher cognitive > functions." "Why," ask the neuroscientists, "do you waste > your time on the fantasies of Artificial Intelligence? They > just invent whatever machinery they want, and say > unpardonably ignorant things about the brain." The cognitive > psychologists, meanwhile, are accused of concocting models > with neither biological plausibility nor proven computational > powers; the anthropologists wouldn't know a model if they saw > one, and the philosophers, as we all know, just take in each > other's laundry, warning about confusions they themselves > have created, in an arena bereft of both data and > empirically testable theories. With so many idiots working on > the problem, no wonder consciousness is still a mystery. > Philosopher Daniel Dennet, consciousness explained, pp. 225 > > > > _______________________________________________ fieldtrip mailing list [ > fieldtrip at donders.ru.nl] [ > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] > > > > -- > > > > > Jean-Michel Badier > > Laboratoire de MagnétoEncéphaloGraphie > INSERM U751. Aix Marseille Université > 33 (0)4 91 38 55 62 > [jean-michel.badier at univmed.fr] > > Service de Neurophysiologie Clinique. CHU > Timone > 264 Rue Saint-Pierre, 13005 Marseille-France > > > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -- Y.Harpaz a link to the BIU MEG lab: http://faculty.biu.ac.il/~goldsa/index.html " Why, Dan," ask the people in Artificial Intelligence, "do you waste your time conferring with those neuroscientists? They wave their hands about information processing and worry about where it happens, and which neurotransmitters are involved, and all those boring facts, but they haven't a clue about the computational requirements of higher cognitive functions." "Why," ask the neuroscientists, "do you waste your time on the fantasies of Artificial Intelligence? They just invent whatever machinery they want, and say unpardonably ignorant things about the brain." The cognitive psychologists, meanwhile, are accused of concocting models with neither biological plausibility nor proven computational powers; the anthropologists wouldn't know a model if they saw one, and the philosophers, as we all know, just take in each other's laundry, warning about confusions they themselves have created, in an arena bereft of both data and empirically testable theories. With so many idiots working on the problem, no wonder consciousness is still a mystery.* Philosopher Daniel Dennet, consciousness explained, pp. 225* -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.j.f.verwer at student.utwente.nl Thu Mar 24 12:06:01 2011 From: s.j.f.verwer at student.utwente.nl (s.j.f.verwer at student.utwente.nl) Date: Thu, 24 Mar 2011 12:06:01 +0100 Subject: [FieldTrip] Cross correlation using xcorr in ft_connectivityanalysis Message-ID: <8CBAD8DB149DE44F83A0BED60293564103A380E7@EX01.service.utwente.nl> Hi, I am a new user of Field Trip, and my Matlab knowledge is ok, but restricted. I am trying to calculate the cross correlation of two EMG signals, using ft_connectivity analysis, with cfg.method = 'xcorr'; Unfortunately I receive this error: ??? Undefined function or variable "inparam". Error in ==> ft_connectivityanalysis at 196 if any(~isfield(data, inparam)) || (isfield(data, 'crsspctrm') && (ischar(inparam) && strcmp(inparam, 'crsspctrm'))), Indeed when looking in the ft_connectivityanalysis.m, inparam is not specified for xcorr and corr: case {'corr' 'xcorr'} data = ft_checkdata(data, 'datatype', 'raw'); Could anybody help with this problem? Thanks in advance, Stan Verwer University of Twente -------------- next part -------------- An HTML attachment was scrubbed... URL: From jean-michel.badier at univmed.fr Thu Mar 24 12:19:02 2011 From: jean-michel.badier at univmed.fr (Jean-Michel Badier) Date: Thu, 24 Mar 2011 12:19:02 +0100 Subject: [FieldTrip] Different way of calculating the covariance for LCM In-Reply-To: References: <4D87BBE5.2000806@univmed.fr> <4D88614C.8070200@univmed.fr> <4D89B28D.8050107@univmed.fr> Message-ID: <4D8B28A6.6050604@univmed.fr> Hello all, Thanks again for the discussion. So now we have to deal with both theoretical consideration and practical implementation of the algorithms within fieldtrip. Let me first comment the previous message: Le 23/03/11 10:42, Yuval Harpaz a écrit : > I checked it again, I used a data structure 'D1st' which included 90 > trials. > I ran the following script and the result was a 'pre' structure. field > pre.cov was a 90*248*248 matrix, i.e., the covariance was estimated > for all the trials. > > cfg = []; > cfg.covariance = 'yes'; > cfg.removemean = 'no'; > cfg.covariancewindow = [-0.1 0]; > cfg.channel='MEG'; > cfg.keeptrials = 'yes' ; > pre=ft_timelockanalysis(cfg, D1st); > > you may find this script repository useful for LCMV analysis. it > includes an older version of fieldtrip but this is the one we work with. > http://yuval-harpaz.github.com/ft_BIU/ > check the actual repository here (read the README) : > https://github.com/yuval-harpaz/ft_BIU > good luck there, yuval. > Yes I do agree that with cfg.keeptrials = 'yes' you will get an estimate of the covariance for each trial, in this case 90. However the covariance will be averaged within fr_sourceanalysis before the call to beamformer_lcmv see for example in version 20110222 ft_sourceanalysis from line 783 elseif Ntrials>1 % average the single-trial covariance matrices Cy = reshape(mean(data.cov,1), [Nchans Nchans]); % select the average ERF avg = data.avg; Nrepetitions = 1; of course developers of fieldtrip would be the experts to comment on this. Jean-Michel From a.wollbrink at uni-muenster.de Thu Mar 24 12:23:20 2011 From: a.wollbrink at uni-muenster.de (Andreas Wollbrink) Date: Thu, 24 Mar 2011 12:23:20 +0100 Subject: [FieldTrip] generating single / multiple local sphere model using brain surface from segmented MRI Message-ID: <4D8B29A8.7020505@uni-muenster.de> Hi all, I just tried to generate a multiple local sphere model using a brain surface from a segmented MRI following the instructions on http://fieldtrip.fcdonders.nl/example/make_leadfields_using_different_headmodels#local_spheres_model_from_fieldtrip_using_brain_surface_from_segmented_mri The actual matlab code is: hdr = ft_read_header('example.ds'); cfg = []; cfg.grad = hdr.grad; ft_segment = ft_prepare_localspheres(cfg,segmentedmri); The error message is as follows: ??? Attempted to access cfg.numvertices(1); index out of bounds because numel(cfg.numvertices)=0. Error in ==> prepare_mesh_segmentation at 67 [pnt, tri] = triangulate_seg(seg, cfg.numvertices(i), ori); Error in ==> ft_prepare_mesh at 104 bnd = prepare_mesh_segmentation(cfg, mri); Error in ==> ft_prepare_localspheres at 93 headshape = ft_prepare_mesh(cfg, mri); The same error occurred when I tried to generate a single local sphere model based on a brain surface derived a segmented MRI. After defining a value for cfg.numvertices = 3000 I got a reasonable good volume conductor model. Since I am not quite sure which value I should use for the numvertices parameter I like to ask for some explanations and suggestions. Thanks in advance! Andreas -- ====================================================================== Andreas Wollbrink, Biomedical Engineer Institute for Biomagnetism and Biosignalanalysis Muenster University Hospital Malmedyweg 15 phone: +49-(0)251-83-52546 D-48149 Muenster mobil: +49-(0)160-98527553 Germany fax: +49-(0)251-83-56874 e-Mail: a.wollbrink at uni-muenster.de ====================================================================== From jan.schoffelen at donders.ru.nl Thu Mar 24 13:29:09 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 24 Mar 2011 13:29:09 +0100 Subject: [FieldTrip] Cross correlation using xcorr in ft_connectivityanalysis In-Reply-To: <8CBAD8DB149DE44F83A0BED60293564103A380E7@EX01.service.utwente.nl> References: <8CBAD8DB149DE44F83A0BED60293564103A380E7@EX01.service.utwente.nl> Message-ID: <56962338-5355-4E04-BA41-DE1ADEAB73A1@donders.ru.nl> Dear Stan, Apologies for giving you high hopes. Based on the documentation of the function ft_connectivityanalysis, the false impression is suggested that cross-correlations can be computed using FieldTrip. We did however not yet have time to actually implement this, although this is on our to do list. The error you report is caused by something unrelated to this, but would you be able to solve that one, it will still not be possible to compute the xcorr. I will remove this error from the documentation of the ft_connectivityanalysis function as soon as possible. What you can do, though, is to compute coherence, which is the frequency domain equivalent of the cross correlation, but I don't know whether this fits your research interests. Best wishes, Jan-Mathijs On Mar 24, 2011, at 12:06 PM, wrote: > Hi, > > I am a new user of Field Trip, and my Matlab knowledge is ok, but > restricted. I am trying to calculate the cross correlation of two > EMG signals, using ft_connectivity analysis, with cfg.method = > 'xcorr'; Unfortunately I receive this error: > > ??? Undefined function or variable "inparam". > > Error in ==> ft_connectivityanalysis at 196 > if any(~isfield(data, inparam)) || (isfield(data, 'crsspctrm') && > (ischar(inparam) && strcmp(inparam, > 'crsspctrm'))), > > Indeed when looking in the ft_connectivityanalysis.m, inparam is not > specified for xcorr and corr: > > case {'corr' 'xcorr'} > data = ft_checkdata(data, 'datatype', 'raw'); > > Could anybody help with this problem? > > Thanks in advance, > > Stan Verwer > University of Twente > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Thu Mar 24 14:01:33 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 24 Mar 2011 14:01:33 +0100 Subject: [FieldTrip] Different way of calculating the covariance for LCM In-Reply-To: <4D8B28A6.6050604@univmed.fr> References: <4D87BBE5.2000806@univmed.fr> <4D88614C.8070200@univmed.fr> <4D89B28D.8050107@univmed.fr> <4D8B28A6.6050604@univmed.fr> Message-ID: Dear JM et al, > > see for example in version 20110222 ft_sourceanalysis from line 783 > elseif Ntrials>1 > % average the single-trial covariance matrices > Cy = reshape(mean(data.cov,1), [Nchans Nchans]); > % select the average ERF > avg = data.avg; > Nrepetitions = 1; > > of course developers of fieldtrip would be the experts to comment on > this. I am not sure what kind of comment you are looking for here. I think the previous discussion with much appreciated contributions by Yuval and Michael was quite conclusive. The difference between keeptrials='yes' and keeptrials='no' is that the single replicates are kept in memory when keeptrials='yes' whereas the covariance will be averaged (across the single trial covariances) if you specify keeptrials='no'. The default behaviour of sourceanalysis is to average across single replicate covariances before computing the spatial filters. This is done to ensure a relatively robust estimate of the covariance matrix. In general, covariances estimated from single trials are just very noisy and don't lead to good quality source reconstructions. In other words, if you would want to have a single trial estimate of the reconstructed source time series, you still need to compute the spatial filters based on a covariance averaged across multiple trials. Once you have the spatial filter, you can project the single trial sensor-level data through them. I believe this is most easily achieved by a 2-step procedure. tlck = ft_timelockanalysis(cfg, data); (with keeptrials = 'no') tlck2 = ft_timelockanalysis(cfg, data); (with keeptrials = 'yes') cfg = []; ... source = ft_sourceanalysis(cfg, tlck); (with keepfilters = 'yes') cfg.grid.filter = source.avg.filter; cfg.rawtrial = 'yes'; source = ft_sourceanalysis(cfg, tlck2); This should (I think) give you the single trial time courses. But perhaps I am totally missing the point and this is not the information you were looking for. BW, JM Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From michael.wibral at web.de Thu Mar 24 15:24:28 2011 From: michael.wibral at web.de (Michael Wibral) Date: Thu, 24 Mar 2011 15:24:28 +0100 (CET) Subject: [FieldTrip] Different way of calculating the covariance for LCM In-Reply-To: References: <4D87BBE5.2000806@univmed.fr> <4D88614C.8070200@univmed.fr> <4D89B28D.8050107@univmed.fr> <1295935147.505310.1300908427321.JavaMail.fmail@mwmweb087>, Message-ID: <1446326873.865399.1300976668472.JavaMail.fmail@mwmweb082> An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Michael Wibral.vcf Type: text/x-vcard Size: 637 bytes Desc: not available URL: From r.oostenveld at donders.ru.nl Thu Mar 24 16:40:58 2011 From: r.oostenveld at donders.ru.nl (Robert Oostenveld) Date: Thu, 24 Mar 2011 10:40:58 -0500 Subject: [FieldTrip] generating single / multiple local sphere model using brain surface from segmented MRI In-Reply-To: <4D8B29A8.7020505@uni-muenster.de> References: <4D8B29A8.7020505@uni-muenster.de> Message-ID: <62B55395-CF5D-438F-B67E-2E56A962B5B2@donders.ru.nl> Hi Andreas Based on the segmentation a set of vertices/points is constructed for the surface. The spheres are subsequently fitted to those vertices/points. 3000 vertices sounds like a good number. best Robert On 24 Mar 2011, at 6:23, Andreas Wollbrink wrote: > Hi all, > > I just tried to generate a multiple local sphere model using a brain surface from a segmented MRI following the instructions on > > http://fieldtrip.fcdonders.nl/example/make_leadfields_using_different_headmodels#local_spheres_model_from_fieldtrip_using_brain_surface_from_segmented_mri > > The actual matlab code is: > > hdr = ft_read_header('example.ds'); > cfg = []; > cfg.grad = hdr.grad; > ft_segment = ft_prepare_localspheres(cfg,segmentedmri); > > > The error message is as follows: > > ??? Attempted to access cfg.numvertices(1); index out of bounds because numel(cfg.numvertices)=0. > > Error in ==> prepare_mesh_segmentation at 67 > [pnt, tri] = triangulate_seg(seg, cfg.numvertices(i), ori); > > Error in ==> ft_prepare_mesh at 104 > bnd = prepare_mesh_segmentation(cfg, mri); > > Error in ==> ft_prepare_localspheres at 93 > headshape = ft_prepare_mesh(cfg, mri); > > > The same error occurred when I tried to generate a single local sphere model based on a brain surface derived a segmented MRI. > > > After defining a value for cfg.numvertices = 3000 I got a reasonable good volume conductor model. > > Since I am not quite sure which value I should use for the numvertices parameter I like to ask for some explanations and suggestions. > > Thanks in advance! > > Andreas > -- > > > ====================================================================== > > Andreas Wollbrink, Biomedical Engineer > > Institute for Biomagnetism and Biosignalanalysis > Muenster University Hospital > > Malmedyweg 15 phone: +49-(0)251-83-52546 > D-48149 Muenster mobil: +49-(0)160-98527553 > Germany fax: +49-(0)251-83-56874 > e-Mail: a.wollbrink at uni-muenster.de > > ====================================================================== > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From yuvharpaz at gmail.com Thu Mar 24 16:58:44 2011 From: yuvharpaz at gmail.com (Yuval Harpaz) Date: Thu, 24 Mar 2011 17:58:44 +0200 Subject: [FieldTrip] Different way of calculating the covariance for LCM In-Reply-To: <1446326873.865399.1300976668472.JavaMail.fmail@mwmweb082> References: <4D87BBE5.2000806@univmed.fr> <4D88614C.8070200@univmed.fr> <4D89B28D.8050107@univmed.fr> <1295935147.505310.1300908427321.JavaMail.fmail@mwmweb087> <1446326873.865399.1300976668472.JavaMail.fmail@mwmweb082> Message-ID: Thanks Michael for the detailed explanation. sorry for misunderstanding you before, making you work hard to explain yourself. thanks again, yuval On 24 March 2011 16:24, Michael Wibral wrote: > Dear Yuval, > > you are completely right with what you wrote but you might have > misunderstood my post (as I say exactly the same): > > What I wrote is exactly this: concatenation of trials followed by cov > computation or trial wise cov computation followed by averaging is the same, > BUT different from averaging and then computing cov (just as you point out). > > Also note that i did NOT write that cov computation is linear BUT bi-linear > (see also the wikipedia article on covariance), hence you have to honor > distributivity in both arguments (and since you average both arguments, > that's were the problem comes in!). > > Let's denote cov computation by C<.|.>, then > > (1a) C=(C + C ) (this is linearity in first > argument) > (1b) C=(C + C + C + C ) (this is > bi-linearity when considering both arguments) > > concatenating signal vectors a, b and c,d into …[a b] and [c d] means: > (1c) C<[a b]|[c d]> = (C + C ) > > For numerical factors 1/m, 1/n as they arise in averaging the following > holds: > C<1/m*a| 1/n*b> =1/m*1/m*C > > > (i.e. concatenation or single trial cov computation and later averaging are > the same. This is because the dot product that is used to compute the > covariance for two signals vectors reads like this: [a b c d] * [e f g > h]=ae+bf+cg+dh=[a b] * [e f] + [c d]*[gh], so whether you multiply the > vectors in pieces and later add results or rather multiply them as a whole > doesn't matter. What matters is that a, b, ... stay exactly the same in both > cases) > > > Now to trial averging and cov computation (see 3) versus cov computation > and averaging afterwards (see 4): > > for two trials a,b and two channels c1,c2: > > (4) > C=1/2*1/2*(C+C+C+C) > (here things get multiplied across trials, the two factors 1/2 come from > each separate averaging in the first and second argument) > (5) AVG(C,C) =1/2*(C+C) (here > things do only get multiplied within trials, we have only the outer > averaging, hence only a factor of 1/2) > > Michael > > > > ------------------------------ > *Von:* "Yuval Harpaz" > *Gesendet:* Mar 24, 2011 10:41:02 AM > > *An:* "Email discussion list for the FieldTrip project" < > fieldtrip at donders.ru.nl> > *Betreff:* Re: [FieldTrip] Different way of calculating the covariance for > LCM > > Dear Michael, Jean-Michel and FieldTrip users. > To my experience and understanding it does matter if you first asses the > covariance and then average or the other way around. > First, as far as my understanding goes, if we have some brain activity such > as alpha, which is not phase locked to the event then in the covariance will > not 'catch' too much covariability there after averaging, compared to > unaveraged data where it should. if the process of calculating covariance > and averaging id linear then I must be wrong here. > anyway, beamforming on averaged and unaveraged base covariance matrices > give different results in fieldtrip. this is because the covariance matrices > are not the same with or without averaging. > > I ran the following test to check it all. I took the same structure as in > the example above, and I tested the covariance matrix after > 1. running it with cfg.keeptrials='yes'; then I averaged (across trials) > the 3d matrix to get 2d matrix. > 2. running it without keeping trials; it gives a 2d covariance matrix. > 3. averaging the data with this command: > mD1st=ft_timelockanalysis([],D1st). no filters baseline correction or > anything. > then I ran timelockanalysis again to compute the covariance (no keeptrials > of course). > > the result is that 1. and 2. gave the same result but not 3. > > It seems to me that the process is not linear, at least in fieldtrip, and > that one doesn't need to specify keeptrials for unaveraged data because it > calculates the covariance for every trial and then averages the cov > matrices. > > If I am wrong here I will appreciate further help with this issue. > > thanks > yuval > > > On 23 March 2011 21:27, Michael Wibral wrote: > >> >> Dear Fieldtrip users interested in covariance computation, >> dear Yuval, >> >> I would like to my opinion on covariance computation up for discussion >> here. >> >> Covariance is a (bi-)linear measure (like an inner (scalar) product) and >> should in principle be commutative mathematically with other linear >> procedures as long as you respect the distributative law from elementary >> math. Hence, >> >> (1) averaging single trial covariances or computing the covariance of >> concatenated trials should give the same result if a am not mistaken. In >> these two approaches samples from your two time course are in the end >> multiplied with each other one by one. Whichever route of these two you take >> does not matter at all. >> This holds as long as you treat baseline correction and filtering (!) >> exactly the same way in both cases - otherwise you'll additionally get the >> baseline covariance over trials as a term in the covariance matrix or >> filtering related differences. This latter point maybe important if you post >> hoc decide on a band width to confine your beamformer analysis to and do not >> go back to the raw data for the band pass filtering. >> >> (2) In contrast, when you compute covariance from a precomputed trial >> average then every sample at time t in one trial on channel A will in the >> course of the calculations be implicitely multiplied with samples at time t >> at EVERY other trial on channel B. So this covariances focuses on covariance >> structures that are consistent irrespective of the correct pairings of >> trials. >> >> It's a little bit like first computing the power spectrum and averaging to >> get total activity (induced+evoked) - this would correspond to procedure (1) >> , or first averaging and then computing spectral power in order to get the >> power of evoked activity alone - this would correspond to procedure (2). >> >> This said, when you're interested in the sources of all task related >> oscillatory activity - not only the activity phase locked to a stimulus you >> should pick option (1). >> >> >> Please let me know If I overlooked something important. >> Michael >> >> >> >> >> --------------------- >> Von: "Jean-Michel Badier" >> Gesendet: Mar 23, 2011 9:42:53 AM >> An: "Email discussion list for the FieldTrip project" < >> fieldtrip at donders.ru.nl> >> Betreff: Re: [FieldTrip] Different way of calculating the covariance for >> LCM >> >> >> Thanks Yuval, >> >> >> Le 22/03/11 10:55, Yuval Harpaz a écrit : >> >> So just run the commands on an unaveraged dataset. >> >> >> >> Yes but that would be correct if there was only one trial in the data >> set (see the message from Luisa). >> >> >> >> Another option to consider is the one used by Dr. Robinson when >> performing SAMerf (we have his tool [here], works for our 4D >> machine). >> >> >> Thanks for it I will test it. >> >> >> The idea is to calculate the covariance on all trials, calculate >> weights by this covariance (keep filter in LCMV) and then apply >> these weights on the averaged data. I found it useful because the >> covariance is better for longer datasets, and the averaging in the >> end increases the signal to noise ratio. I do not know exactly how >> to do it in fieldtrip. >> >> >> On 22 March 2011 10:43, Jean-Michel Badier <[ >> jean-michel.badier at univmed.fr]> wrote: >> >> >> Dear Yuval, >> >> I have to admit that I did not look at the matlab routines. >> In item 2 I suppose that the covariance is calculated for >> each trial then averaged. In item 3 I would like to calculate >> the covariance from all the signal (the trials being >> concatenated). >> >> Jean-Michel >> >> Le 22/03/11 05:47, Yuval Harpaz a écrit : >> >> >> >> Dear Jean Michel >> As far as I know you can do it on an averaged data >> structure (item 1) or do the same with the data >> structure before averaging (3). I did not understand >> what you meant by 2. >> >> Yuval >> >> >> On 21 March 2011 22:58, Jean-Michel Badier <[ >> jean-michel.badier at univmed.fr]> wrote: >> >> >> Dear fieldtrip users, >> >> There are different ways of estimating the >> covariance for LCMV calculation. >> If I am correct: >> >> 1. As suggested in one of the tutorial one >> can apply the calculation of the covariance >> directly on the average data (for the >> different periods of interest that are at >> least a base line and the period of interest). >> >> 2. Estimate the covariance from the average >> of the covariance rather than the covariance >> of the average using cfg.keeptrials = "yes" >> >> 3. Estimate the covariance from the whole >> trials concatenated together. >> Is there an easy way to do that in >> fieldtrip (beside create a new data set of one >> trial constituted of all the trials)? >> >> Thanks >> >> Jean-Michel >> >> >> -- Jean-Michel Badier PhD >> Laboratoire de >> MagnétoEncéphaloGraphie INSERM U751. Aix >> Marseille Université 33 (0)4 91 38 55 62 [ >> jean-michel.badier at univmed.fr] >> Service de Neurophysiologie >> Clinique. CHU Timone 264 Rue >> Saint-Pierre, 13005 >> Marseille-France >> >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> [fieldtrip at donders.ru.nl] >> [http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] >> >> >> >> >> >> -- >> >> Y.Harpaz >> >> a link to the BIU MEG lab: >> [http://faculty.biu.ac.il/~goldsa/index.html] >> >> >> >> _______________________________________________ fieldtrip mailing list [ >> fieldtrip at donders.ru.nl] [ >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] >> >> >> >> >> >> >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> [fieldtrip at donders.ru.nl] >> [http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] >> >> >> >> >> >> -- >> >> Y.Harpaz >> >> a link to the BIU MEG lab: >> [http://faculty.biu.ac.il/~goldsa/index.html] >> >> >> >> >> _______________________________________________ fieldtrip mailing list >> [fieldtrip at donders.ru.nl] [ >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] >> >> >> >> -- >> >> >> >> >> Jean-Michel Badier >> >> Laboratoire de MagnétoEncéphaloGraphie >> INSERM U751. Aix Marseille Université >> 33 (0)4 91 38 55 62 >> [jean-michel.badier at univmed.fr] >> >> Service de Neurophysiologie Clinique. CHU >> Timone >> 264 Rue Saint-Pierre, 13005 Marseille-France >> >> >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jean-michel.badier at univmed.fr Thu Mar 24 22:06:03 2011 From: jean-michel.badier at univmed.fr (Jean-Michel Badier) Date: Thu, 24 Mar 2011 22:06:03 +0100 Subject: [FieldTrip] Different way of calculating the covariance for LCM In-Reply-To: References: <4D87BBE5.2000806@univmed.fr> <4D88614C.8070200@univmed.fr> <4D89B28D.8050107@univmed.fr> <4D8B28A6.6050604@univmed.fr> Message-ID: <4D8BB23B.8060701@univmed.fr> Thanks all for your explanations, Le 24/03/11 14:01, jan-mathijs schoffelen a écrit : > Dear JM et al, > >> >> see for example in version 20110222 ft_sourceanalysis from line 783 >> elseif Ntrials>1 >> % average the single-trial covariance matrices >> Cy = reshape(mean(data.cov,1), [Nchans Nchans]); >> % select the average ERF >> avg = data.avg; >> Nrepetitions = 1; >> >> of course developers of fieldtrip would be the experts to comment on >> this. > > I am not sure what kind of comment you are looking for here. I think > the previous discussion with much appreciated contributions by Yuval > and Michael was quite conclusive. > > The difference between keeptrials='yes' and keeptrials='no' is that > the single replicates are kept in memory when keeptrials='yes' whereas > the covariance will be averaged (across the single trial covariances) > if you specify keeptrials='no'. The default behaviour of > sourceanalysis is to average across single replicate covariances > before computing the spatial filters. This is done to ensure a > relatively robust estimate of the covariance matrix. In general, > covariances estimated from single trials are just very noisy and don't > lead to good quality source reconstructions. It is clear. Part of my misunderstanding comes from a very fast overview of the code and/or documentation and I did not realize that the option covariance = 'yes' would be enough to calculate the covariance over the wholes trials and there is no need to specify keeptrials = 'yes'. > In other words, if you would want to have a single trial estimate of > the reconstructed source time series, you still need to compute the > spatial filters based on a covariance averaged across multiple trials. > Once you have the spatial filter, you can project the single trial > sensor-level data through them. > > I believe this is most easily achieved by a 2-step procedure. > > tlck = ft_timelockanalysis(cfg, data); (with keeptrials = 'no') > > > tlck2 = ft_timelockanalysis(cfg, data); (with keeptrials = 'yes') > > cfg = []; > ... > source = ft_sourceanalysis(cfg, tlck); (with keepfilters = 'yes') > > cfg.grid.filter = source.avg.filter; > cfg.rawtrial = 'yes'; > source = ft_sourceanalysis(cfg, tlck2); > > This should (I think) give you the single trial time courses. Ok it is an other step further > > But perhaps I am totally missing the point and this is not the > information you were looking for. I do not think so. Thanks again Jean-Michel > > BW, > > JM > > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Jean-Michel Badier Laboratoire de MagnétoEncéphaloGraphie INSERM U751. Aix Marseille Université 33 (0)4 91 38 55 62 _jean-michel.badier at univmed.fr_ Service de Neurophysiologie Clinique. CHU Timone 264 Rue Saint-Pierre, 13005 Marseille-France -------------- next part -------------- An HTML attachment was scrubbed... URL: From jean-michel.badier at univmed.fr Thu Mar 24 22:08:46 2011 From: jean-michel.badier at univmed.fr (Jean-Michel Badier) Date: Thu, 24 Mar 2011 22:08:46 +0100 Subject: [FieldTrip] Different way of calculating the covariance for LCM In-Reply-To: References: <4D87BBE5.2000806@univmed.fr> <4D88614C.8070200@univmed.fr> <4D89B28D.8050107@univmed.fr> <1295935147.505310.1300908427321.JavaMail.fmail@mwmweb087> <1446326873.865399.1300976668472.JavaMail.fmail@mwmweb082> Message-ID: <4D8BB2DE.8090700@univmed.fr> Thanks Michael and Yuval, That clarify the theoretical points. Clearly the point 2 and 3 of my original message would give the same results. Jean-Michel Le 24/03/11 16:58, Yuval Harpaz a écrit : > Thanks Michael for the detailed explanation. sorry for > misunderstanding you before, making you work hard to explain yourself. > thanks again, yuval > > On 24 March 2011 16:24, Michael Wibral > wrote: > > Dear Yuval, > > you are completely right with what you wrote but you might have > misunderstood my post (as I say exactly the same): > > What I wrote is exactly this: concatenation of trials followed by > cov computation or trial wise cov computation followed by > averaging is the same, BUT different from averaging and then > computing cov (just as you point out). > > Also note that i did NOT write that cov computation is linear BUT > bi-linear (see also the wikipedia article on covariance), hence > you have to honor distributivity in both arguments (and since you > average both arguments, that's were the problem comes in!). > > Let's denote cov computation by C<.|.>, then > > (1a) C=(C + C ) (this is linearity in > first argument) > (1b) C=(C + C + C + C ) (this > is bi-linearity when considering both arguments) > > concatenating signal vectors a, b and c,d into …[a b] and [c d] means: > (1c) C<[a b]|[c d]> = (C + C ) > > For numerical factors 1/m, 1/n as they arise in averaging the > following holds: > C<1/m*a| 1/n*b> =1/m*1/m*C > > > (i.e. concatenation or single trial cov computation and later > averaging are the same. This is because the dot product that is > used to compute the covariance for two signals vectors reads like > this: [a b c d] * [e f g h]=ae+bf+cg+dh=[a b] * [e f] + [c > d]*[gh], so whether you multiply the vectors in pieces and later > add results or rather multiply them as a whole doesn't matter. > What matters is that a, b, ... stay exactly the same in both cases) > > > Now to trial averging and cov computation (see 3) versus cov > computation and averaging afterwards (see 4): > > for two trials a,b and two channels c1,c2: > > (4) > C=1/2*1/2*(C+C+C+C) > (here things get multiplied across trials, the two factors 1/2 > come from each separate averaging in the first and second argument) > (5) AVG(C,C) =1/2*(C+C) > (here things do only get multiplied within trials, we have only > the outer averaging, hence only a factor of 1/2) > > Michael > > > > ------------------------------------------------------------------------ > *Von:* "Yuval Harpaz" > > *Gesendet:* Mar 24, 2011 10:41:02 AM > > *An:* "Email discussion list for the FieldTrip project" > > > *Betreff:* Re: [FieldTrip] Different way of calculating the > covariance for LCM > > Dear Michael, Jean-Michel and FieldTrip users. > To my experience and understanding it does matter if you first > asses the covariance and then average or the other way around. > First, as far as my understanding goes, if we have some brain > activity such as alpha, which is not phase locked to the event > then in the covariance will not 'catch' too much covariability > there after averaging, compared to unaveraged data where it > should. if the process of calculating covariance and averaging > id linear then I must be wrong here. > anyway, beamforming on averaged and unaveraged base covariance > matrices give different results in fieldtrip. this is because > the covariance matrices are not the same with or without > averaging. > > I ran the following test to check it all. I took the same > structure as in the example above, and I tested the covariance > matrix after > 1. running it with cfg.keeptrials='yes'; then I averaged > (across trials) the 3d matrix to get 2d matrix. > 2. running it without keeping trials; it gives a 2d covariance > matrix. > 3. averaging the data with this command: > mD1st=ft_timelockanalysis([],D1st). no filters baseline > correction or anything. > then I ran timelockanalysis again to compute the covariance > (no keeptrials of course). > > the result is that 1. and 2. gave the same result but not 3. > > It seems to me that the process is not linear, at least in > fieldtrip, and that one doesn't need to specify keeptrials for > unaveraged data because it calculates the covariance for every > trial and then averages the cov matrices. > > If I am wrong here I will appreciate further help with this issue. > > thanks > yuval > > > On 23 March 2011 21:27, Michael Wibral > wrote: > > > Dear Fieldtrip users interested in covariance computation, > dear Yuval, > > I would like to my opinion on covariance computation up > for discussion here. > > Covariance is a (bi-)linear measure (like an inner > (scalar) product) and should in principle be commutative > mathematically with other linear procedures as long as you > respect the distributative law from elementary math. Hence, > > (1) averaging single trial covariances or computing the > covariance of concatenated trials should give the same > result if a am not mistaken. In these two approaches > samples from your two time course are in the end > multiplied with each other one by one. Whichever route of > these two you take does not matter at all. > This holds as long as you treat baseline correction and > filtering (!) exactly the same way in both cases - > otherwise you'll additionally get the baseline covariance > over trials as a term in the covariance matrix or > filtering related differences. This latter point maybe > important if you post hoc decide on a band width to > confine your beamformer analysis to and do not go back to > the raw data for the band pass filtering. > > (2) In contrast, when you compute covariance from a > precomputed trial average then every sample at time t in > one trial on channel A will in the course of the > calculations be implicitely multiplied with samples at > time t at EVERY other trial on channel B. So this > covariances focuses on covariance structures that are > consistent irrespective of the correct pairings of trials. > > It's a little bit like first computing the power spectrum > and averaging to get total activity (induced+evoked) - > this would correspond to procedure (1) , or first > averaging and then computing spectral power in order to > get the power of evoked activity alone - this would > correspond to procedure (2). > > This said, when you're interested in the sources of all > task related oscillatory activity - not only the activity > phase locked to a stimulus you should pick option (1). > > > Please let me know If I overlooked something important. > Michael > > > > > --------------------- > Von: "Jean-Michel Badier" > > Gesendet: Mar 23, 2011 9:42:53 AM > An: "Email discussion list for the FieldTrip project" > > > Betreff: Re: [FieldTrip] Different way of calculating the > covariance for LCM > > > Thanks Yuval, > > > Le 22/03/11 10:55, Yuval Harpaz a écrit : > > So just run the commands on an unaveraged dataset. > > > > Yes but that would be correct if there was only one trial > in the data set (see the message from Luisa). > > > > Another option to consider is the one used by Dr. > Robinson when performing SAMerf (we have his tool [here], > works for our 4D machine). > > > Thanks for it I will test it. > > > The idea is to calculate the covariance on all trials, > calculate weights by this covariance (keep filter > in LCMV) and then apply these weights on the > averaged data. I found it useful because the > covariance is better for longer datasets, and the > averaging in the end increases the signal to noise > ratio. I do not know exactly how to do it in > fieldtrip. > > > On 22 March 2011 10:43, Jean-Michel Badier > <[jean-michel.badier at univmed.fr > ]> wrote: > > > Dear Yuval, > > I have to admit that I did not look at the matlab > routines. > In item 2 I suppose that the covariance is calculated for > each trial then averaged. In item 3 I would > like to calculate the covariance from all > the signal (the trials being concatenated). > > Jean-Michel > > Le 22/03/11 05:47, Yuval Harpaz a écrit : > > > > Dear Jean Michel > As far as I know you can do it on an averaged > data structure (item 1) or do the same with > the data structure before > averaging (3). I did not > understand what you meant by 2. > > Yuval > > > On 21 March 2011 22:58, > Jean-Michel Badier <[jean-michel.badier at univmed.fr > ]> wrote: > > > Dear fieldtrip users, > > There are different ways of estimating the > covariance for LCMV calculation. > If I am correct: > > 1. As suggested in one of the tutorial one > can apply the calculation of the > covariance directly on the average > data (for the different > periods of interest that are > at least a base line and the > period of interest). > > 2. Estimate the covariance from the > average of the covariance rather than the > covariance of the average using > cfg.keeptrials = "yes" > > 3. Estimate the covariance from the whole > trials concatenated together. > Is there an easy way to do that in > fieldtrip (beside create a new data set of > one trial constituted of all the > trials)? > > Thanks > > Jean-Michel > > > -- Jean-Michel Badier PhD > Laboratoire de > MagnétoEncéphaloGraphie INSERM U751. Aix > Marseille Université 33 (0)4 91 38 > 55 62 [jean-michel.badier at univmed.fr > ] > Service de > Neurophysiologie Clinique. CHU > Timone 264 Rue > Saint-Pierre, 13005 > Marseille-France > > > > > > _______________________________________________ > fieldtrip mailing list > [fieldtrip at donders.ru.nl ] > [http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] > > > > > > -- > > Y.Harpaz > > a link to the BIU MEG lab: > [http://faculty.biu.ac.il/~goldsa/index.html > ] > > > > _______________________________________________ fieldtrip > mailing list [fieldtrip at donders.ru.nl > ] > [http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] > > > > > > > > > > > _______________________________________________ > fieldtrip mailing list > [fieldtrip at donders.ru.nl ] > [http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] > > > > > > -- > > Y.Harpaz > > a link to the BIU MEG lab: > [http://faculty.biu.ac.il/~goldsa/index.html > ] > > > > > _______________________________________________ fieldtrip > mailing list [fieldtrip at donders.ru.nl > ] > [http://mailman.science.ru.nl/mailman/listinfo/fieldtrip] > > > > -- > > > > > Jean-Michel Badier > > Laboratoire de MagnétoEncéphaloGraphie > INSERM U751. Aix Marseille Université > 33 (0)4 91 38 55 62 > [jean-michel.badier at univmed.fr > ] > > Service de Neurophysiologie Clinique. > CHU Timone > 264 Rue Saint-Pierre, 13005 Marseille-France > > > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Jean-Michel Badier Laboratoire de MagnétoEncéphaloGraphie INSERM U751. Aix Marseille Université 33 (0)4 91 38 55 62 _jean-michel.badier at univmed.fr_ Service de Neurophysiologie Clinique. CHU Timone 264 Rue Saint-Pierre, 13005 Marseille-France -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.j.f.verwer at student.utwente.nl Fri Mar 25 15:00:50 2011 From: s.j.f.verwer at student.utwente.nl (s.j.f.verwer at student.utwente.nl) Date: Fri, 25 Mar 2011 15:00:50 +0100 Subject: [FieldTrip] Cross correlation using xcorr in ft_connectivityanalysis In-Reply-To: References: Message-ID: <8CBAD8DB149DE44F83A0BED60293564103A380EC@EX01.service.utwente.nl> Hi Jan-Mathijs, Thank you for your quick response. Actually, I already calculated the coherence with the Fieldtrip Toolbox and that worked out for me indeed. However, in my research I focus on inter- and intramuscular coherence/synchrony and I'd like to have information both in frequency and time domain. For my research assignment it is important to analyze the lag between the EMG signals in order to characterize e.g. the origin of synchrony. A lot of researchers in this area work with the cumulant density function (using the Neurospec toolbox, Halliday et al.), but that is in my opinion similar to the xcorr-function in MATLAB. Do you advise me to use the "standard" xcorr function in MATLAB or do you have other ideas? You'd help me a lot! Best wishes, Stan ------------------------------ Message: 4 Date: Thu, 24 Mar 2011 13:29:09 +0100 From: jan-mathijs schoffelen To: Email discussion list for the FieldTrip project Subject: Re: [FieldTrip] Cross correlation using xcorr in ft_connectivityanalysis Message-ID: <56962338-5355-4E04-BA41-DE1ADEAB73A1 at donders.ru.nl> Content-Type: text/plain; charset="us-ascii"; Format="flowed"; DelSp="yes" Dear Stan, Apologies for giving you high hopes. Based on the documentation of the function ft_connectivityanalysis, the false impression is suggested that cross-correlations can be computed using FieldTrip. We did however not yet have time to actually implement this, although this is on our to do list. The error you report is caused by something unrelated to this, but would you be able to solve that one, it will still not be possible to compute the xcorr. I will remove this error from the documentation of the ft_connectivityanalysis function as soon as possible. What you can do, though, is to compute coherence, which is the frequency domain equivalent of the cross correlation, but I don't know whether this fits your research interests. Best wishes, Jan-Mathijs On Mar 24, 2011, at 12:06 PM, wrote: > Hi, > > I am a new user of Field Trip, and my Matlab knowledge is ok, but > restricted. I am trying to calculate the cross correlation of two > EMG signals, using ft_connectivity analysis, with cfg.method = > 'xcorr'; Unfortunately I receive this error: > > ??? Undefined function or variable "inparam". > > Error in ==> ft_connectivityanalysis at 196 > if any(~isfield(data, inparam)) || (isfield(data, 'crsspctrm') && > (ischar(inparam) && strcmp(inparam, > 'crsspctrm'))), > > Indeed when looking in the ft_connectivityanalysis.m, inparam is not > specified for xcorr and corr: > > case {'corr' 'xcorr'} > data = ft_checkdata(data, 'datatype', 'raw'); > > Could anybody help with this problem? > > Thanks in advance, > > Stan Verwer > University of Twente From info at bbss.it Fri Mar 25 17:09:11 2011 From: info at bbss.it (BrainBalance Solutions) Date: Fri, 25 Mar 2011 17:09:11 +0100 Subject: [FieldTrip] PLV analysis clarification In-Reply-To: References: <00F172BC-AB16-4BE2-8BCE-1A22A78AB595@donders.ru.nl> Message-ID: Hi there, I'm trying to perform the same analysis and the trick Jan give to tranform the pvlspctrm to powerspctrm and labels give me the ability to compute the grandaverage. But now I'm trying to do a cluster analysis and if I give this simple script: load GApun; load GArew; cfg = []; cfg.method = 'montecarlo'; cfg.statistic = 'depsamplesT'; cfg.correctm = 'cluster'; cfg.clusteralpha = 0.05; cfg.clusterstatistic = 'maxsum'; cfg.minnbchan = 2; cfg.tail = 0; cfg.clustertail = 0; cfg.alpha = 0.025; cfg.numrandomization = 500; subj = 40; design = zeros(2,2*subj); for i = 1:subj design(1,i) = i; end for i = 1:subj design(1,subj+i) = i; end design(2,1:subj) = 1; design(2,subj+1:2*subj) = 2; cfg.design = design; cfg.uvar = 1; cfg.ivar = 2; [stat] = ft_freqstatistics(cfg, GApun, GArew); I have this error: ??? Undefined function or variable "sens". Error in ==> ft_neighbourselection at 95 if ~isstruct(sens) Error in ==> statistics_wrapper at 241 cfg.neighbours = ft_neighbourselection(cfg,varargin{1}); Error in ==> ft_freqstatistics at 127 [stat, cfg] = statistics_wrapper(cfg, varargin{:}); Error in ==> calcoloStudent at 31 [stat] = ft_freqstatistics(cfg, GApun, GArew); Following the errors I've found that the problem is in: cfg.correctm = 'cluster'; If I comment it some analysis are done, but I think that clusters are skipped (here are some comments): Warning: The field cfg.clusterstatistic is unused, it will be removed from your configuration The field cfg.clusteralpha is unused, it will be removed from your configuration The field cfg.clustertail is unused, it will be removed from your configuration and at the end of randomization: not performing a correction for multiple comparisons Any idea? Marco -------------- next part -------------- An HTML attachment was scrubbed... URL: From matt.mollison at gmail.com Fri Mar 25 17:26:59 2011 From: matt.mollison at gmail.com (Matt Mollison) Date: Fri, 25 Mar 2011 10:26:59 -0600 Subject: [FieldTrip] PLV analysis clarification In-Reply-To: References: <00F172BC-AB16-4BE2-8BCE-1A22A78AB595@donders.ru.nl> Message-ID: Hi Marco, Could it be that you didn't define cfg.channel, cfg.latency, and cfg.frequency? (and cfg.avgoverfreq—unless, is there a way to run a cluster analysis across multiple frequencies?) It seems to me that for a cluster analysis on plv data you need to rename the 'plvspctrm' field to 'cohspctrm' and define cfg.channel with the format {'channel - cohrefchannel'} (should be how it was input in the original ft_freqanalysis function). Hope that helps. Matt On Fri, Mar 25, 2011 at 10:09 AM, BrainBalance Solutions wrote: > Hi there, > I'm trying to perform the same analysis and the trick Jan give to tranform > the pvlspctrm to powerspctrm and labels give me the ability to compute the > grandaverage. > But now I'm trying to do a cluster analysis and if I give this simple > script: > > load GApun; > load GArew; > > cfg = []; > cfg.method = 'montecarlo'; > cfg.statistic = 'depsamplesT'; > cfg.correctm = 'cluster'; > cfg.clusteralpha = 0.05; > cfg.clusterstatistic = 'maxsum'; > cfg.minnbchan = 2; > cfg.tail = 0; > cfg.clustertail = 0; > cfg.alpha = 0.025; > cfg.numrandomization = 500; > > subj = 40; > design = zeros(2,2*subj); > for i = 1:subj > design(1,i) = i; > end > for i = 1:subj > design(1,subj+i) = i; > end > design(2,1:subj) = 1; > design(2,subj+1:2*subj) = 2; > > cfg.design = design; > cfg.uvar = 1; > cfg.ivar = 2; > > [stat] = ft_freqstatistics(cfg, GApun, GArew); > > > > I have this error: > ??? Undefined function or variable "sens". > > Error in ==> ft_neighbourselection at 95 > if ~isstruct(sens) > > Error in ==> statistics_wrapper at 241 > cfg.neighbours = ft_neighbourselection(cfg,varargin{1}); > > Error in ==> ft_freqstatistics at 127 > [stat, cfg] = statistics_wrapper(cfg, varargin{:}); > > Error in ==> calcoloStudent at 31 > [stat] = ft_freqstatistics(cfg, GApun, GArew); > > > > Following the errors I've found that the problem is in: > cfg.correctm = 'cluster'; > > If I comment it some analysis are done, but I think that clusters are > skipped (here are some comments): > > Warning: The field cfg.clusterstatistic is unused, it will be removed from > your > configuration > The field cfg.clusteralpha is unused, it will be removed from your > configuration > The field cfg.clustertail is unused, it will be removed from your > configuration > > and at the end of randomization: > not performing a correction for multiple comparisons > > > Any idea? > > Marco > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -------------- next part -------------- An HTML attachment was scrubbed... URL: From marco.rotonda at gmail.com Fri Mar 25 18:10:50 2011 From: marco.rotonda at gmail.com (Marco Rotonda) Date: Fri, 25 Mar 2011 18:10:50 +0100 Subject: [FieldTrip] PLV analysis clarification In-Reply-To: References: <00F172BC-AB16-4BE2-8BCE-1A22A78AB595@donders.ru.nl> Message-ID: Thanks Matt > Could it be that you didn't define cfg.channel, cfg.latency, and cfg.frequency? but that options shouldn't take the default (all) value if aren't specified? > (and cfg.avgoverfreq—unless, is there a way to run a cluster analysis across multiple frequencies?) > It seems to me that for a cluster analysis on plv data you need to rename the 'plvspctrm' field to 'cohspctrm' and define cfg.channel with the format {'channel - cohrefchannel'} that's almost the trick I did following Jan suggestion: rename plvspctrm into powspctrm and create a label-field, e.g. by for i =1:size(data_conn.labelcmb,1) data_conn.label{k} = [data_conn.labelcmb{i,1},'_',data_conn.labelcmb{i,2}]; end (and remove the labelcmb field) btw I added all the cfg you suggested and the cfg.avgoverfreq but I'm getting the same error... Marco From matt.mollison at gmail.com Fri Mar 25 18:36:18 2011 From: matt.mollison at gmail.com (Matt Mollison) Date: Fri, 25 Mar 2011 11:36:18 -0600 Subject: [FieldTrip] PLV analysis clarification In-Reply-To: References: <00F172BC-AB16-4BE2-8BCE-1A22A78AB595@donders.ru.nl> Message-ID: Hi Marco, Oh right, there are some idiosyncrasies that I've found. When you have a field called 'cohspctrm' then any statistics analysis (cluster, t-test, etc.) wants a labelcmb field like is originally output from ft_connectivityanalysis, not a hacked label field. This is because ft_freqstatistics creates the {'E1 - E2'} label field on its own in the for loop at line 108, but this is ONLY in the case of cohspctrm (see the if statement at line 102). Therefore it seems that you need to specify cfg.channel={'E1 - E2'} because this is the channel match that it's going to look for. I don't know what happens in a cluster analysis if you don't specify cfg.channel with coherence data—there can be a lot of channel combinations if you've got a full set (e.g., 129 channels is 8256 pairwise combinations). I also don't know what is technically happening if you've only computed coherence between a few channels. If you're didn't output 'coh' from ft_connectivityanalysis and you kept the field name (e.g., output 'plv' and therefore you have 'plvspctrm'), then the statistics function will take the hacked label field (e.g., {'E1 - E2'}) because it falls down to the elseif statement at line 116. And of course, if you want the grand average (e.g., for looking at a grand average plot) then you need to have the hacked label field. This is all quite confusing. Would really appreciate some insight from someone who has been successful at doing coherence/plv analyses... Matt On Fri, Mar 25, 2011 at 11:10 AM, Marco Rotonda wrote: > Thanks Matt > > > Could it be that you didn't define cfg.channel, cfg.latency, and > cfg.frequency? > > but that options shouldn't take the default (all) value if aren't > specified? > > > > (and cfg.avgoverfreq—unless, is there a way to run a cluster analysis > across multiple frequencies?) > > > It seems to me that for a cluster analysis on plv data you need to rename > the 'plvspctrm' field to 'cohspctrm' and define cfg.channel with the format > {'channel - cohrefchannel'} > > that's almost the trick I did following Jan suggestion: > > rename plvspctrm into powspctrm and create a label-field, e.g. by for i > =1:size(data_conn.labelcmb,1) data_conn.label{k} = > [data_conn.labelcmb{i,1},'_',data_conn.labelcmb{i,2}]; end (and remove the > labelcmb field) > > > btw I added all the cfg you suggested and the cfg.avgoverfreq but I'm > getting the same error... > > Marco > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Fri Mar 25 20:08:14 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Fri, 25 Mar 2011 20:08:14 +0100 Subject: [FieldTrip] PLV analysis clarification In-Reply-To: References: <00F172BC-AB16-4BE2-8BCE-1A22A78AB595@donders.ru.nl> Message-ID: <4B34B6AA-630E-416A-8525-F395374FF967@donders.ru.nl> Hi Matt, Marco and others, In the following I will address some issues which occurred earlier in this thread and try to also address the stuff that has come up since. Here's my 2 cents: As Matt and others already found out to their frustration, there is no straightforward way (in terms of how fieldtrip can handle the data) to carry out a statistical test (across a group of subjects) on data, which is the output of ft_connectivityanalysis. I will not talk about single subject analyses, but I sensed some confusion here and there, in that the 'statfun_indepsamplesZcoh' occasionally popped up. This is essentially indeed a function allowing to compute significance of coherence differences within a single subject. Let's return to the statistics across a group case. The dirty hack I proposed a while ago in principle should work, but I could imagine that it doesn't work flawlessly, and it may need some fine-tuning. Having said this, in the past some functionality was built in to actually apply this dirty trick but only specifically so on coherence data, i.e. the data field called 'cohspctrm'. Internally in the ft_freqstatistics code, the field 'label' was created, in which each element consisted of a concatenation of 2 label strings, e.g. {'E1 - E2'}. The reason why other metrics are not supported, is that the aforementioned functionality was built in long before the existence of ft_connectivityanalysis, at the time we were mostly doing coherence analysis. As such, there is no principled reason why fieldtrip should not support similar functionality for other connectivity metrics, and it's certainly on the developers' to-do list (in this case: my to-do list). On a related note, once one manages to 'fool' freqstatistics (or if one would like to do a more traditional analysis with freqstatistics) and wants to apply clustering in the channel dimension, fieldtrip needs to know which channels are neighbours of each other. For this, the cfg structure needs to have a field called cfg.neighbours, and if this does not exist, fieldtrip tries to create one on the fly, based on the specification of the positions of the channels. This information is always stored (if known) in the data field called grad (for MEG), or elec (for EEG). Apparently, Marco's data does not contain this field, most likely causing the error he reported in an earlier message. This does not mean that one cannot do clustering in this case. It just means that one has to create the neighbourhood structure between the channels on his own. There's surely some documentation about this on the wiki, so I don't want to enter into details about this here. If one now has scalp level estimates of connectivity between channel pairs, the clustering over channels may in principle be done (but not yet in fieldtrip as far as I am aware), since the channel dimension is now not just defined in 2D (as a projection of the channels onto a plane), but in 4-dimensional space. So in such a case one needs to specify an empty neighbourhood structure, i.e. cfg.neighbours{k}.label = data.label{k} and cfg.neighbours{k}.neighblabel = {} (where k is the k'th label in the (in this case) bivariate data, see above. Fieldtrip then still allows for clustering over frequencies and time. Then it is of course the question as to how to generate the connectivity data in order to optimally fool ft_freqstatistics, and one level higher in the analysis pipeline, it relates to how ft_freqanalysis should behave. Let me start from the top, and use coherence as an example. Coherence essentially is the frequency domain version of the cross-correlation function and as such is constructed from the frequency domain representation of the time series. Analogous to the correlation which is the covariance between two signals, normalised with the variance of the two respective signals, the coherence is the cross-spectral density between two signals, normalised with the power of the two respective signals, at frequency X. The correlation can be loosely seen as a multiplication between two time domain signals, the cross-spectral density is obtained by (conjugate) multiplication between the frequency domain representation of those two signals. This essentially is related to the two different (relevant) outputs ft_freqanalysis will provide. Cfg.output = 'fourier' provides the fourier transforms of the time domain signals, and cfg.output='powandcsd' provides the cross-spectral density between a specified set of channel combinations, and you get the power spectra for free. Both versions allow for the coherence to be computed but the memory requirements at this stage differs. For 'fourier' data the dimensionality of the fourierspctrm = 'rpttap_chan_freq_time' (by force the single replicates are kept in memory, because replicates may only be averaged once the fourierspectra are multiplied (yielding auto- and cross-spectra). For 'powandcsd' data the dimensionality of crsspctrm is either 'chan_freq_time', or 'rpt_chan_freq_time'. Averaging across replicates is now possible (when cfg.keeptrials = 'no' before calling ft_freqanalysis) (since the multiplication is now performed), yet the 'chan' dimension now represents channel combinations, which in the case of cfg.channelcmb = {'all' 'all'} leads to (N-1)*N/2 channel combinations. This typically leads to a much higher memory usage, particularly because for some connectivity metrics (such as plv) one needs to process the single replicates before computing the plv, requiring cfg.keeptrials to be 'yes' prior to calling ft_freqanalysis. Therefore I would advocate the use of cfg.method = 'fourier', as long as the number of trials and tapers is not too big. Next, ft_connectivityanalysis can be called, using the freq data with fourier. One can actually specify a cfg.channelcmb at this stage, which makes sense if not all combinations are needed, or if the requested connectivity metric is symmetric, such as coherence. This could be the trick Matt is waiting for, i.e. run ft_freqanalysis with output='fourier', and specify cfg.channelcmb = {'all' 'all'} before calling ft_connectivityanalysis. Alternatively, you could do a reshape on the plvspctrm, and keep only the interesting non-duplicated pairs, e.g. indx = reshape(1:length(conn.label).^2,[length(conn.label) length(conn.label]); indx = tril(indx,-1); plvspctrm = reshape(plvspctrm, [length(conn.label) length(conn.label) length(conn.freq) length(conn.time)]); plvspctrm = plvspctrm(indx(:),:,:); label = label(indx); label in this case is the processed labelcmb field. I hope that this will be of any help. Jan-Mathijs On Mar 23, 2011, at 11:30 PM, Matt Mollison wrote: > Dear Jan-Mathijs, > > Thanks for your reply. I know my post was a large one. I have two > further questions that are borne out in more detail below: 1) how > would one do connectivity analyses with 'fourier' data (the issue > for "next time")? and 2) what's the difference between using > 'powandcsd' and 'fourier'? > > 1. I'm still confused about the last case that you said to keep for > next time (cfg.method='mtmconvol', cfg.output='fourier'). > How do FT users run ft_freqstatistics on ft_connectivityanalysis > data (processed as output='fourier') in a within-subjects experiment > if the stats throw an error because of "chan_chan" in dimord? It > seems like one must reshape plvspctrm/cohspctrm and modify dimord. > However, for me, reshaping plvspctrm produces a dimension that is > more than twice as large as it should be. > size(data_conn.plvspctrm)=129 129 9 33 (i.e., > chan_chan_freq_time) > If I then reshape with > siz = size(data_conn.plvspctrm); > size(reshape(data_conn.plvspctrm,siz(1)*siz(2),siz(3),siz(4))) = > 16641 9 33 > and (16641-129)/2 = 8256, which are the nchoosek(129,2)=8256 channel > combinations that I *should* have. So it seems that > ft_connectivityanalysis is producing duplicate channel combinations > (i.e., 'E1_E2' and 'E2_E1' when those should be equal) plus auto- > correlations ('E1_E1'), and making some imagesc plots of the data > confirms this. > People here are surely running PLV/coherence analyses (there have > been questions about single-subject analyses with > statfun_indepsamplesZcoh, which requires fourier input), so there > must be a way to use fourier input. > > The only thing I can figure is to instead use cfg.output='powandcsd' > and implement the label-field creation trick you suggested. However, > this doesn't seem like it's the only option because > statfun_indepsamplesZcoh requires 'fourier'. Nonetheless, I tried > using 'powandcsd' with the label trick and I was able to run > ft_freqstatistics (finally!! doing both a t-test and a > clusteranalysis), but it seems like FT could/should deal with the > issue more elegantly instead of needing the trick. Maybe all coh/plv > analyses ever done with FT have required this hack and maybe the > correct reshape for fourier data still needs to be implemented, both > of which are completely fine with me, but in that case I'm curious > what hacks other people are using. > > 2. Despite being successful with powandcsd data, I still can't > figure out how to use fourier data. That leads me to ask, what's the > functional different between fourier and powandcsd output? Or > rather, what can/can't I do with complex Fourier spectra? Will FT > perform "better" (faster?) with one or the other? Are they used in > different situations (it seems like I should be able to use either > for PLV/coherence, especially since statfun_indepsamplesZcoh > requires fourier)? If I also want to look at power, can I calculate > it from the complex Fourier spectra? Sorry for my lack of knowledge > in this department. > > Thanks again for all the information. > Matt > > > On Wed, Mar 16, 2011 at 2:25 AM, jan-mathijs schoffelen > wrote: > Dear Matt, > > As usual, thanks for your detailed report (although one also > shouldn't exaggerate ;o) ). > Reading your mail and attachment, it seems there are several > features/problems in the code that restrict your analysis. > In the following, I pasted your script and will provide some comments > > ================================================================= > cfg_freq.method = 'wavelet'; > cfg_freq.output = 'powandcsd'; > cfg_freq.channelcmb = {'all','all'}; % 129 channels > > -------------------------------------- > ft_freqanalysis > data_freq = > label: {129x1 cell} > dimord: 'chan_freq_time' > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > powspctrm: [129x9x33 double] > labelcmb: {8256x2 cell} > crsspctrm: [8256x9x33 double] > cfg: [1x1 struct] > > ft_connectivityanalysis with 'plv' > data_conn = > labelcmb: {8256x2 cell} > dimord: 'chan_freq_time' > plvspctrm: [8256x9x33 double] > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > cfg: [1x1 struct] > > -------------------------------------- > FAILURE: can't run ft_freqgrandaverage on data_conn because there is > no label field > > This has indeed been noted by you and posted on bugzilla. We didn't > find time to work on it yet, but as a general remark > ft_freqgrandaverage (and ft_timelockgrandaverage and > ft_sourcegrandaverage) were designed to work on univariate data > only, i.e. it fails on data which comes out of > ft_connectivityanalysis. As such there is no other reason for it > than a historical one (the averaging functions were there long > before we started doing serious connectivity stuff). Of course it > should be possible to combine the data into one structure and do > statistics later on, although I guess the clustering in the channel > dimension becomes really complicated. Note, also that I pointed out > to you that as such ft_XXXgrandaverage is not mandatory before > calling ft_XXXstatistics, you can also input a cell-array of data > structures. Yet, this will not help you because then you probably > encounter a crash later on. > > SOLUTION for now: rename plvspctrm into powspctrm and create a label- > field, e.g. by for i =1:size(data_conn.labelcmb,1) > data_conn.label{k} = [data_conn.labelcmb{i, > 1},'_',data_conn.labelcmb{i,2}]; end (and remove the labelcmb field) > > > > -------------------------------------- > FAILURE: can't run ft_singleplotTFR on data_conn > > cfg_ft.cohrefchannel = 'E3'; > cfg_ft.channel = 'E60'; > selected 1408 channels for plvspctrm > ??? Error using ==> ft_channelselection at 72 > data with non-unique channel names is not supported > > Error in ==> ft_singleplotTFR at 290 > selchannel = ft_channelselection(cfg.channel, data.label); > > The plotting functions keep haunting me. I thought that with my > recent overhaul I made them somewhat more robust for plotting > connectivity data. > It would be helpful if you create a bug out of this specific > section, and add an attachment containing data_conn, and cfg_ft) > > -------------------------------------- > FAILURE: can't run ft_topoplotTFR on data_conn > > creating layout from data.elec > creating layout for egi128 system > selected 1408 channels for plvspctrm > Warning: Duplicate x-y data points detected: using average of the z > values. > > In griddata at 108 > In ft_plot_topo at 146 > In ft_topoplotER at 747 > In ft_topoplotTFR at 116 > ??? Error using ==> griddata at 122 > Not enough unique sample points specified. > > Error in ==> ft_plot_topo at 146 > [Xi,Yi,Zi] = griddata(chanX', chanY, dat, xi', yi, interpmethod); % > interpolate the topographic data > > Error in ==> ft_topoplotER at 747 > > ft_plot_topo > (chanX,chanY,datavector,'interpmethod',cfg.interpolation,... > > Error in ==> ft_topoplotTFR at 116 > cfg=ft_topoplotER(cfg, varargin{:}); > ================================================================= > ================================================================= > > You requested only a single pair to be plotted (1 cohrefchannel and > 1 channel). A topography does not makes sense. FieldTrip does not > detect this, but the low-level interpolation function starts > complaining. > > SOLUTION: don't call ft_topoplotTFR if you want to look at 1 TFR > only, as specified by the cfg. In that case it should be possible to > specify cfg.interactive = 'yes', allowing you to toggle back and > forth between topographies and selected sensors. > > > ================================================================= > cfg_freq.method = 'wavelet'; > cfg_freq.output = 'fourier' > > cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; > cfg_freq.channel = unique(cfg_freq.channelcmb); > > have to set keeptapers to 'no' even though (as far as I know) there > are no tapers used in wavelets (see ft_freqanalysis line 313) > > cfg_freq.keeptrials = 'no'; > cfg_freq.keeptapers = 'no'; > > -------------------------------------- > ft_freqanalysis > data_freq = > label: {4x1 cell} > dimord: 'chan_freq_time' > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > fourierspctrm: [4x9x33 double] > cfg: [1x1 struct] > > -------------------------------------- > FAILURE: can't run ft_connectivityanalysis on data_freq because > there is no cumtapcnt field > > ??? Reference to non-existent field 'cumtapcnt'. > > Error in ==> ft_checkdata>fixcsd at 844 > sumtapcnt = [0;cumsum(data.cumtapcnt(:))]; > > Error in ==> ft_checkdata at 594 > data = fixcsd(data, cmbrepresentation, channelcmb); > > Error in ==> univariate2bivariate at 29 > data = ft_checkdata(data, 'cmbrepresentation', 'full'); > > Error in ==> ft_connectivityanalysis at 234 > [data, powindx, hasrpt] = univariate2bivariate(data, > 'fourierspctrm', 'crsspctrm', dtype, 'cmb', cfg.channelcmb); > ================================================================= > ================================================================= > > Thanks for noticing this. I never considered anybody to use the > wavelet method before calling ft_connectivityanalysis. Why would you > want to use it in the first place if there's mtmconvol ;o) ? > > SOLUTION: Don't use wavelet (and post a bug on bugzilla stating this > specific problem: output to waveletanalysis cannot be processed by > ft_connectivityanalysis). > > ================================================================= > > cfg_freq.method = 'mtmconvol'; > cfg_freq.output = 'powandcsd'; > cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; > cfg_freq.channel = unique(cfg_freq.channelcmb); > > > cfg_freq.keeptrials = 'no'; > cfg_freq.keeptapers = 'no'; > cfg_freq.taper = 'hanning'; > > -------------------------------------- > ft_freqanalysis > data_freq = > label: {4x1 cell} > dimord: 'chan_freq_time' > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > powspctrm: [4x9x33 double] > labelcmb: {4x2 cell} > crsspctrm: [4x9x33 double] > cumtapcnt: [173x9 double] > cfg: [1x1 struct] > > ft_connectivityanalysis with 'plv' > data_conn = > labelcmb: {4x2 cell} > dimord: 'chan_freq_time' > plvspctrm: [4x9x33 double] > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > cfg: [1x1 struct] > -------------------------------------- > FAILURE: can't run ft_freqgrandaverage on data_conn because there is > no label field > > > See above. > > -------------------------------------- > SUCCESS: ft_singleplotTFR successfully makes a plot > > > Hurrah > > > -------------------------------------- > FAILURE: can't run ft_freqstatistics on data_conn because there's no > label field > > ??? Reference to non-existent field 'label'. > > Error in ==> prepare_timefreq_data>forcedimord at 509 > output.label = input.label; > > Error in ==> prepare_timefreq_data at 87 > [remember{c}, hascrsspctrm] = forcedimord(varargin{c}); > > Error in ==> statistics_wrapper at 217 > [cfg, data] = prepare_timefreq_data(cfg, varargin{:}); > > Error in ==> ft_freqstatistics at 127 > [stat, cfg] = statistics_wrapper(cfg, varargin{:}); > ================================================================= > ================================================================= > > > See above > > ================================================================= > > cfg_freq.method = 'mtmconvol'; > cfg_freq.output = 'fourier'; > cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; > cfg_freq.channel = unique(cfg_freq.channelcmb); > > > cfg_freq.keeptrials = 'no'; > cfg_freq.keeptapers = 'no'; > cfg_freq.taper = 'hanning'; > > -------------------------------------- > ft_freqanalysis > data_freq = > label: {4x1 cell} > dimord: 'chan_freq_time' > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > fourierspctrm: [4x9x33 double] > cumtapcnt: [173x9 double] > cfg: [1x1 struct] > > -------------------------------------- > FAILURE: can't run ft_connectivityanalysis on data_freq > > ??? Subscripted assignment dimension mismatch. > > Error in ==> ft_checkdata>fixcsd at 851 > crsspctrm(p,:,:,m,k) = (tmpdat*tmpdat')./data.cumtapcnt(p); > > Error in ==> ft_checkdata at 594 > data = fixcsd(data, cmbrepresentation, channelcmb); > > Error in ==> univariate2bivariate at 29 > data = ft_checkdata(data, 'cmbrepresentation', 'full'); > > Error in ==> ft_connectivityanalysis at 234 > [data, powindx, hasrpt] = univariate2bivariate(data, > 'fourierspctrm', 'crsspctrm', dtype, 'cmb', cfg.channelcmb); > ================================================================= > > This seems to be a bug in ft_freqanalysis. It should be very > forbidden to run ft_freqanalysis with cfg.keeptrials = 'no' and > cfg.output = 'fourier'. Just doesn't make sense. Could you file > this as a bug please? > > > ================================================================= > ================================================================= > > cfg_freq.method = 'mtmconvol'; > cfg_freq.output = 'fourier'; > cfg_freq.channelcmb = {'E3','E60';'E3','E62';'E11','E60';'E11','E62'}; > cfg_freq.channel = unique(cfg_freq.channelcmb); > > > cfg_freq.keeptrials = 'yes'; > cfg_freq.keeptapers = 'yes'; > cfg_freq.taper = 'hanning'; > > -------------------------------------- > ft_freqanalysis > data_freq = > label: {4x1 cell} > dimord: 'rpttap_chan_freq_time' > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > fourierspctrm: [4-D double] > cumtapcnt: [173x9 double] > cfg: [1x1 struct] > > ft_connectivityanalysis with 'plv' > data_conn = > label: {4x1 cell} > dimord: 'chan_chan_freq_time' > plvspctrm: [4-D double] > freq: [2.9630 3.7037 4.4444 5.1852 5.9259 6.6667 7.4074 > 8.1481 8.8889] > time: [1x33 double] > dof: [173 173 173 173 173 173 173 173 173] > cfg: [1x1 struct] > > -------------------------------------- > FAILURE: can't run ft_freqgrandaverage on data_conn > > ??? Error using ==> ft_freqgrandaverage at 170 > unsupported dimord > > -------------------------------------- > SUCCESS: ft_singleplotTFR makes a plot > > -------------------------------------- > FAILURE: can't do ft_freqstatistics on data_conn because of > chan_chan in dimord > > ??? Error using ==> size > Dimension argument must be a positive integer scalar within indexing > range. > > Error in ==> prepare_timefreq_data>forcedimord at 540 > Nchan = size(output.dat, chandim); > > Error in ==> prepare_timefreq_data at 87 > [remember{c}, hascrsspctrm] = forcedimord(varargin{c}); > > Error in ==> statistics_wrapper at 217 > [cfg, data] = prepare_timefreq_data(cfg, varargin{:}); > > Error in ==> ft_freqstatistics at 127 > [stat, cfg] = statistics_wrapper(cfg, varargin{:}); > > Error in ==> mm_ft_ttestTFR at 228 > cfg_ana.(vs_str) = eval(sprintf('ft_freqstatistics(cfg_ft, > %s);',subj_str)); > ================================================================= > > Let's keep this one for the next time... > > Best, > > Jan-Mathijs > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From sklein at berkeley.edu Fri Mar 25 20:14:11 2011 From: sklein at berkeley.edu (Stanley Klein) Date: Fri, 25 Mar 2011 12:14:11 -0700 Subject: [FieldTrip] PLV analysis clarification In-Reply-To: <4B34B6AA-630E-416A-8525-F395374FF967@donders.ru.nl> References: <00F172BC-AB16-4BE2-8BCE-1A22A78AB595@donders.ru.nl> <4B34B6AA-630E-416A-8525-F395374FF967@donders.ru.nl> Message-ID: Thanks Jan for that detailed discussion. I'd like to just focus on issues regarding the PLV, the topic of recent discussion. Could someone discuss the present status of the phase locking value? I recall that when Lachaux et al. (1999) introduced it (I think it was them) I didn't understand what is the advantage of adding unit magnitude phasors. I would have thought that neglecting the magnitude of the phasor would give a noisier measure of coherence. Another worry is that the PLV includes the real part of the phasor which is contaminated by the volume conduction from the forward model. To avoid that contamination many people only look at the imaginary part (the aspect of PLV with 90 deg phase shift). The problem with the imaginary part is that one loses the information from the non-volume conduction real part. One also needs to consider the potential contamination due to the reference. So PLV is a topic on which care must be taken. I'm interested in the current thinking on these issues. thanks Stan On Fri, Mar 25, 2011 at 12:08 PM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: > Hi Matt, Marco and others, > > In the following I will address some issues which occurred earlier in this > thread and try to also address the stuff that has come up since. > > Here's my 2 cents: > > As Matt and others already found out to their frustration, there is no > straightforward way (in terms of how fieldtrip can handle the data) to carry > out a statistical test (across a group of subjects) on data, which is the > output of ft_connectivityanalysis. I will not talk about single subject > analyses, but I sensed some confusion here and there, in that the > 'statfun_indepsamplesZcoh' occasionally popped up. This is essentially > indeed a function allowing to compute significance of coherence differences > within a single subject. > Let's return to the statistics across a group case. The dirty hack I > proposed a while ago in principle should work, but I could imagine that it > doesn't work flawlessly, and it may need some fine-tuning. Having said this, > in the past some functionality was built in to actually apply this dirty > trick but only specifically so on coherence data, i.e. the data field called > 'cohspctrm'. Internally in the ft_freqstatistics code, the field 'label' was > created, in which each element consisted of a concatenation of 2 label > strings, e.g. {'E1 - E2'}. The reason why other metrics are not supported, > is that the aforementioned functionality was built in long before the > existence of ft_connectivityanalysis, at the time we were mostly doing > coherence analysis. As such, there is no principled reason why fieldtrip > should not support similar functionality for other connectivity metrics, and > it's certainly on the developers' to-do list (in this case: my to-do list). > On a related note, once one manages to 'fool' freqstatistics (or if one > would like to do a more traditional analysis with freqstatistics) and wants > to apply clustering in the channel dimension, fieldtrip needs to know which > channels are neighbours of each other. For this, the cfg structure needs to > have a field called cfg.neighbours, and if this does not exist, fieldtrip > tries to create one on the fly, based on the specification of the positions > of the channels. This information is always stored (if known) in the data > field called grad (for MEG), or elec (for EEG). Apparently, Marco's data > does not contain this field, most likely causing the error he reported in an > earlier message. This does not mean that one cannot do clustering in this > case. It just means that one has to create the neighbourhood structure > between the channels on his own. There's surely some documentation about > this on the wiki, so I don't want to enter into details about this here. > If one now has scalp level estimates of connectivity between channel pairs, > the clustering over channels may in principle be done (but not yet in > fieldtrip as far as I am aware), since the channel dimension is now not just > defined in 2D (as a projection of the channels onto a plane), but in > 4-dimensional space. So in such a case one needs to specify an empty > neighbourhood structure, i.e. cfg.neighbours{k}.label = data.label{k} and > cfg.neighbours{k}.neighblabel = {} (where k is the k'th label in the (in > this case) bivariate data, see above. Fieldtrip then still allows for > clustering over frequencies and time. > Then it is of course the question as to how to generate the connectivity > data in order to optimally fool ft_freqstatistics, and one level higher in > the analysis pipeline, it relates to how ft_freqanalysis should behave. Let > me start from the top, and use coherence as an example. Coherence > essentially is the frequency domain version of the cross-correlation > function and as such is constructed from the frequency domain representation > of the time series. Analogous to the correlation which is the covariance > between two signals, normalised with the variance of the two respective > signals, the coherence is the cross-spectral density between two signals, > normalised with the power of the two respective signals, at frequency X. The > correlation can be loosely seen as a multiplication between two time domain > signals, the cross-spectral density is obtained by (conjugate) > multiplication between the frequency domain representation of those two > signals. This essentially is related to the two different (relevant) outputs > ft_freqanalysis will provide. Cfg.output = 'fourier' provides the fourier > transforms of the time domain signals, and cfg.output='powandcsd' provides > the cross-spectral density between a specified set of channel combinations, > and you get the power spectra for free. > Both versions allow for the coherence to be computed but the memory > requirements at this stage differs. For 'fourier' data the dimensionality of > the fourierspctrm = 'rpttap_chan_freq_time' (by force the single replicates > are kept in memory, because replicates may only be averaged once the > fourierspectra are multiplied (yielding auto- and cross-spectra). For > 'powandcsd' data the dimensionality of crsspctrm is either 'chan_freq_time', > or 'rpt_chan_freq_time'. Averaging across replicates is now possible (when > cfg.keeptrials = 'no' before calling ft_freqanalysis) (since the > multiplication is now performed), yet the 'chan' dimension now represents > channel combinations, which in the case of cfg.channelcmb = {'all' 'all'} > leads to (N-1)*N/2 channel combinations. This typically leads to a much > higher memory usage, particularly because for some connectivity metrics > (such as plv) one needs to process the single replicates before computing > the plv, requiring cfg.keeptrials to be 'yes' prior to calling > ft_freqanalysis. Therefore I would advocate the use of cfg.method = > 'fourier', as long as the number of trials and tapers is not too big. > Next, ft_connectivityanalysis can be called, using the freq data with > fourier. One can actually specify a cfg.channelcmb at this stage, which > makes sense if not all combinations are needed, or if the requested > connectivity metric is symmetric, such as coherence. This could be the trick > Matt is waiting for, i.e. run ft_freqanalysis with output='fourier', and > specify cfg.channelcmb = {'all' 'all'} before calling > ft_connectivityanalysis. Alternatively, you could do a reshape on the > plvspctrm, and keep only the interesting non-duplicated pairs, e.g. indx = > reshape(1:length(conn.label).^2,[length(conn.label) length(conn.label]); > indx = tril(indx,-1); plvspctrm = reshape(plvspctrm, [length(conn.label) > length(conn.label) length(conn.freq) length(conn.time)]); plvspctrm = > plvspctrm(indx(:),:,:); label = label(indx); label in this case is the > processed labelcmb field. > > I hope that this will be of any help. > > Jan-Mathijs > -------------- next part -------------- An HTML attachment was scrubbed... URL: From TAVABIK at email.chop.edu Mon Mar 28 20:59:36 2011 From: TAVABIK at email.chop.edu (Tavabi, Kambiz) Date: Mon, 28 Mar 2011 14:59:36 -0400 Subject: [FieldTrip] working with neuromag data Message-ID: Greetings - I have preprocessed/averaged neuromag data for a group of subjects that I'd like to visualize, compute grandaverage and carry out sensor level statistics on. The only help I managed to find on the Fieldtrip site/list Re: neurmag data concerns getting started e.g., with ft_read_header and ft_read_data. In my case these programs work fine meaning that I can proceed with further analysis. On a side, in my limited experience with FT, a major problem I run into frequently is that there is no clear suggestion(s) on how to proceed with data that is not raw. I understand it is impossible to cover all analysis scenarios, but it is often the case that working with CTF, or in particular Elekta system, the data is likely to be in a post-preprocessed phase. Everytime I've tried to work with ft, It seems to me that if I don't start with square one in fieldtrip, it is difficult to figure out how to use downstream programs to work on the data. That said, in my case I have the output from ft_read_header: label: {338x1 cell} nChans: 338 Fs: 1000 grad: [1x1 struct] unit: {1x338 cell} nSamples: 651 nSamplesPre: 100 nTrials: 6 orig: [1x1 struct] and output from ft_read_data [338x651x6] that being channels by samples by number of stimulus averaged epochs. To proceed, ideally I'd like to compute a grandaverage for each condition, visualize them in a multiplot, and carry out sensor level stats. To be able to do this I understand I need the output from ft_timelockanalysis, how do I arrange my data as such? I am assuming it is already in that state. Thanks for your time. -Kambiz. ------------------------------------------------------------- Kambiz Tavabi PhD Biomedical Imaging Laboratory The Children's Hospital of Philadelphia 34th Street and Civic Center Boulevard Philadelphia, Pa. 19104 Tel: 267.426.0302 email: tavabik at email.chop.edu ------------------------------------------------------------- From a.stolk at fcdonders.ru.nl Mon Mar 28 22:05:41 2011 From: a.stolk at fcdonders.ru.nl (Stolk, A.) Date: Mon, 28 Mar 2011 22:05:41 +0200 (CEST) Subject: [FieldTrip] working with neuromag data In-Reply-To: <1461047266.305819.1301342635502.JavaMail.root@sculptor.zimbra.ru.nl> Message-ID: <1581885567.305836.1301342741076.JavaMail.root@sculptor.zimbra.ru.nl> Dear Kambiz, While you are able to use the 'low level' ft_read_header and ft_read_data functions, you should be able to preprocess and analyze your neuromag data using the 'high level' functions such as ft_preprocessing (which calls the low level functions mentioned above). How to proceed depends on what you want to do with your data. If you have triggers stored in your dataset that are synchronuous with the recorded brain activity, it'd be recommended to start with the following tutorial on how to select your trials: http://fieldtrip.fcdonders.nl/tutorial/preprocessing Since your experience with FT is still limited as you say, I believe the following text may provide a good overview of what the data, once read in to FT (i.e. matlab) environment, may look like: http://fieldtrip.fcdonders.nl/walkthrough Typically, your next steps involve single-subject timelocked analysis, then grand-average and perform statistics at the group level. For an overview of the steps and protocols, see: http://fieldtrip.fcdonders.nl/tutorial/analysis_protocols Hope this has helped for a start, Arjen ----- "Kambiz Tavabi" schreef: > Van: "Kambiz Tavabi" > Aan: "Email discussion list for the FieldTrip project" > Verzonden: Maandag 28 maart 2011 20:59:36 > Onderwerp: [FieldTrip] working with neuromag data > > Greetings - I have preprocessed/averaged neuromag data for a group of > subjects that I'd like to visualize, compute grandaverage and carry > out sensor level statistics on. The only help I managed to find on the > Fieldtrip site/list Re: neurmag data concerns getting started e.g., > with ft_read_header and ft_read_data. In my case these programs work > fine meaning that I can proceed with further analysis. > On a side, in my limited experience with FT, a major problem I run > into frequently is that there is no clear suggestion(s) on how to > proceed with data that is not raw. I understand it is impossible to > cover all analysis scenarios, but it is often the case that working > with CTF, or in particular Elekta system, the data is likely to be in > a post-preprocessed phase. Everytime I've tried to work with ft, It > seems to me that if I don't start with square one in fieldtrip, it is > difficult to figure out how to use downstream programs to work on the > data. > That said, in my case I have the output from ft_read_header: > > label: {338x1 cell} > nChans: 338 > Fs: 1000 > grad: [1x1 struct] > unit: {1x338 cell} > nSamples: 651 > nSamplesPre: 100 > nTrials: 6 > orig: [1x1 struct] > > and output from ft_read_data > > [338x651x6] that being channels by samples by number of stimulus > averaged epochs. To proceed, ideally I'd like to compute a > grandaverage for each condition, visualize them in a multiplot, and > carry out sensor level stats. To be able to do this I understand I > need the output from ft_timelockanalysis, how do I arrange my data as > such? I am assuming it is already in that state. Thanks for your > time. > > -Kambiz. > ------------------------------------------------------------- > Kambiz Tavabi PhD > Biomedical Imaging Laboratory > The Children's Hospital of Philadelphia > 34th Street and Civic Center Boulevard > Philadelphia, Pa. 19104 > Tel: 267.426.0302 > email: tavabik at email.chop.edu > ------------------------------------------------------------- > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From TAVABIK at email.chop.edu Tue Mar 29 01:10:14 2011 From: TAVABIK at email.chop.edu (Tavabi, Kambiz) Date: Mon, 28 Mar 2011 19:10:14 -0400 Subject: [FieldTrip] working with neuromag data In-Reply-To: <1581885567.305836.1301342741076.JavaMail.root@sculptor.zimbra.ru.nl> References: <1461047266.305819.1301342635502.JavaMail.root@sculptor.zimbra.ru.nl>, <1581885567.305836.1301342741076.JavaMail.root@sculptor.zimbra.ru.nl> Message-ID: Dear Arjen - Thanks for your response. Just to clarify the low level functions ft_read_header & ft_read_data are mentioned in the ft getting started tutorial. I believe they're recommended to make sure the data is ft friendly. In my case the data is ft friendly. My data is also pre-processed and already 'time-locked'--meaning that I have stimulus averaged epoch data in fif format for all my subjects. My question is how to proceed from there? I've been through the pages you refer to but have not been able to piece together my data in such a way to proceed with grand-averaging and carrying out stats. -Kambiz. ------------------------------------------------------------- Kambiz Tavabi PhD Biomedical Imaging Laboratory The Children's Hospital of Philadelphia 34th Street and Civic Center Boulevard Philadelphia, Pa. 19104 Tel: 267.426.0302 email: tavabik at email.chop.edu ------------------------------------------------------------- ________________________________________ From: fieldtrip-bounces at donders.ru.nl [fieldtrip-bounces at donders.ru.nl] On Behalf Of Stolk, A. [a.stolk at fcdonders.ru.nl] Sent: Monday, March 28, 2011 4:05 PM To: Email discussion list for the FieldTrip project Subject: Re: [FieldTrip] working with neuromag data Dear Kambiz, While you are able to use the 'low level' ft_read_header and ft_read_data functions, you should be able to preprocess and analyze your neuromag data using the 'high level' functions such as ft_preprocessing (which calls the low level functions mentioned above). How to proceed depends on what you want to do with your data. If you have triggers stored in your dataset that are synchronuous with the recorded brain activity, it'd be recommended to start with the following tutorial on how to select your trials: http://fieldtrip.fcdonders.nl/tutorial/preprocessing Since your experience with FT is still limited as you say, I believe the following text may provide a good overview of what the data, once read in to FT (i.e. matlab) environment, may look like: http://fieldtrip.fcdonders.nl/walkthrough Typically, your next steps involve single-subject timelocked analysis, then grand-average and perform statistics at the group level. For an overview of the steps and protocols, see: http://fieldtrip.fcdonders.nl/tutorial/analysis_protocols Hope this has helped for a start, Arjen ----- "Kambiz Tavabi" schreef: > Van: "Kambiz Tavabi" > Aan: "Email discussion list for the FieldTrip project" > Verzonden: Maandag 28 maart 2011 20:59:36 > Onderwerp: [FieldTrip] working with neuromag data > > Greetings - I have preprocessed/averaged neuromag data for a group of > subjects that I'd like to visualize, compute grandaverage and carry > out sensor level statistics on. The only help I managed to find on the > Fieldtrip site/list Re: neurmag data concerns getting started e.g., > with ft_read_header and ft_read_data. In my case these programs work > fine meaning that I can proceed with further analysis. > On a side, in my limited experience with FT, a major problem I run > into frequently is that there is no clear suggestion(s) on how to > proceed with data that is not raw. I understand it is impossible to > cover all analysis scenarios, but it is often the case that working > with CTF, or in particular Elekta system, the data is likely to be in > a post-preprocessed phase. Everytime I've tried to work with ft, It > seems to me that if I don't start with square one in fieldtrip, it is > difficult to figure out how to use downstream programs to work on the > data. > That said, in my case I have the output from ft_read_header: > > label: {338x1 cell} > nChans: 338 > Fs: 1000 > grad: [1x1 struct] > unit: {1x338 cell} > nSamples: 651 > nSamplesPre: 100 > nTrials: 6 > orig: [1x1 struct] > > and output from ft_read_data > > [338x651x6] that being channels by samples by number of stimulus > averaged epochs. To proceed, ideally I'd like to compute a > grandaverage for each condition, visualize them in a multiplot, and > carry out sensor level stats. To be able to do this I understand I > need the output from ft_timelockanalysis, how do I arrange my data as > such? I am assuming it is already in that state. Thanks for your > time. > > -Kambiz. > ------------------------------------------------------------- > Kambiz Tavabi PhD > Biomedical Imaging Laboratory > The Children's Hospital of Philadelphia > 34th Street and Civic Center Boulevard > Philadelphia, Pa. 19104 > Tel: 267.426.0302 > email: tavabik at email.chop.edu > ------------------------------------------------------------- > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From a.stolk at fcdonders.ru.nl Tue Mar 29 10:20:35 2011 From: a.stolk at fcdonders.ru.nl (Stolk, A.) Date: Tue, 29 Mar 2011 10:20:35 +0200 (CEST) Subject: [FieldTrip] working with neuromag data In-Reply-To: <717208384.308488.1301386421578.JavaMail.root@sculptor.zimbra.ru.nl> Message-ID: <887659131.308634.1301386835573.JavaMail.root@sculptor.zimbra.ru.nl> Dear Kambiz, I think I see your point. Your data presumably is already preprocessed and timelocked (averaged over trials) with neuromag software. I then take it that you have 6 different conditions which you would like to plot separately and possibly test at the group level. Since the data is already averaged, I'd recommend to do the following to get your data back on track. 1) ft_preprocessing on your stimulus averaged epoch data. This should give you a data structure with 6 trials (which are actually the averages per condition). 2) ft_timelockanalysis with cfg.trials = 1 (2,3..until 6). And repeat this so you end up with 6 timelocked structures representing the 6 different conditions. 3) plot or grandaverage (see tutorials how to proceed as your data now should be 'ft-friendly'). Goodluck, Arjen ----- "Kambiz Tavabi" schreef: > Van: "Kambiz Tavabi" > Aan: "Email discussion list for the FieldTrip project" > Verzonden: Dinsdag 29 maart 2011 01:10:14 > Onderwerp: Re: [FieldTrip] working with neuromag data > > Dear Arjen - Thanks for your response. Just to clarify the low level > functions ft_read_header & ft_read_data are mentioned in the ft > getting started tutorial. I believe they're recommended to make sure > the data is ft friendly. In my case the data is ft friendly. My data > is also pre-processed and already 'time-locked'--meaning that I have > stimulus averaged epoch data in fif format for all my subjects. My > question is how to proceed from there? I've been through the pages you > refer to but have not been able to piece together my data in such a > way to proceed with grand-averaging and carrying out stats. > -Kambiz. > ------------------------------------------------------------- > Kambiz Tavabi PhD > Biomedical Imaging Laboratory > The Children's Hospital of Philadelphia > 34th Street and Civic Center Boulevard > Philadelphia, Pa. 19104 > Tel: 267.426.0302 > email: tavabik at email.chop.edu > ------------------------------------------------------------- > ________________________________________ > From: fieldtrip-bounces at donders.ru.nl > [fieldtrip-bounces at donders.ru.nl] On Behalf Of Stolk, A. > [a.stolk at fcdonders.ru.nl] > Sent: Monday, March 28, 2011 4:05 PM > To: Email discussion list for the FieldTrip project > Subject: Re: [FieldTrip] working with neuromag data > > Dear Kambiz, > > While you are able to use the 'low level' ft_read_header and > ft_read_data functions, you should be able to preprocess and analyze > your neuromag data using the 'high level' functions such as > ft_preprocessing (which calls the low level functions mentioned > above). > > How to proceed depends on what you want to do with your data. If you > have triggers stored in your dataset that are synchronuous with the > recorded brain activity, it'd be recommended to start with the > following tutorial on how to select your trials: > > http://fieldtrip.fcdonders.nl/tutorial/preprocessing > > Since your experience with FT is still limited as you say, I believe > the following text may provide a good overview of what the data, once > read in to FT (i.e. matlab) environment, may look like: > > http://fieldtrip.fcdonders.nl/walkthrough > > Typically, your next steps involve single-subject timelocked analysis, > then grand-average and perform statistics at the group level. For an > overview of the steps and protocols, see: > > http://fieldtrip.fcdonders.nl/tutorial/analysis_protocols > > Hope this has helped for a start, > > Arjen > > > ----- "Kambiz Tavabi" schreef: > > > Van: "Kambiz Tavabi" > > Aan: "Email discussion list for the FieldTrip project" > > > Verzonden: Maandag 28 maart 2011 20:59:36 > > Onderwerp: [FieldTrip] working with neuromag data > > > > Greetings - I have preprocessed/averaged neuromag data for a group > of > > subjects that I'd like to visualize, compute grandaverage and carry > > out sensor level statistics on. The only help I managed to find on > the > > Fieldtrip site/list Re: neurmag data concerns getting started e.g., > > with ft_read_header and ft_read_data. In my case these programs > work > > fine meaning that I can proceed with further analysis. > > On a side, in my limited experience with FT, a major problem I run > > into frequently is that there is no clear suggestion(s) on how to > > proceed with data that is not raw. I understand it is impossible to > > cover all analysis scenarios, but it is often the case that working > > with CTF, or in particular Elekta system, the data is likely to be > in > > a post-preprocessed phase. Everytime I've tried to work with ft, It > > seems to me that if I don't start with square one in fieldtrip, it > is > > difficult to figure out how to use downstream programs to work on > the > > data. > > That said, in my case I have the output from ft_read_header: > > > > label: {338x1 cell} > > nChans: 338 > > Fs: 1000 > > grad: [1x1 struct] > > unit: {1x338 cell} > > nSamples: 651 > > nSamplesPre: 100 > > nTrials: 6 > > orig: [1x1 struct] > > > > and output from ft_read_data > > > > [338x651x6] that being channels by samples by number of stimulus > > averaged epochs. To proceed, ideally I'd like to compute a > > grandaverage for each condition, visualize them in a multiplot, and > > carry out sensor level stats. To be able to do this I understand I > > need the output from ft_timelockanalysis, how do I arrange my data > as > > such? I am assuming it is already in that state. Thanks for your > > time. > > > > -Kambiz. > > ------------------------------------------------------------- > > Kambiz Tavabi PhD > > Biomedical Imaging Laboratory > > The Children's Hospital of Philadelphia > > 34th Street and Civic Center Boulevard > > Philadelphia, Pa. 19104 > > Tel: 267.426.0302 > > email: tavabik at email.chop.edu > > ------------------------------------------------------------- > > _______________________________________________ > > fieldtrip mailing list > > fieldtrip at donders.ru.nl > > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From Don.Rojas at ucdenver.edu Tue Mar 29 18:32:32 2011 From: Don.Rojas at ucdenver.edu (Rojas, Don) Date: Tue, 29 Mar 2011 10:32:32 -0600 Subject: [FieldTrip] problems with ft_dipolesimulation Message-ID: <2DD56803-916C-42DF-AB33-CF6728DE2DD0@ucdenver.edu> Dear Fieldtrippers, I'm having difficulties trying to construct a simulated dataset using ft_dipolesimulation. I am simulating using a 4D MEG sensor array, read in from an existing dataset (this dataset poses no particular problems when used in other FT routines, but I'm only using the headshape and the gradiometer location/orientation info for the headmodel and simulation anyway). The problem is that I am getting values of zero in all channels at all time points in the simulated set. No errors are generated, but there is a message about the RMS value of simulated data is 0 when ft_dipolesimulation is run - no surprise there. Here is my code: % read 4D file file = 'c,rfhp0.1Hz'; hdr = ft_read_header(file); hs = ft_read_headshape('hs_file'); % create a single sphere conductor model from 4D dataset cfg = []; cfg.grad = hdr.grad; cfg.headshape = hs.pnt; cfg.singlesphere = 'yes'; ft_sphere = ft_prepare_localspheres(cfg); % simulate a dipole cfg_sim.vol = ft_sphere; cfg_sim.grad = hdr.grad; cfg_sim.fsample = hdr.Fs; cfg_sim.relnoise = .1; cfg_sim.dip.frequency = 20; cfg_sim.dip.phase = pi/2; % 90 degree phase cfg_sim.triallength = 1; cfg_sim.ntrials = 50; cfg_sim.dip.pos = [0 -.05 .05]; % position in meters cfg_sim.dip.mom = [0 0 -1]'; sim = ft_dipolesimulation(cfg_sim); Also, I have run the script from the following example: http://fieldtrip.fcdonders.nl/example/compute_forward_simulated_data_and_apply_a_dipole_fit The simulated data in that example also has no data other than zeros in all channels. So, I don't think this is due to my code per se, which was adapted from that example. My MATLAB version is 2009b (maci64) and I've tried this in several FT versions, including the 20110328 version, all of which produce the same results. Any ideas? Don ----------------------- Don Rojas, Ph.D. Associate Professor of Psychiatry U. of Colorado Denver Anschutz Medical Campus Director, UCD Magnetoencephalography Lab 13001 E. 17th Pl F546 Aurora, CO 80045 USA 303-724-4994 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Don.Rojas at ucdenver.edu Tue Mar 29 18:58:11 2011 From: Don.Rojas at ucdenver.edu (Rojas, Don) Date: Tue, 29 Mar 2011 10:58:11 -0600 Subject: [FieldTrip] problems with ft_dipolesimulation References: <2DD56803-916C-42DF-AB33-CF6728DE2DD0@ucdenver.edu> Message-ID: <970A2014-FA6E-415C-831F-FBB98290B623@ucdenver.edu> To all: Regarding that last email, I think I found the problem. Line 187 of ft_dipolesimulation calls ft_compute_leadfield, which in my case returned all zeros, so that explains the zeroed data in the output. If I change that line to read: lf = ft_compute_leadfield(dippos{trial}, sens, vol,'reducerank',2); to reflect the fact that the input is gradiometer sensors, the simulation is correct. I'm thinking perhaps that code needs to detect the sensor type for input to ft_compute_leadfield. Thanks, Don Begin forwarded message: From: "Rojas, Don" > Date: March 29, 2011 10:32:32 AM MDT To: Email discussion list for the FieldTrip project > Subject: problems with ft_dipolesimulation Dear Fieldtrippers, I'm having difficulties trying to construct a simulated dataset using ft_dipolesimulation. I am simulating using a 4D MEG sensor array, read in from an existing dataset (this dataset poses no particular problems when used in other FT routines, but I'm only using the headshape and the gradiometer location/orientation info for the headmodel and simulation anyway). The problem is that I am getting values of zero in all channels at all time points in the simulated set. No errors are generated, but there is a message about the RMS value of simulated data is 0 when ft_dipolesimulation is run - no surprise there. Here is my code: % read 4D file file = 'c,rfhp0.1Hz'; hdr = ft_read_header(file); hs = ft_read_headshape('hs_file'); % create a single sphere conductor model from 4D dataset cfg = []; cfg.grad = hdr.grad; cfg.headshape = hs.pnt; cfg.singlesphere = 'yes'; ft_sphere = ft_prepare_localspheres(cfg); % simulate a dipole cfg_sim.vol = ft_sphere; cfg_sim.grad = hdr.grad; cfg_sim.fsample = hdr.Fs; cfg_sim.relnoise = .1; cfg_sim.dip.frequency = 20; cfg_sim.dip.phase = pi/2; % 90 degree phase cfg_sim.triallength = 1; cfg_sim.ntrials = 50; cfg_sim.dip.pos = [0 -.05 .05]; % position in meters cfg_sim.dip.mom = [0 0 -1]'; sim = ft_dipolesimulation(cfg_sim); Also, I have run the script from the following example: http://fieldtrip.fcdonders.nl/example/compute_forward_simulated_data_and_apply_a_dipole_fit The simulated data in that example also has no data other than zeros in all channels. So, I don't think this is due to my code per se, which was adapted from that example. My MATLAB version is 2009b (maci64) and I've tried this in several FT versions, including the 20110328 version, all of which produce the same results. Any ideas? Don ----------------------- Don Rojas, Ph.D. Associate Professor of Psychiatry U. of Colorado Denver Anschutz Medical Campus Director, UCD Magnetoencephalography Lab 13001 E. 17th Pl F546 Aurora, CO 80045 USA 303-724-4994 -------------- next part -------------- An HTML attachment was scrubbed... URL: From mcoskun at mail.uh.edu Wed Mar 30 07:44:09 2011 From: mcoskun at mail.uh.edu (Mehmet-Akif Coskun) Date: Wed, 30 Mar 2011 00:44:09 -0500 Subject: [FieldTrip] Dipole fitting error Message-ID: <707098a85823e.4d927cd9@mail.uh.edu> An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hm.jpg Type: image/jpeg Size: 49511 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ERF.jpg Type: image/jpeg Size: 59109 bytes Desc: not available URL: From loes.koelewijn at mq.edu.au Wed Mar 30 08:21:35 2011 From: loes.koelewijn at mq.edu.au (Loes Koelewijn) Date: Wed, 30 Mar 2011 17:21:35 +1100 Subject: [FieldTrip] cluster analysis on time courses from virtual channels Message-ID: Hi all, I have a question about group analysis statistics of my MEG study. I've made virtual sensors from group average images of an independent localiser run, created at several time windows, based on the group inversion. I then extracted dipole waveforms for all other conditions (6), for each subject (10), based on those virtual sensors (the study has a repeated measures design). I would now like to analyse group significance of any differences between these 6 time courses, over all time samples, corrected for multiple comparisons. I have tried to do this using FieldTrip's cluster based permutation test (Monte Carlo), independently for each virtual channel, by setting the neighbouring channels to 0. However, I get an error about the design matrix when running ft_timelockstatistics. Matlab's output is the following: selected 1 channels selected 251 time bins selected 1 frequency bins Using the gradiometer configuration from the dataset. there are on average 0.0 neighbours per channel using "statistics_montecarlo" for the statistical testing using "statfun_depsamplesT" for the single-sample statistics constructing randomized design total number of measurements = 60 total number of variables = 2 number of independent variables = 1 number of unit variables = 1 number of within-cell variables = 0 number of control variables = 0 using a permutation resampling approach repeated measurement in variable 2 over 6 levels number of repeated measurements in each level is 10 10 10 10 10 10 computing a parmetric threshold for clustering Error using ==> statfun_depsamplesT at 78 Invalid specification of the design array. ??? Error using ==> statistics_montecarlo at 217 could not determine the parametric critical value for clustering Error in ==> statistics_wrapper at 285 [stat, cfg] = statmethod(cfg, dat, cfg.design, 'issource',issource); Error in ==> ft_timelockstatistics at 117 [stat, cfg] = statistics_wrapper(cfg, varargin{:}); Could anybody help me in the direction of what is going wrong here? I wondered earlier if my data structures were incorrect, but these were created with ft_timelockgrandaverage, keeping the individual data. This is what I ran: [stat]=ft_timelockstatistics(cfg,cond1,cond2,cond3,cond4,cond5,cond6); cfg = channel: 'Occipital_Inf_RR_X' latency: [-0.2000 0.8000] method: 'montecarlo' statistic: 'depsamplesT' correctm: 'cluster' clusteralpha: 0.0500 clusterstatistic: 'maxsum' tail: 0 clustertail: 0 alpha: 0.0250 numrandomization: 500 design: [2x60 double] uvar: 2 ivar: 1 cfg.design is 2*60, with the first row (ivar) [1:10,1:10,1:10 etc], second row (uvar) [ones(1,10),ones(1,10)*2, etc]. I initially had ivar and uvar reversed, but I got the same error. And this is the format of each data structure: label: {'Occipital_Inf_RR_X'} fsample: 250 avg: [1x826 double] var: [1x826 double] time: [1x826 double] individual: [10x1x826 double] dimord: 'subj_chan_time' cfg: [1x1 struct] grad: [1x1 struct] Apologies for the massive email, but I was hoping this is enough info for someone to have more of a clue than I do? Kind regards, Loes PS Do let me know if you think this approach is wrong in the first place. I was trying to avoid pre-setting time windows for image-based statistics, as we do not really have strong a priori expectations for times. -- Loes Koelewijn PhD Candidate Macquarie Centre for Cognitive Science (MACCS) Macquarie University Sydney NSW 2109 Australia Ph: +61 2 9850 4135 Fax: +61 2 9850 6059 email: loes.koelewijn at mq.edu.au -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Wed Mar 30 09:13:26 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Wed, 30 Mar 2011 09:13:26 +0200 Subject: [FieldTrip] Dipole fitting error In-Reply-To: <707098a85823e.4d927cd9@mail.uh.edu> References: <707098a85823e.4d927cd9@mail.uh.edu> Message-ID: <96FDBFBA-F7B1-4B18-BE3C-BAE126CAC57B@donders.ru.nl> Hi Mehmet, Try to define cfg.resolution = 0.02 and see whether that works. The resolution needs to be specified in the same units as your sensor array, which I suspect is 'm', rather than 'cm'. Specifying resolution to be 2, means that an initial search grid is created with a resolution of 2 m, i.e. each probed potential source position is 2 meters apart. Not realistic I'd say. Good luck, Jan-Mathijs On Mar 30, 2011, at 7:44 AM, Mehmet-Akif Coskun wrote: > rid.xgrid Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From jan.schoffelen at donders.ru.nl Wed Mar 30 09:15:16 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Wed, 30 Mar 2011 09:15:16 +0200 Subject: [FieldTrip] cluster analysis on time courses from virtual channels In-Reply-To: References: Message-ID: <612AE770-356E-4045-B193-B13BC015F496@donders.ru.nl> Hi Loes, The statistical test you are trying to do, is a dependent samples T test. This can only be applied if you have a repeated measures design with 2 conditions. You have 6 conditions, and this causes the error I presume. I guess what you need is probably a depsamplesF or so. Best wishes, Jan-Mathijs On Mar 30, 2011, at 8:21 AM, Loes Koelewijn wrote: > Hi all, > > I have a question about group analysis statistics of my MEG study. > I've made virtual sensors from group average images of an > independent localiser run, created at several time windows, based on > the group inversion. I then extracted dipole waveforms for all other > conditions (6), for each subject (10), based on those virtual > sensors (the study has a repeated measures design). I would now like > to analyse group significance of any differences between these 6 > time courses, over all time samples, corrected for multiple > comparisons. I have tried to do this using FieldTrip's cluster based > permutation test (Monte Carlo), independently for each virtual > channel, by setting the neighbouring channels to 0. However, I get > an error about the design matrix when running ft_timelockstatistics. > > Matlab's output is the following: > > selected 1 channels > selected 251 time bins > selected 1 frequency bins > Using the gradiometer configuration from the dataset. > there are on average 0.0 neighbours per channel > using "statistics_montecarlo" for the statistical testing > using "statfun_depsamplesT" for the single-sample statistics > constructing randomized design > total number of measurements = 60 > total number of variables = 2 > number of independent variables = 1 > number of unit variables = 1 > number of within-cell variables = 0 > number of control variables = 0 > using a permutation resampling approach > repeated measurement in variable 2 over 6 levels > number of repeated measurements in each level is 10 10 10 10 10 10 > computing a parmetric threshold for clustering > Error using ==> statfun_depsamplesT at 78 > Invalid specification of the design array. > ??? Error using ==> statistics_montecarlo at 217 > could not determine the parametric critical value for clustering > > Error in ==> statistics_wrapper at 285 > [stat, cfg] = statmethod(cfg, dat, cfg.design, > 'issource',issource); > > Error in ==> ft_timelockstatistics at 117 > [stat, cfg] = statistics_wrapper(cfg, varargin{:}); > > Could anybody help me in the direction of what is going wrong here? > I wondered earlier if my data structures were incorrect, but these > were created with ft_timelockgrandaverage, keeping the individual > data. This is what I ran: > > [stat]=ft_timelockstatistics(cfg,cond1,cond2,cond3,cond4,cond5,cond6); > > cfg = > > channel: 'Occipital_Inf_RR_X' > latency: [-0.2000 0.8000] > method: 'montecarlo' > statistic: 'depsamplesT' > correctm: 'cluster' > clusteralpha: 0.0500 > clusterstatistic: 'maxsum' > tail: 0 > clustertail: 0 > alpha: 0.0250 > numrandomization: 500 > design: [2x60 double] > uvar: 2 > ivar: 1 > > cfg.design is 2*60, with the first row (ivar) [1:10,1:10,1:10 etc], > second row (uvar) [ones(1,10),ones(1,10)*2, etc]. > I initially had ivar and uvar reversed, but I got the same error. > > And this is the format of each data structure: > > label: {'Occipital_Inf_RR_X'} > fsample: 250 > avg: [1x826 double] > var: [1x826 double] > time: [1x826 double] > individual: [10x1x826 double] > dimord: 'subj_chan_time' > cfg: [1x1 struct] > grad: [1x1 struct] > > Apologies for the massive email, but I was hoping this is enough > info for someone to have more of a clue than I do? > > Kind regards, > > Loes > > PS Do let me know if you think this approach is wrong in the first > place. I was trying to avoid pre-setting time windows for image- > based statistics, as we do not really have strong a priori > expectations for times. > > -- > Loes Koelewijn > PhD Candidate > Macquarie Centre for Cognitive Science (MACCS) > Macquarie University > Sydney NSW 2109 > Australia > > Ph: +61 2 9850 4135 > Fax: +61 2 9850 6059 > email: loes.koelewijn at mq.edu.au > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Wed Mar 30 09:26:01 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Wed, 30 Mar 2011 09:26:01 +0200 Subject: [FieldTrip] problems with ft_dipolesimulation In-Reply-To: <970A2014-FA6E-415C-831F-FBB98290B623@ucdenver.edu> References: <2DD56803-916C-42DF-AB33-CF6728DE2DD0@ucdenver.edu> <970A2014-FA6E-415C-831F-FBB98290B623@ucdenver.edu> Message-ID: <1E1CEFE0-5C2D-43B2-885A-D2FDD13A5E29@donders.ru.nl> Dear Don, Thanks for your message. I was able to reproduce the issue using a similar setup (using a 4D gradiometer array constructed from a dataset recorded in St.Louis). There indeed was an issue related to the reducerank option, which you indeed bypassed by explicitly specifying this to be a numeric value. Yet, ft_dipolesimulation should also work on eeg data, i.e. computing leadfields without reduced rank should also be supported. Fortunately I see an easy solution: for one or another reason there are the following lines in ft_compute_leadfield: if strcmpi(reducerank,'yes') || strcmpi(reducerank,'no') reducerank = istrue(reducerank); end which convert the variable reducerank, if it is a string, into a boolean. The boolean variable causes the problem you reported. Note that the boolean will not be created when you specify manually that reducerank is numeric. Commenting out these lines does the trick for me, and does not seem to affect the rest of the code. I'll remove them from the code, and the latest version will be available tonight (CET). I hope for now that you can work your way around it. best wishes, Jan-Mathijs On Mar 29, 2011, at 6:58 PM, Rojas, Don wrote: > To all: > > Regarding that last email, I think I found the problem. Line 187 of > ft_dipolesimulation calls ft_compute_leadfield, which in my case > returned all zeros, so that explains the zeroed data in the output. > If I change that line to read: > > lf = ft_compute_leadfield(dippos{trial}, sens, vol,'reducerank',2); > > to reflect the fact that the input is gradiometer sensors, the > simulation is correct. I'm thinking perhaps that code needs to > detect the sensor type for input to ft_compute_leadfield. > > Thanks, > > Don > > Begin forwarded message: > >> From: "Rojas, Don" >> Date: March 29, 2011 10:32:32 AM MDT >> To: Email discussion list for the FieldTrip project > > >> Subject: problems with ft_dipolesimulation >> >> Dear Fieldtrippers, >> >> I'm having difficulties trying to construct a simulated dataset >> using ft_dipolesimulation. I am simulating using a 4D MEG sensor >> array, read in from an existing dataset (this dataset poses no >> particular problems when used in other FT routines, but I'm only >> using the headshape and the gradiometer location/orientation info >> for the headmodel and simulation anyway). The problem is that I am >> getting values of zero in all channels at all time points in the >> simulated set. No errors are generated, but there is a message >> about the RMS value of simulated data is 0 when ft_dipolesimulation >> is run - no surprise there. Here is my code: >> >> % read 4D file >> file = 'c,rfhp0.1Hz'; >> hdr = ft_read_header(file); >> hs = ft_read_headshape('hs_file'); >> >> % create a single sphere conductor model from 4D dataset >> cfg = []; >> cfg.grad = hdr.grad; >> cfg.headshape = hs.pnt; >> cfg.singlesphere = 'yes'; >> ft_sphere = ft_prepare_localspheres(cfg); >> >> % simulate a dipole >> cfg_sim.vol = ft_sphere; >> cfg_sim.grad = hdr.grad; >> cfg_sim.fsample = hdr.Fs; >> cfg_sim.relnoise = .1; >> cfg_sim.dip.frequency = 20; >> cfg_sim.dip.phase = pi/2; % 90 degree phase >> cfg_sim.triallength = 1; >> cfg_sim.ntrials = 50; >> cfg_sim.dip.pos = [0 -.05 .05]; % position in meters >> cfg_sim.dip.mom = [0 0 -1]'; >> sim = ft_dipolesimulation(cfg_sim); >> >> Also, I have run the script from the following example: >> >> http://fieldtrip.fcdonders.nl/example/compute_forward_simulated_data_and_apply_a_dipole_fit >> >> The simulated data in that example also has no data other than >> zeros in all channels. So, I don't think this is due to my code per >> se, which was adapted from that example. My MATLAB version is 2009b >> (maci64) and I've tried this in several FT versions, including the >> 20110328 version, all of which produce the same results. >> >> Any ideas? >> >> Don >> >> ----------------------- >> Don Rojas, Ph.D. >> Associate Professor of Psychiatry >> U. of Colorado Denver Anschutz Medical Campus >> Director, UCD Magnetoencephalography Lab >> 13001 E. 17th Pl F546 >> Aurora, CO 80045 >> USA >> 303-724-4994 >> > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From lifengmiao at gmail.com Wed Mar 30 23:43:02 2011 From: lifengmiao at gmail.com (Lifeng Miao) Date: Wed, 30 Mar 2011 14:43:02 -0700 Subject: [FieldTrip] reference lutkenhoner1992 for eeg_leadfield1 Message-ID: Hi fieldtrip group, When I reading the code of "eeg_leadfield1", I see that there is a reference called lutkenhoner1992. But I check all the papers of lutkenhoner, and there is no one related to the "eeg_leadfield1" code (these is no equation A.17 in these papers). So could you please show me what is reference for "lutkenhoner1992"? Thank you very much! Thanks, Lifeng -------------- next part -------------- An HTML attachment was scrubbed... URL: From loes.koelewijn at mq.edu.au Thu Mar 31 06:23:20 2011 From: loes.koelewijn at mq.edu.au (Loes Koelewijn) Date: Thu, 31 Mar 2011 15:23:20 +1100 Subject: [FieldTrip] cluster analysis on time courses from virtual channels In-Reply-To: <612AE770-356E-4045-B193-B13BC015F496@donders.ru.nl> References: <612AE770-356E-4045-B193-B13BC015F496@donders.ru.nl> Message-ID: Hi Jan-Mathijs, Many thanks - I wasn't aware of there being an F test version and this has solved the problem now. Strangely, I had tried running the same dependent samples T test with only 2 conditions just to see if that would work, and for some reason, it wouldn't (I had adjusted the design matrix of course). I have now gotten it all to work though, both F test with several conditions and the T test with only 2, so I must have overlooked something previously. Many thanks for your help! Loes On Wed, Mar 30, 2011 at 6:15 PM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: > Hi Loes, > > The statistical test you are trying to do, is a dependent samples T test. > This can only be applied if you have a repeated measures design with 2 > conditions. You have 6 conditions, and this causes the error I presume. > I guess what you need is probably a depsamplesF or so. > > Best wishes, > > Jan-Mathijs > > On Mar 30, 2011, at 8:21 AM, Loes Koelewijn wrote: > > Hi all, > > I have a question about group analysis statistics of my MEG study. I've > made virtual sensors from group average images of an independent localiser > run, created at several time windows, based on the group inversion. I then > extracted dipole waveforms for all other conditions (6), for each subject > (10), based on those virtual sensors (the study has a repeated measures > design). I would now like to analyse group significance of any differences > between these 6 time courses, over all time samples, corrected for multiple > comparisons. I have tried to do this using FieldTrip's cluster based > permutation test (Monte Carlo), independently for each virtual channel, by > setting the neighbouring channels to 0. However, I get an error about the > design matrix when running ft_timelockstatistics. > > Matlab's output is the following: > > selected 1 channels > selected 251 time bins > selected 1 frequency bins > Using the gradiometer configuration from the dataset. > there are on average 0.0 neighbours per channel > using "statistics_montecarlo" for the statistical testing > using "statfun_depsamplesT" for the single-sample statistics > constructing randomized design > total number of measurements = 60 > total number of variables = 2 > number of independent variables = 1 > number of unit variables = 1 > number of within-cell variables = 0 > number of control variables = 0 > using a permutation resampling approach > repeated measurement in variable 2 over 6 levels > number of repeated measurements in each level is 10 10 10 10 10 10 > computing a parmetric threshold for clustering > Error using ==> statfun_depsamplesT at 78 > Invalid specification of the design array. > ??? Error using ==> statistics_montecarlo at 217 > could not determine the parametric critical value for clustering > > Error in ==> statistics_wrapper at 285 > [stat, cfg] = statmethod(cfg, dat, cfg.design, 'issource',issource); > > Error in ==> ft_timelockstatistics at 117 > [stat, cfg] = statistics_wrapper(cfg, varargin{:}); > > Could anybody help me in the direction of what is going wrong here? I > wondered earlier if my data structures were incorrect, but these were > created with ft_timelockgrandaverage, keeping the individual data. This is > what I ran: > > [stat]=ft_timelockstatistics(cfg,cond1,cond2,cond3,cond4,cond5,cond6); > > cfg = > > channel: 'Occipital_Inf_RR_X' > latency: [-0.2000 0.8000] > method: 'montecarlo' > statistic: 'depsamplesT' > correctm: 'cluster' > clusteralpha: 0.0500 > clusterstatistic: 'maxsum' > tail: 0 > clustertail: 0 > alpha: 0.0250 > numrandomization: 500 > design: [2x60 double] > uvar: 2 > ivar: 1 > > cfg.design is 2*60, with the first row (ivar) [1:10,1:10,1:10 etc], second > row (uvar) [ones(1,10),ones(1,10)*2, etc]. > I initially had ivar and uvar reversed, but I got the same error. > > And this is the format of each data structure: > > label: {'Occipital_Inf_RR_X'} > fsample: 250 > avg: [1x826 double] > var: [1x826 double] > time: [1x826 double] > individual: [10x1x826 double] > dimord: 'subj_chan_time' > cfg: [1x1 struct] > grad: [1x1 struct] > > Apologies for the massive email, but I was hoping this is enough info for > someone to have more of a clue than I do? > > Kind regards, > > Loes > > PS Do let me know if you think this approach is wrong in the first place. > I was trying to avoid pre-setting time windows for image-based statistics, > as we do not really have strong a priori expectations for times. > > -- > Loes Koelewijn > PhD Candidate > Macquarie Centre for Cognitive Science (MACCS) > Macquarie University > Sydney NSW 2109 > Australia > > Ph: +61 2 9850 4135 > Fax: +61 2 9850 6059 > email: loes.koelewijn at mq.edu.au > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -- Loes Koelewijn PhD Candidate Macquarie Centre for Cognitive Science (MACCS) Macquarie University Sydney NSW 2109 Australia Ph: +61 2 9850 4135 Fax: +61 2 9850 6059 email: loes.koelewijn at mq.edu.au -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Thu Mar 31 09:38:23 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 31 Mar 2011 09:38:23 +0200 Subject: [FieldTrip] Dipole time course References: <722089035bbba.4d93df8a@mail.uh.edu> Message-ID: <0A4E2DDD-B79F-4B96-A777-CB880E117016@donders.ru.nl> Hi Mehmet, I forward this to the mailing list, so that people can participate in the thread. I do not fully understand where the orientation information in the vol comes from. The description of the volume conductor is namely a geometrical object, containing either a (set of) triangulated surface(s), to describe compartment boundaries, or the description of a (set of) sphere(s), with an origin and a radius. The outcome of the dipolefitting algorithm gives you a field, called dip.mom, describing the dipole moment as a function of time. At each time point, the three numbers reflect the instantaneous orientation of the dipole. Since you are working with MEG, I assume that the orientation of this dipole is actually defined on a plane, because we routinely suppress the component with the most radial orientation from the leadfield. One way of reducing the dimension is to check whether there is a single dominant orientation over time. This can be achieved by doing a pca (or svd) of dip.mom. The ratio of the first two singular values specifies how well the dipole can be approximated as one having a fixed orientation. The left singular vectors give you the projection vectors, and thus specify the orientation. In other words [u,s,v] = svd(dip.mom). if s(1,1) >> s(2,2), one could justify to use u(:,1) as the 'orientation' of the corresponding dipole. Best, Jan-Mathijs Begin forwarded message: > From: Mehmet-Akif Coskun > Date: March 31, 2011 8:57:30 AM GMT+02:00 > To: jan-mathijs schoffelen > Subject: Dipole time course > > Hi Jan, > Thanks for all your help. I am really close to get the dipole time > courses. Everything looks fine in terms of reading data, > preprocessing, creating headmodel and fitting a dipole. The last > part is to obtain a dipole time course. > > I actually read through the previous emails in discussion list and > followed the advices. I used the code below to obtain the leadfield > and then project the pinv'ed leadfield onto ERF to get the dipole > course. But the leadfield is 3D so i get 3 time courses. > % prepare leadfield cfg=[]; cfg.grad= hdr.grad; cfg.vol=vol; > cfg.channel='MEG'; cfg.grid.pos=dipM50.dip.pos; > [grid_ft_segment2]=ft_prepare_leadfield(cfg); > > In the email below, you suggested to an other user to multiply the > 3D leadfields with the orientation estimated by the dipole fit. I > checked the outcome of the dipole but there wasn't any orientation > information. However, i checked the vol structure which has the > orientation and multiply 3D leadfields with vol.ori and then project > 1d leadfield onto ERF. I got a nice looking time course. I just > wonder whether what i did is meaningful. > > Thanks > Mehmet > > P.S= Below is your previous email > I suspect that the 'orientation' onto which the pca projects the > dipoles is not optimal. Perhaps you might want to try the other way, > i.e. compute the leadfields in 1D, either by specifying something in > cfg.grid.mom (or ori, I keep forgetting) before calling > prepare_leadfield, or by postmultiplying the 3D leadfields with the > orientation as estimated by the dipole fit. Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Don.Rojas at ucdenver.edu Thu Mar 31 17:57:41 2011 From: Don.Rojas at ucdenver.edu (Rojas, Don) Date: Thu, 31 Mar 2011 09:57:41 -0600 Subject: [FieldTrip] Dipole time course In-Reply-To: <0A4E2DDD-B79F-4B96-A777-CB880E117016@donders.ru.nl> References: <722089035bbba.4d93df8a@mail.uh.edu> <0A4E2DDD-B79F-4B96-A777-CB880E117016@donders.ru.nl> Message-ID: <2E7764CB-846C-4A40-A4FB-7F6C3376C465@ucdenver.edu> Mehmet et al. As a follow up to this, once you have the orientation info from the dipole, the source space projection you wish to achieve to derive the timecourse can be done as follows (or at least something similar to this), assuming you have the fieldtrip data (data) the source, and the volume conductor (vol): L = ft_compute_leadfield(source.dip.pos, data.grad,vol); % leadfields Li = pinv(L); % pseudoinverse of L Qn = double(orientation_vector)/norm(orientation_vector); % normed orientation vector W = dot(Li,Qn); % weights for projection to source space waveform = dot(data,repmat(W',1,length(data))); % source waveform where the orientation_vector is a 1 x 3 vector of qx, qy and qz. This can be had from one of your sources from source.dip.mom, or from the suggestion of Jan-Mathijs. I don't know if the data you have is an average that you want to project into source space or individual trials. If you want to do this with the individual trials, you'd just need to do the last piece of code above as a for loop through your trials - you don't have to recompute the weights (W) used for the projection. Best, Don On Mar 31, 2011, at 1:38 AM, jan-mathijs schoffelen wrote: Hi Mehmet, I forward this to the mailing list, so that people can participate in the thread. I do not fully understand where the orientation information in the vol comes from. The description of the volume conductor is namely a geometrical object, containing either a (set of) triangulated surface(s), to describe compartment boundaries, or the description of a (set of) sphere(s), with an origin and a radius. The outcome of the dipolefitting algorithm gives you a field, called dip.mom, describing the dipole moment as a function of time. At each time point, the three numbers reflect the instantaneous orientation of the dipole. Since you are working with MEG, I assume that the orientation of this dipole is actually defined on a plane, because we routinely suppress the component with the most radial orientation from the leadfield. One way of reducing the dimension is to check whether there is a single dominant orientation over time. This can be achieved by doing a pca (or svd) of dip.mom. The ratio of the first two singular values specifies how well the dipole can be approximated as one having a fixed orientation. The left singular vectors give you the projection vectors, and thus specify the orientation. In other words [u,s,v] = svd(dip.mom). if s(1,1) >> s(2,2), one could justify to use u(:,1) as the 'orientation' of the corresponding dipole. Best, Jan-Mathijs Begin forwarded message: From: Mehmet-Akif Coskun > Date: March 31, 2011 8:57:30 AM GMT+02:00 To: jan-mathijs schoffelen > Subject: Dipole time course Hi Jan, Thanks for all your help. I am really close to get the dipole time courses. Everything looks fine in terms of reading data, preprocessing, creating headmodel and fitting a dipole. The last part is to obtain a dipole time course. I actually read through the previous emails in discussion list and followed the advices. I used the code below to obtain the leadfield and then project the pinv'ed leadfield onto ERF to get the dipole course. But the leadfield is 3D so i get 3 time courses. % prepare leadfield cfg=[]; cfg.grad= hdr.grad; cfg.vol=vol; cfg.channel='MEG'; cfg.grid.pos=dipM50.dip.pos; [grid_ft_segment2]=ft_prepare_leadfield(cfg); In the email below, you suggested to an other user to multiply the 3D leadfields with the orientation estimated by the dipole fit. I checked the outcome of the dipole but there wasn't any orientation information. However, i checked the vol structure which has the orientation and multiply 3D leadfields with vol.ori and then project 1d leadfield onto ERF. I got a nice looking time course. I just wonder whether what i did is meaningful. Thanks Mehmet P.S= Below is your previous email I suspect that the 'orientation' onto which the pca projects the dipoles is not optimal. Perhaps you might want to try the other way, i.e. compute the leadfields in 1D, either by specifying something in cfg.grid.mom (or ori, I keep forgetting) before calling prepare_leadfield, or by postmultiplying the 3D leadfields with the orientation as estimated by the dipole fit. Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip ----------------------- Don Rojas, Ph.D. Associate Professor of Psychiatry U. of Colorado Denver Anschutz Medical Campus Director, UCD Magnetoencephalography Lab 13001 E. 17th Pl F546 Aurora, CO 80045 303-724-4994 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Don.Rojas at ucdenver.edu Thu Mar 31 18:03:35 2011 From: Don.Rojas at ucdenver.edu (Rojas, Don) Date: Thu, 31 Mar 2011 10:03:35 -0600 Subject: [FieldTrip] Dipole time course In-Reply-To: <0A4E2DDD-B79F-4B96-A777-CB880E117016@donders.ru.nl> References: <722089035bbba.4d93df8a@mail.uh.edu> <0A4E2DDD-B79F-4B96-A777-CB880E117016@donders.ru.nl> Message-ID: <9F1AD6B2-CBD2-4A8F-96B0-5288AC53EFD4@ucdenver.edu> Mehmet, As a follow on to that last email, if these are MEG gradiometer data, don't forget to add 'reducerank', 2 to your call to ft_compute_leadfields. Otherwise, your leadfields will be incorrect. Don On Mar 31, 2011, at 1:38 AM, jan-mathijs schoffelen wrote: Hi Mehmet, I forward this to the mailing list, so that people can participate in the thread. I do not fully understand where the orientation information in the vol comes from. The description of the volume conductor is namely a geometrical object, containing either a (set of) triangulated surface(s), to describe compartment boundaries, or the description of a (set of) sphere(s), with an origin and a radius. The outcome of the dipolefitting algorithm gives you a field, called dip.mom, describing the dipole moment as a function of time. At each time point, the three numbers reflect the instantaneous orientation of the dipole. Since you are working with MEG, I assume that the orientation of this dipole is actually defined on a plane, because we routinely suppress the component with the most radial orientation from the leadfield. One way of reducing the dimension is to check whether there is a single dominant orientation over time. This can be achieved by doing a pca (or svd) of dip.mom. The ratio of the first two singular values specifies how well the dipole can be approximated as one having a fixed orientation. The left singular vectors give you the projection vectors, and thus specify the orientation. In other words [u,s,v] = svd(dip.mom). if s(1,1) >> s(2,2), one could justify to use u(:,1) as the 'orientation' of the corresponding dipole. Best, Jan-Mathijs Begin forwarded message: From: Mehmet-Akif Coskun > Date: March 31, 2011 8:57:30 AM GMT+02:00 To: jan-mathijs schoffelen > Subject: Dipole time course Hi Jan, Thanks for all your help. I am really close to get the dipole time courses. Everything looks fine in terms of reading data, preprocessing, creating headmodel and fitting a dipole. The last part is to obtain a dipole time course. I actually read through the previous emails in discussion list and followed the advices. I used the code below to obtain the leadfield and then project the pinv'ed leadfield onto ERF to get the dipole course. But the leadfield is 3D so i get 3 time courses. % prepare leadfield cfg=[]; cfg.grad= hdr.grad; cfg.vol=vol; cfg.channel='MEG'; cfg.grid.pos=dipM50.dip.pos; [grid_ft_segment2]=ft_prepare_leadfield(cfg); In the email below, you suggested to an other user to multiply the 3D leadfields with the orientation estimated by the dipole fit. I checked the outcome of the dipole but there wasn't any orientation information. However, i checked the vol structure which has the orientation and multiply 3D leadfields with vol.ori and then project 1d leadfield onto ERF. I got a nice looking time course. I just wonder whether what i did is meaningful. Thanks Mehmet P.S= Below is your previous email I suspect that the 'orientation' onto which the pca projects the dipoles is not optimal. Perhaps you might want to try the other way, i.e. compute the leadfields in 1D, either by specifying something in cfg.grid.mom (or ori, I keep forgetting) before calling prepare_leadfield, or by postmultiplying the 3D leadfields with the orientation as estimated by the dipole fit. Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip ----------------------- Don Rojas, Ph.D. Associate Professor of Psychiatry U. of Colorado Denver Anschutz Medical Campus Director, UCD Magnetoencephalography Lab 13001 E. 17th Pl F546 Aurora, CO 80045 303-724-4994 -------------- next part -------------- An HTML attachment was scrubbed... URL: