From h.stoegbauer at GMAIL.COM Mon Sep 4 16:30:05 2006 From: h.stoegbauer at GMAIL.COM (Harald Stoegbauer) Date: Mon, 4 Sep 2006 16:30:05 +0200 Subject: channel mismatch In-Reply-To: Message-ID: Hi Robert, Thanks for your reply. Is there any paper/reference on the Cluster-level randomization test available ? Thanks, Harald On 8/29/06, Robert Oostenveld wrote: > > Hi Harald, > > On 3 Aug 2006, at 16:22, Harald Stoegbauer wrote: > > The problme is that the tfc-files form different subjects have > > different > > amount of channels due to artifact rejection. > > ... > > Is there a simple way to use only channels which are used in all > > subjects ? > > All Fieldtrip functions in principle should support datasets with > different input channels (i.e. only selecting the overlapping > channels), but it seems that that is not yet supported in the > FREQGRANDAVERAGE function. I have fixed that and will include the > updated version in the FTP release tonight. > > thanks for reporting this bug > Robert > -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Thu Sep 7 13:34:37 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 7 Sep 2006 13:34:37 +0200 Subject: question on data formats In-Reply-To: Message-ID: Hi Silvia, I am doing a CC of this mail to the discussion list, since other people may be interested in it as well. Please continue through the maliing list. On 7 Sep 2006, at 10:53, Silvia Gennari wrote: > Thanks very much for your prompt response. I will write to the list > as you suggest. I just wanted to ask you one more thing so I > understand what is involved. > > It seems from what you are saying that if I get the MEG data, the > triggers, and coil positions into some text format, then it would > be OK. I can see in the raw files (in text viewers) the kind of > information we have. I forgot to mention that you also need the coil orientations. But yes, that information would be sufficient, and it does not matter whether that information comes from binary or from text files. Besides this information, it would be convenient to have additional information, like the position of the coils used for head localization (I am not sure how that is done for BTi, but I presume in a similar fashion as CTF). And it is convenient to read the auxiliary files that are generated with the BTi software, e.g. the MRI file and the head model file. But the data represented in those files can all be generated and managed inside FT. > Also, I do open the data in Matlab, and I have some functions that > are trying to do some basic kind of analysis. So the problem is > not reading the data into MAtlab but the kind of assumptions that > Fieldtrip makes regarding the layout of the information. Fieldtrip works with data structured in particular ways. The most basic data structure from where most analysis start is that of raw data, which is the output of PREPROCESSING. Have a look at http:// www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:dataformats, which I just updated. Furthermore, have a look at http://www2.ru.nl/fcdonders/fieldtrip/ doku.php?id=fieldtrip:documentation:tutorial:introduction and especially figure 3 to see how the functions interact and how the data flows. Other fieldtrip functions, such as TIMELOCKANALYSIS, FREQANALYSIS and SOURCEANALYSIS also have relatively fixed output structure. As long as you use data structures that are fieldtrip-like, you can use fieldtrip functions on them. best, Robert From r.oostenveld at FCDONDERS.RU.NL Thu Sep 7 15:01:14 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 7 Sep 2006 15:01:14 +0200 Subject: channel mismatch In-Reply-To: <5bbfdea0609040730qd82aed4q70e0070eb5b1bab9@mail.gmail.com> Message-ID: It is described in sufficient detail -- for referencing to -- in Takashima et al. (2006) and in Osipova et al. (accepted, will appear soon). More details are on http://www2.ru.nl/fcdonders/fieldtrip/ doku.php?id=fieldtrip:publications Robert On 4 Sep 2006, at 16:30, Harald Stoegbauer wrote: > Is there any paper/reference on the Cluster-level randomization > test available ? From nathanweisz at MAC.COM Thu Sep 7 23:19:59 2006 From: nathanweisz at MAC.COM (Nathan Weisz) Date: Thu, 7 Sep 2006 23:19:59 +0200 Subject: dipole moment Message-ID: hi everyone, my intention is to steal some code of the dipolefitting function to model source activity of raw EEG data (keep fixed locations, just analyse changes in dipole moment; i have a leadfield matrix using prepare_leadfield). to test things i used a visual ERP data set as outputted by timelockanalysis. the waveforms look fine, i just get really huge values: ~14000 as maximum dipole moments (the N1 is about 6000). so my question is what units i have? do i have to scale by 1000 to get nAm (14 & 6 nAm would make sense) or do these values imply that something has gone completely wrong. thanks in advance, nathan From r.oostenveld at FCDONDERS.RU.NL Fri Sep 8 12:39:02 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 8 Sep 2006 12:39:02 +0200 Subject: dipole moment In-Reply-To: <68AF4365-C630-4E9F-87DE-9A5C65E639CD@mac.com> Message-ID: Hi Nathan, On 7 Sep 2006, at 23:19, Nathan Weisz wrote: > my intention is to steal some code of the dipolefitting function to > model source activity of raw EEG data (keep fixed locations, just > analyse changes in dipole moment; i have a leadfield matrix using > prepare_leadfield). to test things i used a visual ERP data set as > outputted by timelockanalysis. Probably you could use dipolefitting with cfg.nonlinear='no' and cfg.gridsearch='no', then the dipole(s) stays where you initially put it(them), and only the moment is estimated. But your approach is also fine. > the waveforms look fine, i just get really huge values: ~14000 as > maximum dipole moments (the N1 is about 6000). so my question is > what units i have? do i have to scale by 1000 to get nAm (14 & 6 > nAm would make sense) or do these values imply that something has > gone completely wrong. There are different physical entities with different units involved, you have to ensure that they are all consistent: electrode positions and volume conductor geometry represent distance (e.g. meter), tissue resistance is in ohm per distance (ohm/m -> conductance is the other way around), potentials are in volt (or often in uV), currents are in A (or mA, uA, nA). If you mix them up, it is easy to get a factor of 10^n difference. E.g. I presume that your N1 is not "6000" Volts (if so, then I would rather stay away from your subject). Robert From thomas at UCSD.EDU Tue Sep 12 01:01:52 2006 From: thomas at UCSD.EDU (Thomas Thesen) Date: Tue, 12 Sep 2006 01:01:52 +0200 Subject: Neuromag stats Message-ID: Hi FieldTrippers, I am trying to run clusterrandanalysis on single-subject data that have been collected on a Neuromag system. It seems that I am running into problems with the neighbouring channel geometry. The epochs are already in a format that went through timelockanalysis and gives the following structure: timelock_data = avg: [102x102 double] var: [102x102 double] fsample: 250 numsamples: [297x1 double] time: [1x102 double] dofvec: [1x102 double] label: {1x102 cell} trial: [297x102x102 double] dimord: 'rpt_chan_time' grad: [1x1 struct] cfg: [1x1 struct] When trying to run the data through clusterrandanalysis using: cfg = []; cfg.statistic = 'depsamplesT'; cfg.alphathresh = 0.01;; cfg.makeclusters = 'yes'; cfg.minnbchan = 0; cfg.clusterteststat = 'orderedsums'; cfg.smallestcluster = 5; cfg.onetwo = 'twosided'; cfg.alpha = cfg.alphathresh ; cfg.nranddraws = 10; cfg.gradfile = data.grad.pnt; [clusrand] = clusterrandanalysis (cfg, timelock_data, timelock_data); It gives the following error message: Selecting and formatting the data. selected 102 channels selected 1 time bins selected 1 frequency bins Calculating the neighbourhood structure of the channels. Obtaining the gradiometer configuration from a file. ??? Error using ==> exist The first input to exist is a string. Error in ==> read_fcdc_elec at 60 if ~exist(filename) Error in ==> clusterrandanalysis>getneighbgeometry at 496 data.grad = read_fcdc_elec(cfg.gradfile); Error in ==> clusterrandanalysis at 461 [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); There seems to be some problem with the gradfile, but I am not sure what exactly. data.grad.pnt contains the sensor configuration. Here is an excerpt: 0.0545 -0.1029 0.0548 0.1002 0.0059 0.0467 0.1002 0.0059 0.0467 0.1023 -0.0238 0.0226 0.1023 -0.0238 0.0226 0.0946 -0.0541 0.0357 0.0946 -0.0541 0.0357 0.0972 -0.0246 0.0603 0.0972 -0.0246 0.0603 The data file timelock_data.m can be downloaded at http://mmil.ucsd.edu/thomas/FT/ if someone could be so nice to have a look at it, I'd really appreciate it. Thanks a lot, Thomas From r.oostenveld at FCDONDERS.RU.NL Wed Sep 13 21:23:21 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 13 Sep 2006 21:23:21 +0200 Subject: Neuromag stats In-Reply-To: Message-ID: Hi Thomas To start with a remark: I suggest that you switch to timelockstatistics/freqstatistics/sourcestatistics, they are the new interface to randomization testing with clustering. These new functions have the same options (and more), but most importantly: they are easier to understand (at least that is what we hope). From now on I will refer to the new functions, but you can do most of the stuff also with the old clusterrandanalysis function. On 12 Sep 2006, at 1:01, Thomas Thesen wrote: > I am trying to run clusterrandanalysis on single-subject data that > have been > collected on a Neuromag system. It seems that I am running into > problems > with the neighbouring channel geometry. We do have (some) experience with that for frequency and time- frequency (power) data, but then based on the virtual planar gradients that we can compute for the CTF system (using MEGPLANAR). I don't think that sofar anyone ever used it for ERP data. The approach we use for power data is PREPROCESSING -> MEGPLANAR -> FREQANALYSIS (with keeptrials) -> COOMBINEPLANAR -> FREQSTATISTICS i.e. the statistic is computed after summing the power in the two planar channels at each sensor location. The power is added for each trial. For ERF data, COMBINEPLANAR is using Pythagoras rule (z^2=x^2+y^2) to compute the combined amplitude of the two planar channels at each location. In that computation, the sign of the field is lost. I.e. you can combine planar ERFs, but you might get into problems with different noise bias and with the interpretation of the combined data. For the old 122 channel Neuroscan system, there are 122 channels at 66 locations. Since the channels are already planar MEGPLANAR is not needed. After COMBINEPLANAR, you have a 66 channel data structure. > The epochs are already in a format that went through > timelockanalysis and > gives the following structure: > > timelock_data = > > avg: [102x102 double] > var: [102x102 double] > fsample: 250 > numsamples: [297x1 double] > time: [1x102 double] > dofvec: [1x102 double] > label: {1x102 cell} > trial: [297x102x102 double] > dimord: 'rpt_chan_time' > grad: [1x1 struct] > cfg: [1x1 struct] It seems that you have 102 channels in the data. You have a 306ch Neuroscan system, with 102 magnetometers and 2x102 planar gradiometers. Are you using the magnetometers (which should probably work), the combined planar channels (102+102=102, should also work) or what? > When trying to run the data through clusterrandanalysis using: > ... > It gives the following error message: > > Selecting and formatting the data. > selected 102 channels > ... > Calculating the neighbourhood structure of the channels. > Obtaining the gradiometer configuration from a file. > ??? Error using ==> exist > The first input to exist is a string. > > Error in ==> read_fcdc_elec at 60 The read_fcdc_elec function should not get called there actually, so something is wrong. Please try using the stand-alone (find attached, I will ad it to the ftp release) NEIGHBOURSELECTION function and put the result in cfg.neighbours. Furthermore, use TIMELOCKSTATISTICS. > There seems to be some problem with the gradfile, but I am not sure > what > exactly. Oh, now I see. You specified cfg.gradfile = data.grad.pnt. You should do either cfg.grad = structure with gradiometer definition (*) or cfg.gradfile = string, file containing the gradiometer definition or neither of them, in which case data.grad will be used. In case (*), the correct syntax would have been cfg.grad=data.grad, i.e. the complete structure (including pnt/ori/tra/label). I suggest that you try with NEIGHBOURSELECTION. It still might not work for the neuromag data (we only used it on pseudo-planar CTF sofar), but that can be extended. Once the initial neighbourhood definition is set up, we can work out the other details about the neuromag data (i.e. planar ERFs). best regards, Robert -------------- next part -------------- A non-text attachment was scrubbed... Name: neighbourselection.m Type: application/octet-stream Size: 4770 bytes Desc: not available URL: -------------- next part -------------- From s.gennari at PSYCH.YORK.AC.UK Thu Sep 14 18:27:05 2006 From: s.gennari at PSYCH.YORK.AC.UK (Silvia Gennari) Date: Thu, 14 Sep 2006 17:27:05 +0100 Subject: 4D data files Message-ID: Hi, all I am trying to get fieldtrip to read 4D data (BTi). I can see in my data all the pertinent information. But the scanner produces several files in which the information is distributed. The header information as well as the trigger information, sample rate and sensor positions is in a different file from the actual raw data files. This data files can be read into matlab with no problems. But Fieldtrip needs to put this together with the header and triggers. It seems that I have all the information I need to be able to read the data, but I am having trouble working with the read-xxxx functions. I just wonder whether someone else have tried to do this so I can get some help. Thanks!! Silvia Silvia Gennari Department of Psychology University of York Heslington, York YO10 5DD United Kingdom -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Thu Sep 14 20:45:16 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 14 Sep 2006 20:45:16 +0200 Subject: 4D data files In-Reply-To: <091094D4-0E94-482F-9016-96A2BBDB4764@PSYCH.YORK.AC.UK> Message-ID: Dear Sylvia, On 14 Sep 2006, at 18:27, Silvia Gennari wrote: > I am trying to get fieldtrip to read 4D data (BTi). I can see in my > data all the pertinent information. Sounds good. Are you using ascii files exported with 4D software, or are you using the original files? > But the scanner produces several files in which the information is > distributed. That is not a problem in itself, as long as you can refer to the collection of data as a whole. The CTF systems produce a directory (that has a name ending with *.ds) with a whole bunch of files in them. In that case we point to it as cfg.dataset="directory_name". In the case of BrainVision Analyzer EEG data, the data, header and triggers are in three seperate files, in which only the extension differs. In that case we use cfg.datafile and cfg.headerfile, each pointing to the appropriate file. There is even a function that translates between them, i.e. that sorts out the filenames (see fieldtrip/private/dataset2files). For the events, most intelligence is in read_fcdc_event, where it determines on the fly which trigger file belongs to the dataset/datafile/headerfile. How many files do you have? Do the files all have the same basename (i.e. without the extension)? If more than three and if they don't have similar names, I suggest to put them in a directory and treat it as in the CTF case. If they have a similar basename, I would put the intelligence for figuring out the extensions in the low level functions. If you have two, I would use the datafile/headerfile specification. Could you upload a zip file with some demo data on ftp://ftp.fcdonders.nl/pub/incoming (anonymous login, the directory is write only)? > The header information as well as the trigger information, sample > rate and sensor positions is in a different file from the actual > raw data files. This data files can be read into matlab with no > problems. But Fieldtrip needs to put this together with the header > and triggers. I suggest that you look at the specifications in the documentation in read_fcdc_data and read_fcdc_header, and that you try to implement a read_bti_data and read_bti_header function that behave similar. If that works, I will include them in fieldtrip as low level functions (i.e. requires a minimal amount of "glue" between fieldtrip and your functions). Alternatively, you can also implement the read_bti_data and read_bti_header in any way you like, and I will also be able to glue them into the read_fcdc_data and read_fcdc_header wrapper functions. Important to realise is that the read_fcdc_data/header functions are rather minimalistic. Most complex stuff is taken care of by the fieldtrip definetrial and preprocessing functions. There are two other details that are important, and that is adding support to read_fcdc_event and writing a private/bti2grad function (see ctf2grad, yokogawa2grad and fif2grad for examples and see link1 below). Regarding events: I have no idea about how that is arranged in the bti files, but the end result should look like an event structure. I suggest that you look through the read_fcdc_event function and at the documentation at link2. I hope this helps to get started. best regards, Robert PS the thee read_fcdc_xxx functions directly call the private/ read_xxx functions. Those are functionally equivalent, but more flexible. For the motivation behind it and otyher details, see link3. link1 -> http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:frequently_asked_questions#how_are_electrodes _magnetometers_or_gradiometers_described link2 -> http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:frequently_asked_questions#what_is_the_relati on_between_events_such_as_triggers_and_trials link3 -> http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:development:read_fcdc_xxx From r.oostenveld at FCDONDERS.RU.NL Fri Sep 15 13:09:52 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 15 Sep 2006 13:09:52 +0200 Subject: dipole moment Message-ID: Begin forwarded message: > From: Nathan Weisz > Date: 15. September 2006 12:47:48 MESZ > To: FieldTrip discussion list > Subject: Re: [FIELDTRIP] dipole moment > > hi robert, > > thanks for the answer. i'm still a little bit confused. i think it > has something to do with the units of my volume conductor. > > %%%%% > here my original settings with cm units: > vol = []; > vol.r = 12*[0.88 0.92 1.00]; % radii of spheres, the head radius is > 12 cm > vol.c = [1 1/80 1]; > vol.o = [0 0 0]; > > cfg = []; > cfg.elec = dataav.elec; > cfg.elec.pnt = 12*cfg.elec.pnt; > cfg.vol = vol; > cfg.grid.pos=12*[-.51 -.37 .49; .51 -.37 .49;-.01 -.67 .08;.00 .33 . > 59]; > grid = prepare_leadfield(cfg); > > lf1=grid.leadfield{1}; > lf2=grid.leadfield{2}; > lf3=grid.leadfield{3}; > lf4=grid.leadfield{4}; > > dipmom1=pinv(lf1)*dataav.avg; > dipmom2=pinv(lf2)*dataav.avg; > dipmom3=pinv(lf3)*dataav.avg; > dipmom4=pinv(lf4)*dataav.avg; > > %%%% > > ----> this yields huge value: > >> max(mean(dipmom3)) > > ans = > > 7.3627e+03 > > now the same thing with unit sphere > > %%% > > vol = []; > vol.r = [0.88 0.92 1.00]; > vol.c = [1 1/80 1]; > vol.o = [0 0 0]; > > cfg = []; > cfg.elec = dataav.elec; > cfg.elec.pnt = cfg.elec.pnt; > cfg.vol = vol; > cfg.grid.pos=[-.51 -.37 .49; .51 -.37 .49;-.01 -.67 .08;.00 .33 .59]; > grid = prepare_leadfield(cfg); > > lf1=grid.leadfield{1}; > lf2=grid.leadfield{2}; > lf3=grid.leadfield{3}; > lf4=grid.leadfield{4}; > > dipmom1=pinv(lf1)*dataav.avg; > dipmom2=pinv(lf2)*dataav.avg; > dipmom3=pinv(lf3)*dataav.avg; > dipmom4=pinv(lf4)*dataav.avg; > > %%%% > > >> max(mean(dipmom3)) > > ans = > > 51.1298 > > best, > nathan > > > > > On 08.09.2006, at 12:39, Robert Oostenveld wrote: > >> Hi Nathan, >> >> On 7 Sep 2006, at 23:19, Nathan Weisz wrote: >>> my intention is to steal some code of the dipolefitting function >>> to model source activity of raw EEG data (keep fixed locations, >>> just analyse changes in dipole moment; i have a leadfield matrix >>> using prepare_leadfield). to test things i used a visual ERP data >>> set as outputted by timelockanalysis. >> >> Probably you could use dipolefitting with cfg.nonlinear='no' and >> cfg.gridsearch='no', then the dipole(s) stays where you initially >> put it(them), and only the moment is estimated. But your approach >> is also fine. >> >>> the waveforms look fine, i just get really huge values: ~14000 as >>> maximum dipole moments (the N1 is about 6000). so my question is >>> what units i have? do i have to scale by 1000 to get nAm (14 & 6 >>> nAm would make sense) or do these values imply that something has >>> gone completely wrong. >> >> There are different physical entities with different units >> involved, you have to ensure that they are all consistent: >> electrode positions and volume conductor geometry represent >> distance (e.g. meter), tissue resistance is in ohm per distance >> (ohm/m -> conductance is the other way around), potentials are in >> volt (or often in uV), currents are in A (or mA, uA, nA). If you >> mix them up, it is easy to get a factor of 10^n difference. E.g. I >> presume that your N1 is not "6000" Volts (if so, then I would >> rather stay away from your subject). >> >> Robert > From Jan.Schoffelen at FCDONDERS.RU.NL Mon Sep 18 11:37:53 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Mon, 18 Sep 2006 11:37:53 +0200 Subject: Fieldtrip question from Piers C In-Reply-To: <1548.217.44.42.174.1158324866.squirrel@psycix.york.ac.uk> Message-ID: Dear Piers, First of all, I took the liberty to include as a CC to this mail the FieldTrip discussion list. It might be that some of its members could positively contribute to answering your questions. You can subscribe to this list on the fieldtrip-website. Anyway, currently there is no support for reading in SAM weights files into fieldtrip. The most important reason for us not having implemented it, is that we do our source estimation in fieldtrip directly. Perhaps anyone already has an implementation to directly read in your SAM weights into matlab (hence the cc to the discussion list). As soon as those weights are available, it is pretty straightforward to create virtual channel data and do the subsequent analysis within fieldtrip. Otherwise a reading routine for SAM weights would be a valuable contribution to the code. Another approach would be to use fieldtrip's beamforming algorithm to create your virtual channels. The 'lcmv'-algorithm is not all too different from SAM, so you could try this on your specified voxels of interest. There is a tutorial on the frequency-domain beamformer on the web-site. The time-domain beamformer needs a slightly different configuration and input-data. 1 you should use timelockanalysis to compute the covariance of your bandpass-filtered data. 2 then you can call sourceanalysis, with the output of timelockanalysis as an input, in combination with a configuration-structure. Key-elements of this configuration would be: cfg.method = 'lcmv'; cfg.pos = Nx3 matrix with x,y,z coordinates of your virtual channels cfg.reducerank = 2; (necessary for comparability with SAM, and also to give reasonable results in the first place) cfg.hdmfile = .hdm file specifying the forward model used ...and I guess some other stuff as well. Yours, Jan-Mathijs -----Original Message----- From: p.cornelissen at psych.york.ac.uk [mailto:p.cornelissen at psych.york.ac.uk] Sent: Friday, September 15, 2006 2:54 PM To: Jan.Schoffelen at fcdonders.ru.nl Subject: Fieldtrip ? from Piers C Dear Fieldtrip team, First - thanks for your excellent software! I hope its OK for me to ask you a Fieldtrip question. We have data from an experiment using Aston (UK) universitie's old 151 channel CTF system, and we have used the CTF tools to extract a set of virtual electrodes, selected on the basis of a robust group SAM analysis. What we would really like to do is to use our SAM weights files for these virtual electrodes, to define specific channels in Fieldtrip so that we can create and compare time*frequency plots from the virtual electrodes in Fieldtrip. Any advice on how to do this (preferably by way of example code)would be deeply appreciated Regards Piers Cornelissen From r.oostenveld at FCDONDERS.RU.NL Tue Sep 19 18:03:04 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Tue, 19 Sep 2006 18:03:04 +0200 Subject: dipole moment In-Reply-To: <5C06834E-DA43-4007-B24A-996515E7435E@fcdonders.ru.nl> Message-ID: Dear Nathan, > Begin forwarded message: >> From: Nathan Weisz >> Date: 15. September 2006 12:47:48 MESZ >> To: FieldTrip discussion list >> Subject: Re: [FIELDTRIP] dipole moment >> >> hi robert, >> thanks for the answer. i'm still a little bit confused. i think it >> has something to do with the units of my volume conductor. You are comparing a 12 "units" sphere with a 1 "units" sphere. The size of the sphere results in a difference in the potential, but the ratio between the spheres is "not nice", hence it is difficult to interpret. I would interpret this as comparing a 12cm to a 1cm sphere. I suggest that you compare a 12cm sphere (specified as a radius of 12) with a 12 cm sphere (specified as a radius of 0.12), also scale the dipole positions. You will also see that those are different, but then with a factor of 10 to the power of something. If you specify a radius of 12 it could equally well be a 12cm as a 12m sphere, hence the difference. Robert From r.oostenveld at FCDONDERS.RU.NL Mon Sep 25 15:34:21 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 25 Sep 2006 15:34:21 +0200 Subject: warning: bug discovered in new cluster-based randomization statistics Message-ID: Dear FT users, last Friday we found a bug in the newly implemented cluster-based randomization statistics. The problem occurred when using either TIMELOCKSTATISTICS, FREQSTATISTICS or SOURCESTATISTICS with cfg.method='montecarlo' in combination with cfg.correctm='cluster' and cfg.clusterthreshold='parametric' (which is the default for clusterthreshold). This bug only affected the new statistics implementations and NOT the old CLUSTERRANDANALYSIS function, which most of you are probably still using for your channel data. The problem was that the samples belonging to the time-frequency- spatial clusters were determined in the observed data, but that the same samples were also re-used to compute the cluster-statistic in each random reshuffling of the data. I.e., the cluster statistics for the randomizations were computed not based on the thresholded data for that randomization, but instead based on the original thresholded data. It is likely that this resulted in values for each random cluster statistic that were smaller that what they should have been (*see note below*), resulting in a randomization distribution of the cluster-statistic that was too narrow (i.e. the histogram was too narrow). Therefore, effects in the observed may have been indicated as significant (in the tail of the randomization distribution) where they should not have been. The bug has not always been in the code, but was recently introduced (copy and paste problem). I suggest that you redo your recent analyses. Sorry about the inconvenience. If you have questions, you can contact us through the mailing list or with a direct mail. best regards, Robert (*) due to the bug, the cluster-statistic values in each observation may also have been larger than what they should have been. This is most likely the case when you have very strong effects. I.e. in strong effects, it is most likely that you have underestimated your significance and in small effects it is likely that you have overestimated your significance. From Brian.Roach at YALE.EDU Fri Sep 29 18:52:25 2006 From: Brian.Roach at YALE.EDU (Brian Roach) Date: Fri, 29 Sep 2006 12:52:25 -0400 Subject: freqanalysis_wltconvol.m Message-ID: Dear FieldTrip users, I have been playing with the freqanalysis_wltconvol function in hopes of using the morlet wavelet time frequency analysis on some eeg data. I have been able to get it running, and I find that it works very quickly, which is great. However, I am hoping some users or F.T. programmers can explain some of the function inputs and processing. The cfg example is as follows: % cfg.method = 'wltconvol'; % cfg.foi = 1:1:100; % cfg.width = 7; % or % cfg.width = linspace(5,10,length(cfg.foi)); % cfg.toi = 0:0.1:2; % cfg.gwidth = 3; I believe that the cfg.width specifies the number of wave cycles used in each frequency's wavelet analysis (so at 2Hz, 7 cycles spans 3500ms of data, right?). Maybe this is not correct, because I do not seem to get the frequencies as low as I would expect given my data epoch length. Perhaps this has to do with the cfg.gwidth parameter, which I do not think I completely understand - what is it? Also, we do not have the matlab wavelet toolbox, and it appears that it is not required, but how is the morlet wavelet implemented? As I look through the code I see calls to fft, ifft, and fftshift, but I wonder how I can give a good technical description of this process if I find results in a larger data set. Finally, is there a function or a way to compute the frequency bandwidth based on the cfg inputs, or is there a fix frequency bandwith for each foi here? I am sure I am confusing a number of things here, so no response is too simple. Thanks for any advice, please let me know if there is more information I can give or if I can clarify my questions. Brian -------------- next part -------------- An HTML attachment was scrubbed... URL: From h.stoegbauer at GMAIL.COM Mon Sep 4 16:30:05 2006 From: h.stoegbauer at GMAIL.COM (Harald Stoegbauer) Date: Mon, 4 Sep 2006 16:30:05 +0200 Subject: channel mismatch In-Reply-To: Message-ID: Hi Robert, Thanks for your reply. Is there any paper/reference on the Cluster-level randomization test available ? Thanks, Harald On 8/29/06, Robert Oostenveld wrote: > > Hi Harald, > > On 3 Aug 2006, at 16:22, Harald Stoegbauer wrote: > > The problme is that the tfc-files form different subjects have > > different > > amount of channels due to artifact rejection. > > ... > > Is there a simple way to use only channels which are used in all > > subjects ? > > All Fieldtrip functions in principle should support datasets with > different input channels (i.e. only selecting the overlapping > channels), but it seems that that is not yet supported in the > FREQGRANDAVERAGE function. I have fixed that and will include the > updated version in the FTP release tonight. > > thanks for reporting this bug > Robert > -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Thu Sep 7 13:34:37 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 7 Sep 2006 13:34:37 +0200 Subject: question on data formats In-Reply-To: Message-ID: Hi Silvia, I am doing a CC of this mail to the discussion list, since other people may be interested in it as well. Please continue through the maliing list. On 7 Sep 2006, at 10:53, Silvia Gennari wrote: > Thanks very much for your prompt response. I will write to the list > as you suggest. I just wanted to ask you one more thing so I > understand what is involved. > > It seems from what you are saying that if I get the MEG data, the > triggers, and coil positions into some text format, then it would > be OK. I can see in the raw files (in text viewers) the kind of > information we have. I forgot to mention that you also need the coil orientations. But yes, that information would be sufficient, and it does not matter whether that information comes from binary or from text files. Besides this information, it would be convenient to have additional information, like the position of the coils used for head localization (I am not sure how that is done for BTi, but I presume in a similar fashion as CTF). And it is convenient to read the auxiliary files that are generated with the BTi software, e.g. the MRI file and the head model file. But the data represented in those files can all be generated and managed inside FT. > Also, I do open the data in Matlab, and I have some functions that > are trying to do some basic kind of analysis. So the problem is > not reading the data into MAtlab but the kind of assumptions that > Fieldtrip makes regarding the layout of the information. Fieldtrip works with data structured in particular ways. The most basic data structure from where most analysis start is that of raw data, which is the output of PREPROCESSING. Have a look at http:// www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:dataformats, which I just updated. Furthermore, have a look at http://www2.ru.nl/fcdonders/fieldtrip/ doku.php?id=fieldtrip:documentation:tutorial:introduction and especially figure 3 to see how the functions interact and how the data flows. Other fieldtrip functions, such as TIMELOCKANALYSIS, FREQANALYSIS and SOURCEANALYSIS also have relatively fixed output structure. As long as you use data structures that are fieldtrip-like, you can use fieldtrip functions on them. best, Robert From r.oostenveld at FCDONDERS.RU.NL Thu Sep 7 15:01:14 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 7 Sep 2006 15:01:14 +0200 Subject: channel mismatch In-Reply-To: <5bbfdea0609040730qd82aed4q70e0070eb5b1bab9@mail.gmail.com> Message-ID: It is described in sufficient detail -- for referencing to -- in Takashima et al. (2006) and in Osipova et al. (accepted, will appear soon). More details are on http://www2.ru.nl/fcdonders/fieldtrip/ doku.php?id=fieldtrip:publications Robert On 4 Sep 2006, at 16:30, Harald Stoegbauer wrote: > Is there any paper/reference on the Cluster-level randomization > test available ? From nathanweisz at MAC.COM Thu Sep 7 23:19:59 2006 From: nathanweisz at MAC.COM (Nathan Weisz) Date: Thu, 7 Sep 2006 23:19:59 +0200 Subject: dipole moment Message-ID: hi everyone, my intention is to steal some code of the dipolefitting function to model source activity of raw EEG data (keep fixed locations, just analyse changes in dipole moment; i have a leadfield matrix using prepare_leadfield). to test things i used a visual ERP data set as outputted by timelockanalysis. the waveforms look fine, i just get really huge values: ~14000 as maximum dipole moments (the N1 is about 6000). so my question is what units i have? do i have to scale by 1000 to get nAm (14 & 6 nAm would make sense) or do these values imply that something has gone completely wrong. thanks in advance, nathan From r.oostenveld at FCDONDERS.RU.NL Fri Sep 8 12:39:02 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 8 Sep 2006 12:39:02 +0200 Subject: dipole moment In-Reply-To: <68AF4365-C630-4E9F-87DE-9A5C65E639CD@mac.com> Message-ID: Hi Nathan, On 7 Sep 2006, at 23:19, Nathan Weisz wrote: > my intention is to steal some code of the dipolefitting function to > model source activity of raw EEG data (keep fixed locations, just > analyse changes in dipole moment; i have a leadfield matrix using > prepare_leadfield). to test things i used a visual ERP data set as > outputted by timelockanalysis. Probably you could use dipolefitting with cfg.nonlinear='no' and cfg.gridsearch='no', then the dipole(s) stays where you initially put it(them), and only the moment is estimated. But your approach is also fine. > the waveforms look fine, i just get really huge values: ~14000 as > maximum dipole moments (the N1 is about 6000). so my question is > what units i have? do i have to scale by 1000 to get nAm (14 & 6 > nAm would make sense) or do these values imply that something has > gone completely wrong. There are different physical entities with different units involved, you have to ensure that they are all consistent: electrode positions and volume conductor geometry represent distance (e.g. meter), tissue resistance is in ohm per distance (ohm/m -> conductance is the other way around), potentials are in volt (or often in uV), currents are in A (or mA, uA, nA). If you mix them up, it is easy to get a factor of 10^n difference. E.g. I presume that your N1 is not "6000" Volts (if so, then I would rather stay away from your subject). Robert From thomas at UCSD.EDU Tue Sep 12 01:01:52 2006 From: thomas at UCSD.EDU (Thomas Thesen) Date: Tue, 12 Sep 2006 01:01:52 +0200 Subject: Neuromag stats Message-ID: Hi FieldTrippers, I am trying to run clusterrandanalysis on single-subject data that have been collected on a Neuromag system. It seems that I am running into problems with the neighbouring channel geometry. The epochs are already in a format that went through timelockanalysis and gives the following structure: timelock_data = avg: [102x102 double] var: [102x102 double] fsample: 250 numsamples: [297x1 double] time: [1x102 double] dofvec: [1x102 double] label: {1x102 cell} trial: [297x102x102 double] dimord: 'rpt_chan_time' grad: [1x1 struct] cfg: [1x1 struct] When trying to run the data through clusterrandanalysis using: cfg = []; cfg.statistic = 'depsamplesT'; cfg.alphathresh = 0.01;; cfg.makeclusters = 'yes'; cfg.minnbchan = 0; cfg.clusterteststat = 'orderedsums'; cfg.smallestcluster = 5; cfg.onetwo = 'twosided'; cfg.alpha = cfg.alphathresh ; cfg.nranddraws = 10; cfg.gradfile = data.grad.pnt; [clusrand] = clusterrandanalysis (cfg, timelock_data, timelock_data); It gives the following error message: Selecting and formatting the data. selected 102 channels selected 1 time bins selected 1 frequency bins Calculating the neighbourhood structure of the channels. Obtaining the gradiometer configuration from a file. ??? Error using ==> exist The first input to exist is a string. Error in ==> read_fcdc_elec at 60 if ~exist(filename) Error in ==> clusterrandanalysis>getneighbgeometry at 496 data.grad = read_fcdc_elec(cfg.gradfile); Error in ==> clusterrandanalysis at 461 [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); There seems to be some problem with the gradfile, but I am not sure what exactly. data.grad.pnt contains the sensor configuration. Here is an excerpt: 0.0545 -0.1029 0.0548 0.1002 0.0059 0.0467 0.1002 0.0059 0.0467 0.1023 -0.0238 0.0226 0.1023 -0.0238 0.0226 0.0946 -0.0541 0.0357 0.0946 -0.0541 0.0357 0.0972 -0.0246 0.0603 0.0972 -0.0246 0.0603 The data file timelock_data.m can be downloaded at http://mmil.ucsd.edu/thomas/FT/ if someone could be so nice to have a look at it, I'd really appreciate it. Thanks a lot, Thomas From r.oostenveld at FCDONDERS.RU.NL Wed Sep 13 21:23:21 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 13 Sep 2006 21:23:21 +0200 Subject: Neuromag stats In-Reply-To: Message-ID: Hi Thomas To start with a remark: I suggest that you switch to timelockstatistics/freqstatistics/sourcestatistics, they are the new interface to randomization testing with clustering. These new functions have the same options (and more), but most importantly: they are easier to understand (at least that is what we hope). From now on I will refer to the new functions, but you can do most of the stuff also with the old clusterrandanalysis function. On 12 Sep 2006, at 1:01, Thomas Thesen wrote: > I am trying to run clusterrandanalysis on single-subject data that > have been > collected on a Neuromag system. It seems that I am running into > problems > with the neighbouring channel geometry. We do have (some) experience with that for frequency and time- frequency (power) data, but then based on the virtual planar gradients that we can compute for the CTF system (using MEGPLANAR). I don't think that sofar anyone ever used it for ERP data. The approach we use for power data is PREPROCESSING -> MEGPLANAR -> FREQANALYSIS (with keeptrials) -> COOMBINEPLANAR -> FREQSTATISTICS i.e. the statistic is computed after summing the power in the two planar channels at each sensor location. The power is added for each trial. For ERF data, COMBINEPLANAR is using Pythagoras rule (z^2=x^2+y^2) to compute the combined amplitude of the two planar channels at each location. In that computation, the sign of the field is lost. I.e. you can combine planar ERFs, but you might get into problems with different noise bias and with the interpretation of the combined data. For the old 122 channel Neuroscan system, there are 122 channels at 66 locations. Since the channels are already planar MEGPLANAR is not needed. After COMBINEPLANAR, you have a 66 channel data structure. > The epochs are already in a format that went through > timelockanalysis and > gives the following structure: > > timelock_data = > > avg: [102x102 double] > var: [102x102 double] > fsample: 250 > numsamples: [297x1 double] > time: [1x102 double] > dofvec: [1x102 double] > label: {1x102 cell} > trial: [297x102x102 double] > dimord: 'rpt_chan_time' > grad: [1x1 struct] > cfg: [1x1 struct] It seems that you have 102 channels in the data. You have a 306ch Neuroscan system, with 102 magnetometers and 2x102 planar gradiometers. Are you using the magnetometers (which should probably work), the combined planar channels (102+102=102, should also work) or what? > When trying to run the data through clusterrandanalysis using: > ... > It gives the following error message: > > Selecting and formatting the data. > selected 102 channels > ... > Calculating the neighbourhood structure of the channels. > Obtaining the gradiometer configuration from a file. > ??? Error using ==> exist > The first input to exist is a string. > > Error in ==> read_fcdc_elec at 60 The read_fcdc_elec function should not get called there actually, so something is wrong. Please try using the stand-alone (find attached, I will ad it to the ftp release) NEIGHBOURSELECTION function and put the result in cfg.neighbours. Furthermore, use TIMELOCKSTATISTICS. > There seems to be some problem with the gradfile, but I am not sure > what > exactly. Oh, now I see. You specified cfg.gradfile = data.grad.pnt. You should do either cfg.grad = structure with gradiometer definition (*) or cfg.gradfile = string, file containing the gradiometer definition or neither of them, in which case data.grad will be used. In case (*), the correct syntax would have been cfg.grad=data.grad, i.e. the complete structure (including pnt/ori/tra/label). I suggest that you try with NEIGHBOURSELECTION. It still might not work for the neuromag data (we only used it on pseudo-planar CTF sofar), but that can be extended. Once the initial neighbourhood definition is set up, we can work out the other details about the neuromag data (i.e. planar ERFs). best regards, Robert -------------- next part -------------- A non-text attachment was scrubbed... Name: neighbourselection.m Type: application/octet-stream Size: 4770 bytes Desc: not available URL: -------------- next part -------------- From s.gennari at PSYCH.YORK.AC.UK Thu Sep 14 18:27:05 2006 From: s.gennari at PSYCH.YORK.AC.UK (Silvia Gennari) Date: Thu, 14 Sep 2006 17:27:05 +0100 Subject: 4D data files Message-ID: Hi, all I am trying to get fieldtrip to read 4D data (BTi). I can see in my data all the pertinent information. But the scanner produces several files in which the information is distributed. The header information as well as the trigger information, sample rate and sensor positions is in a different file from the actual raw data files. This data files can be read into matlab with no problems. But Fieldtrip needs to put this together with the header and triggers. It seems that I have all the information I need to be able to read the data, but I am having trouble working with the read-xxxx functions. I just wonder whether someone else have tried to do this so I can get some help. Thanks!! Silvia Silvia Gennari Department of Psychology University of York Heslington, York YO10 5DD United Kingdom -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Thu Sep 14 20:45:16 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 14 Sep 2006 20:45:16 +0200 Subject: 4D data files In-Reply-To: <091094D4-0E94-482F-9016-96A2BBDB4764@PSYCH.YORK.AC.UK> Message-ID: Dear Sylvia, On 14 Sep 2006, at 18:27, Silvia Gennari wrote: > I am trying to get fieldtrip to read 4D data (BTi). I can see in my > data all the pertinent information. Sounds good. Are you using ascii files exported with 4D software, or are you using the original files? > But the scanner produces several files in which the information is > distributed. That is not a problem in itself, as long as you can refer to the collection of data as a whole. The CTF systems produce a directory (that has a name ending with *.ds) with a whole bunch of files in them. In that case we point to it as cfg.dataset="directory_name". In the case of BrainVision Analyzer EEG data, the data, header and triggers are in three seperate files, in which only the extension differs. In that case we use cfg.datafile and cfg.headerfile, each pointing to the appropriate file. There is even a function that translates between them, i.e. that sorts out the filenames (see fieldtrip/private/dataset2files). For the events, most intelligence is in read_fcdc_event, where it determines on the fly which trigger file belongs to the dataset/datafile/headerfile. How many files do you have? Do the files all have the same basename (i.e. without the extension)? If more than three and if they don't have similar names, I suggest to put them in a directory and treat it as in the CTF case. If they have a similar basename, I would put the intelligence for figuring out the extensions in the low level functions. If you have two, I would use the datafile/headerfile specification. Could you upload a zip file with some demo data on ftp://ftp.fcdonders.nl/pub/incoming (anonymous login, the directory is write only)? > The header information as well as the trigger information, sample > rate and sensor positions is in a different file from the actual > raw data files. This data files can be read into matlab with no > problems. But Fieldtrip needs to put this together with the header > and triggers. I suggest that you look at the specifications in the documentation in read_fcdc_data and read_fcdc_header, and that you try to implement a read_bti_data and read_bti_header function that behave similar. If that works, I will include them in fieldtrip as low level functions (i.e. requires a minimal amount of "glue" between fieldtrip and your functions). Alternatively, you can also implement the read_bti_data and read_bti_header in any way you like, and I will also be able to glue them into the read_fcdc_data and read_fcdc_header wrapper functions. Important to realise is that the read_fcdc_data/header functions are rather minimalistic. Most complex stuff is taken care of by the fieldtrip definetrial and preprocessing functions. There are two other details that are important, and that is adding support to read_fcdc_event and writing a private/bti2grad function (see ctf2grad, yokogawa2grad and fif2grad for examples and see link1 below). Regarding events: I have no idea about how that is arranged in the bti files, but the end result should look like an event structure. I suggest that you look through the read_fcdc_event function and at the documentation at link2. I hope this helps to get started. best regards, Robert PS the thee read_fcdc_xxx functions directly call the private/ read_xxx functions. Those are functionally equivalent, but more flexible. For the motivation behind it and otyher details, see link3. link1 -> http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:frequently_asked_questions#how_are_electrodes _magnetometers_or_gradiometers_described link2 -> http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:frequently_asked_questions#what_is_the_relati on_between_events_such_as_triggers_and_trials link3 -> http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:development:read_fcdc_xxx From r.oostenveld at FCDONDERS.RU.NL Fri Sep 15 13:09:52 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 15 Sep 2006 13:09:52 +0200 Subject: dipole moment Message-ID: Begin forwarded message: > From: Nathan Weisz > Date: 15. September 2006 12:47:48 MESZ > To: FieldTrip discussion list > Subject: Re: [FIELDTRIP] dipole moment > > hi robert, > > thanks for the answer. i'm still a little bit confused. i think it > has something to do with the units of my volume conductor. > > %%%%% > here my original settings with cm units: > vol = []; > vol.r = 12*[0.88 0.92 1.00]; % radii of spheres, the head radius is > 12 cm > vol.c = [1 1/80 1]; > vol.o = [0 0 0]; > > cfg = []; > cfg.elec = dataav.elec; > cfg.elec.pnt = 12*cfg.elec.pnt; > cfg.vol = vol; > cfg.grid.pos=12*[-.51 -.37 .49; .51 -.37 .49;-.01 -.67 .08;.00 .33 . > 59]; > grid = prepare_leadfield(cfg); > > lf1=grid.leadfield{1}; > lf2=grid.leadfield{2}; > lf3=grid.leadfield{3}; > lf4=grid.leadfield{4}; > > dipmom1=pinv(lf1)*dataav.avg; > dipmom2=pinv(lf2)*dataav.avg; > dipmom3=pinv(lf3)*dataav.avg; > dipmom4=pinv(lf4)*dataav.avg; > > %%%% > > ----> this yields huge value: > >> max(mean(dipmom3)) > > ans = > > 7.3627e+03 > > now the same thing with unit sphere > > %%% > > vol = []; > vol.r = [0.88 0.92 1.00]; > vol.c = [1 1/80 1]; > vol.o = [0 0 0]; > > cfg = []; > cfg.elec = dataav.elec; > cfg.elec.pnt = cfg.elec.pnt; > cfg.vol = vol; > cfg.grid.pos=[-.51 -.37 .49; .51 -.37 .49;-.01 -.67 .08;.00 .33 .59]; > grid = prepare_leadfield(cfg); > > lf1=grid.leadfield{1}; > lf2=grid.leadfield{2}; > lf3=grid.leadfield{3}; > lf4=grid.leadfield{4}; > > dipmom1=pinv(lf1)*dataav.avg; > dipmom2=pinv(lf2)*dataav.avg; > dipmom3=pinv(lf3)*dataav.avg; > dipmom4=pinv(lf4)*dataav.avg; > > %%%% > > >> max(mean(dipmom3)) > > ans = > > 51.1298 > > best, > nathan > > > > > On 08.09.2006, at 12:39, Robert Oostenveld wrote: > >> Hi Nathan, >> >> On 7 Sep 2006, at 23:19, Nathan Weisz wrote: >>> my intention is to steal some code of the dipolefitting function >>> to model source activity of raw EEG data (keep fixed locations, >>> just analyse changes in dipole moment; i have a leadfield matrix >>> using prepare_leadfield). to test things i used a visual ERP data >>> set as outputted by timelockanalysis. >> >> Probably you could use dipolefitting with cfg.nonlinear='no' and >> cfg.gridsearch='no', then the dipole(s) stays where you initially >> put it(them), and only the moment is estimated. But your approach >> is also fine. >> >>> the waveforms look fine, i just get really huge values: ~14000 as >>> maximum dipole moments (the N1 is about 6000). so my question is >>> what units i have? do i have to scale by 1000 to get nAm (14 & 6 >>> nAm would make sense) or do these values imply that something has >>> gone completely wrong. >> >> There are different physical entities with different units >> involved, you have to ensure that they are all consistent: >> electrode positions and volume conductor geometry represent >> distance (e.g. meter), tissue resistance is in ohm per distance >> (ohm/m -> conductance is the other way around), potentials are in >> volt (or often in uV), currents are in A (or mA, uA, nA). If you >> mix them up, it is easy to get a factor of 10^n difference. E.g. I >> presume that your N1 is not "6000" Volts (if so, then I would >> rather stay away from your subject). >> >> Robert > From Jan.Schoffelen at FCDONDERS.RU.NL Mon Sep 18 11:37:53 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Mon, 18 Sep 2006 11:37:53 +0200 Subject: Fieldtrip question from Piers C In-Reply-To: <1548.217.44.42.174.1158324866.squirrel@psycix.york.ac.uk> Message-ID: Dear Piers, First of all, I took the liberty to include as a CC to this mail the FieldTrip discussion list. It might be that some of its members could positively contribute to answering your questions. You can subscribe to this list on the fieldtrip-website. Anyway, currently there is no support for reading in SAM weights files into fieldtrip. The most important reason for us not having implemented it, is that we do our source estimation in fieldtrip directly. Perhaps anyone already has an implementation to directly read in your SAM weights into matlab (hence the cc to the discussion list). As soon as those weights are available, it is pretty straightforward to create virtual channel data and do the subsequent analysis within fieldtrip. Otherwise a reading routine for SAM weights would be a valuable contribution to the code. Another approach would be to use fieldtrip's beamforming algorithm to create your virtual channels. The 'lcmv'-algorithm is not all too different from SAM, so you could try this on your specified voxels of interest. There is a tutorial on the frequency-domain beamformer on the web-site. The time-domain beamformer needs a slightly different configuration and input-data. 1 you should use timelockanalysis to compute the covariance of your bandpass-filtered data. 2 then you can call sourceanalysis, with the output of timelockanalysis as an input, in combination with a configuration-structure. Key-elements of this configuration would be: cfg.method = 'lcmv'; cfg.pos = Nx3 matrix with x,y,z coordinates of your virtual channels cfg.reducerank = 2; (necessary for comparability with SAM, and also to give reasonable results in the first place) cfg.hdmfile = .hdm file specifying the forward model used ...and I guess some other stuff as well. Yours, Jan-Mathijs -----Original Message----- From: p.cornelissen at psych.york.ac.uk [mailto:p.cornelissen at psych.york.ac.uk] Sent: Friday, September 15, 2006 2:54 PM To: Jan.Schoffelen at fcdonders.ru.nl Subject: Fieldtrip ? from Piers C Dear Fieldtrip team, First - thanks for your excellent software! I hope its OK for me to ask you a Fieldtrip question. We have data from an experiment using Aston (UK) universitie's old 151 channel CTF system, and we have used the CTF tools to extract a set of virtual electrodes, selected on the basis of a robust group SAM analysis. What we would really like to do is to use our SAM weights files for these virtual electrodes, to define specific channels in Fieldtrip so that we can create and compare time*frequency plots from the virtual electrodes in Fieldtrip. Any advice on how to do this (preferably by way of example code)would be deeply appreciated Regards Piers Cornelissen From r.oostenveld at FCDONDERS.RU.NL Tue Sep 19 18:03:04 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Tue, 19 Sep 2006 18:03:04 +0200 Subject: dipole moment In-Reply-To: <5C06834E-DA43-4007-B24A-996515E7435E@fcdonders.ru.nl> Message-ID: Dear Nathan, > Begin forwarded message: >> From: Nathan Weisz >> Date: 15. September 2006 12:47:48 MESZ >> To: FieldTrip discussion list >> Subject: Re: [FIELDTRIP] dipole moment >> >> hi robert, >> thanks for the answer. i'm still a little bit confused. i think it >> has something to do with the units of my volume conductor. You are comparing a 12 "units" sphere with a 1 "units" sphere. The size of the sphere results in a difference in the potential, but the ratio between the spheres is "not nice", hence it is difficult to interpret. I would interpret this as comparing a 12cm to a 1cm sphere. I suggest that you compare a 12cm sphere (specified as a radius of 12) with a 12 cm sphere (specified as a radius of 0.12), also scale the dipole positions. You will also see that those are different, but then with a factor of 10 to the power of something. If you specify a radius of 12 it could equally well be a 12cm as a 12m sphere, hence the difference. Robert From r.oostenveld at FCDONDERS.RU.NL Mon Sep 25 15:34:21 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 25 Sep 2006 15:34:21 +0200 Subject: warning: bug discovered in new cluster-based randomization statistics Message-ID: Dear FT users, last Friday we found a bug in the newly implemented cluster-based randomization statistics. The problem occurred when using either TIMELOCKSTATISTICS, FREQSTATISTICS or SOURCESTATISTICS with cfg.method='montecarlo' in combination with cfg.correctm='cluster' and cfg.clusterthreshold='parametric' (which is the default for clusterthreshold). This bug only affected the new statistics implementations and NOT the old CLUSTERRANDANALYSIS function, which most of you are probably still using for your channel data. The problem was that the samples belonging to the time-frequency- spatial clusters were determined in the observed data, but that the same samples were also re-used to compute the cluster-statistic in each random reshuffling of the data. I.e., the cluster statistics for the randomizations were computed not based on the thresholded data for that randomization, but instead based on the original thresholded data. It is likely that this resulted in values for each random cluster statistic that were smaller that what they should have been (*see note below*), resulting in a randomization distribution of the cluster-statistic that was too narrow (i.e. the histogram was too narrow). Therefore, effects in the observed may have been indicated as significant (in the tail of the randomization distribution) where they should not have been. The bug has not always been in the code, but was recently introduced (copy and paste problem). I suggest that you redo your recent analyses. Sorry about the inconvenience. If you have questions, you can contact us through the mailing list or with a direct mail. best regards, Robert (*) due to the bug, the cluster-statistic values in each observation may also have been larger than what they should have been. This is most likely the case when you have very strong effects. I.e. in strong effects, it is most likely that you have underestimated your significance and in small effects it is likely that you have overestimated your significance. From Brian.Roach at YALE.EDU Fri Sep 29 18:52:25 2006 From: Brian.Roach at YALE.EDU (Brian Roach) Date: Fri, 29 Sep 2006 12:52:25 -0400 Subject: freqanalysis_wltconvol.m Message-ID: Dear FieldTrip users, I have been playing with the freqanalysis_wltconvol function in hopes of using the morlet wavelet time frequency analysis on some eeg data. I have been able to get it running, and I find that it works very quickly, which is great. However, I am hoping some users or F.T. programmers can explain some of the function inputs and processing. The cfg example is as follows: % cfg.method = 'wltconvol'; % cfg.foi = 1:1:100; % cfg.width = 7; % or % cfg.width = linspace(5,10,length(cfg.foi)); % cfg.toi = 0:0.1:2; % cfg.gwidth = 3; I believe that the cfg.width specifies the number of wave cycles used in each frequency's wavelet analysis (so at 2Hz, 7 cycles spans 3500ms of data, right?). Maybe this is not correct, because I do not seem to get the frequencies as low as I would expect given my data epoch length. Perhaps this has to do with the cfg.gwidth parameter, which I do not think I completely understand - what is it? Also, we do not have the matlab wavelet toolbox, and it appears that it is not required, but how is the morlet wavelet implemented? As I look through the code I see calls to fft, ifft, and fftshift, but I wonder how I can give a good technical description of this process if I find results in a larger data set. Finally, is there a function or a way to compute the frequency bandwidth based on the cfg inputs, or is there a fix frequency bandwith for each foi here? I am sure I am confusing a number of things here, so no response is too simple. Thanks for any advice, please let me know if there is more information I can give or if I can clarify my questions. Brian -------------- next part -------------- An HTML attachment was scrubbed... URL: From h.stoegbauer at GMAIL.COM Mon Sep 4 16:30:05 2006 From: h.stoegbauer at GMAIL.COM (Harald Stoegbauer) Date: Mon, 4 Sep 2006 16:30:05 +0200 Subject: channel mismatch In-Reply-To: Message-ID: Hi Robert, Thanks for your reply. Is there any paper/reference on the Cluster-level randomization test available ? Thanks, Harald On 8/29/06, Robert Oostenveld wrote: > > Hi Harald, > > On 3 Aug 2006, at 16:22, Harald Stoegbauer wrote: > > The problme is that the tfc-files form different subjects have > > different > > amount of channels due to artifact rejection. > > ... > > Is there a simple way to use only channels which are used in all > > subjects ? > > All Fieldtrip functions in principle should support datasets with > different input channels (i.e. only selecting the overlapping > channels), but it seems that that is not yet supported in the > FREQGRANDAVERAGE function. I have fixed that and will include the > updated version in the FTP release tonight. > > thanks for reporting this bug > Robert > -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Thu Sep 7 13:34:37 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 7 Sep 2006 13:34:37 +0200 Subject: question on data formats In-Reply-To: Message-ID: Hi Silvia, I am doing a CC of this mail to the discussion list, since other people may be interested in it as well. Please continue through the maliing list. On 7 Sep 2006, at 10:53, Silvia Gennari wrote: > Thanks very much for your prompt response. I will write to the list > as you suggest. I just wanted to ask you one more thing so I > understand what is involved. > > It seems from what you are saying that if I get the MEG data, the > triggers, and coil positions into some text format, then it would > be OK. I can see in the raw files (in text viewers) the kind of > information we have. I forgot to mention that you also need the coil orientations. But yes, that information would be sufficient, and it does not matter whether that information comes from binary or from text files. Besides this information, it would be convenient to have additional information, like the position of the coils used for head localization (I am not sure how that is done for BTi, but I presume in a similar fashion as CTF). And it is convenient to read the auxiliary files that are generated with the BTi software, e.g. the MRI file and the head model file. But the data represented in those files can all be generated and managed inside FT. > Also, I do open the data in Matlab, and I have some functions that > are trying to do some basic kind of analysis. So the problem is > not reading the data into MAtlab but the kind of assumptions that > Fieldtrip makes regarding the layout of the information. Fieldtrip works with data structured in particular ways. The most basic data structure from where most analysis start is that of raw data, which is the output of PREPROCESSING. Have a look at http:// www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:dataformats, which I just updated. Furthermore, have a look at http://www2.ru.nl/fcdonders/fieldtrip/ doku.php?id=fieldtrip:documentation:tutorial:introduction and especially figure 3 to see how the functions interact and how the data flows. Other fieldtrip functions, such as TIMELOCKANALYSIS, FREQANALYSIS and SOURCEANALYSIS also have relatively fixed output structure. As long as you use data structures that are fieldtrip-like, you can use fieldtrip functions on them. best, Robert From r.oostenveld at FCDONDERS.RU.NL Thu Sep 7 15:01:14 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 7 Sep 2006 15:01:14 +0200 Subject: channel mismatch In-Reply-To: <5bbfdea0609040730qd82aed4q70e0070eb5b1bab9@mail.gmail.com> Message-ID: It is described in sufficient detail -- for referencing to -- in Takashima et al. (2006) and in Osipova et al. (accepted, will appear soon). More details are on http://www2.ru.nl/fcdonders/fieldtrip/ doku.php?id=fieldtrip:publications Robert On 4 Sep 2006, at 16:30, Harald Stoegbauer wrote: > Is there any paper/reference on the Cluster-level randomization > test available ? From nathanweisz at MAC.COM Thu Sep 7 23:19:59 2006 From: nathanweisz at MAC.COM (Nathan Weisz) Date: Thu, 7 Sep 2006 23:19:59 +0200 Subject: dipole moment Message-ID: hi everyone, my intention is to steal some code of the dipolefitting function to model source activity of raw EEG data (keep fixed locations, just analyse changes in dipole moment; i have a leadfield matrix using prepare_leadfield). to test things i used a visual ERP data set as outputted by timelockanalysis. the waveforms look fine, i just get really huge values: ~14000 as maximum dipole moments (the N1 is about 6000). so my question is what units i have? do i have to scale by 1000 to get nAm (14 & 6 nAm would make sense) or do these values imply that something has gone completely wrong. thanks in advance, nathan From r.oostenveld at FCDONDERS.RU.NL Fri Sep 8 12:39:02 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 8 Sep 2006 12:39:02 +0200 Subject: dipole moment In-Reply-To: <68AF4365-C630-4E9F-87DE-9A5C65E639CD@mac.com> Message-ID: Hi Nathan, On 7 Sep 2006, at 23:19, Nathan Weisz wrote: > my intention is to steal some code of the dipolefitting function to > model source activity of raw EEG data (keep fixed locations, just > analyse changes in dipole moment; i have a leadfield matrix using > prepare_leadfield). to test things i used a visual ERP data set as > outputted by timelockanalysis. Probably you could use dipolefitting with cfg.nonlinear='no' and cfg.gridsearch='no', then the dipole(s) stays where you initially put it(them), and only the moment is estimated. But your approach is also fine. > the waveforms look fine, i just get really huge values: ~14000 as > maximum dipole moments (the N1 is about 6000). so my question is > what units i have? do i have to scale by 1000 to get nAm (14 & 6 > nAm would make sense) or do these values imply that something has > gone completely wrong. There are different physical entities with different units involved, you have to ensure that they are all consistent: electrode positions and volume conductor geometry represent distance (e.g. meter), tissue resistance is in ohm per distance (ohm/m -> conductance is the other way around), potentials are in volt (or often in uV), currents are in A (or mA, uA, nA). If you mix them up, it is easy to get a factor of 10^n difference. E.g. I presume that your N1 is not "6000" Volts (if so, then I would rather stay away from your subject). Robert From thomas at UCSD.EDU Tue Sep 12 01:01:52 2006 From: thomas at UCSD.EDU (Thomas Thesen) Date: Tue, 12 Sep 2006 01:01:52 +0200 Subject: Neuromag stats Message-ID: Hi FieldTrippers, I am trying to run clusterrandanalysis on single-subject data that have been collected on a Neuromag system. It seems that I am running into problems with the neighbouring channel geometry. The epochs are already in a format that went through timelockanalysis and gives the following structure: timelock_data = avg: [102x102 double] var: [102x102 double] fsample: 250 numsamples: [297x1 double] time: [1x102 double] dofvec: [1x102 double] label: {1x102 cell} trial: [297x102x102 double] dimord: 'rpt_chan_time' grad: [1x1 struct] cfg: [1x1 struct] When trying to run the data through clusterrandanalysis using: cfg = []; cfg.statistic = 'depsamplesT'; cfg.alphathresh = 0.01;; cfg.makeclusters = 'yes'; cfg.minnbchan = 0; cfg.clusterteststat = 'orderedsums'; cfg.smallestcluster = 5; cfg.onetwo = 'twosided'; cfg.alpha = cfg.alphathresh ; cfg.nranddraws = 10; cfg.gradfile = data.grad.pnt; [clusrand] = clusterrandanalysis (cfg, timelock_data, timelock_data); It gives the following error message: Selecting and formatting the data. selected 102 channels selected 1 time bins selected 1 frequency bins Calculating the neighbourhood structure of the channels. Obtaining the gradiometer configuration from a file. ??? Error using ==> exist The first input to exist is a string. Error in ==> read_fcdc_elec at 60 if ~exist(filename) Error in ==> clusterrandanalysis>getneighbgeometry at 496 data.grad = read_fcdc_elec(cfg.gradfile); Error in ==> clusterrandanalysis at 461 [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); There seems to be some problem with the gradfile, but I am not sure what exactly. data.grad.pnt contains the sensor configuration. Here is an excerpt: 0.0545 -0.1029 0.0548 0.1002 0.0059 0.0467 0.1002 0.0059 0.0467 0.1023 -0.0238 0.0226 0.1023 -0.0238 0.0226 0.0946 -0.0541 0.0357 0.0946 -0.0541 0.0357 0.0972 -0.0246 0.0603 0.0972 -0.0246 0.0603 The data file timelock_data.m can be downloaded at http://mmil.ucsd.edu/thomas/FT/ if someone could be so nice to have a look at it, I'd really appreciate it. Thanks a lot, Thomas From r.oostenveld at FCDONDERS.RU.NL Wed Sep 13 21:23:21 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 13 Sep 2006 21:23:21 +0200 Subject: Neuromag stats In-Reply-To: Message-ID: Hi Thomas To start with a remark: I suggest that you switch to timelockstatistics/freqstatistics/sourcestatistics, they are the new interface to randomization testing with clustering. These new functions have the same options (and more), but most importantly: they are easier to understand (at least that is what we hope). From now on I will refer to the new functions, but you can do most of the stuff also with the old clusterrandanalysis function. On 12 Sep 2006, at 1:01, Thomas Thesen wrote: > I am trying to run clusterrandanalysis on single-subject data that > have been > collected on a Neuromag system. It seems that I am running into > problems > with the neighbouring channel geometry. We do have (some) experience with that for frequency and time- frequency (power) data, but then based on the virtual planar gradients that we can compute for the CTF system (using MEGPLANAR). I don't think that sofar anyone ever used it for ERP data. The approach we use for power data is PREPROCESSING -> MEGPLANAR -> FREQANALYSIS (with keeptrials) -> COOMBINEPLANAR -> FREQSTATISTICS i.e. the statistic is computed after summing the power in the two planar channels at each sensor location. The power is added for each trial. For ERF data, COMBINEPLANAR is using Pythagoras rule (z^2=x^2+y^2) to compute the combined amplitude of the two planar channels at each location. In that computation, the sign of the field is lost. I.e. you can combine planar ERFs, but you might get into problems with different noise bias and with the interpretation of the combined data. For the old 122 channel Neuroscan system, there are 122 channels at 66 locations. Since the channels are already planar MEGPLANAR is not needed. After COMBINEPLANAR, you have a 66 channel data structure. > The epochs are already in a format that went through > timelockanalysis and > gives the following structure: > > timelock_data = > > avg: [102x102 double] > var: [102x102 double] > fsample: 250 > numsamples: [297x1 double] > time: [1x102 double] > dofvec: [1x102 double] > label: {1x102 cell} > trial: [297x102x102 double] > dimord: 'rpt_chan_time' > grad: [1x1 struct] > cfg: [1x1 struct] It seems that you have 102 channels in the data. You have a 306ch Neuroscan system, with 102 magnetometers and 2x102 planar gradiometers. Are you using the magnetometers (which should probably work), the combined planar channels (102+102=102, should also work) or what? > When trying to run the data through clusterrandanalysis using: > ... > It gives the following error message: > > Selecting and formatting the data. > selected 102 channels > ... > Calculating the neighbourhood structure of the channels. > Obtaining the gradiometer configuration from a file. > ??? Error using ==> exist > The first input to exist is a string. > > Error in ==> read_fcdc_elec at 60 The read_fcdc_elec function should not get called there actually, so something is wrong. Please try using the stand-alone (find attached, I will ad it to the ftp release) NEIGHBOURSELECTION function and put the result in cfg.neighbours. Furthermore, use TIMELOCKSTATISTICS. > There seems to be some problem with the gradfile, but I am not sure > what > exactly. Oh, now I see. You specified cfg.gradfile = data.grad.pnt. You should do either cfg.grad = structure with gradiometer definition (*) or cfg.gradfile = string, file containing the gradiometer definition or neither of them, in which case data.grad will be used. In case (*), the correct syntax would have been cfg.grad=data.grad, i.e. the complete structure (including pnt/ori/tra/label). I suggest that you try with NEIGHBOURSELECTION. It still might not work for the neuromag data (we only used it on pseudo-planar CTF sofar), but that can be extended. Once the initial neighbourhood definition is set up, we can work out the other details about the neuromag data (i.e. planar ERFs). best regards, Robert -------------- next part -------------- A non-text attachment was scrubbed... Name: neighbourselection.m Type: application/octet-stream Size: 4770 bytes Desc: not available URL: -------------- next part -------------- From s.gennari at PSYCH.YORK.AC.UK Thu Sep 14 18:27:05 2006 From: s.gennari at PSYCH.YORK.AC.UK (Silvia Gennari) Date: Thu, 14 Sep 2006 17:27:05 +0100 Subject: 4D data files Message-ID: Hi, all I am trying to get fieldtrip to read 4D data (BTi). I can see in my data all the pertinent information. But the scanner produces several files in which the information is distributed. The header information as well as the trigger information, sample rate and sensor positions is in a different file from the actual raw data files. This data files can be read into matlab with no problems. But Fieldtrip needs to put this together with the header and triggers. It seems that I have all the information I need to be able to read the data, but I am having trouble working with the read-xxxx functions. I just wonder whether someone else have tried to do this so I can get some help. Thanks!! Silvia Silvia Gennari Department of Psychology University of York Heslington, York YO10 5DD United Kingdom -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Thu Sep 14 20:45:16 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 14 Sep 2006 20:45:16 +0200 Subject: 4D data files In-Reply-To: <091094D4-0E94-482F-9016-96A2BBDB4764@PSYCH.YORK.AC.UK> Message-ID: Dear Sylvia, On 14 Sep 2006, at 18:27, Silvia Gennari wrote: > I am trying to get fieldtrip to read 4D data (BTi). I can see in my > data all the pertinent information. Sounds good. Are you using ascii files exported with 4D software, or are you using the original files? > But the scanner produces several files in which the information is > distributed. That is not a problem in itself, as long as you can refer to the collection of data as a whole. The CTF systems produce a directory (that has a name ending with *.ds) with a whole bunch of files in them. In that case we point to it as cfg.dataset="directory_name". In the case of BrainVision Analyzer EEG data, the data, header and triggers are in three seperate files, in which only the extension differs. In that case we use cfg.datafile and cfg.headerfile, each pointing to the appropriate file. There is even a function that translates between them, i.e. that sorts out the filenames (see fieldtrip/private/dataset2files). For the events, most intelligence is in read_fcdc_event, where it determines on the fly which trigger file belongs to the dataset/datafile/headerfile. How many files do you have? Do the files all have the same basename (i.e. without the extension)? If more than three and if they don't have similar names, I suggest to put them in a directory and treat it as in the CTF case. If they have a similar basename, I would put the intelligence for figuring out the extensions in the low level functions. If you have two, I would use the datafile/headerfile specification. Could you upload a zip file with some demo data on ftp://ftp.fcdonders.nl/pub/incoming (anonymous login, the directory is write only)? > The header information as well as the trigger information, sample > rate and sensor positions is in a different file from the actual > raw data files. This data files can be read into matlab with no > problems. But Fieldtrip needs to put this together with the header > and triggers. I suggest that you look at the specifications in the documentation in read_fcdc_data and read_fcdc_header, and that you try to implement a read_bti_data and read_bti_header function that behave similar. If that works, I will include them in fieldtrip as low level functions (i.e. requires a minimal amount of "glue" between fieldtrip and your functions). Alternatively, you can also implement the read_bti_data and read_bti_header in any way you like, and I will also be able to glue them into the read_fcdc_data and read_fcdc_header wrapper functions. Important to realise is that the read_fcdc_data/header functions are rather minimalistic. Most complex stuff is taken care of by the fieldtrip definetrial and preprocessing functions. There are two other details that are important, and that is adding support to read_fcdc_event and writing a private/bti2grad function (see ctf2grad, yokogawa2grad and fif2grad for examples and see link1 below). Regarding events: I have no idea about how that is arranged in the bti files, but the end result should look like an event structure. I suggest that you look through the read_fcdc_event function and at the documentation at link2. I hope this helps to get started. best regards, Robert PS the thee read_fcdc_xxx functions directly call the private/ read_xxx functions. Those are functionally equivalent, but more flexible. For the motivation behind it and otyher details, see link3. link1 -> http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:frequently_asked_questions#how_are_electrodes _magnetometers_or_gradiometers_described link2 -> http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:frequently_asked_questions#what_is_the_relati on_between_events_such_as_triggers_and_trials link3 -> http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:development:read_fcdc_xxx From r.oostenveld at FCDONDERS.RU.NL Fri Sep 15 13:09:52 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 15 Sep 2006 13:09:52 +0200 Subject: dipole moment Message-ID: Begin forwarded message: > From: Nathan Weisz > Date: 15. September 2006 12:47:48 MESZ > To: FieldTrip discussion list > Subject: Re: [FIELDTRIP] dipole moment > > hi robert, > > thanks for the answer. i'm still a little bit confused. i think it > has something to do with the units of my volume conductor. > > %%%%% > here my original settings with cm units: > vol = []; > vol.r = 12*[0.88 0.92 1.00]; % radii of spheres, the head radius is > 12 cm > vol.c = [1 1/80 1]; > vol.o = [0 0 0]; > > cfg = []; > cfg.elec = dataav.elec; > cfg.elec.pnt = 12*cfg.elec.pnt; > cfg.vol = vol; > cfg.grid.pos=12*[-.51 -.37 .49; .51 -.37 .49;-.01 -.67 .08;.00 .33 . > 59]; > grid = prepare_leadfield(cfg); > > lf1=grid.leadfield{1}; > lf2=grid.leadfield{2}; > lf3=grid.leadfield{3}; > lf4=grid.leadfield{4}; > > dipmom1=pinv(lf1)*dataav.avg; > dipmom2=pinv(lf2)*dataav.avg; > dipmom3=pinv(lf3)*dataav.avg; > dipmom4=pinv(lf4)*dataav.avg; > > %%%% > > ----> this yields huge value: > >> max(mean(dipmom3)) > > ans = > > 7.3627e+03 > > now the same thing with unit sphere > > %%% > > vol = []; > vol.r = [0.88 0.92 1.00]; > vol.c = [1 1/80 1]; > vol.o = [0 0 0]; > > cfg = []; > cfg.elec = dataav.elec; > cfg.elec.pnt = cfg.elec.pnt; > cfg.vol = vol; > cfg.grid.pos=[-.51 -.37 .49; .51 -.37 .49;-.01 -.67 .08;.00 .33 .59]; > grid = prepare_leadfield(cfg); > > lf1=grid.leadfield{1}; > lf2=grid.leadfield{2}; > lf3=grid.leadfield{3}; > lf4=grid.leadfield{4}; > > dipmom1=pinv(lf1)*dataav.avg; > dipmom2=pinv(lf2)*dataav.avg; > dipmom3=pinv(lf3)*dataav.avg; > dipmom4=pinv(lf4)*dataav.avg; > > %%%% > > >> max(mean(dipmom3)) > > ans = > > 51.1298 > > best, > nathan > > > > > On 08.09.2006, at 12:39, Robert Oostenveld wrote: > >> Hi Nathan, >> >> On 7 Sep 2006, at 23:19, Nathan Weisz wrote: >>> my intention is to steal some code of the dipolefitting function >>> to model source activity of raw EEG data (keep fixed locations, >>> just analyse changes in dipole moment; i have a leadfield matrix >>> using prepare_leadfield). to test things i used a visual ERP data >>> set as outputted by timelockanalysis. >> >> Probably you could use dipolefitting with cfg.nonlinear='no' and >> cfg.gridsearch='no', then the dipole(s) stays where you initially >> put it(them), and only the moment is estimated. But your approach >> is also fine. >> >>> the waveforms look fine, i just get really huge values: ~14000 as >>> maximum dipole moments (the N1 is about 6000). so my question is >>> what units i have? do i have to scale by 1000 to get nAm (14 & 6 >>> nAm would make sense) or do these values imply that something has >>> gone completely wrong. >> >> There are different physical entities with different units >> involved, you have to ensure that they are all consistent: >> electrode positions and volume conductor geometry represent >> distance (e.g. meter), tissue resistance is in ohm per distance >> (ohm/m -> conductance is the other way around), potentials are in >> volt (or often in uV), currents are in A (or mA, uA, nA). If you >> mix them up, it is easy to get a factor of 10^n difference. E.g. I >> presume that your N1 is not "6000" Volts (if so, then I would >> rather stay away from your subject). >> >> Robert > From Jan.Schoffelen at FCDONDERS.RU.NL Mon Sep 18 11:37:53 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Mon, 18 Sep 2006 11:37:53 +0200 Subject: Fieldtrip question from Piers C In-Reply-To: <1548.217.44.42.174.1158324866.squirrel@psycix.york.ac.uk> Message-ID: Dear Piers, First of all, I took the liberty to include as a CC to this mail the FieldTrip discussion list. It might be that some of its members could positively contribute to answering your questions. You can subscribe to this list on the fieldtrip-website. Anyway, currently there is no support for reading in SAM weights files into fieldtrip. The most important reason for us not having implemented it, is that we do our source estimation in fieldtrip directly. Perhaps anyone already has an implementation to directly read in your SAM weights into matlab (hence the cc to the discussion list). As soon as those weights are available, it is pretty straightforward to create virtual channel data and do the subsequent analysis within fieldtrip. Otherwise a reading routine for SAM weights would be a valuable contribution to the code. Another approach would be to use fieldtrip's beamforming algorithm to create your virtual channels. The 'lcmv'-algorithm is not all too different from SAM, so you could try this on your specified voxels of interest. There is a tutorial on the frequency-domain beamformer on the web-site. The time-domain beamformer needs a slightly different configuration and input-data. 1 you should use timelockanalysis to compute the covariance of your bandpass-filtered data. 2 then you can call sourceanalysis, with the output of timelockanalysis as an input, in combination with a configuration-structure. Key-elements of this configuration would be: cfg.method = 'lcmv'; cfg.pos = Nx3 matrix with x,y,z coordinates of your virtual channels cfg.reducerank = 2; (necessary for comparability with SAM, and also to give reasonable results in the first place) cfg.hdmfile = .hdm file specifying the forward model used ...and I guess some other stuff as well. Yours, Jan-Mathijs -----Original Message----- From: p.cornelissen at psych.york.ac.uk [mailto:p.cornelissen at psych.york.ac.uk] Sent: Friday, September 15, 2006 2:54 PM To: Jan.Schoffelen at fcdonders.ru.nl Subject: Fieldtrip ? from Piers C Dear Fieldtrip team, First - thanks for your excellent software! I hope its OK for me to ask you a Fieldtrip question. We have data from an experiment using Aston (UK) universitie's old 151 channel CTF system, and we have used the CTF tools to extract a set of virtual electrodes, selected on the basis of a robust group SAM analysis. What we would really like to do is to use our SAM weights files for these virtual electrodes, to define specific channels in Fieldtrip so that we can create and compare time*frequency plots from the virtual electrodes in Fieldtrip. Any advice on how to do this (preferably by way of example code)would be deeply appreciated Regards Piers Cornelissen From r.oostenveld at FCDONDERS.RU.NL Tue Sep 19 18:03:04 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Tue, 19 Sep 2006 18:03:04 +0200 Subject: dipole moment In-Reply-To: <5C06834E-DA43-4007-B24A-996515E7435E@fcdonders.ru.nl> Message-ID: Dear Nathan, > Begin forwarded message: >> From: Nathan Weisz >> Date: 15. September 2006 12:47:48 MESZ >> To: FieldTrip discussion list >> Subject: Re: [FIELDTRIP] dipole moment >> >> hi robert, >> thanks for the answer. i'm still a little bit confused. i think it >> has something to do with the units of my volume conductor. You are comparing a 12 "units" sphere with a 1 "units" sphere. The size of the sphere results in a difference in the potential, but the ratio between the spheres is "not nice", hence it is difficult to interpret. I would interpret this as comparing a 12cm to a 1cm sphere. I suggest that you compare a 12cm sphere (specified as a radius of 12) with a 12 cm sphere (specified as a radius of 0.12), also scale the dipole positions. You will also see that those are different, but then with a factor of 10 to the power of something. If you specify a radius of 12 it could equally well be a 12cm as a 12m sphere, hence the difference. Robert From r.oostenveld at FCDONDERS.RU.NL Mon Sep 25 15:34:21 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 25 Sep 2006 15:34:21 +0200 Subject: warning: bug discovered in new cluster-based randomization statistics Message-ID: Dear FT users, last Friday we found a bug in the newly implemented cluster-based randomization statistics. The problem occurred when using either TIMELOCKSTATISTICS, FREQSTATISTICS or SOURCESTATISTICS with cfg.method='montecarlo' in combination with cfg.correctm='cluster' and cfg.clusterthreshold='parametric' (which is the default for clusterthreshold). This bug only affected the new statistics implementations and NOT the old CLUSTERRANDANALYSIS function, which most of you are probably still using for your channel data. The problem was that the samples belonging to the time-frequency- spatial clusters were determined in the observed data, but that the same samples were also re-used to compute the cluster-statistic in each random reshuffling of the data. I.e., the cluster statistics for the randomizations were computed not based on the thresholded data for that randomization, but instead based on the original thresholded data. It is likely that this resulted in values for each random cluster statistic that were smaller that what they should have been (*see note below*), resulting in a randomization distribution of the cluster-statistic that was too narrow (i.e. the histogram was too narrow). Therefore, effects in the observed may have been indicated as significant (in the tail of the randomization distribution) where they should not have been. The bug has not always been in the code, but was recently introduced (copy and paste problem). I suggest that you redo your recent analyses. Sorry about the inconvenience. If you have questions, you can contact us through the mailing list or with a direct mail. best regards, Robert (*) due to the bug, the cluster-statistic values in each observation may also have been larger than what they should have been. This is most likely the case when you have very strong effects. I.e. in strong effects, it is most likely that you have underestimated your significance and in small effects it is likely that you have overestimated your significance. From Brian.Roach at YALE.EDU Fri Sep 29 18:52:25 2006 From: Brian.Roach at YALE.EDU (Brian Roach) Date: Fri, 29 Sep 2006 12:52:25 -0400 Subject: freqanalysis_wltconvol.m Message-ID: Dear FieldTrip users, I have been playing with the freqanalysis_wltconvol function in hopes of using the morlet wavelet time frequency analysis on some eeg data. I have been able to get it running, and I find that it works very quickly, which is great. However, I am hoping some users or F.T. programmers can explain some of the function inputs and processing. The cfg example is as follows: % cfg.method = 'wltconvol'; % cfg.foi = 1:1:100; % cfg.width = 7; % or % cfg.width = linspace(5,10,length(cfg.foi)); % cfg.toi = 0:0.1:2; % cfg.gwidth = 3; I believe that the cfg.width specifies the number of wave cycles used in each frequency's wavelet analysis (so at 2Hz, 7 cycles spans 3500ms of data, right?). Maybe this is not correct, because I do not seem to get the frequencies as low as I would expect given my data epoch length. Perhaps this has to do with the cfg.gwidth parameter, which I do not think I completely understand - what is it? Also, we do not have the matlab wavelet toolbox, and it appears that it is not required, but how is the morlet wavelet implemented? As I look through the code I see calls to fft, ifft, and fftshift, but I wonder how I can give a good technical description of this process if I find results in a larger data set. Finally, is there a function or a way to compute the frequency bandwidth based on the cfg inputs, or is there a fix frequency bandwith for each foi here? I am sure I am confusing a number of things here, so no response is too simple. Thanks for any advice, please let me know if there is more information I can give or if I can clarify my questions. Brian -------------- next part -------------- An HTML attachment was scrubbed... URL: