From r.oostenveld at FCDONDERS.RU.NL Thu Feb 2 16:55:36 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 2 Feb 2006 16:55:36 +0100 Subject: dft filtering for 50Hz In-Reply-To: <000101c62808$cf668650$90514484@dellgx240> Message-ID: Hi Vladimir, On 2-feb-2006, at 15:56, Vladimir Litvak wrote: > I think I already asked you this once but I couldn't find your > answer in my > archives. In the Science paper and in the recent J. Neurosci. Paper > of Bauer > et al. you mention the method for removing line noise with DFT. Is it > implemented in FT? C yes. in preprocessing with cfg.dftfilter=yes, optionally cfg.dftfreq (default is [50 100 150]), and what we do is cfg.padding=10 to pad the data up to 10 seconds before subtracting the 50Hz sine wave. The padding ensures that we only filter out a narrow 1/10 Hz wide frequency bin. After sufficient mutitapering in the frequency domain, you won't notice the narrow 50Hz notch any more. If you don't filterpad, and e.g. have 0.5 s trials, you will put a wider 1/0.5=2Hz notch in your power spectrum. > an this just be done 'blindly' as the first step in > preprocessing or are there any special considerations? I have some > data with > TMS artifacts (deltas) which come about once in 10 sec (but not > regularly). That is problematic. A delta peak contains all frequencies, hence it will add significantly to the 50Hz estimate. In case of a jump estimating the 50Hz component, and subsequently subtracting this estimate, the filter is very likely to *increase* the amount of 50Hz in the remainder of the trial. You can consider it as filter ringing: the DFT filter is an infinite-impuls response (IIR) filter. We occasionally have "jumping" squids in the MEG, which resembles a step function. We detect them with artifact_jump, and remove all data 10 seconds before, untill 10 seconds after the jump. > The part I'm interested in is not contaminated by these deltas but > do you > think that such a delta appearing in the 10 sec segment that you > use to > compute DFT can somehow lead to a wrong result? Yep, see above. If there are not many TMS deltas, you should remove the trials nearby. This is all implemented in FT with artifact_jump and rejectartifact. If you are going to use this, please fetch a recent version of FieldTrip from the ftp server, since I recently cleaned up that part of the code considerably. Robert From Marcel.Bastiaansen at FCDONDERS.RU.NL Thu Feb 2 17:01:39 2006 From: Marcel.Bastiaansen at FCDONDERS.RU.NL (Marcel Bastiaansen) Date: Thu, 2 Feb 2006 17:01:39 +0100 Subject: update: artifact detection In-Reply-To: <9AA693A5-1714-4BD6-87DD-BCFBBE717A06@fcdonders.ru.nl> Message-ID: Dear Robert, Thanks for updating the functions. They generally look much better now. I have a slight problem however. For certain types of analysis (e.g. multitaper) I need some data before and after the actual trials in my experiment (to allow tapers to shift into the data at the beginning of the trial, and out of the data at the end of the trial). Usually I cut my data so that these extra datapoints are part of the 'trial', but I don't check these extra datastretches for EOG artefacts (as they fall in the ITI they typically contain a lot of blinks). I used to do that by specifying a negative padding value in the artefact_eog function, but that is no longer possible. Hence, my question is, whether it would be possible to include the option of checking only a user-specified part of each trial for artefacts. Another thing is that it is not (yet?) possible to call the old artefact routines in the way you specified it in your message below (though it is possible to directly call the artefact_eog_old function). Best, Marcel Robert Oostenveld wrote: > Dear Fieldtrip users, > > I have updated the artifact detection functions (artiact_xxx, where > xxx=jump, eog and muscle). Each of these three functions was already > based on the same underlying idea, namely to filter and preprocess > the data, then z-transform the result, cummulate the z-values over > channels and finally look for z-values that are larger than the > cutoff level. To reflect this similarity, I have created a new > function: artifact_zvalue. Each of the artifact_jump, eog and muscle > functions now sets some default values and then calls > artifact_zvalue. That facilitates the maintenance and ensures that > all functions behave the same regarding graphical feedback. From now > on, you can also visually verify the trial definition and the > detected artifacts in rejectartifact, using cfg.artfctdef.feedback=yes. > > Most important for you to know is that: > 1) the new functions should be largely backward compatible. The > filtering and preprocessing computations were only marginally > changed, so the outcome should be almost the same. > 2) the padding has been better defined. I will also write an artifact > detection tutorial that explains these padding values better. > 3) the new artifact detections functions (for jump, eog and muscle) > now only will work on continuous and pseudo-continuous data. Jumps in > the data at the trial boundaries for non-continous data are not dealt > with and will mess up the result so --if you want to use them on > trial-based data-- you are responsible yourself for configuring the > padding options correctly. > 4) the old functions are still available, with the name > artifact_xxx_old (where xxx=jump, eog and muscle). If you want to use > them, you should specify cfg.artifact.type={'eog_old', ...} and call > the rejectartifact function. > > The idea (which I will describe in the upcoming "artifact tutorial") > is that you do not use cfg.rejectjump/muscle/eog=yes any more in the > preprocessing cfg structure, but that you do the following steps > seperately: > cfg = something to start with... > cfg = definetrial(cfg) > cfg = artifact_eog(cfg) > cfg = artifact_eog(cfg) > cfg = artifact_jump(cfg) > cfg = artifact_muscle(cfg) > cfg = rejectartifact(cfg) > data = preprocessing(cfg) > > The fieldtrip version on home/common (inside the FCDC) will be > updated this afternoon. The fieldtrip version on the ftp server > (outside the FCDC) will be updated this evening. > > Since it is a large change in the fieldtrip code, bugs might have > crept in. Please be extra cautious the upcoming time and report > unusual behaviour. Sorry for the inconvenience that this may result in. > > best regards, > Robert > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Robert Oostenveld, PhD > F.C. Donders Centre for Cognitive Neuroimaging > Radboud University Nijmegen > phone: +31-24-3619695 > http://www.ru.nl/fcdonders/ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > -- dr. Marcel C.M. Bastiaansen. FC Donders Centre for Cognitive Neuroimaging Visiting address: Kapittelweg 29, 6525 EN Nijmegen, the Netherlands Mailing address: Trigon 181, PO Box 9101, 6500 HB Nijmegen, the Netherlands phone: + 31 24 3610 882 fax: + 31 24 3610 989 mail: marcel.bastiaansen at fcdonders.ru.nl web: http://www.ru.nl/aspx/get.aspx?xdl=/views/run/xdl/page&ItmIdt=20592&SitIdt=119&VarIdt=96 -- From r.oostenveld at FCDONDERS.RU.NL Thu Feb 2 18:12:41 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 2 Feb 2006 18:12:41 +0100 Subject: update: artifact detection In-Reply-To: <43E22CE3.6060403@fcdonders.ru.nl> Message-ID: Hi Marcel On 2-feb-2006, at 17:01, Marcel Bastiaansen wrote: > Thanks for updating the functions. They generally look much better > now. > I have a slight problem however. For certain types of analysis (e.g. > multitaper) I need some data before and after the actual trials in my > experiment (to allow tapers to shift into the data at the beginning of > the trial, and out of the data at the end of the trial). Usually I cut > my data so that these extra datapoints are part of the 'trial', but I > don't check these extra datastretches for EOG artefacts (as they > fall in > the ITI they typically contain a lot of blinks). That means that the eventual eye artifacts might be smeared (due to the wavelet length, or the equivalent multitaper mechanism) into later timepoints. I guess that yu are aware of that, and I assume that that is not a problem. > I used to do that by > specifying a negative padding value in the artefact_eog function, but > that is no longer possible. Hence, my question is, whether it would be > possible to include the option of checking only a user-specified > part of > each trial for artefacts. The usual sequence of functions needed to get raw data from disk into matlab memory is definetrial -> rejectartifact -> preprocessing However, rejectartifact can (for you as end user) also be split up into seperate parts. The first part is detecting artifacts, the second part is deciding what to do with them. Artifact detection is implemented in the artifact_xxx functions (with xxx=eog//muscle/jump etc). The sequence then becomes definetrial -> artifact_eog -> rejectartifact -> preprocessing Artifact detection is only done on selected parts of the data. The part of the data where it searches for artifacts usually is the part that you later want to read in (using the preprocessing function), or sometimes with some extra time before and after each trial. Whether it is desirable to have this padding depends on your experimental question and type of data. The additional amount of time before and after each trial to look for artifacts is specified using the "trlpadding" option. However, you can also do it manually: cfg = [] cfg = ... cfg = definetrial(cfg); trlorg = cfg.trl; % <<<< make a copy of the original cfg.trl(:,1) = cfg.trl(:,1) - number_of_samples_pre cfg.trl(:,2) = cfg.trl(:,2) + number_of_samples_post cfg = artifact_eog(cfg); cfg.trl = trlorg; % <<<< put the original back cfg = rejectartifact(cfg); data = preprocessing(cfg); This also allows you to specify a negative amount of padding before and after each trial, i.e. if you do *not* want to look for artifacts in the first xxx ms. I suggest that for the moment you use this manual option. I might implement the pre and post padding seperately and add support for the negative padding, but don't hold your breath for it. > Another thing is that it is not (yet?) possible to call the old > artefact > routines in the way you specified it in your message below (though > it is > possible to directly call the artefact_eog_old function). Thanks, I will look into that. I don't immediately see a reason why it should not work, so that might indicate a bug. best Robert From jhouck at UNM.EDU Thu Feb 2 20:29:55 2006 From: jhouck at UNM.EDU (Jon Houck) Date: Thu, 2 Feb 2006 12:29:55 -0700 Subject: Errors with Neuromag 306 raw data Message-ID: Hello, I encountered a few problems in preprocessing using the latest fieldtrip version (fieldtrip-20060131) with raw Neuromag 306 channel data. Following are the error messages and the changes that seemed to clear them up. The first error was: ??? Undefined function or variable 'iscontinuous'. Error in ==> fieldtrip-20060131\private\trialfun_neuromag at 13 trigger = read_fcdc_data(cfg.datafile, hdr, 1, nsamples, chanindx, iscontinuous); Error in ==> definetrial at 151 trl = feval(cfg.trialfun, cfg); Error in ==> preprocessing at 270 [cfg] = definetrial(cfg); To work around this, I edited fieldtrip-20060131/private/trialfun_neuromag.m to replace iscontinuous on line 13 with 1. The edited line reads "trigger = read_fcdc_data(cfg.datafile, hdr, 1, nsamples, chanindx, 1);" And the second was: ??? Subscripted assignment dimension mismatch. Error in ==> read_fcdc_data at 392 dat(:,((i-begepoch)*hdr.nSamples+1):((i-begepoch+1)*hdr.nSamples)) = buf(:,chanindx)'; Error in ==> fieldtrip-20060131\private\trialfun_neuromag at 13 trigger = read_fcdc_data(cfg.datafile, hdr, 1, nsamples, chanindx, 1); Error in ==> definetrial at 151 trl = feval(cfg.trialfun, cfg); Error in ==> preprocessing at 270 [cfg] = definetrial(cfg); To fix this one, I edited fieldtrip-20060131/read_fcdc_data.m to replace buf(:,chanindx)' on line 392 with buf(chandindx,:). The edited line reads "dat(:,((i-begepoch)*hdr.nSamples+1):((i-begepoch+1)*hdr.nSamples)) = buf(chanindx,:);" These changes seem to work well on Matlab 7.1(R14) service pack 3 on Windows XP and Matlab 6.5 (R13) on HP-UX 10.20. If there are better workarounds or (equally likely) if I've irreparably broken something, please let me know. Regards, Jon Houck -------------------------------------------------- Jon Houck, M.A. Department of Psychology MSC03 2220 University of New Mexico Albuquerque, NM 87131 Office: (505) 277-0607 Lab: (505) 277-4725 Fax: (505) 277-1394 CASAA: (505) 925-2381 From r.oostenveld at FCDONDERS.RU.NL Thu Feb 2 21:58:51 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 2 Feb 2006 21:58:51 +0100 Subject: Errors with Neuromag 306 raw data In-Reply-To: Message-ID: Hi Jon On 2-feb-2006, at 20:29, Jon Houck wrote: > The first error was: ??? Undefined function or variable > 'iscontinuous'. > ... > To work around this, I edited fieldtrip-20060131/private/ > trialfun_neuromag.m to replace iscontinuous on line 13 with 1. The > edited line reads "trigger = read_fcdc_data(cfg.datafile, hdr, 1, > nsamples, chanindx, 1);" I think that fif files are continuous by default, but I am not sure. It matters for filtering and artifact detection, since reading over a discontinuous trial boundary would result in a weird jump in the signal. The iscontinuous flag in read_fcdc_data() indicates whether it should check if the desired data segments extend over trial boundaries. By default, the check is decided based on the data (if hdr.nTrials==1 then don't check, otherwise do check). It could be that the files are stored in blocks, like the ctf pseudocontinuous format. For that case, i.e. the data specifies that it is epoched, but the epochs form a continuous signal, I have implemented the flag cfg.datatype='continuous'. So I suggest to change line 13 to the following snippet if ~isfield(cfg, 'datatype') || ~strcmp(cfg.datatype, 'continuous') % datatype is unknown or not continuous, perform epoch boundary check iscontinuous = 0; else % do not perform epoch boundary check, usefull for pseudo- continuous data iscontinuous = strcmp(cfg.datatype, 'continuous'); end read_fcdc_data(cfg.datafile, hdr, 1, nsamples, chanindx, iscontinuous); That ensures decent (=safe) epoch boundary checking if the file specifies that it is epoched, and it allows you to pass the cfg.datatype=continuous option in case you know for sure that the data can be interpreted as continuous. I will change the code to include the segment that I gave above. > And the second was: ??? Subscripted assignment dimension mismatch. > > Error in ==> read_fcdc_data at 392 > dat(:,((i-begepoch)*hdr.nSamples+1):((i-begepoch+1) > *hdr.nSamples)) = buf(:,chanindx)'; > ... > To fix this one, I edited fieldtrip-20060131/read_fcdc_data.m to > replace buf(:,chanindx)' on line 392 with buf(chandindx,:). The > edited line reads "dat(:,((i-begepoch)*hdr.nSamples+1):((i-begepoch > +1)*hdr.nSamples)) = buf(chanindx,:);" You're right, the buf matrix should not be transposed. I'll fix that in the next release code as well. > These changes seem to work well on Matlab 7.1(R14) service pack 3 > on Windows XP and Matlab 6.5 (R13) on HP-UX 10.20. If there are > better workarounds or (equally likely) if I've irreparably broken > something, please let me know. Regarding the first bug that you reported, but seperate of that bug: I suggest to use trialfun_general, instead of trialfun_neuromag. The trialfun_neuromag is only for backward compatibility with the initial code, and the trialfun_general is used by default if you use in definetrial the following % cfg.trialdef.eventtype = 'string' % cfg.trialdef.eventvalue = number, string or list with numbers or strings % cfg.trialdef.prestim = 0.300 latency in seconds (optional) % cfg.trialdef.poststim = 0.700 latency in seconds (optional) alternatively, you can use % cfg.trialdef.eventtype = '?' That uses the read_fcdc_event function, which makes your (and our) code much more portable to other fileformats and allows more complex trigger sequences. Please read the read_fcdc_event help and code if you want to know more. Thanks for your contribution. best, Robert From luis.patino at UNIKLINIK-FREIBURG.DE Fri Feb 3 08:44:53 2006 From: luis.patino at UNIKLINIK-FREIBURG.DE (Dr. Jose Luis Patino Vilchis) Date: Fri, 3 Feb 2006 08:44:53 +0100 Subject: update: artifact detection In-Reply-To: <43E22CE3.6060403@fcdonders.ru.nl> Message-ID: Dear Robert, Is it there a paper explaining how the muscle artifact rejection is done? best regards Luis Patino Zitat von Marcel Bastiaansen : > Dear Robert, > > Thanks for updating the functions. They generally look much better now. > I have a slight problem however. For certain types of analysis (e.g. > multitaper) I need some data before and after the actual trials in my > experiment (to allow tapers to shift into the data at the beginning of > the trial, and out of the data at the end of the trial). Usually I cut > my data so that these extra datapoints are part of the 'trial', but I > don't check these extra datastretches for EOG artefacts (as they fall in > the ITI they typically contain a lot of blinks). I used to do that by > specifying a negative padding value in the artefact_eog function, but > that is no longer possible. Hence, my question is, whether it would be > possible to include the option of checking only a user-specified part of > each trial for artefacts. > Another thing is that it is not (yet?) possible to call the old artefact > routines in the way you specified it in your message below (though it is > possible to directly call the artefact_eog_old function). > > Best, > Marcel > > > Robert Oostenveld wrote: > > > Dear Fieldtrip users, > > > > I have updated the artifact detection functions (artiact_xxx, where > > xxx=jump, eog and muscle). Each of these three functions was already > > based on the same underlying idea, namely to filter and preprocess > > the data, then z-transform the result, cummulate the z-values over > > channels and finally look for z-values that are larger than the > > cutoff level. To reflect this similarity, I have created a new > > function: artifact_zvalue. Each of the artifact_jump, eog and muscle > > functions now sets some default values and then calls > > artifact_zvalue. That facilitates the maintenance and ensures that > > all functions behave the same regarding graphical feedback. From now > > on, you can also visually verify the trial definition and the > > detected artifacts in rejectartifact, using cfg.artfctdef.feedback=yes. > > > > Most important for you to know is that: > > 1) the new functions should be largely backward compatible. The > > filtering and preprocessing computations were only marginally > > changed, so the outcome should be almost the same. > > 2) the padding has been better defined. I will also write an artifact > > detection tutorial that explains these padding values better. > > 3) the new artifact detections functions (for jump, eog and muscle) > > now only will work on continuous and pseudo-continuous data. Jumps in > > the data at the trial boundaries for non-continous data are not dealt > > with and will mess up the result so --if you want to use them on > > trial-based data-- you are responsible yourself for configuring the > > padding options correctly. > > 4) the old functions are still available, with the name > > artifact_xxx_old (where xxx=jump, eog and muscle). If you want to use > > them, you should specify cfg.artifact.type={'eog_old', ...} and call > > the rejectartifact function. > > > > The idea (which I will describe in the upcoming "artifact tutorial") > > is that you do not use cfg.rejectjump/muscle/eog=yes any more in the > > preprocessing cfg structure, but that you do the following steps > > seperately: > > cfg = something to start with... > > cfg = definetrial(cfg) > > cfg = artifact_eog(cfg) > > cfg = artifact_eog(cfg) > > cfg = artifact_jump(cfg) > > cfg = artifact_muscle(cfg) > > cfg = rejectartifact(cfg) > > data = preprocessing(cfg) > > > > The fieldtrip version on home/common (inside the FCDC) will be > > updated this afternoon. The fieldtrip version on the ftp server > > (outside the FCDC) will be updated this evening. > > > > Since it is a large change in the fieldtrip code, bugs might have > > crept in. Please be extra cautious the upcoming time and report > > unusual behaviour. Sorry for the inconvenience that this may result in. > > > > best regards, > > Robert > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Robert Oostenveld, PhD > > F.C. Donders Centre for Cognitive Neuroimaging > > Radboud University Nijmegen > > phone: +31-24-3619695 > > http://www.ru.nl/fcdonders/ > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > -- > dr. Marcel C.M. Bastiaansen. > FC Donders Centre for Cognitive Neuroimaging > Visiting address: Kapittelweg 29, 6525 EN Nijmegen, the Netherlands > Mailing address: Trigon 181, PO Box 9101, 6500 HB Nijmegen, the Netherlands > phone: + 31 24 3610 882 > fax: + 31 24 3610 989 > mail: marcel.bastiaansen at fcdonders.ru.nl > web: > http://www.ru.nl/aspx/get.aspx?xdl=/views/run/xdl/page&ItmIdt=20592&SitIdt=119&VarIdt=96 > -- > > From georges.otte at PANDORA.BE Fri Feb 3 09:41:01 2006 From: georges.otte at PANDORA.BE (georges Otte) Date: Fri, 3 Feb 2006 09:41:01 +0100 Subject: update: artifact detection In-Reply-To: <1138952693.43e309f5b072f@webmail1.uniklinik-freiburg.de> Message-ID: Hi, I saw some paper from a group in Leuven eliminating EMG artefact based on the canonical component analysis (another Blind Source method). Google it with CCA- EEG. It worked very fast. I think that ANT compagny is looking into porting this into their standard software. The method is based on the difference in aotocorellation between EEG and EMG signals. Hope this helps, Georges ------------------------------------ Neurologpsychiatrie EEG-EMG Otte Georges Dr. georges.otte at pandora.be Bijlokehof 24 9000 Gent tel: 09 329 06 62 fax: 09 282 26 72 mobile: 0478 205 202 ------------------------------------ > -----Original Message----- > From: FieldTrip discussion list > [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Dr. Jose Luis > Patino Vilchis > Sent: vrijdag 3 februari 2006 8:45 > To: FIELDTRIP at NIC.SURFNET.NL > Subject: Re: [FIELDTRIP] update: artifact detection > > > Dear Robert, > > Is it there a paper explaining how the muscle artifact > rejection is done? > > best regards > > Luis Patino > > > Zitat von Marcel Bastiaansen : > > > Dear Robert, > > > > Thanks for updating the functions. They generally look much better > > now. I have a slight problem however. For certain types of analysis > > (e.g. > > multitaper) I need some data before and after the actual > trials in my > > experiment (to allow tapers to shift into the data at the > beginning of > > the trial, and out of the data at the end of the trial). > Usually I cut > > my data so that these extra datapoints are part of the > 'trial', but I > > don't check these extra datastretches for EOG artefacts (as > they fall in > > the ITI they typically contain a lot of blinks). I used to > do that by > > specifying a negative padding value in the artefact_eog > function, but > > that is no longer possible. Hence, my question is, whether > it would be > > possible to include the option of checking only a > user-specified part of > > each trial for artefacts. > > Another thing is that it is not (yet?) possible to call the > old artefact > > routines in the way you specified it in your message below > (though it is > > possible to directly call the artefact_eog_old function). > > > > Best, > > Marcel > > > > > > Robert Oostenveld wrote: > > > > > Dear Fieldtrip users, > > > > > > I have updated the artifact detection functions > (artiact_xxx, where > > > xxx=jump, eog and muscle). Each of these three functions > was already > > > based on the same underlying idea, namely to filter and > preprocess > > > the data, then z-transform the result, cummulate the > z-values over > > > channels and finally look for z-values that are larger than the > > > cutoff level. To reflect this similarity, I have created a new > > > function: artifact_zvalue. Each of the artifact_jump, eog > and muscle > > > functions now sets some default values and then calls > > > artifact_zvalue. That facilitates the maintenance and > ensures that > > > all functions behave the same regarding graphical > feedback. From now > > > on, you can also visually verify the trial definition and the > > > detected artifacts in rejectartifact, using > cfg.artfctdef.feedback=yes. > > > > > > Most important for you to know is that: > > > 1) the new functions should be largely backward compatible. The > > > filtering and preprocessing computations were only marginally > > > changed, so the outcome should be almost the same. > > > 2) the padding has been better defined. I will also write > an artifact > > > detection tutorial that explains these padding values better. > > > 3) the new artifact detections functions (for jump, eog > and muscle) > > > now only will work on continuous and pseudo-continuous > data. Jumps in > > > the data at the trial boundaries for non-continous data > are not dealt > > > with and will mess up the result so --if you want to use them on > > > trial-based data-- you are responsible yourself for > configuring the > > > padding options correctly. > > > 4) the old functions are still available, with the name > > > artifact_xxx_old (where xxx=jump, eog and muscle). If you > want to use > > > them, you should specify cfg.artifact.type={'eog_old', > ...} and call > > > the rejectartifact function. > > > > > > The idea (which I will describe in the upcoming "artifact > tutorial") > > > is that you do not use cfg.rejectjump/muscle/eog=yes any > more in the > > > preprocessing cfg structure, but that you do the following steps > > > seperately: > > > cfg = something to start with... > > > cfg = definetrial(cfg) > > > cfg = artifact_eog(cfg) > > > cfg = artifact_eog(cfg) > > > cfg = artifact_jump(cfg) > > > cfg = artifact_muscle(cfg) > > > cfg = rejectartifact(cfg) > > > data = preprocessing(cfg) > > > > > > The fieldtrip version on home/common (inside the FCDC) will be > > > updated this afternoon. The fieldtrip version on the ftp server > > > (outside the FCDC) will be updated this evening. > > > > > > Since it is a large change in the fieldtrip code, bugs might have > > > crept in. Please be extra cautious the upcoming time and report > > > unusual behaviour. Sorry for the inconvenience that this > may result in. > > > > > > best regards, > > > Robert > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > Robert Oostenveld, PhD > > > F.C. Donders Centre for Cognitive Neuroimaging > > > Radboud University Nijmegen > > > phone: +31-24-3619695 > > > http://www.ru.nl/fcdonders/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > > -- > > dr. Marcel C.M. Bastiaansen. > > FC Donders Centre for Cognitive Neuroimaging > > Visiting address: Kapittelweg 29, 6525 EN Nijmegen, the Netherlands > > Mailing address: Trigon 181, PO Box 9101, 6500 HB Nijmegen, > the Netherlands > > phone: + 31 24 3610 882 > > fax: + 31 24 3610 989 > > mail: marcel.bastiaansen at fcdonders.ru.nl > > web: > > > http://www.ru.nl/aspx/get.aspx?xdl=/views/run/xdl/page&ItmIdt= > 20592&SitIdt=119&VarIdt=96 > > -- > > > > > > From lauri at NEURO.HUT.FI Fri Feb 3 11:45:49 2006 From: lauri at NEURO.HUT.FI (Lauri Parkkonen) Date: Fri, 3 Feb 2006 12:45:49 +0200 Subject: Errors with Neuromag 306 raw data In-Reply-To: <5BC129DE-7F2D-4D29-A749-03F47B3B4EDC@fcdonders.ru.nl> Message-ID: Hello Robert and Jon >> The first error was: ??? Undefined function or variable 'iscontinuous'. >> ... >> To work around this, I edited fieldtrip-20060131/private/ >> trialfun_neuromag.m to replace iscontinuous on line 13 with 1. The >> edited line reads "trigger = read_fcdc_data(cfg.datafile, hdr, 1, >> nsamples, chanindx, 1);" > > > I think that fif files are continuous by default, but I am not sure. > It matters for filtering and artifact detection, since reading over a > discontinuous trial boundary would result in a weird jump in the signal. Yes, the "raw data" fif files are continuous over trials, i.e., there is no "epoch mode", however, one fif file can hold several data segments. For example, two different experimental conditions can be recorded in the same file as separate segments; the boundary between the segments is of course a discontinuity. The MEX function "rawdata" returns the string 'skip' as status when a segment boundary is encountered in a fif file. I have added some more checking to read_fcdc_data so that these boundaries are not silently ignored. Robert: I could incorporate my changes to your most recent version since my read_fcdc_data is very old. With the best regards, Lauri -- ----------------------------------------------- Lauri Parkkonen Brain Research Unit, Low Temperature Laboratory Helsinki University of Technology Otakaari 3 A, 02150 ESPOO, FINLAND tel: +358-9-4512965 fax: +358-9-4512969 mailto:lauri at neuro.hut.fi http://boojum.hut.fi From r.oostenveld at FCDONDERS.RU.NL Fri Feb 3 12:44:40 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 3 Feb 2006 12:44:40 +0100 Subject: Errors with Neuromag 306 raw data In-Reply-To: <43E3345D.3090602@neuro.hut.fi> Message-ID: Hi Lauri On 3-feb-2006, at 11:45, Lauri Parkkonen wrote: > Yes, the "raw data" fif files are continuous over trials, i.e., > there is no "epoch mode", however, one fif file can hold several > data segments. For example, two different experimental conditions > can be recorded in the same file as separate segments; the boundary > between the segments is of course a discontinuity. The MEX function > "rawdata" returns the string 'skip' as status when a segment > boundary is encountered in a fif file. I have added some more > checking to read_fcdc_data so that these boundaries are not > silently ignored. > > Robert: I could incorporate my changes to your most recent version > since my read_fcdc_data is very old. Thanks, I would appreciate that very much. Please fetch the latest version of the read_fcdc_data function from ftp://ftp.fcdonders.nl/ pub/fieldtrip. If you change that one, it is easy for me to update the official version. best, Robert From tolgacan1 at YAHOO.COM Sat Feb 4 21:47:18 2006 From: tolgacan1 at YAHOO.COM (Tolga Ozkurt) Date: Sat, 4 Feb 2006 21:47:18 +0100 Subject: neuromag data and lead fields for sensors Message-ID: Hello all, I have just downloaded Fieldtrip and trying use it with data collected from Neuromag 306 Vectorview system. When I used the version of fieldtrip- 20060131; I had some problems even with reading data and I had to make some minor changes in the code mentioned in the pervious post of the list. The main problem of me is how to compute the lead field with Neuromag data? The fieldtrip gives me orientation values which are exactly same for the same coil. Haw can I exploit these orientation of the sensors for two planar gradiometers and one magneteometer for each coil? I will appreciate, if you could help. Thanks. Tolga Esat Ozkurt From r.oostenveld at FCDONDERS.RU.NL Sun Feb 5 13:16:31 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Sun, 5 Feb 2006 13:16:31 +0100 Subject: update: artifact detection In-Reply-To: <1138952693.43e309f5b072f@webmail1.uniklinik-freiburg.de> Message-ID: Dear Luis, No, we have not described it in much detail in our publications, we only mention that it is a semi-automatic procedure. The approach is the following: we bandpass filter the data in the frequency band where the artifact is most pronounced, then we hilbert transform (i.e. compute the signal amplitude envelope, which is comparable to rectifying and smoothing). This is done per channel. For each signal obtained like this, we z-transform it, i.e. subtract the mean and divide by the standard deviation (over time). Then we sum all z-values and divide by the square root of the number of channels that goes into the sum. This results in a single pseudo- signal that is sensitive to the artifact that we want to detect. We then threshold this pseudo siugnal. After thresholding, we use visual feedback of the original data to check that the desired artifacts are really detected using the filtering and thhesholding options. In the feedback, the original unfiltered data of that channel is shown which contributed the most to the z-value (i.e. the channel that is the most artifact-like). We are reasonably happy with the performance of this approach on MEG and on EOG data, it allows us to do it reasonably objective and it saves a lot of time browsing through the 151 channels of our MEG. Recently we recorded a small MEG dataset with a lot of artifacts on purpose. I am working on writing a tutorial on the artifact detection using that dataset, which will then also be made available on the ftp server. Robert On 3-feb-2006, at 8:44, Dr. Jose Luis Patino Vilchis wrote: > Dear Robert, > > Is it there a paper explaining how the muscle artifact rejection is > done? > > best regards > > Luis Patino > From r.oostenveld at FCDONDERS.RU.NL Sun Feb 5 13:30:17 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Sun, 5 Feb 2006 13:30:17 +0100 Subject: update: artifact detection In-Reply-To: <03b801c6289d$95046eb0$0400a8c0@georges> Message-ID: Dear Georges, On 3-feb-2006, at 9:41, georges Otte wrote: > I saw some paper from a group in Leuven eliminating EMG artefact based > on the canonical component analysis (another Blind Source method). > Google it with CCA- EEG. It worked very fast. I think that ANT > compagny > is looking into porting this into their standard software. The > method is > based on the difference in aotocorellation between EEG and EMG > signals. We have implemented that algorithm in Fieldtrip, in the componentanalysis function (cfg.method=cca). I am not sure whether it is compleetly in the ftp release version of fieldtrip. We did try it out on our MEG data. It performed rather poor on our MEG data, the obvious EMG artifacts in the lower temporal channels were not very well separates into seperate components to be removed from the data. I suspect the reason for it performing rather poor on the MEG data is that it is based on 1-sample lag autocorrelation. The seperation (linear unmixing) using autocorrelation seperates the signal into high frequency components and low frequency components. But our MEG data has a much higher sampling rate (usually 1200Hz), and contains noise components at a much higher frequency than the EMG artifacts. It may work for clinical EEG data for which the Leuven group develloped the algorithm, since that is sampled at typically 250 Hz, which means that the EMG does correspond to the high frequency part of the data. It may be possible to tweak the algorithm (e.g. use N- lag autocorrelation) and to use differently preprocessed (filtered and downsampled) data to improve the performance, but we have not pursued that. Furthermore, we have not tested it on EEG data, so I cannot judge how it performs there. best Robert From r.oostenveld at FCDONDERS.RU.NL Sun Feb 5 13:55:02 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Sun, 5 Feb 2006 13:55:02 +0100 Subject: neuromag data and lead fields for sensors In-Reply-To: Message-ID: Dear Tolga, On 4-feb-2006, at 21:47, Tolga Ozkurt wrote: > Hello all, > I have just downloaded Fieldtrip and trying use it with data collected > from Neuromag 306 Vectorview system. When I used the version of > fieldtrip- > 20060131; I had some problems even with reading data and I had to make > some minor changes in the code mentioned in the pervious post of > the list. > The main problem of me is how to compute the lead field with Neuromag > data? The fieldtrip gives me orientation values which are exactly > same for > the same coil. Haw can I exploit these orientation of the sensors > for two > planar gradiometers and one magneteometer for each coil? I will > appreciate, if you could help. Thanks. Let me first explain the headmodels. Fieldtrip supports different forward models for MEG. The ones that we use the most are based on the multisphere model, i.e. each channel has it's own sphere. We construct the multisphere models by fitting the spheres to the head surface. That is done using CTF software, and the result is stored in a *.hdm file. Since recently we do have a fieldtrip function which can replace the CTF software, and which allows fitting the spheres to the brain surface instead of to the head surface. That function (prepare_localspheres) is not yet in the release version, if you are interested in beta testing, I can send it to you. Fieldtrip also supports single sphere models. Those can also be read from CTF *.hdm file, but are also easy to specify on the command line, e.g. cfg.vol.r = 12; cfg.vol.o = [0 0 5]; specifies a 12cm sphere with its origin in [0 0 5] (relative to the head coordinate system). Finally, fieldtrip also supports the use of the BEM head models that can be constructed in the Neuromag software. That requires the mex files which are released by Neuromag to their customers (I think in the pd-calc toolbox), specifically the mex file "megfield" is required. This code has been contributed by Joachim Gross, and he tested it for the 122 channel Neuromag system. [* see below] I suggest that for the moment, you try to get the single sphere model to work, since that is the easiest. Now the gradiometer array: It indeed has the position (grad.pnt) of each coil and the orientation (grad.ori) of each coil. But furthermore, it has the field grad.tra, which combines the field at the two coils into one gradiometer-channel-output. I.e. if grad.pnt=302x3 (for our 151 channel CTF), then grad.tra is 151x302. Multiplying the leadfield on the 302 coils with the 151x302 matrix results in the 151 channel leadfield that we need. The grad.tra is a very sparse matrix, consisting of the concatenation of identity matrices. That is where your question of the orientations relates to, i.e. If grad.tra = [eye(151) eye(151)], then the orientations of the two coils should be opposite, since the field at the two coils is added. If grad.tra = [eye(151) -eye(151)], then the orientations of the two coils should be the same, since the subtraction is coded in the minus sign. So the orientation can be coded either in the grad.ori, or in the grad.tra. I suspect that for the Neuromag, it is coded in the grad.tra matrix. I hope that this clarifies it. You should be able to use the prepare_leadfield() function to compute the leadfield at many grid locations at once. If you want to do more low-level computations yourself, you should use the private/compute_leadfield() function. I would appreciate it if you can report back whether it works, since sofar I don't fully know how well FieldTrip works on Neuromag data. In principle it should all work, and some people have used it wich success on their data, but I guess (as obvious from the previous mail) that there are still some small glitches that need to be fixed in the official version. So please share your findings with us, so that we can improve the support. best, Robert [*] I just checked, and it seems as this code is not in the current release version any more. I will build it back in. From georges.otte at PANDORA.BE Sun Feb 5 15:22:41 2006 From: georges.otte at PANDORA.BE (georges Otte) Date: Sun, 5 Feb 2006 15:22:41 +0100 Subject: update: artifact detection In-Reply-To: <6C531155-F4A3-45BF-A2D7-169629B4E3A6@fcdonders.ru.nl> Message-ID: I am working on writing a tutorial on the artifact > detection > using that dataset, which will then also be made available on > the ftp > server. > > Robert > This sounds very interesting as artefact removal is of uttermost importance in EEG also. It is interesting to note that differences in sample frequencies must indeed be kept in mind when applying certain algoritms. Please let us know when the tutorial will be ready. Sincerely, Georges Otte From georges.otte at PANDORA.BE Sun Feb 5 15:22:41 2006 From: georges.otte at PANDORA.BE (georges Otte) Date: Sun, 5 Feb 2006 15:22:41 +0100 Subject: update: artifact detection In-Reply-To: <9482A704-EAB9-4EDA-86B2-B656C08DC02F@fcdonders.ru.nl> Message-ID: Thanks Robert ! Georges Otte ------------------------------------ Neurologpsychiatrie EEG-EMG Otte Georges Dr. georges.otte at pandora.be Bijlokehof 24 9000 Gent tel: 09 329 06 62 fax: 09 282 26 72 mobile: 0478 205 202 ------------------------------------ > -----Original Message----- > From: FieldTrip discussion list > [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Robert Oostenveld > Sent: zondag 5 februari 2006 13:30 > To: FIELDTRIP at NIC.SURFNET.NL > Subject: Re: [FIELDTRIP] update: artifact detection > > > Dear Georges, > > On 3-feb-2006, at 9:41, georges Otte wrote: > > I saw some paper from a group in Leuven eliminating EMG > artefact based > > on the canonical component analysis (another Blind Source method). > > Google it with CCA- EEG. It worked very fast. I think that ANT > > compagny > > is looking into porting this into their standard software. The > > method is > > based on the difference in aotocorellation between EEG and EMG > > signals. > > We have implemented that algorithm in Fieldtrip, in the > componentanalysis function (cfg.method=cca). I am not sure > whether it > is compleetly in the ftp release version of fieldtrip. > > We did try it out on our MEG data. It performed rather poor on our > MEG data, the obvious EMG artifacts in the lower temporal channels > were not very well separates into seperate components to be removed > from the data. I suspect the reason for it performing rather poor on > the MEG data is that it is based on 1-sample lag > autocorrelation. The > seperation (linear unmixing) using autocorrelation seperates the > signal into high frequency components and low frequency components. > But our MEG data has a much higher sampling rate (usually 1200Hz), > and contains noise components at a much higher frequency than > the EMG > artifacts. > > It may work for clinical EEG data for which the Leuven group > develloped the algorithm, since that is sampled at typically 250 Hz, > which means that the EMG does correspond to the high frequency part > of the data. It may be possible to tweak the algorithm (e.g. use N- > lag autocorrelation) and to use differently preprocessed (filtered > and downsampled) data to improve the performance, but we have not > pursued that. Furthermore, we have not tested it on EEG data, so I > cannot judge how it performs there. > > best > Robert > > From kambiz.tavabi at UNI-MUENSTER.DE Mon Feb 6 12:22:24 2006 From: kambiz.tavabi at UNI-MUENSTER.DE (Kambiz Tavabi) Date: Mon, 6 Feb 2006 12:22:24 +0100 Subject: wavelet analysis In-Reply-To: <8C9FB8EC-56F7-46B3-BF43-F1D657AEF8B3@fcdonders.ru.nl> Message-ID: Hello, There does not seem to be a function/m-file waveletanaysis in the Jan. 21 2006 or few previous releases of FIELDTRIP. The following commands as per tutorials cfg = []; cfg.method = 'TFR'; cfg.foi = 15:30; cfg.channel = 'all'; cfg.keeptrials = 'no'; cfg.waveletwidth = 7; cfg.downsample = 4; TFRwave = waveletanalysis(cfg, dataFIC); save('TFR','TFRwave','-append'); Results in the output ??? Undefined command/function 'waveletanalysis'. Please advise, thank you. Kambiz From r.oostenveld at FCDONDERS.RU.NL Mon Feb 6 13:57:27 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 6 Feb 2006 13:57:27 +0100 Subject: wavelet analysis In-Reply-To: <000d01c62b0f$9a79b890$1423b080@KAMTRANSTEC> Message-ID: On 6-feb-2006, at 12:22, Kambiz Tavabi wrote: > Hello, > There does not seem to be a function/m-file waveletanaysis in the > Jan. 21 > 2006 or few previous releases of FIELDTRIP. > > The following commands as per tutorials > ... This has been moved to the general FREQANALYSIS function. You should call freqanalysis with the option cfg.method='tfr'. See "help freqanalysis" and "help freqanalysis_tfr". The 2005 version of the tutorial specifies it correctly, please use that instead of the 2004 version (see http://www2.ru.nl/fcdonders/ fieldtrip/tutorial.html) best regards, Robert From thomas.koelewijn at FCDONDERS.RU.NL Mon Feb 13 11:42:23 2006 From: thomas.koelewijn at FCDONDERS.RU.NL (Thomas Koelewijn) Date: Mon, 13 Feb 2006 11:42:23 +0100 Subject: No subject Message-ID: Dear all, I'm working with a old fieldtrip script in which I perform artefact rejection for both EOG channels separately. When I run the scrip for the second channel fieldtrip tells me that I already used EOG rejection and skips this part. Is there a trick to prevent this? Gr. Thomas From r.oostenveld at FCDONDERS.RU.NL Mon Feb 13 12:35:38 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 13 Feb 2006 12:35:38 +0100 Subject: dft filtering for 50Hz In-Reply-To: <000001c6308d$0cb183c0$90514484@dellgx240> Message-ID: Hi Vladimir > I looked at the data file and I see that in most trials there is a > TMS pulse > closer than 10 sec to the pulse I'm looking at. So I can't throw > out trials > where I don't get a clean 10 sec segment because then I'll throw > out most of > them. I think there are two options the simple one and the > complicated one: The method implemented in Fieldtrip to prevent filter atrifacts at the side of the trial, and also to get a very sharp (dft) line noise filter, is to pad the complete trial up to cfg.padding on *both* sides of the original trial. I.e. if you have a trial of 2 seconds, it will be padded with data for filtering with 4 seconds before and 4 seconds after the original trial. The padding segments are removed from the data imediately after the filtering has been done. Related to 50 or 60 Hz line noise filtering: the resulting notch is 1/ Tpadding, i.e. with 10 seconds the notch is 1/10 Hz, with 4 seconds it would be 1/4 Hz. I leave it up to you to decide whether that is much, it depends on the frequency and the amount of multi-taper smoothing that you can apply afterwards. If your data consists of short trials (e.g. 500ms), you would have a low frequency resolution anyway (1/0.5=2Hz). Besides using the default filter padding, you could also do it manually by modifying the cfg.trl trial definition. In your case I can imagine that you have plenty of time after the trial but not before (with the TMS pulse before each trial), so you can do cfg.trl (:,2) = cfg.trl(:,2)+N*Fsample and specify cfg.padding=0. Afterwards, you manually have to get rid of the additional data that has been glued at the end of each trial. > 1) The simple one is take 4 sec segments. In this case I can get > enough. The > question is whether it is better to pad them to 10 sec or less. You > say that > if I pad them to less I'll get a wider notch. The question is what > happens > if I pad too short a segment to 10 sec and how short is too short? If I were you, I would just give the 4 sec a try. You should not be too rigid about the 10 seconds, which is a good default for our own type of long-trial MEG experiments but which is impractically long for most other experiments. > 2) I can look at trials one by one, cut as long a segment as I can > before > the artifact and pad it if necessary to 10 sec. The question here > is whether > this will really improve things greatly. Also how do I implement it > - should > I read the data twice - first find the artifacts, rebuild the trl > structure > and then read again? Also can I use Fieldtrip artifact functions to > find the > artifacts? Yes you can, but I am not sure what the most sensitive way is of detecting the TMS artifacts. Look into the artifact_zvalue code and tweak the preprocessing options (see private/preproc) to make it sensitive to the TMS artifacts. Probbaly the settings used in artifact_muscle are already pretty close (except that you should not do the boxcar). Robert From r.oostenveld at FCDONDERS.RU.NL Mon Feb 13 12:56:40 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 13 Feb 2006 12:56:40 +0100 Subject: No subject In-Reply-To: <544b3ee4236ed.43f0709f@ru.nl> Message-ID: Hi Thomas On 13-feb-2006, at 11:42, Thomas Koelewijn wrote: > Dear all, > > I'm working with a old fieldtrip script in which I perform artefact > rejection for both EOG channels separately. When I run the scrip > for the second channel fieldtrip tells me that I already used EOG > rejection and skips this part. Is there a trick to prevent this? > > Gr. > Thomas You can erase the field cfg.artfctdef.eog after the first EOG detection. i.e. cfg = ... general settings ... cfg.artfctdef.eog = ... EOG1 settings ... cfg = artifact_eog(cfg); % detect EOG in channel 1 keepeog1 = cfg.artfctdef.eog; cfg.artfctdef.eog = []; cfg.artfctdef.eog = ... EOG2 settings ... cfg = artifact_eog(cfg); % detect EOG in channel 2 keepeog2 = cfg.artfctdef.eog; cfg.artfctdef.eog = []; Then you can concatenate the artifacts for EOG1 to those of EOG2 and reject them together: cfg.artfctdef.eog.artifact = [keepeog1.artifact; keepeog2.artifact]; % this is a Nx2 trl-like array without offset cfg = rejectartifact(cfg); I hope this works, Robert From kambiz.tavabi at UNI-MUENSTER.DE Fri Feb 17 10:05:05 2006 From: kambiz.tavabi at UNI-MUENSTER.DE (Kambiz Tavabi) Date: Fri, 17 Feb 2006 10:05:05 +0100 Subject: wavelet analysis In-Reply-To: Message-ID: Hello, According to the help text the command... [event] = read_fcdc_event('A0132_Aud-Obj-Recognition_20051115_02.ds') should provide all events from the dataset. In a similar fashion to read_fcdc_header which in fact works as or Jan. 31. However the call to read_fcdc_event results in the following error ??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 no channels were specified for reading CTF data Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); Error in ==> read_fcdc_event at 187 [backpanel, frontpanel] = read_ctf_trigger(filename); Please advise, thank you. Kambiz Tavabi From Jan.Schoffelen at FCDONDERS.RU.NL Fri Feb 17 10:18:06 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Fri, 17 Feb 2006 10:18:06 +0100 Subject: wavelet analysis In-Reply-To: <002201c633a1$3ec77c90$1423b080@KAMTRANSTEC> Message-ID: Dear Kambiz, This looks like a pretty low level error to me. >??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 >no channels were specified for reading CTF data >Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); It seems as if the variable stimindx has not been defined. Perhaps you could check that first, by putting a breakpoint at the specified line in read_ctf_trigger. Might it be the case that your dataset does not contain a channel with the label 'STIM'? Yours, Jan-Mathijs From kambiz.tavabi at UNI-MUENSTER.DE Fri Feb 17 11:13:15 2006 From: kambiz.tavabi at UNI-MUENSTER.DE (Kambiz Tavabi) Date: Fri, 17 Feb 2006 11:13:15 +0100 Subject: read_fcdc_event In-Reply-To: <003e01c633a3$0fac8c50$902dae83@fcdonders.nl> Message-ID: Hi Jan, When it comes to MATLAB I am a low level kind of guy! With a break @ line 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, A call to stimindx returns; Empty matrix: 0-by-1. The data I have has been recorded on a CTF machine with the newest available software which apparently displays only a virtual channel labeled STIM seen in the Data Editor. The virtual STIM channel is a combination of UPPT01 & UPPT02 parallel ports used for stimulus delivery. I can send you the dsinfo for this file if you'd like. Apparently stimindx is empty; and my dataset consists of a no channel labeled STIM. But this is in accordance with current CTF format. What to do now? Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 10:18 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] wavelet analysis Dear Kambiz, This looks like a pretty low level error to me. >??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 >no channels were specified for reading CTF data >Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); It seems as if the variable stimindx has not been defined. Perhaps you could check that first, by putting a breakpoint at the specified line in read_ctf_trigger. Might it be the case that your dataset does not contain a channel with the label 'STIM'? Yours, Jan-Mathijs From Jan.Schoffelen at FCDONDERS.RU.NL Fri Feb 17 12:03:09 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Fri, 17 Feb 2006 12:03:09 +0100 Subject: read_fcdc_event In-Reply-To: <002f01c633aa$c443c370$1423b080@KAMTRANSTEC> Message-ID: Dear Kambiz, As a first guess I would try to explicitly create this virtual 'STIM' channel, using DataEditor. Subsquently I would create a new dataset using the command-line program newDs. I recall that it has an option to include virtual channels in it. I would say, that then you have a dataset which actually contains a 'STIM' channel, so you can use it on the fieldtrip-files you have. Hope this is a sufficient workaround, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Kambiz Tavabi Sent: Friday, February 17, 2006 11:13 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Hi Jan, When it comes to MATLAB I am a low level kind of guy! With a break @ line 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, A call to stimindx returns; Empty matrix: 0-by-1. The data I have has been recorded on a CTF machine with the newest available software which apparently displays only a virtual channel labeled STIM seen in the Data Editor. The virtual STIM channel is a combination of UPPT01 & UPPT02 parallel ports used for stimulus delivery. I can send you the dsinfo for this file if you'd like. Apparently stimindx is empty; and my dataset consists of a no channel labeled STIM. But this is in accordance with current CTF format. What to do now? Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 10:18 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] wavelet analysis Dear Kambiz, This looks like a pretty low level error to me. >??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 >no channels were specified for reading CTF data >Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); It seems as if the variable stimindx has not been defined. Perhaps you could check that first, by putting a breakpoint at the specified line in read_ctf_trigger. Might it be the case that your dataset does not contain a channel with the label 'STIM'? Yours, Jan-Mathijs From kambiz.tavabi at UNI-MUENSTER.DE Fri Feb 17 14:07:43 2006 From: kambiz.tavabi at UNI-MUENSTER.DE (Kambiz Tavabi) Date: Fri, 17 Feb 2006 14:07:43 +0100 Subject: read_fcdc_event In-Reply-To: <003f01c633b1$bc77beb0$902dae83@fcdonders.nl> Message-ID: Dear Jan, This is not a practical workaround! I have already too many datasets extricated according to conditions from the raw continuous datasets. What I am trying to do with fcdc_event is an intermediary step in order to implement the TF analysis capabilities in FieldTrip. As I understand FIELDTRIP was written around the CTF format and considering read_fcdc.... is a low level operation I don't see why I need to use NewDs to meet a demand imposed by FIELDTRIP. Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 12:03 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Dear Kambiz, As a first guess I would try to explicitly create this virtual 'STIM' channel, using DataEditor. Subsquently I would create a new dataset using the command-line program newDs. I recall that it has an option to include virtual channels in it. I would say, that then you have a dataset which actually contains a 'STIM' channel, so you can use it on the fieldtrip-files you have. Hope this is a sufficient workaround, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Kambiz Tavabi Sent: Friday, February 17, 2006 11:13 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Hi Jan, When it comes to MATLAB I am a low level kind of guy! With a break @ line 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, A call to stimindx returns; Empty matrix: 0-by-1. The data I have has been recorded on a CTF machine with the newest available software which apparently displays only a virtual channel labeled STIM seen in the Data Editor. The virtual STIM channel is a combination of UPPT01 & UPPT02 parallel ports used for stimulus delivery. I can send you the dsinfo for this file if you'd like. Apparently stimindx is empty; and my dataset consists of a no channel labeled STIM. But this is in accordance with current CTF format. What to do now? Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 10:18 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] wavelet analysis Dear Kambiz, This looks like a pretty low level error to me. >??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 >no channels were specified for reading CTF data >Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); It seems as if the variable stimindx has not been defined. Perhaps you could check that first, by putting a breakpoint at the specified line in read_ctf_trigger. Might it be the case that your dataset does not contain a channel with the label 'STIM'? Yours, Jan-Mathijs From Jan.Schoffelen at FCDONDERS.RU.NL Fri Feb 17 14:56:56 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Fri, 17 Feb 2006 14:56:56 +0100 Subject: read_fcdc_event In-Reply-To: <003c01c633c3$23adcd70$1423b080@KAMTRANSTEC> Message-ID: Dear Kambiz, If you already have 'preprocessed' your data, which I understand from your statement that you already created new .ds, according to your conditions, I'd say you do not need to use read_fcdc_event anymore to extract your epochs of interest. Am I correct in assuming, that the data you want to read in, is 'trial-based', with all trials of a given condition concatenated in time? If it is too unpractical to re-create a newDs based on your raw data, then you have to define your trials in a different way. -As you have probably seen, you have to specify a trial-matrix in your configuration. In the case of trial-based data, the header contains this information: hdr = read_fcdc_header(headerfile) the fields: hdr.Ntrials (or hdr.nTrials, I don't know anymore) hdr.Nsamples give the information you need (you also have to know about the offset of each trial) for j = 1:hdr.Ntrials trl(:,1) = ([1:hdr.Ntrials]'-1)*hdr.Nsamples + 1; trl(:,2) = ([1:hdr.Ntrials]')*hdr.Nsamples; trl(:,3) = the offset end Then you can put this in your configuration and proceed with the analysis. -Another possibility is writing your own trial-detection function, not using read_fcdc_event, you can write your own function and call it when you specify cfg.trialfun = 'yourownfunction'; -Still, I would prefer my first suggestion, since the fun thing with fieldtrip is, that you can really flexibly define your epochs of interest from a datafile, which has been recorded continuously. One would not need to make the data 'trial-based' using the ctf-software. That means that you would have to create the newDs only once, and define your trials within fieldtrip. Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Kambiz Tavabi Sent: Friday, February 17, 2006 2:08 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Dear Jan, This is not a practical workaround! I have already too many datasets extricated according to conditions from the raw continuous datasets. What I am trying to do with fcdc_event is an intermediary step in order to implement the TF analysis capabilities in FieldTrip. As I understand FIELDTRIP was written around the CTF format and considering read_fcdc.... is a low level operation I don't see why I need to use NewDs to meet a demand imposed by FIELDTRIP. Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 12:03 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Dear Kambiz, As a first guess I would try to explicitly create this virtual 'STIM' channel, using DataEditor. Subsquently I would create a new dataset using the command-line program newDs. I recall that it has an option to include virtual channels in it. I would say, that then you have a dataset which actually contains a 'STIM' channel, so you can use it on the fieldtrip-files you have. Hope this is a sufficient workaround, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Kambiz Tavabi Sent: Friday, February 17, 2006 11:13 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Hi Jan, When it comes to MATLAB I am a low level kind of guy! With a break @ line 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, A call to stimindx returns; Empty matrix: 0-by-1. The data I have has been recorded on a CTF machine with the newest available software which apparently displays only a virtual channel labeled STIM seen in the Data Editor. The virtual STIM channel is a combination of UPPT01 & UPPT02 parallel ports used for stimulus delivery. I can send you the dsinfo for this file if you'd like. Apparently stimindx is empty; and my dataset consists of a no channel labeled STIM. But this is in accordance with current CTF format. What to do now? Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 10:18 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] wavelet analysis Dear Kambiz, This looks like a pretty low level error to me. >??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 >no channels were specified for reading CTF data >Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); It seems as if the variable stimindx has not been defined. Perhaps you could check that first, by putting a breakpoint at the specified line in read_ctf_trigger. Might it be the case that your dataset does not contain a channel with the label 'STIM'? Yours, Jan-Mathijs From muthuraman10 at HOTMAIL.COM Tue Feb 21 11:27:21 2006 From: muthuraman10 at HOTMAIL.COM (Muthuraman Muthuraman) Date: Tue, 21 Feb 2006 10:27:21 +0000 Subject: query on loading CNT files In-Reply-To: <89836CD8-5337-4B94-B820-6BD110A5DE2B@fcdonders.ru.nl> Message-ID: hello I have tried what you have suggested me in the previous mail and i have attached the steps i have performed in matlab and the error also if i skip the preprocessing step and go for the calculation of coherence using freqanalysis how to specify data in that case for the function (freq=freqanalysis(cfg,data)); please give me suggestion on this >>headerfile='pd_mof_tr0_o_0307.cnt'; >>hdr = read_fcdc_header(headerfile); Loading file pd_mof_tr0_o_0307.cnt ... >>cfg.trl = []; for i=1:floor(hdr.nSamples/hdr.Fs) cfg.trl(i,1) = (i-1)*hdr.Fs + 1; cfg.trl(i,2) = (i )*hdr.Fs; cfg.trl(i,3) = 0; end >>cfg cfg = trl: [172x3 double] >>[cfg] = definetrial(cfg); retaining exist trial definition found 0 events created 172 trials >>data=preprocessing(cfg); ??? Error using ==> read_fcdc_header file '' does not exist Error in ==> C:\muthu\work\fieldtrip-20060131\preprocessing.m On line 236 ==> hdr = read_fcdc_header(cfg.headerfile); with regards muthuraman >From: Robert Oostenveld >Reply-To: FieldTrip discussion list >To: FIELDTRIP at NIC.SURFNET.NL >Subject: Re: [FIELDTRIP] query on loading CNT files >Date: Tue, 24 Jan 2006 13:54:16 +0100 > >The relevant warning seems to be > >>Warning: no events found in pd_mof_tr0_o_0307.cnt > >That means that the low level code used to read the CNT file does not find >any triggers in your datafile. That either means that the low level >reading function (private/read_ns_cnt.m) has a bug, or that your data does >not contain any triggers. > >If it does not contain triggers (i.e. if there are no trials in the data), >you should make your own cfg.trl field prior to calling PREPROCESSING and >skip preprocessing. The documentation of DEFINETRIAL explains what cfg.trl >means. I suggest that you try something like > >hdr = read_fcdc_header(headerfile); >cfg.trl = []; >for i=1:floor(hdr.nSamples/hdr.Fs) > cfg.trl(i,1) = (i-1)*hdr.Fs + 1; % begin sample of each trial > cfg.trl(i,2) = (i )*hdr.Fs; % end sample > cfg.trl(i,3) = 0; % offset, i.e. relative location of >the time axis >end >data = preprocessing(cfg); > >This segments your continuous data in trials of one second length. > >best, >Robert > > > >On 24-jan-2006, at 11:46, Muthuraman Muthuraman wrote: > >>hello >> >>I am beginner with field trip >>as in the previous mail i have asked about the query on loading CNT files >>and according to the reply i need to call the function DEFINETRAIL >>in the function DEFINETRAIL i have to use the READ_FCDC_EVENT to find the >>events in the data >>which gave warnings >> >>i have attached in the mail what were exactly the steps carried out for >>the EEG analysis >> >>'pd_mof_tr0_o_0307.cnt' is the file which contains the data >> >> >> >>headerfile='pd_mof_tr0_o_0307.cnt'; >>>>[hdr] = read_fcdc_header(headerfile); >>Loading file pd_mof_tr0_o_0307.cnt ... >>>>hdr >> >>hdr = >> >> Fs: 1000 >> nChans: 64 >> nSamples: 172040 >> nSamplesPre: 0 >> nTrials: 1 >> label: {1x64 cell} >> >>>>datafile='pd_mof_tr0_o_0307.cnt';begsample=1;endsample=172;chanindx= >>>>64;continuous=1; >>>>[dat] = read_fcdc_data(datafile, hdr, begsample, endsample, chanindx, >>>>continuous); >>Loading file pd_mof_tr0_o_0307.cnt ... >>done >>>>filename='pd_mof_tr0_o_0307.cnt'; >>>>[event] = read_fcdc_event(filename) >>Warning: handling of event structure has not been fully tested for >>Neuroscan *.cnt files >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 414 >>Loading file pd_mof_tr0_o_0307.cnt ... >>done >>Warning: no events found in pd_mof_tr0_o_0307.cnt >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 620 >> >>event = >> >> [] >> >> >>Thanking you >>with regards >>muthuraman >> >>>From: Robert Oostenveld >>>Reply-To: FieldTrip discussion list >>>To: FIELDTRIP at NIC.SURFNET.NL >>>Subject: Re: [FIELDTRIP] query on loading CNT files >>>Date: Wed, 18 Jan 2006 21:20:37 +0100 >>> >>>Dear Muthuraman >>> >>>All analyses start by calling the PREPROCESSING function, which reads >>>the data segments of interest into memory. Prior to that, you should >>>call DEFINETRIAL to determine the data segments of interest (usually >>>based on the triggers present in the datafile). Please see the help of >>>those two functions (type "help function_name" on the matlab command >>>line) or look at http:// www2.ru.nl/fcdonders/fieldtrip/ reference.html >>> >>>best regards >>>Robert >>> >>> >>>On 18-jan-2006, at 11:44, Muthuraman Muthuraman wrote: >>> >>>>hello >>>> >>>>I would like to use fieldtrip to analyse EEG recordings >>>>how to load CNT files which contains the data >>>>how can i load the data and do the analysis >>>> >>>> >>>>with regards >>>>muthuraman >>>> >>> >>> >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>>Robert Oostenveld, PhD >>>F.C. Donders Centre for Cognitive Neuroimaging >>>Radboud University Nijmegen >>>phone: +31-24-3619695 >>>http://www.ru.nl/fcdonders/ >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> From Jan.Schoffelen at FCDONDERS.RU.NL Tue Feb 21 12:37:17 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Tue, 21 Feb 2006 12:37:17 +0100 Subject: query on loading CNT files In-Reply-To: Message-ID: Dear Muthuraman, I guess that you should specify the files which the preprocessing-function is going to read in. So you should specify a cfg.headerfile (which causes your crash, since you left it empty) and a cfg.datafile In your case I would try: cfg.headerfile = headerfile; cfg.datafile = headerfile; (since as far as I know, these are one and the same). Good luck, Jan-Mathijs PS: Since you already manually defined your trials, you do not need to call Definetrial anymore (so the step: [cfg] = definetrial(cfg) can be omitted) -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Muthuraman Muthuraman Sent: Tuesday, February 21, 2006 11:27 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] query on loading CNT files hello I have tried what you have suggested me in the previous mail and i have attached the steps i have performed in matlab and the error also if i skip the preprocessing step and go for the calculation of coherence using freqanalysis how to specify data in that case for the function (freq=freqanalysis(cfg,data)); please give me suggestion on this >>headerfile='pd_mof_tr0_o_0307.cnt'; >>hdr = read_fcdc_header(headerfile); Loading file pd_mof_tr0_o_0307.cnt ... >>cfg.trl = []; for i=1:floor(hdr.nSamples/hdr.Fs) cfg.trl(i,1) = (i-1)*hdr.Fs + 1; cfg.trl(i,2) = (i )*hdr.Fs; cfg.trl(i,3) = 0; end >>cfg cfg = trl: [172x3 double] >>[cfg] = definetrial(cfg); retaining exist trial definition found 0 events created 172 trials >>data=preprocessing(cfg); ??? Error using ==> read_fcdc_header file '' does not exist Error in ==> C:\muthu\work\fieldtrip-20060131\preprocessing.m On line 236 ==> hdr = read_fcdc_header(cfg.headerfile); with regards muthuraman >From: Robert Oostenveld >Reply-To: FieldTrip discussion list >To: FIELDTRIP at NIC.SURFNET.NL >Subject: Re: [FIELDTRIP] query on loading CNT files >Date: Tue, 24 Jan 2006 13:54:16 +0100 > >The relevant warning seems to be > >>Warning: no events found in pd_mof_tr0_o_0307.cnt > >That means that the low level code used to read the CNT file does not find >any triggers in your datafile. That either means that the low level >reading function (private/read_ns_cnt.m) has a bug, or that your data does >not contain any triggers. > >If it does not contain triggers (i.e. if there are no trials in the data), >you should make your own cfg.trl field prior to calling PREPROCESSING and >skip preprocessing. The documentation of DEFINETRIAL explains what cfg.trl >means. I suggest that you try something like > >hdr = read_fcdc_header(headerfile); >cfg.trl = []; >for i=1:floor(hdr.nSamples/hdr.Fs) > cfg.trl(i,1) = (i-1)*hdr.Fs + 1; % begin sample of each trial > cfg.trl(i,2) = (i )*hdr.Fs; % end sample > cfg.trl(i,3) = 0; % offset, i.e. relative location of >the time axis >end >data = preprocessing(cfg); > >This segments your continuous data in trials of one second length. > >best, >Robert > > > >On 24-jan-2006, at 11:46, Muthuraman Muthuraman wrote: > >>hello >> >>I am beginner with field trip >>as in the previous mail i have asked about the query on loading CNT files >>and according to the reply i need to call the function DEFINETRAIL >>in the function DEFINETRAIL i have to use the READ_FCDC_EVENT to find the >>events in the data >>which gave warnings >> >>i have attached in the mail what were exactly the steps carried out for >>the EEG analysis >> >>'pd_mof_tr0_o_0307.cnt' is the file which contains the data >> >> >> >>headerfile='pd_mof_tr0_o_0307.cnt'; >>>>[hdr] = read_fcdc_header(headerfile); >>Loading file pd_mof_tr0_o_0307.cnt ... >>>>hdr >> >>hdr = >> >> Fs: 1000 >> nChans: 64 >> nSamples: 172040 >> nSamplesPre: 0 >> nTrials: 1 >> label: {1x64 cell} >> >>>>datafile='pd_mof_tr0_o_0307.cnt';begsample=1;endsample=172;chanindx= >>>>64;continuous=1; >>>>[dat] = read_fcdc_data(datafile, hdr, begsample, endsample, chanindx, >>>>continuous); >>Loading file pd_mof_tr0_o_0307.cnt ... >>done >>>>filename='pd_mof_tr0_o_0307.cnt'; >>>>[event] = read_fcdc_event(filename) >>Warning: handling of event structure has not been fully tested for >>Neuroscan *.cnt files >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 414 >>Loading file pd_mof_tr0_o_0307.cnt ... >>done >>Warning: no events found in pd_mof_tr0_o_0307.cnt >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 620 >> >>event = >> >> [] >> >> >>Thanking you >>with regards >>muthuraman >> >>>From: Robert Oostenveld >>>Reply-To: FieldTrip discussion list >>>To: FIELDTRIP at NIC.SURFNET.NL >>>Subject: Re: [FIELDTRIP] query on loading CNT files >>>Date: Wed, 18 Jan 2006 21:20:37 +0100 >>> >>>Dear Muthuraman >>> >>>All analyses start by calling the PREPROCESSING function, which reads >>>the data segments of interest into memory. Prior to that, you should >>>call DEFINETRIAL to determine the data segments of interest (usually >>>based on the triggers present in the datafile). Please see the help of >>>those two functions (type "help function_name" on the matlab command >>>line) or look at http:// www2.ru.nl/fcdonders/fieldtrip/ reference.html >>> >>>best regards >>>Robert >>> >>> >>>On 18-jan-2006, at 11:44, Muthuraman Muthuraman wrote: >>> >>>>hello >>>> >>>>I would like to use fieldtrip to analyse EEG recordings >>>>how to load CNT files which contains the data >>>>how can i load the data and do the analysis >>>> >>>> >>>>with regards >>>>muthuraman >>>> >>> >>> >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>>Robert Oostenveld, PhD >>>F.C. Donders Centre for Cognitive Neuroimaging >>>Radboud University Nijmegen >>>phone: +31-24-3619695 >>>http://www.ru.nl/fcdonders/ >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> From tomh at KURAGE.NIMH.NIH.GOV Tue Feb 21 15:41:18 2006 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Tue, 21 Feb 2006 09:41:18 -0500 Subject: cfg.channel needed? Message-ID: Hi; just exploring some of the recent changes, I noticed that if you let cfg.channel default in preprocessing, you'll get all the channels, MEG + junk, as expected. But then if I'm doing cross-power and specify channel combinations of all MEG by all MEG, strange things happen. I get an error saying "The cross-spectral-density matrix is not complete" from prepare_freq_matrices(). This is because there are more channels in cfg.channel than in the csd matrix. I was thinking it might be nice for it to default to only the channels specified in the csd, but it looks like there's too much going on previously, and it's better to use cfg.channel in preprocessing. But the error message could be nicer. If you leave the call to channelcombination() out, that is, omit cfg.channelcmb = channelcombination({'MEG' 'MEG'}, data.label); from freqanalysis(), does it default to 'all' by 'all' so that if you said cfg.channel = { 'MEG' }; to preprocessing() you'll get 'MEG' by 'MEG'? Basically I just want to ask if cfg.channel is now more-or-less required to preprocessing()? Thanks Dr. Tom Holroyd The 9th Amendment of the U.S. Constitution: "The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people." From r.oostenveld at FCDONDERS.RU.NL Wed Feb 22 10:23:11 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 22 Feb 2006 10:23:11 +0100 Subject: read_fcdc_event In-Reply-To: <003c01c633c3$23adcd70$1423b080@KAMTRANSTEC> Message-ID: Dear Kambiz, I was away for a few days, otherwise I would have pointed this out to you and JM before: I recently got a patch from Tom Holroyd which exactly fixes this problem in the low level trigger reading code. I have applied the patch to the inhouse version, however, the ftp version of fieldtrip is currently slightly lagging behind. I hope to have the ftp version up to date again by the end of the week. Please find attached an updated read_fcdc_event an a read_ctf_trigger (which goes into the private subdir). These should return the trigger information for your new electronics. best regards, Robert PS could you perhaps send me a dataset with the new trigger channels? I have not been able to test the code since I was not able to test the code since we don't have the new eelctronics. If you would not mind, please put it on ftp://ftp.fcdonders.nl/pub/incoming and/or send me a direct mail. -------------- next part -------------- A non-text attachment was scrubbed... Name: read_ctf_trigger.m Type: application/octet-stream Size: 3780 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: read_fcdc_event.m Type: application/octet-stream Size: 25723 bytes Desc: not available URL: -------------- next part -------------- On 17-feb-2006, at 14:07, Kambiz Tavabi wrote: > Dear Jan, > This is not a practical workaround! I have already too many datasets > extricated according to conditions from the raw continuous > datasets. What I > am trying to do with fcdc_event is an intermediary step in order to > implement the TF analysis capabilities in FieldTrip. As I understand > FIELDTRIP was written around the CTF format and considering > read_fcdc.... is > a low level operation I don't see why I need to use NewDs to meet a > demand > imposed by FIELDTRIP. > > Thanks, > Kambiz From r.oostenveld at FCDONDERS.RU.NL Wed Feb 22 10:50:06 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 22 Feb 2006 10:50:06 +0100 Subject: cfg.channel needed? In-Reply-To: Message-ID: Hi Tom, The default for freqanalysis is cfg.channelcmb='all', which means all- with-all. If you do cfg.channel='MEG' in preprocessing and use the default in freqanalysis, you'll hence get MEG-with-MEG. Alternatively, preprocessing with cfg.channel='all' should also work and you should be able to get MEG-with-MEG using cfg.channelcmb as you have specified it. I am not sure what the problem is in your case, but I can explain what is happening: The idea is that sourceanalysis (and the underlying prepare_freq_matrices) should not make assumptions on the configuration that was used in freqanlysis, but has to rely on the output freq structure. Freqanalysis computes powsctrm and crsspctrm seperately and store them in arrays. To prevent excess memory use, only one copy of each channel combinations is strored (i.e. ch1-ch2, but not ch2-ch1). When you do sourceanalysis (which triggers prepare_freq_matrices ), a selection along the time and frequency dimension is made. In the nchanXnchan CSD matrix that is constructed, the powspctrm should be on the diagonal and the crsspctrm should be assigned to both off-diagonal sides of the CSD matrix. This is a large reshuffling of numbers coming from the two (pow/csspctrm) arrays. Since there is no guarantee that all elements of the CSD matrix can be found somewhere in either of the arrays, the CSD matrix is first filled with nans and then all elements that can be found are copied in. If, at the end, there is still a nan somewhere in the CSD matrix, then that means that the output of freqanalysis was not complete enough for sourceanalysis. See prepare_freq_matrices lines 147-175. I hope that this provides enough information for you to find the underlying problem in your case. Robert PS The code is not very readible, and is pretty old. I would implement it differently (although with the same basic idea) if I had to do it again. All the string comparisons between all channel combinations make it very slow. I would now do it using the cmb2label and label2cmb subfunctions that are currently only used inside the prepare_timefreq_data function. On 21-feb-2006, at 15:41, Tom Holroyd wrote: > Hi; just exploring some of the recent changes, I noticed that if > you let cfg.channel default in preprocessing, you'll get all the > channels, MEG + junk, as expected. But then if I'm doing cross- > power and specify channel combinations of all MEG by all MEG, > strange things happen. I get an error saying "The cross-spectral- > density matrix is not complete" from prepare_freq_matrices(). This > is because there are more channels in cfg.channel than in the csd > matrix. I was thinking it might be nice for it to default to only > the channels specified in the csd, but it looks like there's too > much going on previously, and it's better to use cfg.channel in > preprocessing. But the error message could be nicer. > > If you leave the call to channelcombination() out, that is, omit > cfg.channelcmb = channelcombination({'MEG' 'MEG'}, data.label); > from freqanalysis(), does it default to 'all' by 'all' so that if > you said > cfg.channel = { 'MEG' }; > to preprocessing() you'll get 'MEG' by 'MEG'? > > Basically I just want to ask if cfg.channel is now more-or-less > required to preprocessing()? > > Thanks > > Dr. Tom Holroyd > The 9th Amendment of the U.S. Constitution: > "The enumeration in the Constitution, of certain rights, shall not be > construed to deny or disparage others retained by the people." > From kambiz.tavabi at UNI-MUENSTER.DE Wed Feb 22 11:44:41 2006 From: kambiz.tavabi at UNI-MUENSTER.DE (Kambiz Tavabi) Date: Wed, 22 Feb 2006 11:44:41 +0100 Subject: read_fcdc_event In-Reply-To: <447B33B1-57A1-43A8-A146-471161BAE753@fcdonders.ru.nl> Message-ID: Dear Robert, I received an email from Dr. Holroyd describing implementation of his patch; I just haven't gotten around to it. Nonetheless, I appreciate the updated function files! As per your request I have uploaded the 'A0132_Aud-Obj-Recognition_20051115_02.ds' dataset in the incoming folder in the Donders FTP. It is a passive auditory dataset with an acoustic trigger on parallel port 1 used for event timing and 4 different stimuli coded on port two; the data is recorded with 3rd order gradient balancing. I have attached a dsinfo output of the data for your convenience. All the best, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Robert Oostenveld Sent: Wednesday, February 22, 2006 10:23 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Dear Kambiz, I was away for a few days, otherwise I would have pointed this out to you and JM before: I recently got a patch from Tom Holroyd which exactly fixes this problem in the low level trigger reading code. I have applied the patch to the inhouse version, however, the ftp version of fieldtrip is currently slightly lagging behind. I hope to have the ftp version up to date again by the end of the week. Please find attached an updated read_fcdc_event an a read_ctf_trigger (which goes into the private subdir). These should return the trigger information for your new electronics. best regards, Robert PS could you perhaps send me a dataset with the new trigger channels? I have not been able to test the code since I was not able to test the code since we don't have the new eelctronics. If you would not mind, please put it on ftp://ftp.fcdonders.nl/pub/incoming and/or send me a direct mail. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: dsinfo.txt URL: From tomh at KURAGE.NIMH.NIH.GOV Wed Feb 22 23:11:25 2006 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd (NIH/NIMH) [E]) Date: Wed, 22 Feb 2006 17:11:25 -0500 Subject: cfg.channel needed? In-Reply-To: <2A2BC392-0CAD-47C3-9DBE-F79612C285DA@fcdonders.ru.nl> Message-ID: Robert Oostenveld wrote: > Hi Tom, > > The default for freqanalysis is cfg.channelcmb='all', which means all- > with-all. If you do cfg.channel='MEG' in preprocessing and use the > default in freqanalysis, you'll hence get MEG-with-MEG. Alternatively, > preprocessing with cfg.channel='all' should also work and you should be > able to get MEG-with-MEG using cfg.channelcmb as you have specified it. However, you can't. :-) > PS The code is not very readible, and is pretty old. I would implement > it differently (although with the same basic idea) if I had to do it > again. All the string comparisons between all channel combinations make > it very slow. That's certainly true; with 275 channels there are over 37,000 pairs. In prepare_freq_matricies.m, on line 125, Nchan is 302. The problem is that size(freq.label) is 306. Somewhere it is dropping some channels, and the numbers don't match. I did this: I let cfg.channel default in preprocessing, and used cfg.channelcmb = channelcombination({'MEG' 'MEG'}, data.label); with freqanalysis. Then to examine the state in sourceanalysis: > dbstop('prepare_freq_matrices', '125'); At this point, cfg.channel has the MEG channels and the references ONLY (and the references have been moved to the end for some reason). freq.label includes everything. Because they don't match, the matrix is built to the wrong size. I tried pruning cfg.channel to just the MEGs, but that caused more problems downstream. FYI, the script I'm using uses prepare_leadfield, does that matter? -- Dr. Tom Holroyd The 9th Amendment of the U.S. Constitution: "The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people." From muthuraman10 at HOTMAIL.COM Thu Feb 23 11:32:13 2006 From: muthuraman10 at HOTMAIL.COM (Muthuraman Muthuraman) Date: Thu, 23 Feb 2006 10:32:13 +0000 Subject: query on channel arrangement In-Reply-To: <001101c636db$2b3fb150$902dae83@fcdonders.nl> Message-ID: hello Thanks Jan We have the data for EEG taken with 64-channel(Neuroscan) arrangement and i need to specify channel arrangement when i want to calculate the coherence between EEG and EMG so for example : in real data FPZ- 45 -in the EEG channel arrangement AF7-41 -in the EEG channel arrangement M1-29- EMG channel M2-30-EMG channel M3-63-EMG channel M4-64-EMG channel but when i calculate the coherence i want them in the 64-channel layout instead of 151 layout and to change the channels in the coherence plot as for example- FPZ-1 -in the coherence plot AF7-2 -in the coherence plot M1-52-in the coherence plot M2-53-in the coherence plot M3-54-in the coherence plot M4-55-in the coherence plot Like this i wanted to change the channel arrangement in the coherence plot for all the channels how can i change it, please can you give me some idea regarding this with regards muthu >From: Jan Mathijs Schoffelen >Reply-To: FieldTrip discussion list >To: FIELDTRIP at NIC.SURFNET.NL >Subject: Re: [FIELDTRIP] query on loading CNT files >Date: Tue, 21 Feb 2006 12:37:17 +0100 > >Dear Muthuraman, > >I guess that you should specify the files which the preprocessing-function >is going to read in. So you should specify a > >cfg.headerfile (which causes your crash, since you left it empty) > >and a > >cfg.datafile > >In your case I would try: > >cfg.headerfile = headerfile; >cfg.datafile = headerfile; (since as far as I know, these are one and the >same). > >Good luck, > >Jan-Mathijs > >PS: Since you already manually defined your trials, you do not need to call >Definetrial anymore (so the step: [cfg] = definetrial(cfg) can be omitted) > >-----Original Message----- >From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf >Of Muthuraman Muthuraman >Sent: Tuesday, February 21, 2006 11:27 AM >To: FIELDTRIP at NIC.SURFNET.NL >Subject: Re: [FIELDTRIP] query on loading CNT files > >hello > >I have tried what you have suggested me in the previous mail >and i have attached the steps i have performed in matlab and the error also > >if i skip the preprocessing step >and go for the calculation of coherence using freqanalysis >how to specify data in that case for the function >(freq=freqanalysis(cfg,data)); >please give me suggestion on this > > > > >>headerfile='pd_mof_tr0_o_0307.cnt'; > >>hdr = read_fcdc_header(headerfile); >Loading file pd_mof_tr0_o_0307.cnt ... > >>cfg.trl = []; >for i=1:floor(hdr.nSamples/hdr.Fs) > cfg.trl(i,1) = (i-1)*hdr.Fs + 1; > cfg.trl(i,2) = (i )*hdr.Fs; > cfg.trl(i,3) = 0; >end > >>cfg > >cfg = > > trl: [172x3 double] > >>[cfg] = definetrial(cfg); >retaining exist trial definition >found 0 events >created 172 trials > > >>data=preprocessing(cfg); >??? Error using ==> read_fcdc_header >file '' does not exist > >Error in ==> C:\muthu\work\fieldtrip-20060131\preprocessing.m >On line 236 ==> hdr = read_fcdc_header(cfg.headerfile); > > > > >with regards >muthuraman > > > > >From: Robert Oostenveld > >Reply-To: FieldTrip discussion list > >To: FIELDTRIP at NIC.SURFNET.NL > >Subject: Re: [FIELDTRIP] query on loading CNT files > >Date: Tue, 24 Jan 2006 13:54:16 +0100 > > > >The relevant warning seems to be > > > >>Warning: no events found in pd_mof_tr0_o_0307.cnt > > > >That means that the low level code used to read the CNT file does not >find > > >any triggers in your datafile. That either means that the low level > >reading function (private/read_ns_cnt.m) has a bug, or that your data >does > > >not contain any triggers. > > > >If it does not contain triggers (i.e. if there are no trials in the >data), > > >you should make your own cfg.trl field prior to calling PREPROCESSING >and > >skip preprocessing. The documentation of DEFINETRIAL explains what >cfg.trl > > >means. I suggest that you try something like > > > >hdr = read_fcdc_header(headerfile); > >cfg.trl = []; > >for i=1:floor(hdr.nSamples/hdr.Fs) > > cfg.trl(i,1) = (i-1)*hdr.Fs + 1; % begin sample of each trial > > cfg.trl(i,2) = (i )*hdr.Fs; % end sample > > cfg.trl(i,3) = 0; % offset, i.e. relative location of > >the time axis > >end > >data = preprocessing(cfg); > > > >This segments your continuous data in trials of one second length. > > > >best, > >Robert > > > > > > > >On 24-jan-2006, at 11:46, Muthuraman Muthuraman wrote: > > > >>hello > >> > >>I am beginner with field trip > >>as in the previous mail i have asked about the query on loading CNT >files > >>and according to the reply i need to call the function DEFINETRAIL > >>in the function DEFINETRAIL i have to use the READ_FCDC_EVENT to find >the > > >>events in the data > >>which gave warnings > >> > >>i have attached in the mail what were exactly the steps carried out for > >>the EEG analysis > >> > >>'pd_mof_tr0_o_0307.cnt' is the file which contains the data > >> > >> > >> >>headerfile='pd_mof_tr0_o_0307.cnt'; > >>>>[hdr] = read_fcdc_header(headerfile); > >>Loading file pd_mof_tr0_o_0307.cnt ... > >>>>hdr > >> > >>hdr = > >> > >> Fs: 1000 > >> nChans: 64 > >> nSamples: 172040 > >> nSamplesPre: 0 > >> nTrials: 1 > >> label: {1x64 cell} > >> > >>>>datafile='pd_mof_tr0_o_0307.cnt';begsample=1;endsample=172;chanindx= > >>>>64;continuous=1; > >>>>[dat] = read_fcdc_data(datafile, hdr, begsample, endsample, chanindx, > >>>>continuous); > >>Loading file pd_mof_tr0_o_0307.cnt ... > >>done > >>>>filename='pd_mof_tr0_o_0307.cnt'; > >>>>[event] = read_fcdc_event(filename) > >>Warning: handling of event structure has not been fully tested for > >>Neuroscan *.cnt files > >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 414 > >>Loading file pd_mof_tr0_o_0307.cnt ... > >>done > >>Warning: no events found in pd_mof_tr0_o_0307.cnt > >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 620 > >> > >>event = > >> > >> [] > >> > >> > >>Thanking you > >>with regards > >>muthuraman > >> > >>>From: Robert Oostenveld > >>>Reply-To: FieldTrip discussion list > >>>To: FIELDTRIP at NIC.SURFNET.NL > >>>Subject: Re: [FIELDTRIP] query on loading CNT files > >>>Date: Wed, 18 Jan 2006 21:20:37 +0100 > >>> > >>>Dear Muthuraman > >>> > >>>All analyses start by calling the PREPROCESSING function, which reads > >>>the data segments of interest into memory. Prior to that, you should > >>>call DEFINETRIAL to determine the data segments of interest (usually > >>>based on the triggers present in the datafile). Please see the help >of > >>>those two functions (type "help function_name" on the matlab command > >>>line) or look at http:// www2.ru.nl/fcdonders/fieldtrip/ reference.html > >>> > >>>best regards > >>>Robert > >>> > >>> > >>>On 18-jan-2006, at 11:44, Muthuraman Muthuraman wrote: > >>> > >>>>hello > >>>> > >>>>I would like to use fieldtrip to analyse EEG recordings > >>>>how to load CNT files which contains the data > >>>>how can i load the data and do the analysis > >>>> > >>>> > >>>>with regards > >>>>muthuraman > >>>> > >>> > >>> > >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >>>Robert Oostenveld, PhD > >>>F.C. Donders Centre for Cognitive Neuroimaging > >>>Radboud University Nijmegen > >>>phone: +31-24-3619695 > >>>http://www.ru.nl/fcdonders/ > >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >> From r.oostenveld at FCDONDERS.RU.NL Fri Feb 24 11:49:29 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 24 Feb 2006 11:49:29 +0100 Subject: new website+wiki Message-ID: Dear FieldTrip users, We have implemented a new layout of the fieldtrip homepage, and a new technical system behind it. The homepage is still available at the same place: http://www.ru.nl/fcdonders/fieldtrip and I'd like to invite you to have a look at the new website. The system behint it is a wiki, similar to that used for Wikipedia (www.wikipedia.org). From now on anyone cabn contribute to the documentation! That means that, if you want to share documentation or demo scripts with others, you can do it directly through the website. Also if you notice an error in the documentation or a typo somewhere, you can fix it yourself immediately. There are still some parts of the old website that need to be copied to the new website, but we are working on that. If you have ideas, suggestions or comments, please share them with us. best regards, the fieldtrip team. PS At the moment we did not implement accounts and passwords, so anyone can contribute. If it turns out that the website becomes too messy, we will make the edit function restricted to people with an account. From tomh at KURAGE.NIMH.NIH.GOV Fri Feb 24 13:46:16 2006 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Fri, 24 Feb 2006 07:46:16 -0500 Subject: new website+wiki In-Reply-To: <99025CC8-DE48-4F40-BFD6-145A4D93CB84@fcdonders.ru.nl> Message-ID: On Fri, 24 Feb 2006, Robert Oostenveld wrote: > PS At the moment we did not implement accounts and passwords, so anyone can > contribute. If it turns out that the website becomes too messy, we will make > the edit function restricted to people with an account. Robert, I would recommend a default account/password that everybody knows. That'll limit attacks from spammers. A common attack is just to create huge lists of links (often in the sidebar) to be indexed by search engines. The NIMH MEG Core website is also a wiki. We've enjoyed it; it's very easy to modify (if you know the magic word, which is shrimp). There's also an RSS feed of the "changed pages page" so it's easy to keep track of when modifications are made. Wikipedea doesn't need passwords as much because they have high vigilance on the main pages... Did you see the article on Magnetoencephalography? It has grown a lot (I've contributed, as have several others). Dr. Tom Holroyd The 9th Amendment of the U.S. Constitution: "The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people." From r.oostenveld at FCDONDERS.RU.NL Fri Feb 24 18:09:14 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 24 Feb 2006 18:09:14 +0100 Subject: change in data structures, inside, dimord, foi and toi Message-ID: Dear FieldTrip users We have made two relatively large changes to FieldTrip that may lead to incompatibilities with your own scripts, therefore a word of warning: The changes affect the "home/common" version inside the Donders Centre from this moment on. The changes affect the daily released ftp version from version 20060224, i.e. today onward. That version does not exist yet, but will be uploaded to the ftp version this evening (CET). From today onward, a daily release will be made available again (which was not the case for the last 2 weeks). The first change is that of volumes. Previously source volumes could have an "inside" and an "outside" vector with indices, indicating the voxels that were scanned with the beamformer or not. Those two "inside" and "outside" vectors have been replaced by an locigal/ boolean "inside" volume, which is 1 if the voxel was inside the brain (i.e. beamed) and 0 if outside the brain (i.e. not beamed). The second change relates to the dimord field that most fieldtrip data structures have, and the freq.foi and freq.toi fields. The use of the dimord field has been made consistent between all functions, due to which some dimords had to be renamed. More importantly, the time and frequency axis in the output of the freqanalysis function have been renamed to freq.time (used to be freq.toi) and freq.freq (used to be freq.foi). This ensures that the dimord and the description of the axes in the data structure is consistent. The dimord also will specify "chan_freq_time" instead of "sgncmb_frq_tim", i.e. the dimord is in better correspondence with the data strucute. We have kept all FieldTrip functions backward compatible, i.e. old datastructures that you have previously computed and saved to disk in a mat file will still work with the new FieldTrip functions. Since the changes affected many fieldtrip functions, it could very well be that the changes introduced some bugs here and there. Please inform us about them, so that we can fix them. Sorry about the inconvenience that this may cause with respect to your analysis scripts. The change was required to ensure a further consistent development of the FieldTrip code. yours sincerely, Robert ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From litvak at TECHUNIX.TECHNION.AC.IL Mon Feb 27 09:23:50 2006 From: litvak at TECHUNIX.TECHNION.AC.IL (Vladimir Litvak) Date: Mon, 27 Feb 2006 10:23:50 +0200 Subject: Activation vs. baseline Message-ID: Dear Eric and all, I'm playing with 'Activation vs. baseline' option in clusterrandanalysis. The problem is that my baseline is about 100ms while the activation period is 300 ms. I cannot extend the baseline since the raw data I have is already segmented. What is the right thing to do in this situation? Should I divide the activation period into 3 segments and test them separately? Or maybe replicate the baseline 3 times, concatenate and use this as baseline for the whole period? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From pascal.fries at FCDONDERS.RU.NL Mon Feb 27 10:05:00 2006 From: pascal.fries at FCDONDERS.RU.NL (Pascal Fries) Date: Mon, 27 Feb 2006 10:05:00 +0100 Subject: Activation vs. baseline In-Reply-To: <000d01c63b77$26406820$90514484@dellgx240> Message-ID: Dear Vladimir, what aspect of the two data pieces are you comparing? Power? Coherence? Amplitude? At the sensor or at the source level? Best, Pascal Pascal Fries Principal Investigator Neuronal Coherence Group F. C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen Kapittelweg 29 6525 EN Nijmegen The Netherlands Phone: (+31) (0)24 36 10657 Fax: (+31) (0)24 36 10989 e-mail: pascal.fries at fcdonders.ru.nl website: www.ru.nl/fcdonders/ _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Monday, February 27, 2006 9:24 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Activation vs. baseline Dear Eric and all, I'm playing with 'Activation vs. baseline' option in clusterrandanalysis. The problem is that my baseline is about 100ms while the activation period is 300 ms. I cannot extend the baseline since the raw data I have is already segmented. What is the right thing to do in this situation? Should I divide the activation period into 3 segments and test them separately? Or maybe replicate the baseline 3 times, concatenate and use this as baseline for the whole period? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Mon Feb 27 10:05:56 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Feb 2006 10:05:56 +0100 Subject: query on channel arrangement In-Reply-To: Message-ID: Dear Muthu FieldTrip always works with channel labels, not with channel numbers. All functions, e.g. freqdescriptives (which computes coherence) or the plotting functions use the labels. The channel labels are read from the datafile, if the datafile does not include the correct channel labels, you have to fix them yourself. Do that after preprocessin, i.e. after preprocessing you can change the data.label cell array. From then on, FT will not look in the data file any more, so the channnel labels will remain as you have renamed them. The freqanalysis or freqdescriptives function do not care where each channel is, they only care about the channelcombiations that you specify between which to compute coherence. The plotting functions of course do need to know where each channel is, otherwise it cannot plot. The information about the channel locations is stored in the layout file, which is an ascii text file with the extension *.lay. You should have a look in the elec1010.lay file, which probably is already pretty close to teh layout that you want to use. best Robert On 23-feb-2006, at 11:32, Muthuraman Muthuraman wrote: > We have the data for EEG taken with 64-channel(Neuroscan) arrangement > and i need to specify channel arrangement > when i want to calculate the coherence between EEG and EMG > > so for example : in real data > > FPZ- 45 -in the EEG channel arrangement > AF7-41 -in the EEG channel arrangement > > M1-29- EMG channel > M2-30-EMG channel > M3-63-EMG channel > M4-64-EMG channel > > but when i calculate the coherence i want them in the 64-channel > layout > instead of 151 layout > > and to change the channels in the coherence plot as > for example- > FPZ-1 -in the coherence plot > AF7-2 -in the coherence plot > > M1-52-in the coherence plot > M2-53-in the coherence plot > M3-54-in the coherence plot > M4-55-in the coherence plot > > Like this i wanted to change the channel arrangement in the > coherence plot for all the channels > how can i change it, please can you give me some idea regarding this From litvak at TECHUNIX.TECHNION.AC.IL Mon Feb 27 10:13:18 2006 From: litvak at TECHUNIX.TECHNION.AC.IL (Vladimir Litvak) Date: Mon, 27 Feb 2006 11:13:18 +0200 Subject: Activation vs. baseline In-Reply-To: Message-ID: Amplitude at the sensor level. Vladimir -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Pascal Fries Sent: Monday, February 27, 2006 11:05 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Activation vs. baseline Dear Vladimir, what aspect of the two data pieces are you comparing? Power? Coherence? Amplitude? At the sensor or at the source level? Best, Pascal Pascal Fries Principal Investigator Neuronal Coherence Group F. C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen Kapittelweg 29 6525 EN Nijmegen The Netherlands Phone: (+31) (0)24 36 10657 Fax: (+31) (0)24 36 10989 e-mail: pascal.fries at fcdonders.ru.nl website: www.ru.nl/fcdonders/ _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Monday, February 27, 2006 9:24 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Activation vs. baseline Dear Eric and all, I'm playing with 'Activation vs. baseline' option in clusterrandanalysis. The problem is that my baseline is about 100ms while the activation period is 300 ms. I cannot extend the baseline since the raw data I have is already segmented. What is the right thing to do in this situation? Should I divide the activation period into 3 segments and test them separately? Or maybe replicate the baseline 3 times, concatenate and use this as baseline for the whole period? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From conrado.bosman at GMAIL.COM Mon Feb 27 10:05:12 2006 From: conrado.bosman at GMAIL.COM (Conrado Bosman) Date: Mon, 27 Feb 2006 10:05:12 +0100 Subject: Error in freqdescriptives ? Message-ID: Hi Robert, After analyze my data with freqanalysis, I use freqdescriptive to get the values of coherence and the power spectrum. In my script I use the foollowing functions, FRtemp = freqanalysis(cfg3,MSMA); FR = freqdescriptives([],FRtemp); and I get the following error: ??? Undefined function or variable "data". Error in ==> freqdescriptives at 113 data = fixdimord(data); If I use the dbstop command, you can see that data variable at that point doesn't exist. 113 data = fixdimord(data); K>> whos Name Size Bytes Class cfg 1x1 164 struct array freq 1x1 25792480 struct array It could be that there is a bug in the name of the variable? (using data instead of freq) Thanks for your attention, Conrado Bosman -------------- next part -------------- An HTML attachment was scrubbed... URL: From pascal.fries at FCDONDERS.RU.NL Mon Feb 27 10:46:56 2006 From: pascal.fries at FCDONDERS.RU.NL (Pascal Fries) Date: Mon, 27 Feb 2006 10:46:56 +0100 Subject: Activation vs. baseline In-Reply-To: <000201c63b7e$0c86b270$90514484@dellgx240> Message-ID: Dear Valdimir, OK. I had been asking, because coherence (and also power) have a bias that is sample size dependent. For those measures, particularly for coherence, I would suggest to use equal sample sizes. As far as I can judge, this problem is not there for amplitude. Then it is to the cluterrandanalysis experts to help you with that particular analysis. Best, Pascal _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Monday, February 27, 2006 10:13 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Activation vs. baseline Amplitude at the sensor level. Vladimir -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Pascal Fries Sent: Monday, February 27, 2006 11:05 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Activation vs. baseline Dear Vladimir, what aspect of the two data pieces are you comparing? Power? Coherence? Amplitude? At the sensor or at the source level? Best, Pascal Pascal Fries Principal Investigator Neuronal Coherence Group F. C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen Kapittelweg 29 6525 EN Nijmegen The Netherlands Phone: (+31) (0)24 36 10657 Fax: (+31) (0)24 36 10989 e-mail: pascal.fries at fcdonders.ru.nl website: www.ru.nl/fcdonders/ _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Monday, February 27, 2006 9:24 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Activation vs. baseline Dear Eric and all, I'm playing with 'Activation vs. baseline' option in clusterrandanalysis. The problem is that my baseline is about 100ms while the activation period is 300 ms. I cannot extend the baseline since the raw data I have is already segmented. What is the right thing to do in this situation? Should I divide the activation period into 3 segments and test them separately? Or maybe replicate the baseline 3 times, concatenate and use this as baseline for the whole period? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From maris at NICI.RU.NL Mon Feb 27 12:01:24 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Mon, 27 Feb 2006 12:01:24 +0100 Subject: Activation vs. baseline Message-ID: Dear Vladimir, I'm playing with 'Activation vs. baseline' option in clusterrandanalysis. The problem is that my baseline is about 100ms while the activation period is 300 ms. I cannot extend the baseline since the raw data I have is already segmented. What is the right thing to do in this situation? Should I divide the activation period into 3 segments and test them separately? Or maybe replicate the baseline 3 times, concatenate and use this as baseline for the whole period? My advice is to divide the activation period into 3 segments and test them separately. You can correct for multiple comparisons by using the Bonferroni-corrected alpha-level of alpha/3. Good luck, Eric Maris From r.oostenveld at FCDONDERS.RU.NL Mon Feb 27 12:23:34 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Feb 2006 12:23:34 +0100 Subject: Error in freqdescriptives ? In-Reply-To: Message-ID: Hi Conrado, Thanks for reporting the bug. I have fixed it in the release version of Fieldtrip. Robert On 27-feb-2006, at 10:05, Conrado Bosman wrote: > Hi Robert, > > After analyze my data with freqanalysis, I use freqdescriptive to > get the values of coherence and the power spectrum. In my script I > use the foollowing functions, > > FRtemp = freqanalysis(cfg3,MSMA); > FR = freqdescriptives([],FRtemp); > > and I get the following error: > > ??? Undefined function or variable "data". > > Error in ==> freqdescriptives at 113 > data = fixdimord(data); > > If I use the dbstop command, you can see that data variable at that > point doesn't exist. > > 113 data = fixdimord(data); > K>> whos > Name Size Bytes Class > > cfg 1x1 164 struct array > freq 1x1 25792480 struct array > > It could be that there is a bug in the name of the variable? (using > data instead of freq) > > Thanks for your attention, > > Conrado Bosman > > From conrado.bosman at GMAIL.COM Mon Feb 27 14:56:00 2006 From: conrado.bosman at GMAIL.COM (Conrado Bosman) Date: Mon, 27 Feb 2006 14:56:00 +0100 Subject: Another bug in freqdescriptives_pf Message-ID: Hi Robert, I find other bug in freqdescriptives_pf. This is the error message ??? Undefined function or variable "output". Error in ==> freqdescriptives>freqdescriptives_pf at 318 output.powspctrm = output.pow; Best, Conrado -- Conrado -------------- next part -------------- An HTML attachment was scrubbed... URL: From tomh at KURAGE.NIMH.NIH.GOV Mon Feb 27 16:57:31 2006 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd (NIH/NIMH) [E]) Date: Mon, 27 Feb 2006 10:57:31 -0500 Subject: Activation vs. baseline In-Reply-To: <2612D6C3714742A58C75AE68696B27FE@fcdonders.nl> Message-ID: Pascal Fries wrote: > OK. I had been asking, because coherence (and also power) have a bias > that is sample size dependent. For those measures, particularly for > coherence, I would suggest to use equal sample sizes. Correct me if I am wrong, but this bias is due to the slow convergence of the covariance; with more samples, the covariance converges more (assuming it converges at all). Furthermore it probably converges 'up', so if you have more samples, you'll see (apparently) more power. I have sometimes dealt with this problem in the past by simply z-scoring the volumes afterwards, thus shifting the means back to zero. But perhaps there are skewness issues as well? I've mostly done that when playing around with things like overlapping windows; for example, using an active window of 0 to 300 ms and a control window of 0 to 250 ms, you expect a slightly higher power in the active state because of the increase convergence, but then normalizing that spatially can give you an estimate of active areas for that 250-300 ms window. There may also be problematic beamformer overlap in this case, though, but that can be dealt with too. Just a thought. -- Dr. Tom Holroyd The 9th Amendment of the U.S. Constitution: "The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people." From r.oostenveld at FCDONDERS.RU.NL Mon Feb 27 17:28:56 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Feb 2006 17:28:56 +0100 Subject: Another bug in freqdescriptives_pf In-Reply-To: Message-ID: Hi Conrado, That also has been fixed. Robert On 27-feb-2006, at 14:56, Conrado Bosman wrote: > Hi Robert, > > I find other bug in freqdescriptives_pf. This is the error message > > ??? Undefined function or variable "output". > > Error in ==> freqdescriptives>freqdescriptives_pf at 318 > output.powspctrm = output.pow; > > Best, > Conrado > > -- > Conrado From pascal.fries at FCDONDERS.RU.NL Mon Feb 27 17:57:10 2006 From: pascal.fries at FCDONDERS.RU.NL (Pascal Fries) Date: Mon, 27 Feb 2006 17:57:10 +0100 Subject: Activation vs. baseline In-Reply-To: <4403216B.4030209@kurage.nimh.nih.gov> Message-ID: Hi Tom, > Pascal Fries wrote: > > OK. I had been asking, because coherence (and also power) > have a bias > > that is sample size dependent. For those measures, particularly for > > coherence, I would suggest to use equal sample sizes. > > Correct me if I am wrong, but this bias is due to the slow > convergence of the covariance; with more samples, the > covariance converges more (assuming it converges at all). > Furthermore it probably converges 'up', so if you have more > samples, you'll see (apparently) more power. I still haven't fully understood the sample size bias of power. For coherence, the issue is simple to understand. As you write, it has to do with the slow convergence towards the true value as the sample increases. But in the coherence case, values will converge "down" towards the true value, not 'up'. For one trial, coherence is numerically always one and will then decrease as you add more trials. In the case of a true coherence of one, it will not decrease and in the case of a true coherence zero, it will rapidly decrease. This is one of the most important things on the agenda for the basic spectral analysis in FieldTrip: To get a good estimate of the coherence bias and subtract it. Until this is finalized, the safest approach is to trim datasets before comparison to equal size. > I have sometimes dealt with this problem in the past by > simply z-scoring the volumes afterwards, thus shifting the > means back to zero. But perhaps there are skewness issues as > well? I've mostly done that when playing around with things > like overlapping windows; for example, using an active window > of 0 to 300 ms and a control window of 0 to 250 ms, you > expect a slightly higher power in the active state because of > the increase convergence, but then normalizing that spatially > can give you an estimate of active areas for that 250-300 ms > window. There may also be problematic beamformer overlap in > this case, though, but that can be dealt with too. Just a thought. I agree: If sample sizes are not orders of magnitude different, then a z-transformation can take care of most of the bias. Best, Pascal From litvak at TECHUNIX.TECHNION.AC.IL Mon Feb 27 18:14:16 2006 From: litvak at TECHUNIX.TECHNION.AC.IL (Vladimir Litvak) Date: Mon, 27 Feb 2006 19:14:16 +0200 Subject: Activation vs. baseline In-Reply-To: <13C2688B7C044C179AE9843BC0334507@fcdonders.nl> Message-ID: Dear Pascal, At the last SFN meeting Partha Mitra presented a poster with a method for dealing with exactly this problem. He told me he would put an implementation on his website. It would be nice if you could incorporate that into Fieldtrip. Although it has nothing to do with my original problem it can be helpful for me in other contexts. The abstract is below. Best, Vladimir -------------------------------------- Abstract View COMPARING SPECTRA AND COHERENCES FOR SAMPLES OF UNEQUAL SIZE H.S.Bokil1*; K.Purpura2; D.Thomson3; P.P.Mitra1 1. Cold Spring Harbor Laboratory, Cold Spring Harbor, NY, USA 2. Weill Med. Col. of Cornell Univ., New York, NY, USA 3. Mathematics, Queens Univ., Kingston, ON, Canada The spectrum and the coherency are classical measures of temporal structure of and association between time series. The multitaper method provides robust estimates of these quantities for noisy and non-stationary time series that are characteristic of neurophysiological recordings. This method has recently been shown to be useful in studying working memory and selective visual attention. However, these studies have raised the important technical issue of comparison of spectra or coherences from two samples of unequal sizes, for example when comparing estimates from different experimental conditions. This is difficult with existing statistical tests since the bias in the estimates depends on the sample size. Here we propose a set of procedures to resolve this issue. Our procedure for the coherence is based on the previously described quantity z=(tanh(c)-tanh(d))/sqrt(1/(2m-2)+1/(2n-2)), where c and d are coherence estimates from 2m and 2n samples respectively. When the number of samples is large, then under the null hypothesis of equal population coherence, z is distributed as N(0,1) for a stationary stochastic process. By applying the two sample Jackknife procedure to z, we derive expressions for the mean and variance of z, and declare the coherences to be equal if the Jackknife estimates are consistent with N(0,1). Interestingly, strong inconsistency between the Jackknife and the normal estimates is therefore diagnostic for the presence of non-Gaussian behavior. A similar analysis is also derived for two sample spectra. Finally, we provide application of these methods to experimental data. Support Contributed By: R01 MH62528-03, Cold Spring Harbor Laboratory Citation:H.S. Bokil, K. Purpura, D. Thomson, P.P. Mitra. COMPARING SPECTRA AND COHERENCES FOR SAMPLES OF UNEQUAL SIZE Program No. 689.22. 2005 Abstract Viewer/Itinerary Planner. Washington, DC: Society for Neuroscience, 2005. Online. 2005 Copyright by the Society for Neuroscience all rights reserved. Permission to republish any abstract or part of any abstract in any form must be obtained in writing from the SfN office prior to publication -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Pascal Fries Sent: Monday, February 27, 2006 6:57 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Activation vs. baseline Hi Tom, > Pascal Fries wrote: > > OK. I had been asking, because coherence (and also power) > have a bias > > that is sample size dependent. For those measures, particularly for > > coherence, I would suggest to use equal sample sizes. > > Correct me if I am wrong, but this bias is due to the slow > convergence of the covariance; with more samples, the > covariance converges more (assuming it converges at all). > Furthermore it probably converges 'up', so if you have more > samples, you'll see (apparently) more power. I still haven't fully understood the sample size bias of power. For coherence, the issue is simple to understand. As you write, it has to do with the slow convergence towards the true value as the sample increases. But in the coherence case, values will converge "down" towards the true value, not 'up'. For one trial, coherence is numerically always one and will then decrease as you add more trials. In the case of a true coherence of one, it will not decrease and in the case of a true coherence zero, it will rapidly decrease. This is one of the most important things on the agenda for the basic spectral analysis in FieldTrip: To get a good estimate of the coherence bias and subtract it. Until this is finalized, the safest approach is to trim datasets before comparison to equal size. > I have sometimes dealt with this problem in the past by > simply z-scoring the volumes afterwards, thus shifting the > means back to zero. But perhaps there are skewness issues as > well? I've mostly done that when playing around with things > like overlapping windows; for example, using an active window > of 0 to 300 ms and a control window of 0 to 250 ms, you > expect a slightly higher power in the active state because of > the increase convergence, but then normalizing that spatially > can give you an estimate of active areas for that 250-300 ms > window. There may also be problematic beamformer overlap in > this case, though, but that can be dealt with too. Just a thought. I agree: If sample sizes are not orders of magnitude different, then a z-transformation can take care of most of the bias. Best, Pascal From Daniel.Jokisch at FCDONDERS.RU.NL Mon Feb 27 18:35:18 2006 From: Daniel.Jokisch at FCDONDERS.RU.NL (Daniel Jokisch) Date: Mon, 27 Feb 2006 18:35:18 +0100 Subject: Bug in multiplotTFR? Message-ID: Hi, after analyzing my MEG-data with freqanalysis I wanted to plot the data with multiplotTFR. It does not work and I get the following error message: ??? Reference to non-existent field 'zparam'. Error in ==> multiplotTFR at 123 if (strcmp(cfg.zparam,'cohspctrm')) & (~isfield(data, 'labelcmb')) I have used exactly the same parameters as last time (before the change in Fieltrip). When I define zparam in the configuration, I get the following error message: ??? Error using ==> freqbaseline unsupported data dimensions, dimord should be "chan_freq_time" Error in ==> multiplotTFR at 139 data = freqbaseline(cfg, data); I guess there is a bug in the new version of multiplotTFR. Best, Daniel -- Daniel Jokisch, PhD F.C. Donders Centre for Cognitive Neuroimaging P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Phone: +31 24 36 68294 Fax : +31 24 36 10989 http://www.ru.nl/fcdonders/ From r.oostenveld at FCDONDERS.RU.NL Mon Feb 27 20:50:58 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Feb 2006 20:50:58 +0100 Subject: new plotting functionality Message-ID: Dear all, Dennis has implemented new plotting functions, they have been committed to CVS this afternoon. The most important difference is that of adding the option cfg.interactive='yes' or 'no' (default) If you specify interactive-yes, you can make a selection, click on it, and that selection will be plotted in a new figure. I.e. if you start with a topoplotTFR, you can make a selection of channels, and the average TFR of that channels will be plotted in the next figure as a singleplotTFR. If you select a time-frequency window in that singgleplotTFR, that selection will be plotted in a topoplotTFR. A similar selection is possible in multiplotTFR, and the same interactive sequence of plotting is possible for topo/multi/ singleplotER. In case of 3D (TFR) data, the default xparam is 'time', the yparam is 'freq' and the zparam is powspctrm or cohspctrm. In case of 2D data (event-related field or power spectra), the xparam is either 'time' or 'freq', and the zparam is 'avg' or 'powspctrm'. Please read the documentation of each of the functions for the new options. best regards, Robert & Dennis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From r.oostenveld at FCDONDERS.RU.NL Thu Feb 2 16:55:36 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 2 Feb 2006 16:55:36 +0100 Subject: dft filtering for 50Hz In-Reply-To: <000101c62808$cf668650$90514484@dellgx240> Message-ID: Hi Vladimir, On 2-feb-2006, at 15:56, Vladimir Litvak wrote: > I think I already asked you this once but I couldn't find your > answer in my > archives. In the Science paper and in the recent J. Neurosci. Paper > of Bauer > et al. you mention the method for removing line noise with DFT. Is it > implemented in FT? C yes. in preprocessing with cfg.dftfilter=yes, optionally cfg.dftfreq (default is [50 100 150]), and what we do is cfg.padding=10 to pad the data up to 10 seconds before subtracting the 50Hz sine wave. The padding ensures that we only filter out a narrow 1/10 Hz wide frequency bin. After sufficient mutitapering in the frequency domain, you won't notice the narrow 50Hz notch any more. If you don't filterpad, and e.g. have 0.5 s trials, you will put a wider 1/0.5=2Hz notch in your power spectrum. > an this just be done 'blindly' as the first step in > preprocessing or are there any special considerations? I have some > data with > TMS artifacts (deltas) which come about once in 10 sec (but not > regularly). That is problematic. A delta peak contains all frequencies, hence it will add significantly to the 50Hz estimate. In case of a jump estimating the 50Hz component, and subsequently subtracting this estimate, the filter is very likely to *increase* the amount of 50Hz in the remainder of the trial. You can consider it as filter ringing: the DFT filter is an infinite-impuls response (IIR) filter. We occasionally have "jumping" squids in the MEG, which resembles a step function. We detect them with artifact_jump, and remove all data 10 seconds before, untill 10 seconds after the jump. > The part I'm interested in is not contaminated by these deltas but > do you > think that such a delta appearing in the 10 sec segment that you > use to > compute DFT can somehow lead to a wrong result? Yep, see above. If there are not many TMS deltas, you should remove the trials nearby. This is all implemented in FT with artifact_jump and rejectartifact. If you are going to use this, please fetch a recent version of FieldTrip from the ftp server, since I recently cleaned up that part of the code considerably. Robert From Marcel.Bastiaansen at FCDONDERS.RU.NL Thu Feb 2 17:01:39 2006 From: Marcel.Bastiaansen at FCDONDERS.RU.NL (Marcel Bastiaansen) Date: Thu, 2 Feb 2006 17:01:39 +0100 Subject: update: artifact detection In-Reply-To: <9AA693A5-1714-4BD6-87DD-BCFBBE717A06@fcdonders.ru.nl> Message-ID: Dear Robert, Thanks for updating the functions. They generally look much better now. I have a slight problem however. For certain types of analysis (e.g. multitaper) I need some data before and after the actual trials in my experiment (to allow tapers to shift into the data at the beginning of the trial, and out of the data at the end of the trial). Usually I cut my data so that these extra datapoints are part of the 'trial', but I don't check these extra datastretches for EOG artefacts (as they fall in the ITI they typically contain a lot of blinks). I used to do that by specifying a negative padding value in the artefact_eog function, but that is no longer possible. Hence, my question is, whether it would be possible to include the option of checking only a user-specified part of each trial for artefacts. Another thing is that it is not (yet?) possible to call the old artefact routines in the way you specified it in your message below (though it is possible to directly call the artefact_eog_old function). Best, Marcel Robert Oostenveld wrote: > Dear Fieldtrip users, > > I have updated the artifact detection functions (artiact_xxx, where > xxx=jump, eog and muscle). Each of these three functions was already > based on the same underlying idea, namely to filter and preprocess > the data, then z-transform the result, cummulate the z-values over > channels and finally look for z-values that are larger than the > cutoff level. To reflect this similarity, I have created a new > function: artifact_zvalue. Each of the artifact_jump, eog and muscle > functions now sets some default values and then calls > artifact_zvalue. That facilitates the maintenance and ensures that > all functions behave the same regarding graphical feedback. From now > on, you can also visually verify the trial definition and the > detected artifacts in rejectartifact, using cfg.artfctdef.feedback=yes. > > Most important for you to know is that: > 1) the new functions should be largely backward compatible. The > filtering and preprocessing computations were only marginally > changed, so the outcome should be almost the same. > 2) the padding has been better defined. I will also write an artifact > detection tutorial that explains these padding values better. > 3) the new artifact detections functions (for jump, eog and muscle) > now only will work on continuous and pseudo-continuous data. Jumps in > the data at the trial boundaries for non-continous data are not dealt > with and will mess up the result so --if you want to use them on > trial-based data-- you are responsible yourself for configuring the > padding options correctly. > 4) the old functions are still available, with the name > artifact_xxx_old (where xxx=jump, eog and muscle). If you want to use > them, you should specify cfg.artifact.type={'eog_old', ...} and call > the rejectartifact function. > > The idea (which I will describe in the upcoming "artifact tutorial") > is that you do not use cfg.rejectjump/muscle/eog=yes any more in the > preprocessing cfg structure, but that you do the following steps > seperately: > cfg = something to start with... > cfg = definetrial(cfg) > cfg = artifact_eog(cfg) > cfg = artifact_eog(cfg) > cfg = artifact_jump(cfg) > cfg = artifact_muscle(cfg) > cfg = rejectartifact(cfg) > data = preprocessing(cfg) > > The fieldtrip version on home/common (inside the FCDC) will be > updated this afternoon. The fieldtrip version on the ftp server > (outside the FCDC) will be updated this evening. > > Since it is a large change in the fieldtrip code, bugs might have > crept in. Please be extra cautious the upcoming time and report > unusual behaviour. Sorry for the inconvenience that this may result in. > > best regards, > Robert > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Robert Oostenveld, PhD > F.C. Donders Centre for Cognitive Neuroimaging > Radboud University Nijmegen > phone: +31-24-3619695 > http://www.ru.nl/fcdonders/ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > -- dr. Marcel C.M. Bastiaansen. FC Donders Centre for Cognitive Neuroimaging Visiting address: Kapittelweg 29, 6525 EN Nijmegen, the Netherlands Mailing address: Trigon 181, PO Box 9101, 6500 HB Nijmegen, the Netherlands phone: + 31 24 3610 882 fax: + 31 24 3610 989 mail: marcel.bastiaansen at fcdonders.ru.nl web: http://www.ru.nl/aspx/get.aspx?xdl=/views/run/xdl/page&ItmIdt=20592&SitIdt=119&VarIdt=96 -- From r.oostenveld at FCDONDERS.RU.NL Thu Feb 2 18:12:41 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 2 Feb 2006 18:12:41 +0100 Subject: update: artifact detection In-Reply-To: <43E22CE3.6060403@fcdonders.ru.nl> Message-ID: Hi Marcel On 2-feb-2006, at 17:01, Marcel Bastiaansen wrote: > Thanks for updating the functions. They generally look much better > now. > I have a slight problem however. For certain types of analysis (e.g. > multitaper) I need some data before and after the actual trials in my > experiment (to allow tapers to shift into the data at the beginning of > the trial, and out of the data at the end of the trial). Usually I cut > my data so that these extra datapoints are part of the 'trial', but I > don't check these extra datastretches for EOG artefacts (as they > fall in > the ITI they typically contain a lot of blinks). That means that the eventual eye artifacts might be smeared (due to the wavelet length, or the equivalent multitaper mechanism) into later timepoints. I guess that yu are aware of that, and I assume that that is not a problem. > I used to do that by > specifying a negative padding value in the artefact_eog function, but > that is no longer possible. Hence, my question is, whether it would be > possible to include the option of checking only a user-specified > part of > each trial for artefacts. The usual sequence of functions needed to get raw data from disk into matlab memory is definetrial -> rejectartifact -> preprocessing However, rejectartifact can (for you as end user) also be split up into seperate parts. The first part is detecting artifacts, the second part is deciding what to do with them. Artifact detection is implemented in the artifact_xxx functions (with xxx=eog//muscle/jump etc). The sequence then becomes definetrial -> artifact_eog -> rejectartifact -> preprocessing Artifact detection is only done on selected parts of the data. The part of the data where it searches for artifacts usually is the part that you later want to read in (using the preprocessing function), or sometimes with some extra time before and after each trial. Whether it is desirable to have this padding depends on your experimental question and type of data. The additional amount of time before and after each trial to look for artifacts is specified using the "trlpadding" option. However, you can also do it manually: cfg = [] cfg = ... cfg = definetrial(cfg); trlorg = cfg.trl; % <<<< make a copy of the original cfg.trl(:,1) = cfg.trl(:,1) - number_of_samples_pre cfg.trl(:,2) = cfg.trl(:,2) + number_of_samples_post cfg = artifact_eog(cfg); cfg.trl = trlorg; % <<<< put the original back cfg = rejectartifact(cfg); data = preprocessing(cfg); This also allows you to specify a negative amount of padding before and after each trial, i.e. if you do *not* want to look for artifacts in the first xxx ms. I suggest that for the moment you use this manual option. I might implement the pre and post padding seperately and add support for the negative padding, but don't hold your breath for it. > Another thing is that it is not (yet?) possible to call the old > artefact > routines in the way you specified it in your message below (though > it is > possible to directly call the artefact_eog_old function). Thanks, I will look into that. I don't immediately see a reason why it should not work, so that might indicate a bug. best Robert From jhouck at UNM.EDU Thu Feb 2 20:29:55 2006 From: jhouck at UNM.EDU (Jon Houck) Date: Thu, 2 Feb 2006 12:29:55 -0700 Subject: Errors with Neuromag 306 raw data Message-ID: Hello, I encountered a few problems in preprocessing using the latest fieldtrip version (fieldtrip-20060131) with raw Neuromag 306 channel data. Following are the error messages and the changes that seemed to clear them up. The first error was: ??? Undefined function or variable 'iscontinuous'. Error in ==> fieldtrip-20060131\private\trialfun_neuromag at 13 trigger = read_fcdc_data(cfg.datafile, hdr, 1, nsamples, chanindx, iscontinuous); Error in ==> definetrial at 151 trl = feval(cfg.trialfun, cfg); Error in ==> preprocessing at 270 [cfg] = definetrial(cfg); To work around this, I edited fieldtrip-20060131/private/trialfun_neuromag.m to replace iscontinuous on line 13 with 1. The edited line reads "trigger = read_fcdc_data(cfg.datafile, hdr, 1, nsamples, chanindx, 1);" And the second was: ??? Subscripted assignment dimension mismatch. Error in ==> read_fcdc_data at 392 dat(:,((i-begepoch)*hdr.nSamples+1):((i-begepoch+1)*hdr.nSamples)) = buf(:,chanindx)'; Error in ==> fieldtrip-20060131\private\trialfun_neuromag at 13 trigger = read_fcdc_data(cfg.datafile, hdr, 1, nsamples, chanindx, 1); Error in ==> definetrial at 151 trl = feval(cfg.trialfun, cfg); Error in ==> preprocessing at 270 [cfg] = definetrial(cfg); To fix this one, I edited fieldtrip-20060131/read_fcdc_data.m to replace buf(:,chanindx)' on line 392 with buf(chandindx,:). The edited line reads "dat(:,((i-begepoch)*hdr.nSamples+1):((i-begepoch+1)*hdr.nSamples)) = buf(chanindx,:);" These changes seem to work well on Matlab 7.1(R14) service pack 3 on Windows XP and Matlab 6.5 (R13) on HP-UX 10.20. If there are better workarounds or (equally likely) if I've irreparably broken something, please let me know. Regards, Jon Houck -------------------------------------------------- Jon Houck, M.A. Department of Psychology MSC03 2220 University of New Mexico Albuquerque, NM 87131 Office: (505) 277-0607 Lab: (505) 277-4725 Fax: (505) 277-1394 CASAA: (505) 925-2381 From r.oostenveld at FCDONDERS.RU.NL Thu Feb 2 21:58:51 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 2 Feb 2006 21:58:51 +0100 Subject: Errors with Neuromag 306 raw data In-Reply-To: Message-ID: Hi Jon On 2-feb-2006, at 20:29, Jon Houck wrote: > The first error was: ??? Undefined function or variable > 'iscontinuous'. > ... > To work around this, I edited fieldtrip-20060131/private/ > trialfun_neuromag.m to replace iscontinuous on line 13 with 1. The > edited line reads "trigger = read_fcdc_data(cfg.datafile, hdr, 1, > nsamples, chanindx, 1);" I think that fif files are continuous by default, but I am not sure. It matters for filtering and artifact detection, since reading over a discontinuous trial boundary would result in a weird jump in the signal. The iscontinuous flag in read_fcdc_data() indicates whether it should check if the desired data segments extend over trial boundaries. By default, the check is decided based on the data (if hdr.nTrials==1 then don't check, otherwise do check). It could be that the files are stored in blocks, like the ctf pseudocontinuous format. For that case, i.e. the data specifies that it is epoched, but the epochs form a continuous signal, I have implemented the flag cfg.datatype='continuous'. So I suggest to change line 13 to the following snippet if ~isfield(cfg, 'datatype') || ~strcmp(cfg.datatype, 'continuous') % datatype is unknown or not continuous, perform epoch boundary check iscontinuous = 0; else % do not perform epoch boundary check, usefull for pseudo- continuous data iscontinuous = strcmp(cfg.datatype, 'continuous'); end read_fcdc_data(cfg.datafile, hdr, 1, nsamples, chanindx, iscontinuous); That ensures decent (=safe) epoch boundary checking if the file specifies that it is epoched, and it allows you to pass the cfg.datatype=continuous option in case you know for sure that the data can be interpreted as continuous. I will change the code to include the segment that I gave above. > And the second was: ??? Subscripted assignment dimension mismatch. > > Error in ==> read_fcdc_data at 392 > dat(:,((i-begepoch)*hdr.nSamples+1):((i-begepoch+1) > *hdr.nSamples)) = buf(:,chanindx)'; > ... > To fix this one, I edited fieldtrip-20060131/read_fcdc_data.m to > replace buf(:,chanindx)' on line 392 with buf(chandindx,:). The > edited line reads "dat(:,((i-begepoch)*hdr.nSamples+1):((i-begepoch > +1)*hdr.nSamples)) = buf(chanindx,:);" You're right, the buf matrix should not be transposed. I'll fix that in the next release code as well. > These changes seem to work well on Matlab 7.1(R14) service pack 3 > on Windows XP and Matlab 6.5 (R13) on HP-UX 10.20. If there are > better workarounds or (equally likely) if I've irreparably broken > something, please let me know. Regarding the first bug that you reported, but seperate of that bug: I suggest to use trialfun_general, instead of trialfun_neuromag. The trialfun_neuromag is only for backward compatibility with the initial code, and the trialfun_general is used by default if you use in definetrial the following % cfg.trialdef.eventtype = 'string' % cfg.trialdef.eventvalue = number, string or list with numbers or strings % cfg.trialdef.prestim = 0.300 latency in seconds (optional) % cfg.trialdef.poststim = 0.700 latency in seconds (optional) alternatively, you can use % cfg.trialdef.eventtype = '?' That uses the read_fcdc_event function, which makes your (and our) code much more portable to other fileformats and allows more complex trigger sequences. Please read the read_fcdc_event help and code if you want to know more. Thanks for your contribution. best, Robert From luis.patino at UNIKLINIK-FREIBURG.DE Fri Feb 3 08:44:53 2006 From: luis.patino at UNIKLINIK-FREIBURG.DE (Dr. Jose Luis Patino Vilchis) Date: Fri, 3 Feb 2006 08:44:53 +0100 Subject: update: artifact detection In-Reply-To: <43E22CE3.6060403@fcdonders.ru.nl> Message-ID: Dear Robert, Is it there a paper explaining how the muscle artifact rejection is done? best regards Luis Patino Zitat von Marcel Bastiaansen : > Dear Robert, > > Thanks for updating the functions. They generally look much better now. > I have a slight problem however. For certain types of analysis (e.g. > multitaper) I need some data before and after the actual trials in my > experiment (to allow tapers to shift into the data at the beginning of > the trial, and out of the data at the end of the trial). Usually I cut > my data so that these extra datapoints are part of the 'trial', but I > don't check these extra datastretches for EOG artefacts (as they fall in > the ITI they typically contain a lot of blinks). I used to do that by > specifying a negative padding value in the artefact_eog function, but > that is no longer possible. Hence, my question is, whether it would be > possible to include the option of checking only a user-specified part of > each trial for artefacts. > Another thing is that it is not (yet?) possible to call the old artefact > routines in the way you specified it in your message below (though it is > possible to directly call the artefact_eog_old function). > > Best, > Marcel > > > Robert Oostenveld wrote: > > > Dear Fieldtrip users, > > > > I have updated the artifact detection functions (artiact_xxx, where > > xxx=jump, eog and muscle). Each of these three functions was already > > based on the same underlying idea, namely to filter and preprocess > > the data, then z-transform the result, cummulate the z-values over > > channels and finally look for z-values that are larger than the > > cutoff level. To reflect this similarity, I have created a new > > function: artifact_zvalue. Each of the artifact_jump, eog and muscle > > functions now sets some default values and then calls > > artifact_zvalue. That facilitates the maintenance and ensures that > > all functions behave the same regarding graphical feedback. From now > > on, you can also visually verify the trial definition and the > > detected artifacts in rejectartifact, using cfg.artfctdef.feedback=yes. > > > > Most important for you to know is that: > > 1) the new functions should be largely backward compatible. The > > filtering and preprocessing computations were only marginally > > changed, so the outcome should be almost the same. > > 2) the padding has been better defined. I will also write an artifact > > detection tutorial that explains these padding values better. > > 3) the new artifact detections functions (for jump, eog and muscle) > > now only will work on continuous and pseudo-continuous data. Jumps in > > the data at the trial boundaries for non-continous data are not dealt > > with and will mess up the result so --if you want to use them on > > trial-based data-- you are responsible yourself for configuring the > > padding options correctly. > > 4) the old functions are still available, with the name > > artifact_xxx_old (where xxx=jump, eog and muscle). If you want to use > > them, you should specify cfg.artifact.type={'eog_old', ...} and call > > the rejectartifact function. > > > > The idea (which I will describe in the upcoming "artifact tutorial") > > is that you do not use cfg.rejectjump/muscle/eog=yes any more in the > > preprocessing cfg structure, but that you do the following steps > > seperately: > > cfg = something to start with... > > cfg = definetrial(cfg) > > cfg = artifact_eog(cfg) > > cfg = artifact_eog(cfg) > > cfg = artifact_jump(cfg) > > cfg = artifact_muscle(cfg) > > cfg = rejectartifact(cfg) > > data = preprocessing(cfg) > > > > The fieldtrip version on home/common (inside the FCDC) will be > > updated this afternoon. The fieldtrip version on the ftp server > > (outside the FCDC) will be updated this evening. > > > > Since it is a large change in the fieldtrip code, bugs might have > > crept in. Please be extra cautious the upcoming time and report > > unusual behaviour. Sorry for the inconvenience that this may result in. > > > > best regards, > > Robert > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Robert Oostenveld, PhD > > F.C. Donders Centre for Cognitive Neuroimaging > > Radboud University Nijmegen > > phone: +31-24-3619695 > > http://www.ru.nl/fcdonders/ > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > -- > dr. Marcel C.M. Bastiaansen. > FC Donders Centre for Cognitive Neuroimaging > Visiting address: Kapittelweg 29, 6525 EN Nijmegen, the Netherlands > Mailing address: Trigon 181, PO Box 9101, 6500 HB Nijmegen, the Netherlands > phone: + 31 24 3610 882 > fax: + 31 24 3610 989 > mail: marcel.bastiaansen at fcdonders.ru.nl > web: > http://www.ru.nl/aspx/get.aspx?xdl=/views/run/xdl/page&ItmIdt=20592&SitIdt=119&VarIdt=96 > -- > > From georges.otte at PANDORA.BE Fri Feb 3 09:41:01 2006 From: georges.otte at PANDORA.BE (georges Otte) Date: Fri, 3 Feb 2006 09:41:01 +0100 Subject: update: artifact detection In-Reply-To: <1138952693.43e309f5b072f@webmail1.uniklinik-freiburg.de> Message-ID: Hi, I saw some paper from a group in Leuven eliminating EMG artefact based on the canonical component analysis (another Blind Source method). Google it with CCA- EEG. It worked very fast. I think that ANT compagny is looking into porting this into their standard software. The method is based on the difference in aotocorellation between EEG and EMG signals. Hope this helps, Georges ------------------------------------ Neurologpsychiatrie EEG-EMG Otte Georges Dr. georges.otte at pandora.be Bijlokehof 24 9000 Gent tel: 09 329 06 62 fax: 09 282 26 72 mobile: 0478 205 202 ------------------------------------ > -----Original Message----- > From: FieldTrip discussion list > [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Dr. Jose Luis > Patino Vilchis > Sent: vrijdag 3 februari 2006 8:45 > To: FIELDTRIP at NIC.SURFNET.NL > Subject: Re: [FIELDTRIP] update: artifact detection > > > Dear Robert, > > Is it there a paper explaining how the muscle artifact > rejection is done? > > best regards > > Luis Patino > > > Zitat von Marcel Bastiaansen : > > > Dear Robert, > > > > Thanks for updating the functions. They generally look much better > > now. I have a slight problem however. For certain types of analysis > > (e.g. > > multitaper) I need some data before and after the actual > trials in my > > experiment (to allow tapers to shift into the data at the > beginning of > > the trial, and out of the data at the end of the trial). > Usually I cut > > my data so that these extra datapoints are part of the > 'trial', but I > > don't check these extra datastretches for EOG artefacts (as > they fall in > > the ITI they typically contain a lot of blinks). I used to > do that by > > specifying a negative padding value in the artefact_eog > function, but > > that is no longer possible. Hence, my question is, whether > it would be > > possible to include the option of checking only a > user-specified part of > > each trial for artefacts. > > Another thing is that it is not (yet?) possible to call the > old artefact > > routines in the way you specified it in your message below > (though it is > > possible to directly call the artefact_eog_old function). > > > > Best, > > Marcel > > > > > > Robert Oostenveld wrote: > > > > > Dear Fieldtrip users, > > > > > > I have updated the artifact detection functions > (artiact_xxx, where > > > xxx=jump, eog and muscle). Each of these three functions > was already > > > based on the same underlying idea, namely to filter and > preprocess > > > the data, then z-transform the result, cummulate the > z-values over > > > channels and finally look for z-values that are larger than the > > > cutoff level. To reflect this similarity, I have created a new > > > function: artifact_zvalue. Each of the artifact_jump, eog > and muscle > > > functions now sets some default values and then calls > > > artifact_zvalue. That facilitates the maintenance and > ensures that > > > all functions behave the same regarding graphical > feedback. From now > > > on, you can also visually verify the trial definition and the > > > detected artifacts in rejectartifact, using > cfg.artfctdef.feedback=yes. > > > > > > Most important for you to know is that: > > > 1) the new functions should be largely backward compatible. The > > > filtering and preprocessing computations were only marginally > > > changed, so the outcome should be almost the same. > > > 2) the padding has been better defined. I will also write > an artifact > > > detection tutorial that explains these padding values better. > > > 3) the new artifact detections functions (for jump, eog > and muscle) > > > now only will work on continuous and pseudo-continuous > data. Jumps in > > > the data at the trial boundaries for non-continous data > are not dealt > > > with and will mess up the result so --if you want to use them on > > > trial-based data-- you are responsible yourself for > configuring the > > > padding options correctly. > > > 4) the old functions are still available, with the name > > > artifact_xxx_old (where xxx=jump, eog and muscle). If you > want to use > > > them, you should specify cfg.artifact.type={'eog_old', > ...} and call > > > the rejectartifact function. > > > > > > The idea (which I will describe in the upcoming "artifact > tutorial") > > > is that you do not use cfg.rejectjump/muscle/eog=yes any > more in the > > > preprocessing cfg structure, but that you do the following steps > > > seperately: > > > cfg = something to start with... > > > cfg = definetrial(cfg) > > > cfg = artifact_eog(cfg) > > > cfg = artifact_eog(cfg) > > > cfg = artifact_jump(cfg) > > > cfg = artifact_muscle(cfg) > > > cfg = rejectartifact(cfg) > > > data = preprocessing(cfg) > > > > > > The fieldtrip version on home/common (inside the FCDC) will be > > > updated this afternoon. The fieldtrip version on the ftp server > > > (outside the FCDC) will be updated this evening. > > > > > > Since it is a large change in the fieldtrip code, bugs might have > > > crept in. Please be extra cautious the upcoming time and report > > > unusual behaviour. Sorry for the inconvenience that this > may result in. > > > > > > best regards, > > > Robert > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > Robert Oostenveld, PhD > > > F.C. Donders Centre for Cognitive Neuroimaging > > > Radboud University Nijmegen > > > phone: +31-24-3619695 > > > http://www.ru.nl/fcdonders/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > > -- > > dr. Marcel C.M. Bastiaansen. > > FC Donders Centre for Cognitive Neuroimaging > > Visiting address: Kapittelweg 29, 6525 EN Nijmegen, the Netherlands > > Mailing address: Trigon 181, PO Box 9101, 6500 HB Nijmegen, > the Netherlands > > phone: + 31 24 3610 882 > > fax: + 31 24 3610 989 > > mail: marcel.bastiaansen at fcdonders.ru.nl > > web: > > > http://www.ru.nl/aspx/get.aspx?xdl=/views/run/xdl/page&ItmIdt= > 20592&SitIdt=119&VarIdt=96 > > -- > > > > > > From lauri at NEURO.HUT.FI Fri Feb 3 11:45:49 2006 From: lauri at NEURO.HUT.FI (Lauri Parkkonen) Date: Fri, 3 Feb 2006 12:45:49 +0200 Subject: Errors with Neuromag 306 raw data In-Reply-To: <5BC129DE-7F2D-4D29-A749-03F47B3B4EDC@fcdonders.ru.nl> Message-ID: Hello Robert and Jon >> The first error was: ??? Undefined function or variable 'iscontinuous'. >> ... >> To work around this, I edited fieldtrip-20060131/private/ >> trialfun_neuromag.m to replace iscontinuous on line 13 with 1. The >> edited line reads "trigger = read_fcdc_data(cfg.datafile, hdr, 1, >> nsamples, chanindx, 1);" > > > I think that fif files are continuous by default, but I am not sure. > It matters for filtering and artifact detection, since reading over a > discontinuous trial boundary would result in a weird jump in the signal. Yes, the "raw data" fif files are continuous over trials, i.e., there is no "epoch mode", however, one fif file can hold several data segments. For example, two different experimental conditions can be recorded in the same file as separate segments; the boundary between the segments is of course a discontinuity. The MEX function "rawdata" returns the string 'skip' as status when a segment boundary is encountered in a fif file. I have added some more checking to read_fcdc_data so that these boundaries are not silently ignored. Robert: I could incorporate my changes to your most recent version since my read_fcdc_data is very old. With the best regards, Lauri -- ----------------------------------------------- Lauri Parkkonen Brain Research Unit, Low Temperature Laboratory Helsinki University of Technology Otakaari 3 A, 02150 ESPOO, FINLAND tel: +358-9-4512965 fax: +358-9-4512969 mailto:lauri at neuro.hut.fi http://boojum.hut.fi From r.oostenveld at FCDONDERS.RU.NL Fri Feb 3 12:44:40 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 3 Feb 2006 12:44:40 +0100 Subject: Errors with Neuromag 306 raw data In-Reply-To: <43E3345D.3090602@neuro.hut.fi> Message-ID: Hi Lauri On 3-feb-2006, at 11:45, Lauri Parkkonen wrote: > Yes, the "raw data" fif files are continuous over trials, i.e., > there is no "epoch mode", however, one fif file can hold several > data segments. For example, two different experimental conditions > can be recorded in the same file as separate segments; the boundary > between the segments is of course a discontinuity. The MEX function > "rawdata" returns the string 'skip' as status when a segment > boundary is encountered in a fif file. I have added some more > checking to read_fcdc_data so that these boundaries are not > silently ignored. > > Robert: I could incorporate my changes to your most recent version > since my read_fcdc_data is very old. Thanks, I would appreciate that very much. Please fetch the latest version of the read_fcdc_data function from ftp://ftp.fcdonders.nl/ pub/fieldtrip. If you change that one, it is easy for me to update the official version. best, Robert From tolgacan1 at YAHOO.COM Sat Feb 4 21:47:18 2006 From: tolgacan1 at YAHOO.COM (Tolga Ozkurt) Date: Sat, 4 Feb 2006 21:47:18 +0100 Subject: neuromag data and lead fields for sensors Message-ID: Hello all, I have just downloaded Fieldtrip and trying use it with data collected from Neuromag 306 Vectorview system. When I used the version of fieldtrip- 20060131; I had some problems even with reading data and I had to make some minor changes in the code mentioned in the pervious post of the list. The main problem of me is how to compute the lead field with Neuromag data? The fieldtrip gives me orientation values which are exactly same for the same coil. Haw can I exploit these orientation of the sensors for two planar gradiometers and one magneteometer for each coil? I will appreciate, if you could help. Thanks. Tolga Esat Ozkurt From r.oostenveld at FCDONDERS.RU.NL Sun Feb 5 13:16:31 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Sun, 5 Feb 2006 13:16:31 +0100 Subject: update: artifact detection In-Reply-To: <1138952693.43e309f5b072f@webmail1.uniklinik-freiburg.de> Message-ID: Dear Luis, No, we have not described it in much detail in our publications, we only mention that it is a semi-automatic procedure. The approach is the following: we bandpass filter the data in the frequency band where the artifact is most pronounced, then we hilbert transform (i.e. compute the signal amplitude envelope, which is comparable to rectifying and smoothing). This is done per channel. For each signal obtained like this, we z-transform it, i.e. subtract the mean and divide by the standard deviation (over time). Then we sum all z-values and divide by the square root of the number of channels that goes into the sum. This results in a single pseudo- signal that is sensitive to the artifact that we want to detect. We then threshold this pseudo siugnal. After thresholding, we use visual feedback of the original data to check that the desired artifacts are really detected using the filtering and thhesholding options. In the feedback, the original unfiltered data of that channel is shown which contributed the most to the z-value (i.e. the channel that is the most artifact-like). We are reasonably happy with the performance of this approach on MEG and on EOG data, it allows us to do it reasonably objective and it saves a lot of time browsing through the 151 channels of our MEG. Recently we recorded a small MEG dataset with a lot of artifacts on purpose. I am working on writing a tutorial on the artifact detection using that dataset, which will then also be made available on the ftp server. Robert On 3-feb-2006, at 8:44, Dr. Jose Luis Patino Vilchis wrote: > Dear Robert, > > Is it there a paper explaining how the muscle artifact rejection is > done? > > best regards > > Luis Patino > From r.oostenveld at FCDONDERS.RU.NL Sun Feb 5 13:30:17 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Sun, 5 Feb 2006 13:30:17 +0100 Subject: update: artifact detection In-Reply-To: <03b801c6289d$95046eb0$0400a8c0@georges> Message-ID: Dear Georges, On 3-feb-2006, at 9:41, georges Otte wrote: > I saw some paper from a group in Leuven eliminating EMG artefact based > on the canonical component analysis (another Blind Source method). > Google it with CCA- EEG. It worked very fast. I think that ANT > compagny > is looking into porting this into their standard software. The > method is > based on the difference in aotocorellation between EEG and EMG > signals. We have implemented that algorithm in Fieldtrip, in the componentanalysis function (cfg.method=cca). I am not sure whether it is compleetly in the ftp release version of fieldtrip. We did try it out on our MEG data. It performed rather poor on our MEG data, the obvious EMG artifacts in the lower temporal channels were not very well separates into seperate components to be removed from the data. I suspect the reason for it performing rather poor on the MEG data is that it is based on 1-sample lag autocorrelation. The seperation (linear unmixing) using autocorrelation seperates the signal into high frequency components and low frequency components. But our MEG data has a much higher sampling rate (usually 1200Hz), and contains noise components at a much higher frequency than the EMG artifacts. It may work for clinical EEG data for which the Leuven group develloped the algorithm, since that is sampled at typically 250 Hz, which means that the EMG does correspond to the high frequency part of the data. It may be possible to tweak the algorithm (e.g. use N- lag autocorrelation) and to use differently preprocessed (filtered and downsampled) data to improve the performance, but we have not pursued that. Furthermore, we have not tested it on EEG data, so I cannot judge how it performs there. best Robert From r.oostenveld at FCDONDERS.RU.NL Sun Feb 5 13:55:02 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Sun, 5 Feb 2006 13:55:02 +0100 Subject: neuromag data and lead fields for sensors In-Reply-To: Message-ID: Dear Tolga, On 4-feb-2006, at 21:47, Tolga Ozkurt wrote: > Hello all, > I have just downloaded Fieldtrip and trying use it with data collected > from Neuromag 306 Vectorview system. When I used the version of > fieldtrip- > 20060131; I had some problems even with reading data and I had to make > some minor changes in the code mentioned in the pervious post of > the list. > The main problem of me is how to compute the lead field with Neuromag > data? The fieldtrip gives me orientation values which are exactly > same for > the same coil. Haw can I exploit these orientation of the sensors > for two > planar gradiometers and one magneteometer for each coil? I will > appreciate, if you could help. Thanks. Let me first explain the headmodels. Fieldtrip supports different forward models for MEG. The ones that we use the most are based on the multisphere model, i.e. each channel has it's own sphere. We construct the multisphere models by fitting the spheres to the head surface. That is done using CTF software, and the result is stored in a *.hdm file. Since recently we do have a fieldtrip function which can replace the CTF software, and which allows fitting the spheres to the brain surface instead of to the head surface. That function (prepare_localspheres) is not yet in the release version, if you are interested in beta testing, I can send it to you. Fieldtrip also supports single sphere models. Those can also be read from CTF *.hdm file, but are also easy to specify on the command line, e.g. cfg.vol.r = 12; cfg.vol.o = [0 0 5]; specifies a 12cm sphere with its origin in [0 0 5] (relative to the head coordinate system). Finally, fieldtrip also supports the use of the BEM head models that can be constructed in the Neuromag software. That requires the mex files which are released by Neuromag to their customers (I think in the pd-calc toolbox), specifically the mex file "megfield" is required. This code has been contributed by Joachim Gross, and he tested it for the 122 channel Neuromag system. [* see below] I suggest that for the moment, you try to get the single sphere model to work, since that is the easiest. Now the gradiometer array: It indeed has the position (grad.pnt) of each coil and the orientation (grad.ori) of each coil. But furthermore, it has the field grad.tra, which combines the field at the two coils into one gradiometer-channel-output. I.e. if grad.pnt=302x3 (for our 151 channel CTF), then grad.tra is 151x302. Multiplying the leadfield on the 302 coils with the 151x302 matrix results in the 151 channel leadfield that we need. The grad.tra is a very sparse matrix, consisting of the concatenation of identity matrices. That is where your question of the orientations relates to, i.e. If grad.tra = [eye(151) eye(151)], then the orientations of the two coils should be opposite, since the field at the two coils is added. If grad.tra = [eye(151) -eye(151)], then the orientations of the two coils should be the same, since the subtraction is coded in the minus sign. So the orientation can be coded either in the grad.ori, or in the grad.tra. I suspect that for the Neuromag, it is coded in the grad.tra matrix. I hope that this clarifies it. You should be able to use the prepare_leadfield() function to compute the leadfield at many grid locations at once. If you want to do more low-level computations yourself, you should use the private/compute_leadfield() function. I would appreciate it if you can report back whether it works, since sofar I don't fully know how well FieldTrip works on Neuromag data. In principle it should all work, and some people have used it wich success on their data, but I guess (as obvious from the previous mail) that there are still some small glitches that need to be fixed in the official version. So please share your findings with us, so that we can improve the support. best, Robert [*] I just checked, and it seems as this code is not in the current release version any more. I will build it back in. From georges.otte at PANDORA.BE Sun Feb 5 15:22:41 2006 From: georges.otte at PANDORA.BE (georges Otte) Date: Sun, 5 Feb 2006 15:22:41 +0100 Subject: update: artifact detection In-Reply-To: <6C531155-F4A3-45BF-A2D7-169629B4E3A6@fcdonders.ru.nl> Message-ID: I am working on writing a tutorial on the artifact > detection > using that dataset, which will then also be made available on > the ftp > server. > > Robert > This sounds very interesting as artefact removal is of uttermost importance in EEG also. It is interesting to note that differences in sample frequencies must indeed be kept in mind when applying certain algoritms. Please let us know when the tutorial will be ready. Sincerely, Georges Otte From georges.otte at PANDORA.BE Sun Feb 5 15:22:41 2006 From: georges.otte at PANDORA.BE (georges Otte) Date: Sun, 5 Feb 2006 15:22:41 +0100 Subject: update: artifact detection In-Reply-To: <9482A704-EAB9-4EDA-86B2-B656C08DC02F@fcdonders.ru.nl> Message-ID: Thanks Robert ! Georges Otte ------------------------------------ Neurologpsychiatrie EEG-EMG Otte Georges Dr. georges.otte at pandora.be Bijlokehof 24 9000 Gent tel: 09 329 06 62 fax: 09 282 26 72 mobile: 0478 205 202 ------------------------------------ > -----Original Message----- > From: FieldTrip discussion list > [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Robert Oostenveld > Sent: zondag 5 februari 2006 13:30 > To: FIELDTRIP at NIC.SURFNET.NL > Subject: Re: [FIELDTRIP] update: artifact detection > > > Dear Georges, > > On 3-feb-2006, at 9:41, georges Otte wrote: > > I saw some paper from a group in Leuven eliminating EMG > artefact based > > on the canonical component analysis (another Blind Source method). > > Google it with CCA- EEG. It worked very fast. I think that ANT > > compagny > > is looking into porting this into their standard software. The > > method is > > based on the difference in aotocorellation between EEG and EMG > > signals. > > We have implemented that algorithm in Fieldtrip, in the > componentanalysis function (cfg.method=cca). I am not sure > whether it > is compleetly in the ftp release version of fieldtrip. > > We did try it out on our MEG data. It performed rather poor on our > MEG data, the obvious EMG artifacts in the lower temporal channels > were not very well separates into seperate components to be removed > from the data. I suspect the reason for it performing rather poor on > the MEG data is that it is based on 1-sample lag > autocorrelation. The > seperation (linear unmixing) using autocorrelation seperates the > signal into high frequency components and low frequency components. > But our MEG data has a much higher sampling rate (usually 1200Hz), > and contains noise components at a much higher frequency than > the EMG > artifacts. > > It may work for clinical EEG data for which the Leuven group > develloped the algorithm, since that is sampled at typically 250 Hz, > which means that the EMG does correspond to the high frequency part > of the data. It may be possible to tweak the algorithm (e.g. use N- > lag autocorrelation) and to use differently preprocessed (filtered > and downsampled) data to improve the performance, but we have not > pursued that. Furthermore, we have not tested it on EEG data, so I > cannot judge how it performs there. > > best > Robert > > From kambiz.tavabi at UNI-MUENSTER.DE Mon Feb 6 12:22:24 2006 From: kambiz.tavabi at UNI-MUENSTER.DE (Kambiz Tavabi) Date: Mon, 6 Feb 2006 12:22:24 +0100 Subject: wavelet analysis In-Reply-To: <8C9FB8EC-56F7-46B3-BF43-F1D657AEF8B3@fcdonders.ru.nl> Message-ID: Hello, There does not seem to be a function/m-file waveletanaysis in the Jan. 21 2006 or few previous releases of FIELDTRIP. The following commands as per tutorials cfg = []; cfg.method = 'TFR'; cfg.foi = 15:30; cfg.channel = 'all'; cfg.keeptrials = 'no'; cfg.waveletwidth = 7; cfg.downsample = 4; TFRwave = waveletanalysis(cfg, dataFIC); save('TFR','TFRwave','-append'); Results in the output ??? Undefined command/function 'waveletanalysis'. Please advise, thank you. Kambiz From r.oostenveld at FCDONDERS.RU.NL Mon Feb 6 13:57:27 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 6 Feb 2006 13:57:27 +0100 Subject: wavelet analysis In-Reply-To: <000d01c62b0f$9a79b890$1423b080@KAMTRANSTEC> Message-ID: On 6-feb-2006, at 12:22, Kambiz Tavabi wrote: > Hello, > There does not seem to be a function/m-file waveletanaysis in the > Jan. 21 > 2006 or few previous releases of FIELDTRIP. > > The following commands as per tutorials > ... This has been moved to the general FREQANALYSIS function. You should call freqanalysis with the option cfg.method='tfr'. See "help freqanalysis" and "help freqanalysis_tfr". The 2005 version of the tutorial specifies it correctly, please use that instead of the 2004 version (see http://www2.ru.nl/fcdonders/ fieldtrip/tutorial.html) best regards, Robert From thomas.koelewijn at FCDONDERS.RU.NL Mon Feb 13 11:42:23 2006 From: thomas.koelewijn at FCDONDERS.RU.NL (Thomas Koelewijn) Date: Mon, 13 Feb 2006 11:42:23 +0100 Subject: No subject Message-ID: Dear all, I'm working with a old fieldtrip script in which I perform artefact rejection for both EOG channels separately. When I run the scrip for the second channel fieldtrip tells me that I already used EOG rejection and skips this part. Is there a trick to prevent this? Gr. Thomas From r.oostenveld at FCDONDERS.RU.NL Mon Feb 13 12:35:38 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 13 Feb 2006 12:35:38 +0100 Subject: dft filtering for 50Hz In-Reply-To: <000001c6308d$0cb183c0$90514484@dellgx240> Message-ID: Hi Vladimir > I looked at the data file and I see that in most trials there is a > TMS pulse > closer than 10 sec to the pulse I'm looking at. So I can't throw > out trials > where I don't get a clean 10 sec segment because then I'll throw > out most of > them. I think there are two options the simple one and the > complicated one: The method implemented in Fieldtrip to prevent filter atrifacts at the side of the trial, and also to get a very sharp (dft) line noise filter, is to pad the complete trial up to cfg.padding on *both* sides of the original trial. I.e. if you have a trial of 2 seconds, it will be padded with data for filtering with 4 seconds before and 4 seconds after the original trial. The padding segments are removed from the data imediately after the filtering has been done. Related to 50 or 60 Hz line noise filtering: the resulting notch is 1/ Tpadding, i.e. with 10 seconds the notch is 1/10 Hz, with 4 seconds it would be 1/4 Hz. I leave it up to you to decide whether that is much, it depends on the frequency and the amount of multi-taper smoothing that you can apply afterwards. If your data consists of short trials (e.g. 500ms), you would have a low frequency resolution anyway (1/0.5=2Hz). Besides using the default filter padding, you could also do it manually by modifying the cfg.trl trial definition. In your case I can imagine that you have plenty of time after the trial but not before (with the TMS pulse before each trial), so you can do cfg.trl (:,2) = cfg.trl(:,2)+N*Fsample and specify cfg.padding=0. Afterwards, you manually have to get rid of the additional data that has been glued at the end of each trial. > 1) The simple one is take 4 sec segments. In this case I can get > enough. The > question is whether it is better to pad them to 10 sec or less. You > say that > if I pad them to less I'll get a wider notch. The question is what > happens > if I pad too short a segment to 10 sec and how short is too short? If I were you, I would just give the 4 sec a try. You should not be too rigid about the 10 seconds, which is a good default for our own type of long-trial MEG experiments but which is impractically long for most other experiments. > 2) I can look at trials one by one, cut as long a segment as I can > before > the artifact and pad it if necessary to 10 sec. The question here > is whether > this will really improve things greatly. Also how do I implement it > - should > I read the data twice - first find the artifacts, rebuild the trl > structure > and then read again? Also can I use Fieldtrip artifact functions to > find the > artifacts? Yes you can, but I am not sure what the most sensitive way is of detecting the TMS artifacts. Look into the artifact_zvalue code and tweak the preprocessing options (see private/preproc) to make it sensitive to the TMS artifacts. Probbaly the settings used in artifact_muscle are already pretty close (except that you should not do the boxcar). Robert From r.oostenveld at FCDONDERS.RU.NL Mon Feb 13 12:56:40 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 13 Feb 2006 12:56:40 +0100 Subject: No subject In-Reply-To: <544b3ee4236ed.43f0709f@ru.nl> Message-ID: Hi Thomas On 13-feb-2006, at 11:42, Thomas Koelewijn wrote: > Dear all, > > I'm working with a old fieldtrip script in which I perform artefact > rejection for both EOG channels separately. When I run the scrip > for the second channel fieldtrip tells me that I already used EOG > rejection and skips this part. Is there a trick to prevent this? > > Gr. > Thomas You can erase the field cfg.artfctdef.eog after the first EOG detection. i.e. cfg = ... general settings ... cfg.artfctdef.eog = ... EOG1 settings ... cfg = artifact_eog(cfg); % detect EOG in channel 1 keepeog1 = cfg.artfctdef.eog; cfg.artfctdef.eog = []; cfg.artfctdef.eog = ... EOG2 settings ... cfg = artifact_eog(cfg); % detect EOG in channel 2 keepeog2 = cfg.artfctdef.eog; cfg.artfctdef.eog = []; Then you can concatenate the artifacts for EOG1 to those of EOG2 and reject them together: cfg.artfctdef.eog.artifact = [keepeog1.artifact; keepeog2.artifact]; % this is a Nx2 trl-like array without offset cfg = rejectartifact(cfg); I hope this works, Robert From kambiz.tavabi at UNI-MUENSTER.DE Fri Feb 17 10:05:05 2006 From: kambiz.tavabi at UNI-MUENSTER.DE (Kambiz Tavabi) Date: Fri, 17 Feb 2006 10:05:05 +0100 Subject: wavelet analysis In-Reply-To: Message-ID: Hello, According to the help text the command... [event] = read_fcdc_event('A0132_Aud-Obj-Recognition_20051115_02.ds') should provide all events from the dataset. In a similar fashion to read_fcdc_header which in fact works as or Jan. 31. However the call to read_fcdc_event results in the following error ??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 no channels were specified for reading CTF data Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); Error in ==> read_fcdc_event at 187 [backpanel, frontpanel] = read_ctf_trigger(filename); Please advise, thank you. Kambiz Tavabi From Jan.Schoffelen at FCDONDERS.RU.NL Fri Feb 17 10:18:06 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Fri, 17 Feb 2006 10:18:06 +0100 Subject: wavelet analysis In-Reply-To: <002201c633a1$3ec77c90$1423b080@KAMTRANSTEC> Message-ID: Dear Kambiz, This looks like a pretty low level error to me. >??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 >no channels were specified for reading CTF data >Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); It seems as if the variable stimindx has not been defined. Perhaps you could check that first, by putting a breakpoint at the specified line in read_ctf_trigger. Might it be the case that your dataset does not contain a channel with the label 'STIM'? Yours, Jan-Mathijs From kambiz.tavabi at UNI-MUENSTER.DE Fri Feb 17 11:13:15 2006 From: kambiz.tavabi at UNI-MUENSTER.DE (Kambiz Tavabi) Date: Fri, 17 Feb 2006 11:13:15 +0100 Subject: read_fcdc_event In-Reply-To: <003e01c633a3$0fac8c50$902dae83@fcdonders.nl> Message-ID: Hi Jan, When it comes to MATLAB I am a low level kind of guy! With a break @ line 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, A call to stimindx returns; Empty matrix: 0-by-1. The data I have has been recorded on a CTF machine with the newest available software which apparently displays only a virtual channel labeled STIM seen in the Data Editor. The virtual STIM channel is a combination of UPPT01 & UPPT02 parallel ports used for stimulus delivery. I can send you the dsinfo for this file if you'd like. Apparently stimindx is empty; and my dataset consists of a no channel labeled STIM. But this is in accordance with current CTF format. What to do now? Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 10:18 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] wavelet analysis Dear Kambiz, This looks like a pretty low level error to me. >??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 >no channels were specified for reading CTF data >Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); It seems as if the variable stimindx has not been defined. Perhaps you could check that first, by putting a breakpoint at the specified line in read_ctf_trigger. Might it be the case that your dataset does not contain a channel with the label 'STIM'? Yours, Jan-Mathijs From Jan.Schoffelen at FCDONDERS.RU.NL Fri Feb 17 12:03:09 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Fri, 17 Feb 2006 12:03:09 +0100 Subject: read_fcdc_event In-Reply-To: <002f01c633aa$c443c370$1423b080@KAMTRANSTEC> Message-ID: Dear Kambiz, As a first guess I would try to explicitly create this virtual 'STIM' channel, using DataEditor. Subsquently I would create a new dataset using the command-line program newDs. I recall that it has an option to include virtual channels in it. I would say, that then you have a dataset which actually contains a 'STIM' channel, so you can use it on the fieldtrip-files you have. Hope this is a sufficient workaround, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Kambiz Tavabi Sent: Friday, February 17, 2006 11:13 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Hi Jan, When it comes to MATLAB I am a low level kind of guy! With a break @ line 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, A call to stimindx returns; Empty matrix: 0-by-1. The data I have has been recorded on a CTF machine with the newest available software which apparently displays only a virtual channel labeled STIM seen in the Data Editor. The virtual STIM channel is a combination of UPPT01 & UPPT02 parallel ports used for stimulus delivery. I can send you the dsinfo for this file if you'd like. Apparently stimindx is empty; and my dataset consists of a no channel labeled STIM. But this is in accordance with current CTF format. What to do now? Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 10:18 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] wavelet analysis Dear Kambiz, This looks like a pretty low level error to me. >??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 >no channels were specified for reading CTF data >Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); It seems as if the variable stimindx has not been defined. Perhaps you could check that first, by putting a breakpoint at the specified line in read_ctf_trigger. Might it be the case that your dataset does not contain a channel with the label 'STIM'? Yours, Jan-Mathijs From kambiz.tavabi at UNI-MUENSTER.DE Fri Feb 17 14:07:43 2006 From: kambiz.tavabi at UNI-MUENSTER.DE (Kambiz Tavabi) Date: Fri, 17 Feb 2006 14:07:43 +0100 Subject: read_fcdc_event In-Reply-To: <003f01c633b1$bc77beb0$902dae83@fcdonders.nl> Message-ID: Dear Jan, This is not a practical workaround! I have already too many datasets extricated according to conditions from the raw continuous datasets. What I am trying to do with fcdc_event is an intermediary step in order to implement the TF analysis capabilities in FieldTrip. As I understand FIELDTRIP was written around the CTF format and considering read_fcdc.... is a low level operation I don't see why I need to use NewDs to meet a demand imposed by FIELDTRIP. Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 12:03 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Dear Kambiz, As a first guess I would try to explicitly create this virtual 'STIM' channel, using DataEditor. Subsquently I would create a new dataset using the command-line program newDs. I recall that it has an option to include virtual channels in it. I would say, that then you have a dataset which actually contains a 'STIM' channel, so you can use it on the fieldtrip-files you have. Hope this is a sufficient workaround, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Kambiz Tavabi Sent: Friday, February 17, 2006 11:13 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Hi Jan, When it comes to MATLAB I am a low level kind of guy! With a break @ line 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, A call to stimindx returns; Empty matrix: 0-by-1. The data I have has been recorded on a CTF machine with the newest available software which apparently displays only a virtual channel labeled STIM seen in the Data Editor. The virtual STIM channel is a combination of UPPT01 & UPPT02 parallel ports used for stimulus delivery. I can send you the dsinfo for this file if you'd like. Apparently stimindx is empty; and my dataset consists of a no channel labeled STIM. But this is in accordance with current CTF format. What to do now? Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 10:18 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] wavelet analysis Dear Kambiz, This looks like a pretty low level error to me. >??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 >no channels were specified for reading CTF data >Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); It seems as if the variable stimindx has not been defined. Perhaps you could check that first, by putting a breakpoint at the specified line in read_ctf_trigger. Might it be the case that your dataset does not contain a channel with the label 'STIM'? Yours, Jan-Mathijs From Jan.Schoffelen at FCDONDERS.RU.NL Fri Feb 17 14:56:56 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Fri, 17 Feb 2006 14:56:56 +0100 Subject: read_fcdc_event In-Reply-To: <003c01c633c3$23adcd70$1423b080@KAMTRANSTEC> Message-ID: Dear Kambiz, If you already have 'preprocessed' your data, which I understand from your statement that you already created new .ds, according to your conditions, I'd say you do not need to use read_fcdc_event anymore to extract your epochs of interest. Am I correct in assuming, that the data you want to read in, is 'trial-based', with all trials of a given condition concatenated in time? If it is too unpractical to re-create a newDs based on your raw data, then you have to define your trials in a different way. -As you have probably seen, you have to specify a trial-matrix in your configuration. In the case of trial-based data, the header contains this information: hdr = read_fcdc_header(headerfile) the fields: hdr.Ntrials (or hdr.nTrials, I don't know anymore) hdr.Nsamples give the information you need (you also have to know about the offset of each trial) for j = 1:hdr.Ntrials trl(:,1) = ([1:hdr.Ntrials]'-1)*hdr.Nsamples + 1; trl(:,2) = ([1:hdr.Ntrials]')*hdr.Nsamples; trl(:,3) = the offset end Then you can put this in your configuration and proceed with the analysis. -Another possibility is writing your own trial-detection function, not using read_fcdc_event, you can write your own function and call it when you specify cfg.trialfun = 'yourownfunction'; -Still, I would prefer my first suggestion, since the fun thing with fieldtrip is, that you can really flexibly define your epochs of interest from a datafile, which has been recorded continuously. One would not need to make the data 'trial-based' using the ctf-software. That means that you would have to create the newDs only once, and define your trials within fieldtrip. Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Kambiz Tavabi Sent: Friday, February 17, 2006 2:08 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Dear Jan, This is not a practical workaround! I have already too many datasets extricated according to conditions from the raw continuous datasets. What I am trying to do with fcdc_event is an intermediary step in order to implement the TF analysis capabilities in FieldTrip. As I understand FIELDTRIP was written around the CTF format and considering read_fcdc.... is a low level operation I don't see why I need to use NewDs to meet a demand imposed by FIELDTRIP. Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 12:03 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Dear Kambiz, As a first guess I would try to explicitly create this virtual 'STIM' channel, using DataEditor. Subsquently I would create a new dataset using the command-line program newDs. I recall that it has an option to include virtual channels in it. I would say, that then you have a dataset which actually contains a 'STIM' channel, so you can use it on the fieldtrip-files you have. Hope this is a sufficient workaround, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Kambiz Tavabi Sent: Friday, February 17, 2006 11:13 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Hi Jan, When it comes to MATLAB I am a low level kind of guy! With a break @ line 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, A call to stimindx returns; Empty matrix: 0-by-1. The data I have has been recorded on a CTF machine with the newest available software which apparently displays only a virtual channel labeled STIM seen in the Data Editor. The virtual STIM channel is a combination of UPPT01 & UPPT02 parallel ports used for stimulus delivery. I can send you the dsinfo for this file if you'd like. Apparently stimindx is empty; and my dataset consists of a no channel labeled STIM. But this is in accordance with current CTF format. What to do now? Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 10:18 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] wavelet analysis Dear Kambiz, This looks like a pretty low level error to me. >??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 >no channels were specified for reading CTF data >Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); It seems as if the variable stimindx has not been defined. Perhaps you could check that first, by putting a breakpoint at the specified line in read_ctf_trigger. Might it be the case that your dataset does not contain a channel with the label 'STIM'? Yours, Jan-Mathijs From muthuraman10 at HOTMAIL.COM Tue Feb 21 11:27:21 2006 From: muthuraman10 at HOTMAIL.COM (Muthuraman Muthuraman) Date: Tue, 21 Feb 2006 10:27:21 +0000 Subject: query on loading CNT files In-Reply-To: <89836CD8-5337-4B94-B820-6BD110A5DE2B@fcdonders.ru.nl> Message-ID: hello I have tried what you have suggested me in the previous mail and i have attached the steps i have performed in matlab and the error also if i skip the preprocessing step and go for the calculation of coherence using freqanalysis how to specify data in that case for the function (freq=freqanalysis(cfg,data)); please give me suggestion on this >>headerfile='pd_mof_tr0_o_0307.cnt'; >>hdr = read_fcdc_header(headerfile); Loading file pd_mof_tr0_o_0307.cnt ... >>cfg.trl = []; for i=1:floor(hdr.nSamples/hdr.Fs) cfg.trl(i,1) = (i-1)*hdr.Fs + 1; cfg.trl(i,2) = (i )*hdr.Fs; cfg.trl(i,3) = 0; end >>cfg cfg = trl: [172x3 double] >>[cfg] = definetrial(cfg); retaining exist trial definition found 0 events created 172 trials >>data=preprocessing(cfg); ??? Error using ==> read_fcdc_header file '' does not exist Error in ==> C:\muthu\work\fieldtrip-20060131\preprocessing.m On line 236 ==> hdr = read_fcdc_header(cfg.headerfile); with regards muthuraman >From: Robert Oostenveld >Reply-To: FieldTrip discussion list >To: FIELDTRIP at NIC.SURFNET.NL >Subject: Re: [FIELDTRIP] query on loading CNT files >Date: Tue, 24 Jan 2006 13:54:16 +0100 > >The relevant warning seems to be > >>Warning: no events found in pd_mof_tr0_o_0307.cnt > >That means that the low level code used to read the CNT file does not find >any triggers in your datafile. That either means that the low level >reading function (private/read_ns_cnt.m) has a bug, or that your data does >not contain any triggers. > >If it does not contain triggers (i.e. if there are no trials in the data), >you should make your own cfg.trl field prior to calling PREPROCESSING and >skip preprocessing. The documentation of DEFINETRIAL explains what cfg.trl >means. I suggest that you try something like > >hdr = read_fcdc_header(headerfile); >cfg.trl = []; >for i=1:floor(hdr.nSamples/hdr.Fs) > cfg.trl(i,1) = (i-1)*hdr.Fs + 1; % begin sample of each trial > cfg.trl(i,2) = (i )*hdr.Fs; % end sample > cfg.trl(i,3) = 0; % offset, i.e. relative location of >the time axis >end >data = preprocessing(cfg); > >This segments your continuous data in trials of one second length. > >best, >Robert > > > >On 24-jan-2006, at 11:46, Muthuraman Muthuraman wrote: > >>hello >> >>I am beginner with field trip >>as in the previous mail i have asked about the query on loading CNT files >>and according to the reply i need to call the function DEFINETRAIL >>in the function DEFINETRAIL i have to use the READ_FCDC_EVENT to find the >>events in the data >>which gave warnings >> >>i have attached in the mail what were exactly the steps carried out for >>the EEG analysis >> >>'pd_mof_tr0_o_0307.cnt' is the file which contains the data >> >> >> >>headerfile='pd_mof_tr0_o_0307.cnt'; >>>>[hdr] = read_fcdc_header(headerfile); >>Loading file pd_mof_tr0_o_0307.cnt ... >>>>hdr >> >>hdr = >> >> Fs: 1000 >> nChans: 64 >> nSamples: 172040 >> nSamplesPre: 0 >> nTrials: 1 >> label: {1x64 cell} >> >>>>datafile='pd_mof_tr0_o_0307.cnt';begsample=1;endsample=172;chanindx= >>>>64;continuous=1; >>>>[dat] = read_fcdc_data(datafile, hdr, begsample, endsample, chanindx, >>>>continuous); >>Loading file pd_mof_tr0_o_0307.cnt ... >>done >>>>filename='pd_mof_tr0_o_0307.cnt'; >>>>[event] = read_fcdc_event(filename) >>Warning: handling of event structure has not been fully tested for >>Neuroscan *.cnt files >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 414 >>Loading file pd_mof_tr0_o_0307.cnt ... >>done >>Warning: no events found in pd_mof_tr0_o_0307.cnt >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 620 >> >>event = >> >> [] >> >> >>Thanking you >>with regards >>muthuraman >> >>>From: Robert Oostenveld >>>Reply-To: FieldTrip discussion list >>>To: FIELDTRIP at NIC.SURFNET.NL >>>Subject: Re: [FIELDTRIP] query on loading CNT files >>>Date: Wed, 18 Jan 2006 21:20:37 +0100 >>> >>>Dear Muthuraman >>> >>>All analyses start by calling the PREPROCESSING function, which reads >>>the data segments of interest into memory. Prior to that, you should >>>call DEFINETRIAL to determine the data segments of interest (usually >>>based on the triggers present in the datafile). Please see the help of >>>those two functions (type "help function_name" on the matlab command >>>line) or look at http:// www2.ru.nl/fcdonders/fieldtrip/ reference.html >>> >>>best regards >>>Robert >>> >>> >>>On 18-jan-2006, at 11:44, Muthuraman Muthuraman wrote: >>> >>>>hello >>>> >>>>I would like to use fieldtrip to analyse EEG recordings >>>>how to load CNT files which contains the data >>>>how can i load the data and do the analysis >>>> >>>> >>>>with regards >>>>muthuraman >>>> >>> >>> >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>>Robert Oostenveld, PhD >>>F.C. Donders Centre for Cognitive Neuroimaging >>>Radboud University Nijmegen >>>phone: +31-24-3619695 >>>http://www.ru.nl/fcdonders/ >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> From Jan.Schoffelen at FCDONDERS.RU.NL Tue Feb 21 12:37:17 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Tue, 21 Feb 2006 12:37:17 +0100 Subject: query on loading CNT files In-Reply-To: Message-ID: Dear Muthuraman, I guess that you should specify the files which the preprocessing-function is going to read in. So you should specify a cfg.headerfile (which causes your crash, since you left it empty) and a cfg.datafile In your case I would try: cfg.headerfile = headerfile; cfg.datafile = headerfile; (since as far as I know, these are one and the same). Good luck, Jan-Mathijs PS: Since you already manually defined your trials, you do not need to call Definetrial anymore (so the step: [cfg] = definetrial(cfg) can be omitted) -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Muthuraman Muthuraman Sent: Tuesday, February 21, 2006 11:27 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] query on loading CNT files hello I have tried what you have suggested me in the previous mail and i have attached the steps i have performed in matlab and the error also if i skip the preprocessing step and go for the calculation of coherence using freqanalysis how to specify data in that case for the function (freq=freqanalysis(cfg,data)); please give me suggestion on this >>headerfile='pd_mof_tr0_o_0307.cnt'; >>hdr = read_fcdc_header(headerfile); Loading file pd_mof_tr0_o_0307.cnt ... >>cfg.trl = []; for i=1:floor(hdr.nSamples/hdr.Fs) cfg.trl(i,1) = (i-1)*hdr.Fs + 1; cfg.trl(i,2) = (i )*hdr.Fs; cfg.trl(i,3) = 0; end >>cfg cfg = trl: [172x3 double] >>[cfg] = definetrial(cfg); retaining exist trial definition found 0 events created 172 trials >>data=preprocessing(cfg); ??? Error using ==> read_fcdc_header file '' does not exist Error in ==> C:\muthu\work\fieldtrip-20060131\preprocessing.m On line 236 ==> hdr = read_fcdc_header(cfg.headerfile); with regards muthuraman >From: Robert Oostenveld >Reply-To: FieldTrip discussion list >To: FIELDTRIP at NIC.SURFNET.NL >Subject: Re: [FIELDTRIP] query on loading CNT files >Date: Tue, 24 Jan 2006 13:54:16 +0100 > >The relevant warning seems to be > >>Warning: no events found in pd_mof_tr0_o_0307.cnt > >That means that the low level code used to read the CNT file does not find >any triggers in your datafile. That either means that the low level >reading function (private/read_ns_cnt.m) has a bug, or that your data does >not contain any triggers. > >If it does not contain triggers (i.e. if there are no trials in the data), >you should make your own cfg.trl field prior to calling PREPROCESSING and >skip preprocessing. The documentation of DEFINETRIAL explains what cfg.trl >means. I suggest that you try something like > >hdr = read_fcdc_header(headerfile); >cfg.trl = []; >for i=1:floor(hdr.nSamples/hdr.Fs) > cfg.trl(i,1) = (i-1)*hdr.Fs + 1; % begin sample of each trial > cfg.trl(i,2) = (i )*hdr.Fs; % end sample > cfg.trl(i,3) = 0; % offset, i.e. relative location of >the time axis >end >data = preprocessing(cfg); > >This segments your continuous data in trials of one second length. > >best, >Robert > > > >On 24-jan-2006, at 11:46, Muthuraman Muthuraman wrote: > >>hello >> >>I am beginner with field trip >>as in the previous mail i have asked about the query on loading CNT files >>and according to the reply i need to call the function DEFINETRAIL >>in the function DEFINETRAIL i have to use the READ_FCDC_EVENT to find the >>events in the data >>which gave warnings >> >>i have attached in the mail what were exactly the steps carried out for >>the EEG analysis >> >>'pd_mof_tr0_o_0307.cnt' is the file which contains the data >> >> >> >>headerfile='pd_mof_tr0_o_0307.cnt'; >>>>[hdr] = read_fcdc_header(headerfile); >>Loading file pd_mof_tr0_o_0307.cnt ... >>>>hdr >> >>hdr = >> >> Fs: 1000 >> nChans: 64 >> nSamples: 172040 >> nSamplesPre: 0 >> nTrials: 1 >> label: {1x64 cell} >> >>>>datafile='pd_mof_tr0_o_0307.cnt';begsample=1;endsample=172;chanindx= >>>>64;continuous=1; >>>>[dat] = read_fcdc_data(datafile, hdr, begsample, endsample, chanindx, >>>>continuous); >>Loading file pd_mof_tr0_o_0307.cnt ... >>done >>>>filename='pd_mof_tr0_o_0307.cnt'; >>>>[event] = read_fcdc_event(filename) >>Warning: handling of event structure has not been fully tested for >>Neuroscan *.cnt files >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 414 >>Loading file pd_mof_tr0_o_0307.cnt ... >>done >>Warning: no events found in pd_mof_tr0_o_0307.cnt >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 620 >> >>event = >> >> [] >> >> >>Thanking you >>with regards >>muthuraman >> >>>From: Robert Oostenveld >>>Reply-To: FieldTrip discussion list >>>To: FIELDTRIP at NIC.SURFNET.NL >>>Subject: Re: [FIELDTRIP] query on loading CNT files >>>Date: Wed, 18 Jan 2006 21:20:37 +0100 >>> >>>Dear Muthuraman >>> >>>All analyses start by calling the PREPROCESSING function, which reads >>>the data segments of interest into memory. Prior to that, you should >>>call DEFINETRIAL to determine the data segments of interest (usually >>>based on the triggers present in the datafile). Please see the help of >>>those two functions (type "help function_name" on the matlab command >>>line) or look at http:// www2.ru.nl/fcdonders/fieldtrip/ reference.html >>> >>>best regards >>>Robert >>> >>> >>>On 18-jan-2006, at 11:44, Muthuraman Muthuraman wrote: >>> >>>>hello >>>> >>>>I would like to use fieldtrip to analyse EEG recordings >>>>how to load CNT files which contains the data >>>>how can i load the data and do the analysis >>>> >>>> >>>>with regards >>>>muthuraman >>>> >>> >>> >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>>Robert Oostenveld, PhD >>>F.C. Donders Centre for Cognitive Neuroimaging >>>Radboud University Nijmegen >>>phone: +31-24-3619695 >>>http://www.ru.nl/fcdonders/ >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> From tomh at KURAGE.NIMH.NIH.GOV Tue Feb 21 15:41:18 2006 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Tue, 21 Feb 2006 09:41:18 -0500 Subject: cfg.channel needed? Message-ID: Hi; just exploring some of the recent changes, I noticed that if you let cfg.channel default in preprocessing, you'll get all the channels, MEG + junk, as expected. But then if I'm doing cross-power and specify channel combinations of all MEG by all MEG, strange things happen. I get an error saying "The cross-spectral-density matrix is not complete" from prepare_freq_matrices(). This is because there are more channels in cfg.channel than in the csd matrix. I was thinking it might be nice for it to default to only the channels specified in the csd, but it looks like there's too much going on previously, and it's better to use cfg.channel in preprocessing. But the error message could be nicer. If you leave the call to channelcombination() out, that is, omit cfg.channelcmb = channelcombination({'MEG' 'MEG'}, data.label); from freqanalysis(), does it default to 'all' by 'all' so that if you said cfg.channel = { 'MEG' }; to preprocessing() you'll get 'MEG' by 'MEG'? Basically I just want to ask if cfg.channel is now more-or-less required to preprocessing()? Thanks Dr. Tom Holroyd The 9th Amendment of the U.S. Constitution: "The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people." From r.oostenveld at FCDONDERS.RU.NL Wed Feb 22 10:23:11 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 22 Feb 2006 10:23:11 +0100 Subject: read_fcdc_event In-Reply-To: <003c01c633c3$23adcd70$1423b080@KAMTRANSTEC> Message-ID: Dear Kambiz, I was away for a few days, otherwise I would have pointed this out to you and JM before: I recently got a patch from Tom Holroyd which exactly fixes this problem in the low level trigger reading code. I have applied the patch to the inhouse version, however, the ftp version of fieldtrip is currently slightly lagging behind. I hope to have the ftp version up to date again by the end of the week. Please find attached an updated read_fcdc_event an a read_ctf_trigger (which goes into the private subdir). These should return the trigger information for your new electronics. best regards, Robert PS could you perhaps send me a dataset with the new trigger channels? I have not been able to test the code since I was not able to test the code since we don't have the new eelctronics. If you would not mind, please put it on ftp://ftp.fcdonders.nl/pub/incoming and/or send me a direct mail. -------------- next part -------------- A non-text attachment was scrubbed... Name: read_ctf_trigger.m Type: application/octet-stream Size: 3780 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: read_fcdc_event.m Type: application/octet-stream Size: 25723 bytes Desc: not available URL: -------------- next part -------------- On 17-feb-2006, at 14:07, Kambiz Tavabi wrote: > Dear Jan, > This is not a practical workaround! I have already too many datasets > extricated according to conditions from the raw continuous > datasets. What I > am trying to do with fcdc_event is an intermediary step in order to > implement the TF analysis capabilities in FieldTrip. As I understand > FIELDTRIP was written around the CTF format and considering > read_fcdc.... is > a low level operation I don't see why I need to use NewDs to meet a > demand > imposed by FIELDTRIP. > > Thanks, > Kambiz From r.oostenveld at FCDONDERS.RU.NL Wed Feb 22 10:50:06 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 22 Feb 2006 10:50:06 +0100 Subject: cfg.channel needed? In-Reply-To: Message-ID: Hi Tom, The default for freqanalysis is cfg.channelcmb='all', which means all- with-all. If you do cfg.channel='MEG' in preprocessing and use the default in freqanalysis, you'll hence get MEG-with-MEG. Alternatively, preprocessing with cfg.channel='all' should also work and you should be able to get MEG-with-MEG using cfg.channelcmb as you have specified it. I am not sure what the problem is in your case, but I can explain what is happening: The idea is that sourceanalysis (and the underlying prepare_freq_matrices) should not make assumptions on the configuration that was used in freqanlysis, but has to rely on the output freq structure. Freqanalysis computes powsctrm and crsspctrm seperately and store them in arrays. To prevent excess memory use, only one copy of each channel combinations is strored (i.e. ch1-ch2, but not ch2-ch1). When you do sourceanalysis (which triggers prepare_freq_matrices ), a selection along the time and frequency dimension is made. In the nchanXnchan CSD matrix that is constructed, the powspctrm should be on the diagonal and the crsspctrm should be assigned to both off-diagonal sides of the CSD matrix. This is a large reshuffling of numbers coming from the two (pow/csspctrm) arrays. Since there is no guarantee that all elements of the CSD matrix can be found somewhere in either of the arrays, the CSD matrix is first filled with nans and then all elements that can be found are copied in. If, at the end, there is still a nan somewhere in the CSD matrix, then that means that the output of freqanalysis was not complete enough for sourceanalysis. See prepare_freq_matrices lines 147-175. I hope that this provides enough information for you to find the underlying problem in your case. Robert PS The code is not very readible, and is pretty old. I would implement it differently (although with the same basic idea) if I had to do it again. All the string comparisons between all channel combinations make it very slow. I would now do it using the cmb2label and label2cmb subfunctions that are currently only used inside the prepare_timefreq_data function. On 21-feb-2006, at 15:41, Tom Holroyd wrote: > Hi; just exploring some of the recent changes, I noticed that if > you let cfg.channel default in preprocessing, you'll get all the > channels, MEG + junk, as expected. But then if I'm doing cross- > power and specify channel combinations of all MEG by all MEG, > strange things happen. I get an error saying "The cross-spectral- > density matrix is not complete" from prepare_freq_matrices(). This > is because there are more channels in cfg.channel than in the csd > matrix. I was thinking it might be nice for it to default to only > the channels specified in the csd, but it looks like there's too > much going on previously, and it's better to use cfg.channel in > preprocessing. But the error message could be nicer. > > If you leave the call to channelcombination() out, that is, omit > cfg.channelcmb = channelcombination({'MEG' 'MEG'}, data.label); > from freqanalysis(), does it default to 'all' by 'all' so that if > you said > cfg.channel = { 'MEG' }; > to preprocessing() you'll get 'MEG' by 'MEG'? > > Basically I just want to ask if cfg.channel is now more-or-less > required to preprocessing()? > > Thanks > > Dr. Tom Holroyd > The 9th Amendment of the U.S. Constitution: > "The enumeration in the Constitution, of certain rights, shall not be > construed to deny or disparage others retained by the people." > From kambiz.tavabi at UNI-MUENSTER.DE Wed Feb 22 11:44:41 2006 From: kambiz.tavabi at UNI-MUENSTER.DE (Kambiz Tavabi) Date: Wed, 22 Feb 2006 11:44:41 +0100 Subject: read_fcdc_event In-Reply-To: <447B33B1-57A1-43A8-A146-471161BAE753@fcdonders.ru.nl> Message-ID: Dear Robert, I received an email from Dr. Holroyd describing implementation of his patch; I just haven't gotten around to it. Nonetheless, I appreciate the updated function files! As per your request I have uploaded the 'A0132_Aud-Obj-Recognition_20051115_02.ds' dataset in the incoming folder in the Donders FTP. It is a passive auditory dataset with an acoustic trigger on parallel port 1 used for event timing and 4 different stimuli coded on port two; the data is recorded with 3rd order gradient balancing. I have attached a dsinfo output of the data for your convenience. All the best, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Robert Oostenveld Sent: Wednesday, February 22, 2006 10:23 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Dear Kambiz, I was away for a few days, otherwise I would have pointed this out to you and JM before: I recently got a patch from Tom Holroyd which exactly fixes this problem in the low level trigger reading code. I have applied the patch to the inhouse version, however, the ftp version of fieldtrip is currently slightly lagging behind. I hope to have the ftp version up to date again by the end of the week. Please find attached an updated read_fcdc_event an a read_ctf_trigger (which goes into the private subdir). These should return the trigger information for your new electronics. best regards, Robert PS could you perhaps send me a dataset with the new trigger channels? I have not been able to test the code since I was not able to test the code since we don't have the new eelctronics. If you would not mind, please put it on ftp://ftp.fcdonders.nl/pub/incoming and/or send me a direct mail. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: dsinfo.txt URL: From tomh at KURAGE.NIMH.NIH.GOV Wed Feb 22 23:11:25 2006 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd (NIH/NIMH) [E]) Date: Wed, 22 Feb 2006 17:11:25 -0500 Subject: cfg.channel needed? In-Reply-To: <2A2BC392-0CAD-47C3-9DBE-F79612C285DA@fcdonders.ru.nl> Message-ID: Robert Oostenveld wrote: > Hi Tom, > > The default for freqanalysis is cfg.channelcmb='all', which means all- > with-all. If you do cfg.channel='MEG' in preprocessing and use the > default in freqanalysis, you'll hence get MEG-with-MEG. Alternatively, > preprocessing with cfg.channel='all' should also work and you should be > able to get MEG-with-MEG using cfg.channelcmb as you have specified it. However, you can't. :-) > PS The code is not very readible, and is pretty old. I would implement > it differently (although with the same basic idea) if I had to do it > again. All the string comparisons between all channel combinations make > it very slow. That's certainly true; with 275 channels there are over 37,000 pairs. In prepare_freq_matricies.m, on line 125, Nchan is 302. The problem is that size(freq.label) is 306. Somewhere it is dropping some channels, and the numbers don't match. I did this: I let cfg.channel default in preprocessing, and used cfg.channelcmb = channelcombination({'MEG' 'MEG'}, data.label); with freqanalysis. Then to examine the state in sourceanalysis: > dbstop('prepare_freq_matrices', '125'); At this point, cfg.channel has the MEG channels and the references ONLY (and the references have been moved to the end for some reason). freq.label includes everything. Because they don't match, the matrix is built to the wrong size. I tried pruning cfg.channel to just the MEGs, but that caused more problems downstream. FYI, the script I'm using uses prepare_leadfield, does that matter? -- Dr. Tom Holroyd The 9th Amendment of the U.S. Constitution: "The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people." From muthuraman10 at HOTMAIL.COM Thu Feb 23 11:32:13 2006 From: muthuraman10 at HOTMAIL.COM (Muthuraman Muthuraman) Date: Thu, 23 Feb 2006 10:32:13 +0000 Subject: query on channel arrangement In-Reply-To: <001101c636db$2b3fb150$902dae83@fcdonders.nl> Message-ID: hello Thanks Jan We have the data for EEG taken with 64-channel(Neuroscan) arrangement and i need to specify channel arrangement when i want to calculate the coherence between EEG and EMG so for example : in real data FPZ- 45 -in the EEG channel arrangement AF7-41 -in the EEG channel arrangement M1-29- EMG channel M2-30-EMG channel M3-63-EMG channel M4-64-EMG channel but when i calculate the coherence i want them in the 64-channel layout instead of 151 layout and to change the channels in the coherence plot as for example- FPZ-1 -in the coherence plot AF7-2 -in the coherence plot M1-52-in the coherence plot M2-53-in the coherence plot M3-54-in the coherence plot M4-55-in the coherence plot Like this i wanted to change the channel arrangement in the coherence plot for all the channels how can i change it, please can you give me some idea regarding this with regards muthu >From: Jan Mathijs Schoffelen >Reply-To: FieldTrip discussion list >To: FIELDTRIP at NIC.SURFNET.NL >Subject: Re: [FIELDTRIP] query on loading CNT files >Date: Tue, 21 Feb 2006 12:37:17 +0100 > >Dear Muthuraman, > >I guess that you should specify the files which the preprocessing-function >is going to read in. So you should specify a > >cfg.headerfile (which causes your crash, since you left it empty) > >and a > >cfg.datafile > >In your case I would try: > >cfg.headerfile = headerfile; >cfg.datafile = headerfile; (since as far as I know, these are one and the >same). > >Good luck, > >Jan-Mathijs > >PS: Since you already manually defined your trials, you do not need to call >Definetrial anymore (so the step: [cfg] = definetrial(cfg) can be omitted) > >-----Original Message----- >From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf >Of Muthuraman Muthuraman >Sent: Tuesday, February 21, 2006 11:27 AM >To: FIELDTRIP at NIC.SURFNET.NL >Subject: Re: [FIELDTRIP] query on loading CNT files > >hello > >I have tried what you have suggested me in the previous mail >and i have attached the steps i have performed in matlab and the error also > >if i skip the preprocessing step >and go for the calculation of coherence using freqanalysis >how to specify data in that case for the function >(freq=freqanalysis(cfg,data)); >please give me suggestion on this > > > > >>headerfile='pd_mof_tr0_o_0307.cnt'; > >>hdr = read_fcdc_header(headerfile); >Loading file pd_mof_tr0_o_0307.cnt ... > >>cfg.trl = []; >for i=1:floor(hdr.nSamples/hdr.Fs) > cfg.trl(i,1) = (i-1)*hdr.Fs + 1; > cfg.trl(i,2) = (i )*hdr.Fs; > cfg.trl(i,3) = 0; >end > >>cfg > >cfg = > > trl: [172x3 double] > >>[cfg] = definetrial(cfg); >retaining exist trial definition >found 0 events >created 172 trials > > >>data=preprocessing(cfg); >??? Error using ==> read_fcdc_header >file '' does not exist > >Error in ==> C:\muthu\work\fieldtrip-20060131\preprocessing.m >On line 236 ==> hdr = read_fcdc_header(cfg.headerfile); > > > > >with regards >muthuraman > > > > >From: Robert Oostenveld > >Reply-To: FieldTrip discussion list > >To: FIELDTRIP at NIC.SURFNET.NL > >Subject: Re: [FIELDTRIP] query on loading CNT files > >Date: Tue, 24 Jan 2006 13:54:16 +0100 > > > >The relevant warning seems to be > > > >>Warning: no events found in pd_mof_tr0_o_0307.cnt > > > >That means that the low level code used to read the CNT file does not >find > > >any triggers in your datafile. That either means that the low level > >reading function (private/read_ns_cnt.m) has a bug, or that your data >does > > >not contain any triggers. > > > >If it does not contain triggers (i.e. if there are no trials in the >data), > > >you should make your own cfg.trl field prior to calling PREPROCESSING >and > >skip preprocessing. The documentation of DEFINETRIAL explains what >cfg.trl > > >means. I suggest that you try something like > > > >hdr = read_fcdc_header(headerfile); > >cfg.trl = []; > >for i=1:floor(hdr.nSamples/hdr.Fs) > > cfg.trl(i,1) = (i-1)*hdr.Fs + 1; % begin sample of each trial > > cfg.trl(i,2) = (i )*hdr.Fs; % end sample > > cfg.trl(i,3) = 0; % offset, i.e. relative location of > >the time axis > >end > >data = preprocessing(cfg); > > > >This segments your continuous data in trials of one second length. > > > >best, > >Robert > > > > > > > >On 24-jan-2006, at 11:46, Muthuraman Muthuraman wrote: > > > >>hello > >> > >>I am beginner with field trip > >>as in the previous mail i have asked about the query on loading CNT >files > >>and according to the reply i need to call the function DEFINETRAIL > >>in the function DEFINETRAIL i have to use the READ_FCDC_EVENT to find >the > > >>events in the data > >>which gave warnings > >> > >>i have attached in the mail what were exactly the steps carried out for > >>the EEG analysis > >> > >>'pd_mof_tr0_o_0307.cnt' is the file which contains the data > >> > >> > >> >>headerfile='pd_mof_tr0_o_0307.cnt'; > >>>>[hdr] = read_fcdc_header(headerfile); > >>Loading file pd_mof_tr0_o_0307.cnt ... > >>>>hdr > >> > >>hdr = > >> > >> Fs: 1000 > >> nChans: 64 > >> nSamples: 172040 > >> nSamplesPre: 0 > >> nTrials: 1 > >> label: {1x64 cell} > >> > >>>>datafile='pd_mof_tr0_o_0307.cnt';begsample=1;endsample=172;chanindx= > >>>>64;continuous=1; > >>>>[dat] = read_fcdc_data(datafile, hdr, begsample, endsample, chanindx, > >>>>continuous); > >>Loading file pd_mof_tr0_o_0307.cnt ... > >>done > >>>>filename='pd_mof_tr0_o_0307.cnt'; > >>>>[event] = read_fcdc_event(filename) > >>Warning: handling of event structure has not been fully tested for > >>Neuroscan *.cnt files > >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 414 > >>Loading file pd_mof_tr0_o_0307.cnt ... > >>done > >>Warning: no events found in pd_mof_tr0_o_0307.cnt > >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 620 > >> > >>event = > >> > >> [] > >> > >> > >>Thanking you > >>with regards > >>muthuraman > >> > >>>From: Robert Oostenveld > >>>Reply-To: FieldTrip discussion list > >>>To: FIELDTRIP at NIC.SURFNET.NL > >>>Subject: Re: [FIELDTRIP] query on loading CNT files > >>>Date: Wed, 18 Jan 2006 21:20:37 +0100 > >>> > >>>Dear Muthuraman > >>> > >>>All analyses start by calling the PREPROCESSING function, which reads > >>>the data segments of interest into memory. Prior to that, you should > >>>call DEFINETRIAL to determine the data segments of interest (usually > >>>based on the triggers present in the datafile). Please see the help >of > >>>those two functions (type "help function_name" on the matlab command > >>>line) or look at http:// www2.ru.nl/fcdonders/fieldtrip/ reference.html > >>> > >>>best regards > >>>Robert > >>> > >>> > >>>On 18-jan-2006, at 11:44, Muthuraman Muthuraman wrote: > >>> > >>>>hello > >>>> > >>>>I would like to use fieldtrip to analyse EEG recordings > >>>>how to load CNT files which contains the data > >>>>how can i load the data and do the analysis > >>>> > >>>> > >>>>with regards > >>>>muthuraman > >>>> > >>> > >>> > >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >>>Robert Oostenveld, PhD > >>>F.C. Donders Centre for Cognitive Neuroimaging > >>>Radboud University Nijmegen > >>>phone: +31-24-3619695 > >>>http://www.ru.nl/fcdonders/ > >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >> From r.oostenveld at FCDONDERS.RU.NL Fri Feb 24 11:49:29 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 24 Feb 2006 11:49:29 +0100 Subject: new website+wiki Message-ID: Dear FieldTrip users, We have implemented a new layout of the fieldtrip homepage, and a new technical system behind it. The homepage is still available at the same place: http://www.ru.nl/fcdonders/fieldtrip and I'd like to invite you to have a look at the new website. The system behint it is a wiki, similar to that used for Wikipedia (www.wikipedia.org). From now on anyone cabn contribute to the documentation! That means that, if you want to share documentation or demo scripts with others, you can do it directly through the website. Also if you notice an error in the documentation or a typo somewhere, you can fix it yourself immediately. There are still some parts of the old website that need to be copied to the new website, but we are working on that. If you have ideas, suggestions or comments, please share them with us. best regards, the fieldtrip team. PS At the moment we did not implement accounts and passwords, so anyone can contribute. If it turns out that the website becomes too messy, we will make the edit function restricted to people with an account. From tomh at KURAGE.NIMH.NIH.GOV Fri Feb 24 13:46:16 2006 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Fri, 24 Feb 2006 07:46:16 -0500 Subject: new website+wiki In-Reply-To: <99025CC8-DE48-4F40-BFD6-145A4D93CB84@fcdonders.ru.nl> Message-ID: On Fri, 24 Feb 2006, Robert Oostenveld wrote: > PS At the moment we did not implement accounts and passwords, so anyone can > contribute. If it turns out that the website becomes too messy, we will make > the edit function restricted to people with an account. Robert, I would recommend a default account/password that everybody knows. That'll limit attacks from spammers. A common attack is just to create huge lists of links (often in the sidebar) to be indexed by search engines. The NIMH MEG Core website is also a wiki. We've enjoyed it; it's very easy to modify (if you know the magic word, which is shrimp). There's also an RSS feed of the "changed pages page" so it's easy to keep track of when modifications are made. Wikipedea doesn't need passwords as much because they have high vigilance on the main pages... Did you see the article on Magnetoencephalography? It has grown a lot (I've contributed, as have several others). Dr. Tom Holroyd The 9th Amendment of the U.S. Constitution: "The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people." From r.oostenveld at FCDONDERS.RU.NL Fri Feb 24 18:09:14 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 24 Feb 2006 18:09:14 +0100 Subject: change in data structures, inside, dimord, foi and toi Message-ID: Dear FieldTrip users We have made two relatively large changes to FieldTrip that may lead to incompatibilities with your own scripts, therefore a word of warning: The changes affect the "home/common" version inside the Donders Centre from this moment on. The changes affect the daily released ftp version from version 20060224, i.e. today onward. That version does not exist yet, but will be uploaded to the ftp version this evening (CET). From today onward, a daily release will be made available again (which was not the case for the last 2 weeks). The first change is that of volumes. Previously source volumes could have an "inside" and an "outside" vector with indices, indicating the voxels that were scanned with the beamformer or not. Those two "inside" and "outside" vectors have been replaced by an locigal/ boolean "inside" volume, which is 1 if the voxel was inside the brain (i.e. beamed) and 0 if outside the brain (i.e. not beamed). The second change relates to the dimord field that most fieldtrip data structures have, and the freq.foi and freq.toi fields. The use of the dimord field has been made consistent between all functions, due to which some dimords had to be renamed. More importantly, the time and frequency axis in the output of the freqanalysis function have been renamed to freq.time (used to be freq.toi) and freq.freq (used to be freq.foi). This ensures that the dimord and the description of the axes in the data structure is consistent. The dimord also will specify "chan_freq_time" instead of "sgncmb_frq_tim", i.e. the dimord is in better correspondence with the data strucute. We have kept all FieldTrip functions backward compatible, i.e. old datastructures that you have previously computed and saved to disk in a mat file will still work with the new FieldTrip functions. Since the changes affected many fieldtrip functions, it could very well be that the changes introduced some bugs here and there. Please inform us about them, so that we can fix them. Sorry about the inconvenience that this may cause with respect to your analysis scripts. The change was required to ensure a further consistent development of the FieldTrip code. yours sincerely, Robert ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From litvak at TECHUNIX.TECHNION.AC.IL Mon Feb 27 09:23:50 2006 From: litvak at TECHUNIX.TECHNION.AC.IL (Vladimir Litvak) Date: Mon, 27 Feb 2006 10:23:50 +0200 Subject: Activation vs. baseline Message-ID: Dear Eric and all, I'm playing with 'Activation vs. baseline' option in clusterrandanalysis. The problem is that my baseline is about 100ms while the activation period is 300 ms. I cannot extend the baseline since the raw data I have is already segmented. What is the right thing to do in this situation? Should I divide the activation period into 3 segments and test them separately? Or maybe replicate the baseline 3 times, concatenate and use this as baseline for the whole period? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From pascal.fries at FCDONDERS.RU.NL Mon Feb 27 10:05:00 2006 From: pascal.fries at FCDONDERS.RU.NL (Pascal Fries) Date: Mon, 27 Feb 2006 10:05:00 +0100 Subject: Activation vs. baseline In-Reply-To: <000d01c63b77$26406820$90514484@dellgx240> Message-ID: Dear Vladimir, what aspect of the two data pieces are you comparing? Power? Coherence? Amplitude? At the sensor or at the source level? Best, Pascal Pascal Fries Principal Investigator Neuronal Coherence Group F. C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen Kapittelweg 29 6525 EN Nijmegen The Netherlands Phone: (+31) (0)24 36 10657 Fax: (+31) (0)24 36 10989 e-mail: pascal.fries at fcdonders.ru.nl website: www.ru.nl/fcdonders/ _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Monday, February 27, 2006 9:24 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Activation vs. baseline Dear Eric and all, I'm playing with 'Activation vs. baseline' option in clusterrandanalysis. The problem is that my baseline is about 100ms while the activation period is 300 ms. I cannot extend the baseline since the raw data I have is already segmented. What is the right thing to do in this situation? Should I divide the activation period into 3 segments and test them separately? Or maybe replicate the baseline 3 times, concatenate and use this as baseline for the whole period? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Mon Feb 27 10:05:56 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Feb 2006 10:05:56 +0100 Subject: query on channel arrangement In-Reply-To: Message-ID: Dear Muthu FieldTrip always works with channel labels, not with channel numbers. All functions, e.g. freqdescriptives (which computes coherence) or the plotting functions use the labels. The channel labels are read from the datafile, if the datafile does not include the correct channel labels, you have to fix them yourself. Do that after preprocessin, i.e. after preprocessing you can change the data.label cell array. From then on, FT will not look in the data file any more, so the channnel labels will remain as you have renamed them. The freqanalysis or freqdescriptives function do not care where each channel is, they only care about the channelcombiations that you specify between which to compute coherence. The plotting functions of course do need to know where each channel is, otherwise it cannot plot. The information about the channel locations is stored in the layout file, which is an ascii text file with the extension *.lay. You should have a look in the elec1010.lay file, which probably is already pretty close to teh layout that you want to use. best Robert On 23-feb-2006, at 11:32, Muthuraman Muthuraman wrote: > We have the data for EEG taken with 64-channel(Neuroscan) arrangement > and i need to specify channel arrangement > when i want to calculate the coherence between EEG and EMG > > so for example : in real data > > FPZ- 45 -in the EEG channel arrangement > AF7-41 -in the EEG channel arrangement > > M1-29- EMG channel > M2-30-EMG channel > M3-63-EMG channel > M4-64-EMG channel > > but when i calculate the coherence i want them in the 64-channel > layout > instead of 151 layout > > and to change the channels in the coherence plot as > for example- > FPZ-1 -in the coherence plot > AF7-2 -in the coherence plot > > M1-52-in the coherence plot > M2-53-in the coherence plot > M3-54-in the coherence plot > M4-55-in the coherence plot > > Like this i wanted to change the channel arrangement in the > coherence plot for all the channels > how can i change it, please can you give me some idea regarding this From litvak at TECHUNIX.TECHNION.AC.IL Mon Feb 27 10:13:18 2006 From: litvak at TECHUNIX.TECHNION.AC.IL (Vladimir Litvak) Date: Mon, 27 Feb 2006 11:13:18 +0200 Subject: Activation vs. baseline In-Reply-To: Message-ID: Amplitude at the sensor level. Vladimir -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Pascal Fries Sent: Monday, February 27, 2006 11:05 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Activation vs. baseline Dear Vladimir, what aspect of the two data pieces are you comparing? Power? Coherence? Amplitude? At the sensor or at the source level? Best, Pascal Pascal Fries Principal Investigator Neuronal Coherence Group F. C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen Kapittelweg 29 6525 EN Nijmegen The Netherlands Phone: (+31) (0)24 36 10657 Fax: (+31) (0)24 36 10989 e-mail: pascal.fries at fcdonders.ru.nl website: www.ru.nl/fcdonders/ _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Monday, February 27, 2006 9:24 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Activation vs. baseline Dear Eric and all, I'm playing with 'Activation vs. baseline' option in clusterrandanalysis. The problem is that my baseline is about 100ms while the activation period is 300 ms. I cannot extend the baseline since the raw data I have is already segmented. What is the right thing to do in this situation? Should I divide the activation period into 3 segments and test them separately? Or maybe replicate the baseline 3 times, concatenate and use this as baseline for the whole period? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From conrado.bosman at GMAIL.COM Mon Feb 27 10:05:12 2006 From: conrado.bosman at GMAIL.COM (Conrado Bosman) Date: Mon, 27 Feb 2006 10:05:12 +0100 Subject: Error in freqdescriptives ? Message-ID: Hi Robert, After analyze my data with freqanalysis, I use freqdescriptive to get the values of coherence and the power spectrum. In my script I use the foollowing functions, FRtemp = freqanalysis(cfg3,MSMA); FR = freqdescriptives([],FRtemp); and I get the following error: ??? Undefined function or variable "data". Error in ==> freqdescriptives at 113 data = fixdimord(data); If I use the dbstop command, you can see that data variable at that point doesn't exist. 113 data = fixdimord(data); K>> whos Name Size Bytes Class cfg 1x1 164 struct array freq 1x1 25792480 struct array It could be that there is a bug in the name of the variable? (using data instead of freq) Thanks for your attention, Conrado Bosman -------------- next part -------------- An HTML attachment was scrubbed... URL: From pascal.fries at FCDONDERS.RU.NL Mon Feb 27 10:46:56 2006 From: pascal.fries at FCDONDERS.RU.NL (Pascal Fries) Date: Mon, 27 Feb 2006 10:46:56 +0100 Subject: Activation vs. baseline In-Reply-To: <000201c63b7e$0c86b270$90514484@dellgx240> Message-ID: Dear Valdimir, OK. I had been asking, because coherence (and also power) have a bias that is sample size dependent. For those measures, particularly for coherence, I would suggest to use equal sample sizes. As far as I can judge, this problem is not there for amplitude. Then it is to the cluterrandanalysis experts to help you with that particular analysis. Best, Pascal _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Monday, February 27, 2006 10:13 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Activation vs. baseline Amplitude at the sensor level. Vladimir -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Pascal Fries Sent: Monday, February 27, 2006 11:05 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Activation vs. baseline Dear Vladimir, what aspect of the two data pieces are you comparing? Power? Coherence? Amplitude? At the sensor or at the source level? Best, Pascal Pascal Fries Principal Investigator Neuronal Coherence Group F. C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen Kapittelweg 29 6525 EN Nijmegen The Netherlands Phone: (+31) (0)24 36 10657 Fax: (+31) (0)24 36 10989 e-mail: pascal.fries at fcdonders.ru.nl website: www.ru.nl/fcdonders/ _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Monday, February 27, 2006 9:24 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Activation vs. baseline Dear Eric and all, I'm playing with 'Activation vs. baseline' option in clusterrandanalysis. The problem is that my baseline is about 100ms while the activation period is 300 ms. I cannot extend the baseline since the raw data I have is already segmented. What is the right thing to do in this situation? Should I divide the activation period into 3 segments and test them separately? Or maybe replicate the baseline 3 times, concatenate and use this as baseline for the whole period? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From maris at NICI.RU.NL Mon Feb 27 12:01:24 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Mon, 27 Feb 2006 12:01:24 +0100 Subject: Activation vs. baseline Message-ID: Dear Vladimir, I'm playing with 'Activation vs. baseline' option in clusterrandanalysis. The problem is that my baseline is about 100ms while the activation period is 300 ms. I cannot extend the baseline since the raw data I have is already segmented. What is the right thing to do in this situation? Should I divide the activation period into 3 segments and test them separately? Or maybe replicate the baseline 3 times, concatenate and use this as baseline for the whole period? My advice is to divide the activation period into 3 segments and test them separately. You can correct for multiple comparisons by using the Bonferroni-corrected alpha-level of alpha/3. Good luck, Eric Maris From r.oostenveld at FCDONDERS.RU.NL Mon Feb 27 12:23:34 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Feb 2006 12:23:34 +0100 Subject: Error in freqdescriptives ? In-Reply-To: Message-ID: Hi Conrado, Thanks for reporting the bug. I have fixed it in the release version of Fieldtrip. Robert On 27-feb-2006, at 10:05, Conrado Bosman wrote: > Hi Robert, > > After analyze my data with freqanalysis, I use freqdescriptive to > get the values of coherence and the power spectrum. In my script I > use the foollowing functions, > > FRtemp = freqanalysis(cfg3,MSMA); > FR = freqdescriptives([],FRtemp); > > and I get the following error: > > ??? Undefined function or variable "data". > > Error in ==> freqdescriptives at 113 > data = fixdimord(data); > > If I use the dbstop command, you can see that data variable at that > point doesn't exist. > > 113 data = fixdimord(data); > K>> whos > Name Size Bytes Class > > cfg 1x1 164 struct array > freq 1x1 25792480 struct array > > It could be that there is a bug in the name of the variable? (using > data instead of freq) > > Thanks for your attention, > > Conrado Bosman > > From conrado.bosman at GMAIL.COM Mon Feb 27 14:56:00 2006 From: conrado.bosman at GMAIL.COM (Conrado Bosman) Date: Mon, 27 Feb 2006 14:56:00 +0100 Subject: Another bug in freqdescriptives_pf Message-ID: Hi Robert, I find other bug in freqdescriptives_pf. This is the error message ??? Undefined function or variable "output". Error in ==> freqdescriptives>freqdescriptives_pf at 318 output.powspctrm = output.pow; Best, Conrado -- Conrado -------------- next part -------------- An HTML attachment was scrubbed... URL: From tomh at KURAGE.NIMH.NIH.GOV Mon Feb 27 16:57:31 2006 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd (NIH/NIMH) [E]) Date: Mon, 27 Feb 2006 10:57:31 -0500 Subject: Activation vs. baseline In-Reply-To: <2612D6C3714742A58C75AE68696B27FE@fcdonders.nl> Message-ID: Pascal Fries wrote: > OK. I had been asking, because coherence (and also power) have a bias > that is sample size dependent. For those measures, particularly for > coherence, I would suggest to use equal sample sizes. Correct me if I am wrong, but this bias is due to the slow convergence of the covariance; with more samples, the covariance converges more (assuming it converges at all). Furthermore it probably converges 'up', so if you have more samples, you'll see (apparently) more power. I have sometimes dealt with this problem in the past by simply z-scoring the volumes afterwards, thus shifting the means back to zero. But perhaps there are skewness issues as well? I've mostly done that when playing around with things like overlapping windows; for example, using an active window of 0 to 300 ms and a control window of 0 to 250 ms, you expect a slightly higher power in the active state because of the increase convergence, but then normalizing that spatially can give you an estimate of active areas for that 250-300 ms window. There may also be problematic beamformer overlap in this case, though, but that can be dealt with too. Just a thought. -- Dr. Tom Holroyd The 9th Amendment of the U.S. Constitution: "The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people." From r.oostenveld at FCDONDERS.RU.NL Mon Feb 27 17:28:56 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Feb 2006 17:28:56 +0100 Subject: Another bug in freqdescriptives_pf In-Reply-To: Message-ID: Hi Conrado, That also has been fixed. Robert On 27-feb-2006, at 14:56, Conrado Bosman wrote: > Hi Robert, > > I find other bug in freqdescriptives_pf. This is the error message > > ??? Undefined function or variable "output". > > Error in ==> freqdescriptives>freqdescriptives_pf at 318 > output.powspctrm = output.pow; > > Best, > Conrado > > -- > Conrado From pascal.fries at FCDONDERS.RU.NL Mon Feb 27 17:57:10 2006 From: pascal.fries at FCDONDERS.RU.NL (Pascal Fries) Date: Mon, 27 Feb 2006 17:57:10 +0100 Subject: Activation vs. baseline In-Reply-To: <4403216B.4030209@kurage.nimh.nih.gov> Message-ID: Hi Tom, > Pascal Fries wrote: > > OK. I had been asking, because coherence (and also power) > have a bias > > that is sample size dependent. For those measures, particularly for > > coherence, I would suggest to use equal sample sizes. > > Correct me if I am wrong, but this bias is due to the slow > convergence of the covariance; with more samples, the > covariance converges more (assuming it converges at all). > Furthermore it probably converges 'up', so if you have more > samples, you'll see (apparently) more power. I still haven't fully understood the sample size bias of power. For coherence, the issue is simple to understand. As you write, it has to do with the slow convergence towards the true value as the sample increases. But in the coherence case, values will converge "down" towards the true value, not 'up'. For one trial, coherence is numerically always one and will then decrease as you add more trials. In the case of a true coherence of one, it will not decrease and in the case of a true coherence zero, it will rapidly decrease. This is one of the most important things on the agenda for the basic spectral analysis in FieldTrip: To get a good estimate of the coherence bias and subtract it. Until this is finalized, the safest approach is to trim datasets before comparison to equal size. > I have sometimes dealt with this problem in the past by > simply z-scoring the volumes afterwards, thus shifting the > means back to zero. But perhaps there are skewness issues as > well? I've mostly done that when playing around with things > like overlapping windows; for example, using an active window > of 0 to 300 ms and a control window of 0 to 250 ms, you > expect a slightly higher power in the active state because of > the increase convergence, but then normalizing that spatially > can give you an estimate of active areas for that 250-300 ms > window. There may also be problematic beamformer overlap in > this case, though, but that can be dealt with too. Just a thought. I agree: If sample sizes are not orders of magnitude different, then a z-transformation can take care of most of the bias. Best, Pascal From litvak at TECHUNIX.TECHNION.AC.IL Mon Feb 27 18:14:16 2006 From: litvak at TECHUNIX.TECHNION.AC.IL (Vladimir Litvak) Date: Mon, 27 Feb 2006 19:14:16 +0200 Subject: Activation vs. baseline In-Reply-To: <13C2688B7C044C179AE9843BC0334507@fcdonders.nl> Message-ID: Dear Pascal, At the last SFN meeting Partha Mitra presented a poster with a method for dealing with exactly this problem. He told me he would put an implementation on his website. It would be nice if you could incorporate that into Fieldtrip. Although it has nothing to do with my original problem it can be helpful for me in other contexts. The abstract is below. Best, Vladimir -------------------------------------- Abstract View COMPARING SPECTRA AND COHERENCES FOR SAMPLES OF UNEQUAL SIZE H.S.Bokil1*; K.Purpura2; D.Thomson3; P.P.Mitra1 1. Cold Spring Harbor Laboratory, Cold Spring Harbor, NY, USA 2. Weill Med. Col. of Cornell Univ., New York, NY, USA 3. Mathematics, Queens Univ., Kingston, ON, Canada The spectrum and the coherency are classical measures of temporal structure of and association between time series. The multitaper method provides robust estimates of these quantities for noisy and non-stationary time series that are characteristic of neurophysiological recordings. This method has recently been shown to be useful in studying working memory and selective visual attention. However, these studies have raised the important technical issue of comparison of spectra or coherences from two samples of unequal sizes, for example when comparing estimates from different experimental conditions. This is difficult with existing statistical tests since the bias in the estimates depends on the sample size. Here we propose a set of procedures to resolve this issue. Our procedure for the coherence is based on the previously described quantity z=(tanh(c)-tanh(d))/sqrt(1/(2m-2)+1/(2n-2)), where c and d are coherence estimates from 2m and 2n samples respectively. When the number of samples is large, then under the null hypothesis of equal population coherence, z is distributed as N(0,1) for a stationary stochastic process. By applying the two sample Jackknife procedure to z, we derive expressions for the mean and variance of z, and declare the coherences to be equal if the Jackknife estimates are consistent with N(0,1). Interestingly, strong inconsistency between the Jackknife and the normal estimates is therefore diagnostic for the presence of non-Gaussian behavior. A similar analysis is also derived for two sample spectra. Finally, we provide application of these methods to experimental data. Support Contributed By: R01 MH62528-03, Cold Spring Harbor Laboratory Citation:H.S. Bokil, K. Purpura, D. Thomson, P.P. Mitra. COMPARING SPECTRA AND COHERENCES FOR SAMPLES OF UNEQUAL SIZE Program No. 689.22. 2005 Abstract Viewer/Itinerary Planner. Washington, DC: Society for Neuroscience, 2005. Online. 2005 Copyright by the Society for Neuroscience all rights reserved. Permission to republish any abstract or part of any abstract in any form must be obtained in writing from the SfN office prior to publication -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Pascal Fries Sent: Monday, February 27, 2006 6:57 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Activation vs. baseline Hi Tom, > Pascal Fries wrote: > > OK. I had been asking, because coherence (and also power) > have a bias > > that is sample size dependent. For those measures, particularly for > > coherence, I would suggest to use equal sample sizes. > > Correct me if I am wrong, but this bias is due to the slow > convergence of the covariance; with more samples, the > covariance converges more (assuming it converges at all). > Furthermore it probably converges 'up', so if you have more > samples, you'll see (apparently) more power. I still haven't fully understood the sample size bias of power. For coherence, the issue is simple to understand. As you write, it has to do with the slow convergence towards the true value as the sample increases. But in the coherence case, values will converge "down" towards the true value, not 'up'. For one trial, coherence is numerically always one and will then decrease as you add more trials. In the case of a true coherence of one, it will not decrease and in the case of a true coherence zero, it will rapidly decrease. This is one of the most important things on the agenda for the basic spectral analysis in FieldTrip: To get a good estimate of the coherence bias and subtract it. Until this is finalized, the safest approach is to trim datasets before comparison to equal size. > I have sometimes dealt with this problem in the past by > simply z-scoring the volumes afterwards, thus shifting the > means back to zero. But perhaps there are skewness issues as > well? I've mostly done that when playing around with things > like overlapping windows; for example, using an active window > of 0 to 300 ms and a control window of 0 to 250 ms, you > expect a slightly higher power in the active state because of > the increase convergence, but then normalizing that spatially > can give you an estimate of active areas for that 250-300 ms > window. There may also be problematic beamformer overlap in > this case, though, but that can be dealt with too. Just a thought. I agree: If sample sizes are not orders of magnitude different, then a z-transformation can take care of most of the bias. Best, Pascal From Daniel.Jokisch at FCDONDERS.RU.NL Mon Feb 27 18:35:18 2006 From: Daniel.Jokisch at FCDONDERS.RU.NL (Daniel Jokisch) Date: Mon, 27 Feb 2006 18:35:18 +0100 Subject: Bug in multiplotTFR? Message-ID: Hi, after analyzing my MEG-data with freqanalysis I wanted to plot the data with multiplotTFR. It does not work and I get the following error message: ??? Reference to non-existent field 'zparam'. Error in ==> multiplotTFR at 123 if (strcmp(cfg.zparam,'cohspctrm')) & (~isfield(data, 'labelcmb')) I have used exactly the same parameters as last time (before the change in Fieltrip). When I define zparam in the configuration, I get the following error message: ??? Error using ==> freqbaseline unsupported data dimensions, dimord should be "chan_freq_time" Error in ==> multiplotTFR at 139 data = freqbaseline(cfg, data); I guess there is a bug in the new version of multiplotTFR. Best, Daniel -- Daniel Jokisch, PhD F.C. Donders Centre for Cognitive Neuroimaging P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Phone: +31 24 36 68294 Fax : +31 24 36 10989 http://www.ru.nl/fcdonders/ From r.oostenveld at FCDONDERS.RU.NL Mon Feb 27 20:50:58 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Feb 2006 20:50:58 +0100 Subject: new plotting functionality Message-ID: Dear all, Dennis has implemented new plotting functions, they have been committed to CVS this afternoon. The most important difference is that of adding the option cfg.interactive='yes' or 'no' (default) If you specify interactive-yes, you can make a selection, click on it, and that selection will be plotted in a new figure. I.e. if you start with a topoplotTFR, you can make a selection of channels, and the average TFR of that channels will be plotted in the next figure as a singleplotTFR. If you select a time-frequency window in that singgleplotTFR, that selection will be plotted in a topoplotTFR. A similar selection is possible in multiplotTFR, and the same interactive sequence of plotting is possible for topo/multi/ singleplotER. In case of 3D (TFR) data, the default xparam is 'time', the yparam is 'freq' and the zparam is powspctrm or cohspctrm. In case of 2D data (event-related field or power spectra), the xparam is either 'time' or 'freq', and the zparam is 'avg' or 'powspctrm'. Please read the documentation of each of the functions for the new options. best regards, Robert & Dennis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From r.oostenveld at FCDONDERS.RU.NL Thu Feb 2 16:55:36 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 2 Feb 2006 16:55:36 +0100 Subject: dft filtering for 50Hz In-Reply-To: <000101c62808$cf668650$90514484@dellgx240> Message-ID: Hi Vladimir, On 2-feb-2006, at 15:56, Vladimir Litvak wrote: > I think I already asked you this once but I couldn't find your > answer in my > archives. In the Science paper and in the recent J. Neurosci. Paper > of Bauer > et al. you mention the method for removing line noise with DFT. Is it > implemented in FT? C yes. in preprocessing with cfg.dftfilter=yes, optionally cfg.dftfreq (default is [50 100 150]), and what we do is cfg.padding=10 to pad the data up to 10 seconds before subtracting the 50Hz sine wave. The padding ensures that we only filter out a narrow 1/10 Hz wide frequency bin. After sufficient mutitapering in the frequency domain, you won't notice the narrow 50Hz notch any more. If you don't filterpad, and e.g. have 0.5 s trials, you will put a wider 1/0.5=2Hz notch in your power spectrum. > an this just be done 'blindly' as the first step in > preprocessing or are there any special considerations? I have some > data with > TMS artifacts (deltas) which come about once in 10 sec (but not > regularly). That is problematic. A delta peak contains all frequencies, hence it will add significantly to the 50Hz estimate. In case of a jump estimating the 50Hz component, and subsequently subtracting this estimate, the filter is very likely to *increase* the amount of 50Hz in the remainder of the trial. You can consider it as filter ringing: the DFT filter is an infinite-impuls response (IIR) filter. We occasionally have "jumping" squids in the MEG, which resembles a step function. We detect them with artifact_jump, and remove all data 10 seconds before, untill 10 seconds after the jump. > The part I'm interested in is not contaminated by these deltas but > do you > think that such a delta appearing in the 10 sec segment that you > use to > compute DFT can somehow lead to a wrong result? Yep, see above. If there are not many TMS deltas, you should remove the trials nearby. This is all implemented in FT with artifact_jump and rejectartifact. If you are going to use this, please fetch a recent version of FieldTrip from the ftp server, since I recently cleaned up that part of the code considerably. Robert From Marcel.Bastiaansen at FCDONDERS.RU.NL Thu Feb 2 17:01:39 2006 From: Marcel.Bastiaansen at FCDONDERS.RU.NL (Marcel Bastiaansen) Date: Thu, 2 Feb 2006 17:01:39 +0100 Subject: update: artifact detection In-Reply-To: <9AA693A5-1714-4BD6-87DD-BCFBBE717A06@fcdonders.ru.nl> Message-ID: Dear Robert, Thanks for updating the functions. They generally look much better now. I have a slight problem however. For certain types of analysis (e.g. multitaper) I need some data before and after the actual trials in my experiment (to allow tapers to shift into the data at the beginning of the trial, and out of the data at the end of the trial). Usually I cut my data so that these extra datapoints are part of the 'trial', but I don't check these extra datastretches for EOG artefacts (as they fall in the ITI they typically contain a lot of blinks). I used to do that by specifying a negative padding value in the artefact_eog function, but that is no longer possible. Hence, my question is, whether it would be possible to include the option of checking only a user-specified part of each trial for artefacts. Another thing is that it is not (yet?) possible to call the old artefact routines in the way you specified it in your message below (though it is possible to directly call the artefact_eog_old function). Best, Marcel Robert Oostenveld wrote: > Dear Fieldtrip users, > > I have updated the artifact detection functions (artiact_xxx, where > xxx=jump, eog and muscle). Each of these three functions was already > based on the same underlying idea, namely to filter and preprocess > the data, then z-transform the result, cummulate the z-values over > channels and finally look for z-values that are larger than the > cutoff level. To reflect this similarity, I have created a new > function: artifact_zvalue. Each of the artifact_jump, eog and muscle > functions now sets some default values and then calls > artifact_zvalue. That facilitates the maintenance and ensures that > all functions behave the same regarding graphical feedback. From now > on, you can also visually verify the trial definition and the > detected artifacts in rejectartifact, using cfg.artfctdef.feedback=yes. > > Most important for you to know is that: > 1) the new functions should be largely backward compatible. The > filtering and preprocessing computations were only marginally > changed, so the outcome should be almost the same. > 2) the padding has been better defined. I will also write an artifact > detection tutorial that explains these padding values better. > 3) the new artifact detections functions (for jump, eog and muscle) > now only will work on continuous and pseudo-continuous data. Jumps in > the data at the trial boundaries for non-continous data are not dealt > with and will mess up the result so --if you want to use them on > trial-based data-- you are responsible yourself for configuring the > padding options correctly. > 4) the old functions are still available, with the name > artifact_xxx_old (where xxx=jump, eog and muscle). If you want to use > them, you should specify cfg.artifact.type={'eog_old', ...} and call > the rejectartifact function. > > The idea (which I will describe in the upcoming "artifact tutorial") > is that you do not use cfg.rejectjump/muscle/eog=yes any more in the > preprocessing cfg structure, but that you do the following steps > seperately: > cfg = something to start with... > cfg = definetrial(cfg) > cfg = artifact_eog(cfg) > cfg = artifact_eog(cfg) > cfg = artifact_jump(cfg) > cfg = artifact_muscle(cfg) > cfg = rejectartifact(cfg) > data = preprocessing(cfg) > > The fieldtrip version on home/common (inside the FCDC) will be > updated this afternoon. The fieldtrip version on the ftp server > (outside the FCDC) will be updated this evening. > > Since it is a large change in the fieldtrip code, bugs might have > crept in. Please be extra cautious the upcoming time and report > unusual behaviour. Sorry for the inconvenience that this may result in. > > best regards, > Robert > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Robert Oostenveld, PhD > F.C. Donders Centre for Cognitive Neuroimaging > Radboud University Nijmegen > phone: +31-24-3619695 > http://www.ru.nl/fcdonders/ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > -- dr. Marcel C.M. Bastiaansen. FC Donders Centre for Cognitive Neuroimaging Visiting address: Kapittelweg 29, 6525 EN Nijmegen, the Netherlands Mailing address: Trigon 181, PO Box 9101, 6500 HB Nijmegen, the Netherlands phone: + 31 24 3610 882 fax: + 31 24 3610 989 mail: marcel.bastiaansen at fcdonders.ru.nl web: http://www.ru.nl/aspx/get.aspx?xdl=/views/run/xdl/page&ItmIdt=20592&SitIdt=119&VarIdt=96 -- From r.oostenveld at FCDONDERS.RU.NL Thu Feb 2 18:12:41 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 2 Feb 2006 18:12:41 +0100 Subject: update: artifact detection In-Reply-To: <43E22CE3.6060403@fcdonders.ru.nl> Message-ID: Hi Marcel On 2-feb-2006, at 17:01, Marcel Bastiaansen wrote: > Thanks for updating the functions. They generally look much better > now. > I have a slight problem however. For certain types of analysis (e.g. > multitaper) I need some data before and after the actual trials in my > experiment (to allow tapers to shift into the data at the beginning of > the trial, and out of the data at the end of the trial). Usually I cut > my data so that these extra datapoints are part of the 'trial', but I > don't check these extra datastretches for EOG artefacts (as they > fall in > the ITI they typically contain a lot of blinks). That means that the eventual eye artifacts might be smeared (due to the wavelet length, or the equivalent multitaper mechanism) into later timepoints. I guess that yu are aware of that, and I assume that that is not a problem. > I used to do that by > specifying a negative padding value in the artefact_eog function, but > that is no longer possible. Hence, my question is, whether it would be > possible to include the option of checking only a user-specified > part of > each trial for artefacts. The usual sequence of functions needed to get raw data from disk into matlab memory is definetrial -> rejectartifact -> preprocessing However, rejectartifact can (for you as end user) also be split up into seperate parts. The first part is detecting artifacts, the second part is deciding what to do with them. Artifact detection is implemented in the artifact_xxx functions (with xxx=eog//muscle/jump etc). The sequence then becomes definetrial -> artifact_eog -> rejectartifact -> preprocessing Artifact detection is only done on selected parts of the data. The part of the data where it searches for artifacts usually is the part that you later want to read in (using the preprocessing function), or sometimes with some extra time before and after each trial. Whether it is desirable to have this padding depends on your experimental question and type of data. The additional amount of time before and after each trial to look for artifacts is specified using the "trlpadding" option. However, you can also do it manually: cfg = [] cfg = ... cfg = definetrial(cfg); trlorg = cfg.trl; % <<<< make a copy of the original cfg.trl(:,1) = cfg.trl(:,1) - number_of_samples_pre cfg.trl(:,2) = cfg.trl(:,2) + number_of_samples_post cfg = artifact_eog(cfg); cfg.trl = trlorg; % <<<< put the original back cfg = rejectartifact(cfg); data = preprocessing(cfg); This also allows you to specify a negative amount of padding before and after each trial, i.e. if you do *not* want to look for artifacts in the first xxx ms. I suggest that for the moment you use this manual option. I might implement the pre and post padding seperately and add support for the negative padding, but don't hold your breath for it. > Another thing is that it is not (yet?) possible to call the old > artefact > routines in the way you specified it in your message below (though > it is > possible to directly call the artefact_eog_old function). Thanks, I will look into that. I don't immediately see a reason why it should not work, so that might indicate a bug. best Robert From jhouck at UNM.EDU Thu Feb 2 20:29:55 2006 From: jhouck at UNM.EDU (Jon Houck) Date: Thu, 2 Feb 2006 12:29:55 -0700 Subject: Errors with Neuromag 306 raw data Message-ID: Hello, I encountered a few problems in preprocessing using the latest fieldtrip version (fieldtrip-20060131) with raw Neuromag 306 channel data. Following are the error messages and the changes that seemed to clear them up. The first error was: ??? Undefined function or variable 'iscontinuous'. Error in ==> fieldtrip-20060131\private\trialfun_neuromag at 13 trigger = read_fcdc_data(cfg.datafile, hdr, 1, nsamples, chanindx, iscontinuous); Error in ==> definetrial at 151 trl = feval(cfg.trialfun, cfg); Error in ==> preprocessing at 270 [cfg] = definetrial(cfg); To work around this, I edited fieldtrip-20060131/private/trialfun_neuromag.m to replace iscontinuous on line 13 with 1. The edited line reads "trigger = read_fcdc_data(cfg.datafile, hdr, 1, nsamples, chanindx, 1);" And the second was: ??? Subscripted assignment dimension mismatch. Error in ==> read_fcdc_data at 392 dat(:,((i-begepoch)*hdr.nSamples+1):((i-begepoch+1)*hdr.nSamples)) = buf(:,chanindx)'; Error in ==> fieldtrip-20060131\private\trialfun_neuromag at 13 trigger = read_fcdc_data(cfg.datafile, hdr, 1, nsamples, chanindx, 1); Error in ==> definetrial at 151 trl = feval(cfg.trialfun, cfg); Error in ==> preprocessing at 270 [cfg] = definetrial(cfg); To fix this one, I edited fieldtrip-20060131/read_fcdc_data.m to replace buf(:,chanindx)' on line 392 with buf(chandindx,:). The edited line reads "dat(:,((i-begepoch)*hdr.nSamples+1):((i-begepoch+1)*hdr.nSamples)) = buf(chanindx,:);" These changes seem to work well on Matlab 7.1(R14) service pack 3 on Windows XP and Matlab 6.5 (R13) on HP-UX 10.20. If there are better workarounds or (equally likely) if I've irreparably broken something, please let me know. Regards, Jon Houck -------------------------------------------------- Jon Houck, M.A. Department of Psychology MSC03 2220 University of New Mexico Albuquerque, NM 87131 Office: (505) 277-0607 Lab: (505) 277-4725 Fax: (505) 277-1394 CASAA: (505) 925-2381 From r.oostenveld at FCDONDERS.RU.NL Thu Feb 2 21:58:51 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 2 Feb 2006 21:58:51 +0100 Subject: Errors with Neuromag 306 raw data In-Reply-To: Message-ID: Hi Jon On 2-feb-2006, at 20:29, Jon Houck wrote: > The first error was: ??? Undefined function or variable > 'iscontinuous'. > ... > To work around this, I edited fieldtrip-20060131/private/ > trialfun_neuromag.m to replace iscontinuous on line 13 with 1. The > edited line reads "trigger = read_fcdc_data(cfg.datafile, hdr, 1, > nsamples, chanindx, 1);" I think that fif files are continuous by default, but I am not sure. It matters for filtering and artifact detection, since reading over a discontinuous trial boundary would result in a weird jump in the signal. The iscontinuous flag in read_fcdc_data() indicates whether it should check if the desired data segments extend over trial boundaries. By default, the check is decided based on the data (if hdr.nTrials==1 then don't check, otherwise do check). It could be that the files are stored in blocks, like the ctf pseudocontinuous format. For that case, i.e. the data specifies that it is epoched, but the epochs form a continuous signal, I have implemented the flag cfg.datatype='continuous'. So I suggest to change line 13 to the following snippet if ~isfield(cfg, 'datatype') || ~strcmp(cfg.datatype, 'continuous') % datatype is unknown or not continuous, perform epoch boundary check iscontinuous = 0; else % do not perform epoch boundary check, usefull for pseudo- continuous data iscontinuous = strcmp(cfg.datatype, 'continuous'); end read_fcdc_data(cfg.datafile, hdr, 1, nsamples, chanindx, iscontinuous); That ensures decent (=safe) epoch boundary checking if the file specifies that it is epoched, and it allows you to pass the cfg.datatype=continuous option in case you know for sure that the data can be interpreted as continuous. I will change the code to include the segment that I gave above. > And the second was: ??? Subscripted assignment dimension mismatch. > > Error in ==> read_fcdc_data at 392 > dat(:,((i-begepoch)*hdr.nSamples+1):((i-begepoch+1) > *hdr.nSamples)) = buf(:,chanindx)'; > ... > To fix this one, I edited fieldtrip-20060131/read_fcdc_data.m to > replace buf(:,chanindx)' on line 392 with buf(chandindx,:). The > edited line reads "dat(:,((i-begepoch)*hdr.nSamples+1):((i-begepoch > +1)*hdr.nSamples)) = buf(chanindx,:);" You're right, the buf matrix should not be transposed. I'll fix that in the next release code as well. > These changes seem to work well on Matlab 7.1(R14) service pack 3 > on Windows XP and Matlab 6.5 (R13) on HP-UX 10.20. If there are > better workarounds or (equally likely) if I've irreparably broken > something, please let me know. Regarding the first bug that you reported, but seperate of that bug: I suggest to use trialfun_general, instead of trialfun_neuromag. The trialfun_neuromag is only for backward compatibility with the initial code, and the trialfun_general is used by default if you use in definetrial the following % cfg.trialdef.eventtype = 'string' % cfg.trialdef.eventvalue = number, string or list with numbers or strings % cfg.trialdef.prestim = 0.300 latency in seconds (optional) % cfg.trialdef.poststim = 0.700 latency in seconds (optional) alternatively, you can use % cfg.trialdef.eventtype = '?' That uses the read_fcdc_event function, which makes your (and our) code much more portable to other fileformats and allows more complex trigger sequences. Please read the read_fcdc_event help and code if you want to know more. Thanks for your contribution. best, Robert From luis.patino at UNIKLINIK-FREIBURG.DE Fri Feb 3 08:44:53 2006 From: luis.patino at UNIKLINIK-FREIBURG.DE (Dr. Jose Luis Patino Vilchis) Date: Fri, 3 Feb 2006 08:44:53 +0100 Subject: update: artifact detection In-Reply-To: <43E22CE3.6060403@fcdonders.ru.nl> Message-ID: Dear Robert, Is it there a paper explaining how the muscle artifact rejection is done? best regards Luis Patino Zitat von Marcel Bastiaansen : > Dear Robert, > > Thanks for updating the functions. They generally look much better now. > I have a slight problem however. For certain types of analysis (e.g. > multitaper) I need some data before and after the actual trials in my > experiment (to allow tapers to shift into the data at the beginning of > the trial, and out of the data at the end of the trial). Usually I cut > my data so that these extra datapoints are part of the 'trial', but I > don't check these extra datastretches for EOG artefacts (as they fall in > the ITI they typically contain a lot of blinks). I used to do that by > specifying a negative padding value in the artefact_eog function, but > that is no longer possible. Hence, my question is, whether it would be > possible to include the option of checking only a user-specified part of > each trial for artefacts. > Another thing is that it is not (yet?) possible to call the old artefact > routines in the way you specified it in your message below (though it is > possible to directly call the artefact_eog_old function). > > Best, > Marcel > > > Robert Oostenveld wrote: > > > Dear Fieldtrip users, > > > > I have updated the artifact detection functions (artiact_xxx, where > > xxx=jump, eog and muscle). Each of these three functions was already > > based on the same underlying idea, namely to filter and preprocess > > the data, then z-transform the result, cummulate the z-values over > > channels and finally look for z-values that are larger than the > > cutoff level. To reflect this similarity, I have created a new > > function: artifact_zvalue. Each of the artifact_jump, eog and muscle > > functions now sets some default values and then calls > > artifact_zvalue. That facilitates the maintenance and ensures that > > all functions behave the same regarding graphical feedback. From now > > on, you can also visually verify the trial definition and the > > detected artifacts in rejectartifact, using cfg.artfctdef.feedback=yes. > > > > Most important for you to know is that: > > 1) the new functions should be largely backward compatible. The > > filtering and preprocessing computations were only marginally > > changed, so the outcome should be almost the same. > > 2) the padding has been better defined. I will also write an artifact > > detection tutorial that explains these padding values better. > > 3) the new artifact detections functions (for jump, eog and muscle) > > now only will work on continuous and pseudo-continuous data. Jumps in > > the data at the trial boundaries for non-continous data are not dealt > > with and will mess up the result so --if you want to use them on > > trial-based data-- you are responsible yourself for configuring the > > padding options correctly. > > 4) the old functions are still available, with the name > > artifact_xxx_old (where xxx=jump, eog and muscle). If you want to use > > them, you should specify cfg.artifact.type={'eog_old', ...} and call > > the rejectartifact function. > > > > The idea (which I will describe in the upcoming "artifact tutorial") > > is that you do not use cfg.rejectjump/muscle/eog=yes any more in the > > preprocessing cfg structure, but that you do the following steps > > seperately: > > cfg = something to start with... > > cfg = definetrial(cfg) > > cfg = artifact_eog(cfg) > > cfg = artifact_eog(cfg) > > cfg = artifact_jump(cfg) > > cfg = artifact_muscle(cfg) > > cfg = rejectartifact(cfg) > > data = preprocessing(cfg) > > > > The fieldtrip version on home/common (inside the FCDC) will be > > updated this afternoon. The fieldtrip version on the ftp server > > (outside the FCDC) will be updated this evening. > > > > Since it is a large change in the fieldtrip code, bugs might have > > crept in. Please be extra cautious the upcoming time and report > > unusual behaviour. Sorry for the inconvenience that this may result in. > > > > best regards, > > Robert > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Robert Oostenveld, PhD > > F.C. Donders Centre for Cognitive Neuroimaging > > Radboud University Nijmegen > > phone: +31-24-3619695 > > http://www.ru.nl/fcdonders/ > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > -- > dr. Marcel C.M. Bastiaansen. > FC Donders Centre for Cognitive Neuroimaging > Visiting address: Kapittelweg 29, 6525 EN Nijmegen, the Netherlands > Mailing address: Trigon 181, PO Box 9101, 6500 HB Nijmegen, the Netherlands > phone: + 31 24 3610 882 > fax: + 31 24 3610 989 > mail: marcel.bastiaansen at fcdonders.ru.nl > web: > http://www.ru.nl/aspx/get.aspx?xdl=/views/run/xdl/page&ItmIdt=20592&SitIdt=119&VarIdt=96 > -- > > From georges.otte at PANDORA.BE Fri Feb 3 09:41:01 2006 From: georges.otte at PANDORA.BE (georges Otte) Date: Fri, 3 Feb 2006 09:41:01 +0100 Subject: update: artifact detection In-Reply-To: <1138952693.43e309f5b072f@webmail1.uniklinik-freiburg.de> Message-ID: Hi, I saw some paper from a group in Leuven eliminating EMG artefact based on the canonical component analysis (another Blind Source method). Google it with CCA- EEG. It worked very fast. I think that ANT compagny is looking into porting this into their standard software. The method is based on the difference in aotocorellation between EEG and EMG signals. Hope this helps, Georges ------------------------------------ Neurologpsychiatrie EEG-EMG Otte Georges Dr. georges.otte at pandora.be Bijlokehof 24 9000 Gent tel: 09 329 06 62 fax: 09 282 26 72 mobile: 0478 205 202 ------------------------------------ > -----Original Message----- > From: FieldTrip discussion list > [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Dr. Jose Luis > Patino Vilchis > Sent: vrijdag 3 februari 2006 8:45 > To: FIELDTRIP at NIC.SURFNET.NL > Subject: Re: [FIELDTRIP] update: artifact detection > > > Dear Robert, > > Is it there a paper explaining how the muscle artifact > rejection is done? > > best regards > > Luis Patino > > > Zitat von Marcel Bastiaansen : > > > Dear Robert, > > > > Thanks for updating the functions. They generally look much better > > now. I have a slight problem however. For certain types of analysis > > (e.g. > > multitaper) I need some data before and after the actual > trials in my > > experiment (to allow tapers to shift into the data at the > beginning of > > the trial, and out of the data at the end of the trial). > Usually I cut > > my data so that these extra datapoints are part of the > 'trial', but I > > don't check these extra datastretches for EOG artefacts (as > they fall in > > the ITI they typically contain a lot of blinks). I used to > do that by > > specifying a negative padding value in the artefact_eog > function, but > > that is no longer possible. Hence, my question is, whether > it would be > > possible to include the option of checking only a > user-specified part of > > each trial for artefacts. > > Another thing is that it is not (yet?) possible to call the > old artefact > > routines in the way you specified it in your message below > (though it is > > possible to directly call the artefact_eog_old function). > > > > Best, > > Marcel > > > > > > Robert Oostenveld wrote: > > > > > Dear Fieldtrip users, > > > > > > I have updated the artifact detection functions > (artiact_xxx, where > > > xxx=jump, eog and muscle). Each of these three functions > was already > > > based on the same underlying idea, namely to filter and > preprocess > > > the data, then z-transform the result, cummulate the > z-values over > > > channels and finally look for z-values that are larger than the > > > cutoff level. To reflect this similarity, I have created a new > > > function: artifact_zvalue. Each of the artifact_jump, eog > and muscle > > > functions now sets some default values and then calls > > > artifact_zvalue. That facilitates the maintenance and > ensures that > > > all functions behave the same regarding graphical > feedback. From now > > > on, you can also visually verify the trial definition and the > > > detected artifacts in rejectartifact, using > cfg.artfctdef.feedback=yes. > > > > > > Most important for you to know is that: > > > 1) the new functions should be largely backward compatible. The > > > filtering and preprocessing computations were only marginally > > > changed, so the outcome should be almost the same. > > > 2) the padding has been better defined. I will also write > an artifact > > > detection tutorial that explains these padding values better. > > > 3) the new artifact detections functions (for jump, eog > and muscle) > > > now only will work on continuous and pseudo-continuous > data. Jumps in > > > the data at the trial boundaries for non-continous data > are not dealt > > > with and will mess up the result so --if you want to use them on > > > trial-based data-- you are responsible yourself for > configuring the > > > padding options correctly. > > > 4) the old functions are still available, with the name > > > artifact_xxx_old (where xxx=jump, eog and muscle). If you > want to use > > > them, you should specify cfg.artifact.type={'eog_old', > ...} and call > > > the rejectartifact function. > > > > > > The idea (which I will describe in the upcoming "artifact > tutorial") > > > is that you do not use cfg.rejectjump/muscle/eog=yes any > more in the > > > preprocessing cfg structure, but that you do the following steps > > > seperately: > > > cfg = something to start with... > > > cfg = definetrial(cfg) > > > cfg = artifact_eog(cfg) > > > cfg = artifact_eog(cfg) > > > cfg = artifact_jump(cfg) > > > cfg = artifact_muscle(cfg) > > > cfg = rejectartifact(cfg) > > > data = preprocessing(cfg) > > > > > > The fieldtrip version on home/common (inside the FCDC) will be > > > updated this afternoon. The fieldtrip version on the ftp server > > > (outside the FCDC) will be updated this evening. > > > > > > Since it is a large change in the fieldtrip code, bugs might have > > > crept in. Please be extra cautious the upcoming time and report > > > unusual behaviour. Sorry for the inconvenience that this > may result in. > > > > > > best regards, > > > Robert > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > Robert Oostenveld, PhD > > > F.C. Donders Centre for Cognitive Neuroimaging > > > Radboud University Nijmegen > > > phone: +31-24-3619695 > > > http://www.ru.nl/fcdonders/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > > -- > > dr. Marcel C.M. Bastiaansen. > > FC Donders Centre for Cognitive Neuroimaging > > Visiting address: Kapittelweg 29, 6525 EN Nijmegen, the Netherlands > > Mailing address: Trigon 181, PO Box 9101, 6500 HB Nijmegen, > the Netherlands > > phone: + 31 24 3610 882 > > fax: + 31 24 3610 989 > > mail: marcel.bastiaansen at fcdonders.ru.nl > > web: > > > http://www.ru.nl/aspx/get.aspx?xdl=/views/run/xdl/page&ItmIdt= > 20592&SitIdt=119&VarIdt=96 > > -- > > > > > > From lauri at NEURO.HUT.FI Fri Feb 3 11:45:49 2006 From: lauri at NEURO.HUT.FI (Lauri Parkkonen) Date: Fri, 3 Feb 2006 12:45:49 +0200 Subject: Errors with Neuromag 306 raw data In-Reply-To: <5BC129DE-7F2D-4D29-A749-03F47B3B4EDC@fcdonders.ru.nl> Message-ID: Hello Robert and Jon >> The first error was: ??? Undefined function or variable 'iscontinuous'. >> ... >> To work around this, I edited fieldtrip-20060131/private/ >> trialfun_neuromag.m to replace iscontinuous on line 13 with 1. The >> edited line reads "trigger = read_fcdc_data(cfg.datafile, hdr, 1, >> nsamples, chanindx, 1);" > > > I think that fif files are continuous by default, but I am not sure. > It matters for filtering and artifact detection, since reading over a > discontinuous trial boundary would result in a weird jump in the signal. Yes, the "raw data" fif files are continuous over trials, i.e., there is no "epoch mode", however, one fif file can hold several data segments. For example, two different experimental conditions can be recorded in the same file as separate segments; the boundary between the segments is of course a discontinuity. The MEX function "rawdata" returns the string 'skip' as status when a segment boundary is encountered in a fif file. I have added some more checking to read_fcdc_data so that these boundaries are not silently ignored. Robert: I could incorporate my changes to your most recent version since my read_fcdc_data is very old. With the best regards, Lauri -- ----------------------------------------------- Lauri Parkkonen Brain Research Unit, Low Temperature Laboratory Helsinki University of Technology Otakaari 3 A, 02150 ESPOO, FINLAND tel: +358-9-4512965 fax: +358-9-4512969 mailto:lauri at neuro.hut.fi http://boojum.hut.fi From r.oostenveld at FCDONDERS.RU.NL Fri Feb 3 12:44:40 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 3 Feb 2006 12:44:40 +0100 Subject: Errors with Neuromag 306 raw data In-Reply-To: <43E3345D.3090602@neuro.hut.fi> Message-ID: Hi Lauri On 3-feb-2006, at 11:45, Lauri Parkkonen wrote: > Yes, the "raw data" fif files are continuous over trials, i.e., > there is no "epoch mode", however, one fif file can hold several > data segments. For example, two different experimental conditions > can be recorded in the same file as separate segments; the boundary > between the segments is of course a discontinuity. The MEX function > "rawdata" returns the string 'skip' as status when a segment > boundary is encountered in a fif file. I have added some more > checking to read_fcdc_data so that these boundaries are not > silently ignored. > > Robert: I could incorporate my changes to your most recent version > since my read_fcdc_data is very old. Thanks, I would appreciate that very much. Please fetch the latest version of the read_fcdc_data function from ftp://ftp.fcdonders.nl/ pub/fieldtrip. If you change that one, it is easy for me to update the official version. best, Robert From tolgacan1 at YAHOO.COM Sat Feb 4 21:47:18 2006 From: tolgacan1 at YAHOO.COM (Tolga Ozkurt) Date: Sat, 4 Feb 2006 21:47:18 +0100 Subject: neuromag data and lead fields for sensors Message-ID: Hello all, I have just downloaded Fieldtrip and trying use it with data collected from Neuromag 306 Vectorview system. When I used the version of fieldtrip- 20060131; I had some problems even with reading data and I had to make some minor changes in the code mentioned in the pervious post of the list. The main problem of me is how to compute the lead field with Neuromag data? The fieldtrip gives me orientation values which are exactly same for the same coil. Haw can I exploit these orientation of the sensors for two planar gradiometers and one magneteometer for each coil? I will appreciate, if you could help. Thanks. Tolga Esat Ozkurt From r.oostenveld at FCDONDERS.RU.NL Sun Feb 5 13:16:31 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Sun, 5 Feb 2006 13:16:31 +0100 Subject: update: artifact detection In-Reply-To: <1138952693.43e309f5b072f@webmail1.uniklinik-freiburg.de> Message-ID: Dear Luis, No, we have not described it in much detail in our publications, we only mention that it is a semi-automatic procedure. The approach is the following: we bandpass filter the data in the frequency band where the artifact is most pronounced, then we hilbert transform (i.e. compute the signal amplitude envelope, which is comparable to rectifying and smoothing). This is done per channel. For each signal obtained like this, we z-transform it, i.e. subtract the mean and divide by the standard deviation (over time). Then we sum all z-values and divide by the square root of the number of channels that goes into the sum. This results in a single pseudo- signal that is sensitive to the artifact that we want to detect. We then threshold this pseudo siugnal. After thresholding, we use visual feedback of the original data to check that the desired artifacts are really detected using the filtering and thhesholding options. In the feedback, the original unfiltered data of that channel is shown which contributed the most to the z-value (i.e. the channel that is the most artifact-like). We are reasonably happy with the performance of this approach on MEG and on EOG data, it allows us to do it reasonably objective and it saves a lot of time browsing through the 151 channels of our MEG. Recently we recorded a small MEG dataset with a lot of artifacts on purpose. I am working on writing a tutorial on the artifact detection using that dataset, which will then also be made available on the ftp server. Robert On 3-feb-2006, at 8:44, Dr. Jose Luis Patino Vilchis wrote: > Dear Robert, > > Is it there a paper explaining how the muscle artifact rejection is > done? > > best regards > > Luis Patino > From r.oostenveld at FCDONDERS.RU.NL Sun Feb 5 13:30:17 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Sun, 5 Feb 2006 13:30:17 +0100 Subject: update: artifact detection In-Reply-To: <03b801c6289d$95046eb0$0400a8c0@georges> Message-ID: Dear Georges, On 3-feb-2006, at 9:41, georges Otte wrote: > I saw some paper from a group in Leuven eliminating EMG artefact based > on the canonical component analysis (another Blind Source method). > Google it with CCA- EEG. It worked very fast. I think that ANT > compagny > is looking into porting this into their standard software. The > method is > based on the difference in aotocorellation between EEG and EMG > signals. We have implemented that algorithm in Fieldtrip, in the componentanalysis function (cfg.method=cca). I am not sure whether it is compleetly in the ftp release version of fieldtrip. We did try it out on our MEG data. It performed rather poor on our MEG data, the obvious EMG artifacts in the lower temporal channels were not very well separates into seperate components to be removed from the data. I suspect the reason for it performing rather poor on the MEG data is that it is based on 1-sample lag autocorrelation. The seperation (linear unmixing) using autocorrelation seperates the signal into high frequency components and low frequency components. But our MEG data has a much higher sampling rate (usually 1200Hz), and contains noise components at a much higher frequency than the EMG artifacts. It may work for clinical EEG data for which the Leuven group develloped the algorithm, since that is sampled at typically 250 Hz, which means that the EMG does correspond to the high frequency part of the data. It may be possible to tweak the algorithm (e.g. use N- lag autocorrelation) and to use differently preprocessed (filtered and downsampled) data to improve the performance, but we have not pursued that. Furthermore, we have not tested it on EEG data, so I cannot judge how it performs there. best Robert From r.oostenveld at FCDONDERS.RU.NL Sun Feb 5 13:55:02 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Sun, 5 Feb 2006 13:55:02 +0100 Subject: neuromag data and lead fields for sensors In-Reply-To: Message-ID: Dear Tolga, On 4-feb-2006, at 21:47, Tolga Ozkurt wrote: > Hello all, > I have just downloaded Fieldtrip and trying use it with data collected > from Neuromag 306 Vectorview system. When I used the version of > fieldtrip- > 20060131; I had some problems even with reading data and I had to make > some minor changes in the code mentioned in the pervious post of > the list. > The main problem of me is how to compute the lead field with Neuromag > data? The fieldtrip gives me orientation values which are exactly > same for > the same coil. Haw can I exploit these orientation of the sensors > for two > planar gradiometers and one magneteometer for each coil? I will > appreciate, if you could help. Thanks. Let me first explain the headmodels. Fieldtrip supports different forward models for MEG. The ones that we use the most are based on the multisphere model, i.e. each channel has it's own sphere. We construct the multisphere models by fitting the spheres to the head surface. That is done using CTF software, and the result is stored in a *.hdm file. Since recently we do have a fieldtrip function which can replace the CTF software, and which allows fitting the spheres to the brain surface instead of to the head surface. That function (prepare_localspheres) is not yet in the release version, if you are interested in beta testing, I can send it to you. Fieldtrip also supports single sphere models. Those can also be read from CTF *.hdm file, but are also easy to specify on the command line, e.g. cfg.vol.r = 12; cfg.vol.o = [0 0 5]; specifies a 12cm sphere with its origin in [0 0 5] (relative to the head coordinate system). Finally, fieldtrip also supports the use of the BEM head models that can be constructed in the Neuromag software. That requires the mex files which are released by Neuromag to their customers (I think in the pd-calc toolbox), specifically the mex file "megfield" is required. This code has been contributed by Joachim Gross, and he tested it for the 122 channel Neuromag system. [* see below] I suggest that for the moment, you try to get the single sphere model to work, since that is the easiest. Now the gradiometer array: It indeed has the position (grad.pnt) of each coil and the orientation (grad.ori) of each coil. But furthermore, it has the field grad.tra, which combines the field at the two coils into one gradiometer-channel-output. I.e. if grad.pnt=302x3 (for our 151 channel CTF), then grad.tra is 151x302. Multiplying the leadfield on the 302 coils with the 151x302 matrix results in the 151 channel leadfield that we need. The grad.tra is a very sparse matrix, consisting of the concatenation of identity matrices. That is where your question of the orientations relates to, i.e. If grad.tra = [eye(151) eye(151)], then the orientations of the two coils should be opposite, since the field at the two coils is added. If grad.tra = [eye(151) -eye(151)], then the orientations of the two coils should be the same, since the subtraction is coded in the minus sign. So the orientation can be coded either in the grad.ori, or in the grad.tra. I suspect that for the Neuromag, it is coded in the grad.tra matrix. I hope that this clarifies it. You should be able to use the prepare_leadfield() function to compute the leadfield at many grid locations at once. If you want to do more low-level computations yourself, you should use the private/compute_leadfield() function. I would appreciate it if you can report back whether it works, since sofar I don't fully know how well FieldTrip works on Neuromag data. In principle it should all work, and some people have used it wich success on their data, but I guess (as obvious from the previous mail) that there are still some small glitches that need to be fixed in the official version. So please share your findings with us, so that we can improve the support. best, Robert [*] I just checked, and it seems as this code is not in the current release version any more. I will build it back in. From georges.otte at PANDORA.BE Sun Feb 5 15:22:41 2006 From: georges.otte at PANDORA.BE (georges Otte) Date: Sun, 5 Feb 2006 15:22:41 +0100 Subject: update: artifact detection In-Reply-To: <6C531155-F4A3-45BF-A2D7-169629B4E3A6@fcdonders.ru.nl> Message-ID: I am working on writing a tutorial on the artifact > detection > using that dataset, which will then also be made available on > the ftp > server. > > Robert > This sounds very interesting as artefact removal is of uttermost importance in EEG also. It is interesting to note that differences in sample frequencies must indeed be kept in mind when applying certain algoritms. Please let us know when the tutorial will be ready. Sincerely, Georges Otte From georges.otte at PANDORA.BE Sun Feb 5 15:22:41 2006 From: georges.otte at PANDORA.BE (georges Otte) Date: Sun, 5 Feb 2006 15:22:41 +0100 Subject: update: artifact detection In-Reply-To: <9482A704-EAB9-4EDA-86B2-B656C08DC02F@fcdonders.ru.nl> Message-ID: Thanks Robert ! Georges Otte ------------------------------------ Neurologpsychiatrie EEG-EMG Otte Georges Dr. georges.otte at pandora.be Bijlokehof 24 9000 Gent tel: 09 329 06 62 fax: 09 282 26 72 mobile: 0478 205 202 ------------------------------------ > -----Original Message----- > From: FieldTrip discussion list > [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Robert Oostenveld > Sent: zondag 5 februari 2006 13:30 > To: FIELDTRIP at NIC.SURFNET.NL > Subject: Re: [FIELDTRIP] update: artifact detection > > > Dear Georges, > > On 3-feb-2006, at 9:41, georges Otte wrote: > > I saw some paper from a group in Leuven eliminating EMG > artefact based > > on the canonical component analysis (another Blind Source method). > > Google it with CCA- EEG. It worked very fast. I think that ANT > > compagny > > is looking into porting this into their standard software. The > > method is > > based on the difference in aotocorellation between EEG and EMG > > signals. > > We have implemented that algorithm in Fieldtrip, in the > componentanalysis function (cfg.method=cca). I am not sure > whether it > is compleetly in the ftp release version of fieldtrip. > > We did try it out on our MEG data. It performed rather poor on our > MEG data, the obvious EMG artifacts in the lower temporal channels > were not very well separates into seperate components to be removed > from the data. I suspect the reason for it performing rather poor on > the MEG data is that it is based on 1-sample lag > autocorrelation. The > seperation (linear unmixing) using autocorrelation seperates the > signal into high frequency components and low frequency components. > But our MEG data has a much higher sampling rate (usually 1200Hz), > and contains noise components at a much higher frequency than > the EMG > artifacts. > > It may work for clinical EEG data for which the Leuven group > develloped the algorithm, since that is sampled at typically 250 Hz, > which means that the EMG does correspond to the high frequency part > of the data. It may be possible to tweak the algorithm (e.g. use N- > lag autocorrelation) and to use differently preprocessed (filtered > and downsampled) data to improve the performance, but we have not > pursued that. Furthermore, we have not tested it on EEG data, so I > cannot judge how it performs there. > > best > Robert > > From kambiz.tavabi at UNI-MUENSTER.DE Mon Feb 6 12:22:24 2006 From: kambiz.tavabi at UNI-MUENSTER.DE (Kambiz Tavabi) Date: Mon, 6 Feb 2006 12:22:24 +0100 Subject: wavelet analysis In-Reply-To: <8C9FB8EC-56F7-46B3-BF43-F1D657AEF8B3@fcdonders.ru.nl> Message-ID: Hello, There does not seem to be a function/m-file waveletanaysis in the Jan. 21 2006 or few previous releases of FIELDTRIP. The following commands as per tutorials cfg = []; cfg.method = 'TFR'; cfg.foi = 15:30; cfg.channel = 'all'; cfg.keeptrials = 'no'; cfg.waveletwidth = 7; cfg.downsample = 4; TFRwave = waveletanalysis(cfg, dataFIC); save('TFR','TFRwave','-append'); Results in the output ??? Undefined command/function 'waveletanalysis'. Please advise, thank you. Kambiz From r.oostenveld at FCDONDERS.RU.NL Mon Feb 6 13:57:27 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 6 Feb 2006 13:57:27 +0100 Subject: wavelet analysis In-Reply-To: <000d01c62b0f$9a79b890$1423b080@KAMTRANSTEC> Message-ID: On 6-feb-2006, at 12:22, Kambiz Tavabi wrote: > Hello, > There does not seem to be a function/m-file waveletanaysis in the > Jan. 21 > 2006 or few previous releases of FIELDTRIP. > > The following commands as per tutorials > ... This has been moved to the general FREQANALYSIS function. You should call freqanalysis with the option cfg.method='tfr'. See "help freqanalysis" and "help freqanalysis_tfr". The 2005 version of the tutorial specifies it correctly, please use that instead of the 2004 version (see http://www2.ru.nl/fcdonders/ fieldtrip/tutorial.html) best regards, Robert From thomas.koelewijn at FCDONDERS.RU.NL Mon Feb 13 11:42:23 2006 From: thomas.koelewijn at FCDONDERS.RU.NL (Thomas Koelewijn) Date: Mon, 13 Feb 2006 11:42:23 +0100 Subject: No subject Message-ID: Dear all, I'm working with a old fieldtrip script in which I perform artefact rejection for both EOG channels separately. When I run the scrip for the second channel fieldtrip tells me that I already used EOG rejection and skips this part. Is there a trick to prevent this? Gr. Thomas From r.oostenveld at FCDONDERS.RU.NL Mon Feb 13 12:35:38 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 13 Feb 2006 12:35:38 +0100 Subject: dft filtering for 50Hz In-Reply-To: <000001c6308d$0cb183c0$90514484@dellgx240> Message-ID: Hi Vladimir > I looked at the data file and I see that in most trials there is a > TMS pulse > closer than 10 sec to the pulse I'm looking at. So I can't throw > out trials > where I don't get a clean 10 sec segment because then I'll throw > out most of > them. I think there are two options the simple one and the > complicated one: The method implemented in Fieldtrip to prevent filter atrifacts at the side of the trial, and also to get a very sharp (dft) line noise filter, is to pad the complete trial up to cfg.padding on *both* sides of the original trial. I.e. if you have a trial of 2 seconds, it will be padded with data for filtering with 4 seconds before and 4 seconds after the original trial. The padding segments are removed from the data imediately after the filtering has been done. Related to 50 or 60 Hz line noise filtering: the resulting notch is 1/ Tpadding, i.e. with 10 seconds the notch is 1/10 Hz, with 4 seconds it would be 1/4 Hz. I leave it up to you to decide whether that is much, it depends on the frequency and the amount of multi-taper smoothing that you can apply afterwards. If your data consists of short trials (e.g. 500ms), you would have a low frequency resolution anyway (1/0.5=2Hz). Besides using the default filter padding, you could also do it manually by modifying the cfg.trl trial definition. In your case I can imagine that you have plenty of time after the trial but not before (with the TMS pulse before each trial), so you can do cfg.trl (:,2) = cfg.trl(:,2)+N*Fsample and specify cfg.padding=0. Afterwards, you manually have to get rid of the additional data that has been glued at the end of each trial. > 1) The simple one is take 4 sec segments. In this case I can get > enough. The > question is whether it is better to pad them to 10 sec or less. You > say that > if I pad them to less I'll get a wider notch. The question is what > happens > if I pad too short a segment to 10 sec and how short is too short? If I were you, I would just give the 4 sec a try. You should not be too rigid about the 10 seconds, which is a good default for our own type of long-trial MEG experiments but which is impractically long for most other experiments. > 2) I can look at trials one by one, cut as long a segment as I can > before > the artifact and pad it if necessary to 10 sec. The question here > is whether > this will really improve things greatly. Also how do I implement it > - should > I read the data twice - first find the artifacts, rebuild the trl > structure > and then read again? Also can I use Fieldtrip artifact functions to > find the > artifacts? Yes you can, but I am not sure what the most sensitive way is of detecting the TMS artifacts. Look into the artifact_zvalue code and tweak the preprocessing options (see private/preproc) to make it sensitive to the TMS artifacts. Probbaly the settings used in artifact_muscle are already pretty close (except that you should not do the boxcar). Robert From r.oostenveld at FCDONDERS.RU.NL Mon Feb 13 12:56:40 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 13 Feb 2006 12:56:40 +0100 Subject: No subject In-Reply-To: <544b3ee4236ed.43f0709f@ru.nl> Message-ID: Hi Thomas On 13-feb-2006, at 11:42, Thomas Koelewijn wrote: > Dear all, > > I'm working with a old fieldtrip script in which I perform artefact > rejection for both EOG channels separately. When I run the scrip > for the second channel fieldtrip tells me that I already used EOG > rejection and skips this part. Is there a trick to prevent this? > > Gr. > Thomas You can erase the field cfg.artfctdef.eog after the first EOG detection. i.e. cfg = ... general settings ... cfg.artfctdef.eog = ... EOG1 settings ... cfg = artifact_eog(cfg); % detect EOG in channel 1 keepeog1 = cfg.artfctdef.eog; cfg.artfctdef.eog = []; cfg.artfctdef.eog = ... EOG2 settings ... cfg = artifact_eog(cfg); % detect EOG in channel 2 keepeog2 = cfg.artfctdef.eog; cfg.artfctdef.eog = []; Then you can concatenate the artifacts for EOG1 to those of EOG2 and reject them together: cfg.artfctdef.eog.artifact = [keepeog1.artifact; keepeog2.artifact]; % this is a Nx2 trl-like array without offset cfg = rejectartifact(cfg); I hope this works, Robert From kambiz.tavabi at UNI-MUENSTER.DE Fri Feb 17 10:05:05 2006 From: kambiz.tavabi at UNI-MUENSTER.DE (Kambiz Tavabi) Date: Fri, 17 Feb 2006 10:05:05 +0100 Subject: wavelet analysis In-Reply-To: Message-ID: Hello, According to the help text the command... [event] = read_fcdc_event('A0132_Aud-Obj-Recognition_20051115_02.ds') should provide all events from the dataset. In a similar fashion to read_fcdc_header which in fact works as or Jan. 31. However the call to read_fcdc_event results in the following error ??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 no channels were specified for reading CTF data Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); Error in ==> read_fcdc_event at 187 [backpanel, frontpanel] = read_ctf_trigger(filename); Please advise, thank you. Kambiz Tavabi From Jan.Schoffelen at FCDONDERS.RU.NL Fri Feb 17 10:18:06 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Fri, 17 Feb 2006 10:18:06 +0100 Subject: wavelet analysis In-Reply-To: <002201c633a1$3ec77c90$1423b080@KAMTRANSTEC> Message-ID: Dear Kambiz, This looks like a pretty low level error to me. >??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 >no channels were specified for reading CTF data >Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); It seems as if the variable stimindx has not been defined. Perhaps you could check that first, by putting a breakpoint at the specified line in read_ctf_trigger. Might it be the case that your dataset does not contain a channel with the label 'STIM'? Yours, Jan-Mathijs From kambiz.tavabi at UNI-MUENSTER.DE Fri Feb 17 11:13:15 2006 From: kambiz.tavabi at UNI-MUENSTER.DE (Kambiz Tavabi) Date: Fri, 17 Feb 2006 11:13:15 +0100 Subject: read_fcdc_event In-Reply-To: <003e01c633a3$0fac8c50$902dae83@fcdonders.nl> Message-ID: Hi Jan, When it comes to MATLAB I am a low level kind of guy! With a break @ line 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, A call to stimindx returns; Empty matrix: 0-by-1. The data I have has been recorded on a CTF machine with the newest available software which apparently displays only a virtual channel labeled STIM seen in the Data Editor. The virtual STIM channel is a combination of UPPT01 & UPPT02 parallel ports used for stimulus delivery. I can send you the dsinfo for this file if you'd like. Apparently stimindx is empty; and my dataset consists of a no channel labeled STIM. But this is in accordance with current CTF format. What to do now? Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 10:18 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] wavelet analysis Dear Kambiz, This looks like a pretty low level error to me. >??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 >no channels were specified for reading CTF data >Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); It seems as if the variable stimindx has not been defined. Perhaps you could check that first, by putting a breakpoint at the specified line in read_ctf_trigger. Might it be the case that your dataset does not contain a channel with the label 'STIM'? Yours, Jan-Mathijs From Jan.Schoffelen at FCDONDERS.RU.NL Fri Feb 17 12:03:09 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Fri, 17 Feb 2006 12:03:09 +0100 Subject: read_fcdc_event In-Reply-To: <002f01c633aa$c443c370$1423b080@KAMTRANSTEC> Message-ID: Dear Kambiz, As a first guess I would try to explicitly create this virtual 'STIM' channel, using DataEditor. Subsquently I would create a new dataset using the command-line program newDs. I recall that it has an option to include virtual channels in it. I would say, that then you have a dataset which actually contains a 'STIM' channel, so you can use it on the fieldtrip-files you have. Hope this is a sufficient workaround, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Kambiz Tavabi Sent: Friday, February 17, 2006 11:13 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Hi Jan, When it comes to MATLAB I am a low level kind of guy! With a break @ line 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, A call to stimindx returns; Empty matrix: 0-by-1. The data I have has been recorded on a CTF machine with the newest available software which apparently displays only a virtual channel labeled STIM seen in the Data Editor. The virtual STIM channel is a combination of UPPT01 & UPPT02 parallel ports used for stimulus delivery. I can send you the dsinfo for this file if you'd like. Apparently stimindx is empty; and my dataset consists of a no channel labeled STIM. But this is in accordance with current CTF format. What to do now? Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 10:18 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] wavelet analysis Dear Kambiz, This looks like a pretty low level error to me. >??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 >no channels were specified for reading CTF data >Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); It seems as if the variable stimindx has not been defined. Perhaps you could check that first, by putting a breakpoint at the specified line in read_ctf_trigger. Might it be the case that your dataset does not contain a channel with the label 'STIM'? Yours, Jan-Mathijs From kambiz.tavabi at UNI-MUENSTER.DE Fri Feb 17 14:07:43 2006 From: kambiz.tavabi at UNI-MUENSTER.DE (Kambiz Tavabi) Date: Fri, 17 Feb 2006 14:07:43 +0100 Subject: read_fcdc_event In-Reply-To: <003f01c633b1$bc77beb0$902dae83@fcdonders.nl> Message-ID: Dear Jan, This is not a practical workaround! I have already too many datasets extricated according to conditions from the raw continuous datasets. What I am trying to do with fcdc_event is an intermediary step in order to implement the TF analysis capabilities in FieldTrip. As I understand FIELDTRIP was written around the CTF format and considering read_fcdc.... is a low level operation I don't see why I need to use NewDs to meet a demand imposed by FIELDTRIP. Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 12:03 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Dear Kambiz, As a first guess I would try to explicitly create this virtual 'STIM' channel, using DataEditor. Subsquently I would create a new dataset using the command-line program newDs. I recall that it has an option to include virtual channels in it. I would say, that then you have a dataset which actually contains a 'STIM' channel, so you can use it on the fieldtrip-files you have. Hope this is a sufficient workaround, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Kambiz Tavabi Sent: Friday, February 17, 2006 11:13 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Hi Jan, When it comes to MATLAB I am a low level kind of guy! With a break @ line 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, A call to stimindx returns; Empty matrix: 0-by-1. The data I have has been recorded on a CTF machine with the newest available software which apparently displays only a virtual channel labeled STIM seen in the Data Editor. The virtual STIM channel is a combination of UPPT01 & UPPT02 parallel ports used for stimulus delivery. I can send you the dsinfo for this file if you'd like. Apparently stimindx is empty; and my dataset consists of a no channel labeled STIM. But this is in accordance with current CTF format. What to do now? Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 10:18 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] wavelet analysis Dear Kambiz, This looks like a pretty low level error to me. >??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 >no channels were specified for reading CTF data >Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); It seems as if the variable stimindx has not been defined. Perhaps you could check that first, by putting a breakpoint at the specified line in read_ctf_trigger. Might it be the case that your dataset does not contain a channel with the label 'STIM'? Yours, Jan-Mathijs From Jan.Schoffelen at FCDONDERS.RU.NL Fri Feb 17 14:56:56 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Fri, 17 Feb 2006 14:56:56 +0100 Subject: read_fcdc_event In-Reply-To: <003c01c633c3$23adcd70$1423b080@KAMTRANSTEC> Message-ID: Dear Kambiz, If you already have 'preprocessed' your data, which I understand from your statement that you already created new .ds, according to your conditions, I'd say you do not need to use read_fcdc_event anymore to extract your epochs of interest. Am I correct in assuming, that the data you want to read in, is 'trial-based', with all trials of a given condition concatenated in time? If it is too unpractical to re-create a newDs based on your raw data, then you have to define your trials in a different way. -As you have probably seen, you have to specify a trial-matrix in your configuration. In the case of trial-based data, the header contains this information: hdr = read_fcdc_header(headerfile) the fields: hdr.Ntrials (or hdr.nTrials, I don't know anymore) hdr.Nsamples give the information you need (you also have to know about the offset of each trial) for j = 1:hdr.Ntrials trl(:,1) = ([1:hdr.Ntrials]'-1)*hdr.Nsamples + 1; trl(:,2) = ([1:hdr.Ntrials]')*hdr.Nsamples; trl(:,3) = the offset end Then you can put this in your configuration and proceed with the analysis. -Another possibility is writing your own trial-detection function, not using read_fcdc_event, you can write your own function and call it when you specify cfg.trialfun = 'yourownfunction'; -Still, I would prefer my first suggestion, since the fun thing with fieldtrip is, that you can really flexibly define your epochs of interest from a datafile, which has been recorded continuously. One would not need to make the data 'trial-based' using the ctf-software. That means that you would have to create the newDs only once, and define your trials within fieldtrip. Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Kambiz Tavabi Sent: Friday, February 17, 2006 2:08 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Dear Jan, This is not a practical workaround! I have already too many datasets extricated according to conditions from the raw continuous datasets. What I am trying to do with fcdc_event is an intermediary step in order to implement the TF analysis capabilities in FieldTrip. As I understand FIELDTRIP was written around the CTF format and considering read_fcdc.... is a low level operation I don't see why I need to use NewDs to meet a demand imposed by FIELDTRIP. Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 12:03 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Dear Kambiz, As a first guess I would try to explicitly create this virtual 'STIM' channel, using DataEditor. Subsquently I would create a new dataset using the command-line program newDs. I recall that it has an option to include virtual channels in it. I would say, that then you have a dataset which actually contains a 'STIM' channel, so you can use it on the fieldtrip-files you have. Hope this is a sufficient workaround, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Kambiz Tavabi Sent: Friday, February 17, 2006 11:13 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Hi Jan, When it comes to MATLAB I am a low level kind of guy! With a break @ line 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, A call to stimindx returns; Empty matrix: 0-by-1. The data I have has been recorded on a CTF machine with the newest available software which apparently displays only a virtual channel labeled STIM seen in the Data Editor. The virtual STIM channel is a combination of UPPT01 & UPPT02 parallel ports used for stimulus delivery. I can send you the dsinfo for this file if you'd like. Apparently stimindx is empty; and my dataset consists of a no channel labeled STIM. But this is in accordance with current CTF format. What to do now? Thanks, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Friday, February 17, 2006 10:18 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] wavelet analysis Dear Kambiz, This looks like a pretty low level error to me. >??? Error using ==> fieldtrip-20060131\private\read_ctf_meg4 >no channels were specified for reading CTF data >Error in ==> fieldtrip-20060131\private\read_ctf_trigger at 64 >stim = read_ctf_meg4(datafile, hdr, 1, hdr.nTrials*hdr.nSamples, stimindx); It seems as if the variable stimindx has not been defined. Perhaps you could check that first, by putting a breakpoint at the specified line in read_ctf_trigger. Might it be the case that your dataset does not contain a channel with the label 'STIM'? Yours, Jan-Mathijs From muthuraman10 at HOTMAIL.COM Tue Feb 21 11:27:21 2006 From: muthuraman10 at HOTMAIL.COM (Muthuraman Muthuraman) Date: Tue, 21 Feb 2006 10:27:21 +0000 Subject: query on loading CNT files In-Reply-To: <89836CD8-5337-4B94-B820-6BD110A5DE2B@fcdonders.ru.nl> Message-ID: hello I have tried what you have suggested me in the previous mail and i have attached the steps i have performed in matlab and the error also if i skip the preprocessing step and go for the calculation of coherence using freqanalysis how to specify data in that case for the function (freq=freqanalysis(cfg,data)); please give me suggestion on this >>headerfile='pd_mof_tr0_o_0307.cnt'; >>hdr = read_fcdc_header(headerfile); Loading file pd_mof_tr0_o_0307.cnt ... >>cfg.trl = []; for i=1:floor(hdr.nSamples/hdr.Fs) cfg.trl(i,1) = (i-1)*hdr.Fs + 1; cfg.trl(i,2) = (i )*hdr.Fs; cfg.trl(i,3) = 0; end >>cfg cfg = trl: [172x3 double] >>[cfg] = definetrial(cfg); retaining exist trial definition found 0 events created 172 trials >>data=preprocessing(cfg); ??? Error using ==> read_fcdc_header file '' does not exist Error in ==> C:\muthu\work\fieldtrip-20060131\preprocessing.m On line 236 ==> hdr = read_fcdc_header(cfg.headerfile); with regards muthuraman >From: Robert Oostenveld >Reply-To: FieldTrip discussion list >To: FIELDTRIP at NIC.SURFNET.NL >Subject: Re: [FIELDTRIP] query on loading CNT files >Date: Tue, 24 Jan 2006 13:54:16 +0100 > >The relevant warning seems to be > >>Warning: no events found in pd_mof_tr0_o_0307.cnt > >That means that the low level code used to read the CNT file does not find >any triggers in your datafile. That either means that the low level >reading function (private/read_ns_cnt.m) has a bug, or that your data does >not contain any triggers. > >If it does not contain triggers (i.e. if there are no trials in the data), >you should make your own cfg.trl field prior to calling PREPROCESSING and >skip preprocessing. The documentation of DEFINETRIAL explains what cfg.trl >means. I suggest that you try something like > >hdr = read_fcdc_header(headerfile); >cfg.trl = []; >for i=1:floor(hdr.nSamples/hdr.Fs) > cfg.trl(i,1) = (i-1)*hdr.Fs + 1; % begin sample of each trial > cfg.trl(i,2) = (i )*hdr.Fs; % end sample > cfg.trl(i,3) = 0; % offset, i.e. relative location of >the time axis >end >data = preprocessing(cfg); > >This segments your continuous data in trials of one second length. > >best, >Robert > > > >On 24-jan-2006, at 11:46, Muthuraman Muthuraman wrote: > >>hello >> >>I am beginner with field trip >>as in the previous mail i have asked about the query on loading CNT files >>and according to the reply i need to call the function DEFINETRAIL >>in the function DEFINETRAIL i have to use the READ_FCDC_EVENT to find the >>events in the data >>which gave warnings >> >>i have attached in the mail what were exactly the steps carried out for >>the EEG analysis >> >>'pd_mof_tr0_o_0307.cnt' is the file which contains the data >> >> >> >>headerfile='pd_mof_tr0_o_0307.cnt'; >>>>[hdr] = read_fcdc_header(headerfile); >>Loading file pd_mof_tr0_o_0307.cnt ... >>>>hdr >> >>hdr = >> >> Fs: 1000 >> nChans: 64 >> nSamples: 172040 >> nSamplesPre: 0 >> nTrials: 1 >> label: {1x64 cell} >> >>>>datafile='pd_mof_tr0_o_0307.cnt';begsample=1;endsample=172;chanindx= >>>>64;continuous=1; >>>>[dat] = read_fcdc_data(datafile, hdr, begsample, endsample, chanindx, >>>>continuous); >>Loading file pd_mof_tr0_o_0307.cnt ... >>done >>>>filename='pd_mof_tr0_o_0307.cnt'; >>>>[event] = read_fcdc_event(filename) >>Warning: handling of event structure has not been fully tested for >>Neuroscan *.cnt files >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 414 >>Loading file pd_mof_tr0_o_0307.cnt ... >>done >>Warning: no events found in pd_mof_tr0_o_0307.cnt >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 620 >> >>event = >> >> [] >> >> >>Thanking you >>with regards >>muthuraman >> >>>From: Robert Oostenveld >>>Reply-To: FieldTrip discussion list >>>To: FIELDTRIP at NIC.SURFNET.NL >>>Subject: Re: [FIELDTRIP] query on loading CNT files >>>Date: Wed, 18 Jan 2006 21:20:37 +0100 >>> >>>Dear Muthuraman >>> >>>All analyses start by calling the PREPROCESSING function, which reads >>>the data segments of interest into memory. Prior to that, you should >>>call DEFINETRIAL to determine the data segments of interest (usually >>>based on the triggers present in the datafile). Please see the help of >>>those two functions (type "help function_name" on the matlab command >>>line) or look at http:// www2.ru.nl/fcdonders/fieldtrip/ reference.html >>> >>>best regards >>>Robert >>> >>> >>>On 18-jan-2006, at 11:44, Muthuraman Muthuraman wrote: >>> >>>>hello >>>> >>>>I would like to use fieldtrip to analyse EEG recordings >>>>how to load CNT files which contains the data >>>>how can i load the data and do the analysis >>>> >>>> >>>>with regards >>>>muthuraman >>>> >>> >>> >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>>Robert Oostenveld, PhD >>>F.C. Donders Centre for Cognitive Neuroimaging >>>Radboud University Nijmegen >>>phone: +31-24-3619695 >>>http://www.ru.nl/fcdonders/ >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> From Jan.Schoffelen at FCDONDERS.RU.NL Tue Feb 21 12:37:17 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Tue, 21 Feb 2006 12:37:17 +0100 Subject: query on loading CNT files In-Reply-To: Message-ID: Dear Muthuraman, I guess that you should specify the files which the preprocessing-function is going to read in. So you should specify a cfg.headerfile (which causes your crash, since you left it empty) and a cfg.datafile In your case I would try: cfg.headerfile = headerfile; cfg.datafile = headerfile; (since as far as I know, these are one and the same). Good luck, Jan-Mathijs PS: Since you already manually defined your trials, you do not need to call Definetrial anymore (so the step: [cfg] = definetrial(cfg) can be omitted) -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Muthuraman Muthuraman Sent: Tuesday, February 21, 2006 11:27 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] query on loading CNT files hello I have tried what you have suggested me in the previous mail and i have attached the steps i have performed in matlab and the error also if i skip the preprocessing step and go for the calculation of coherence using freqanalysis how to specify data in that case for the function (freq=freqanalysis(cfg,data)); please give me suggestion on this >>headerfile='pd_mof_tr0_o_0307.cnt'; >>hdr = read_fcdc_header(headerfile); Loading file pd_mof_tr0_o_0307.cnt ... >>cfg.trl = []; for i=1:floor(hdr.nSamples/hdr.Fs) cfg.trl(i,1) = (i-1)*hdr.Fs + 1; cfg.trl(i,2) = (i )*hdr.Fs; cfg.trl(i,3) = 0; end >>cfg cfg = trl: [172x3 double] >>[cfg] = definetrial(cfg); retaining exist trial definition found 0 events created 172 trials >>data=preprocessing(cfg); ??? Error using ==> read_fcdc_header file '' does not exist Error in ==> C:\muthu\work\fieldtrip-20060131\preprocessing.m On line 236 ==> hdr = read_fcdc_header(cfg.headerfile); with regards muthuraman >From: Robert Oostenveld >Reply-To: FieldTrip discussion list >To: FIELDTRIP at NIC.SURFNET.NL >Subject: Re: [FIELDTRIP] query on loading CNT files >Date: Tue, 24 Jan 2006 13:54:16 +0100 > >The relevant warning seems to be > >>Warning: no events found in pd_mof_tr0_o_0307.cnt > >That means that the low level code used to read the CNT file does not find >any triggers in your datafile. That either means that the low level >reading function (private/read_ns_cnt.m) has a bug, or that your data does >not contain any triggers. > >If it does not contain triggers (i.e. if there are no trials in the data), >you should make your own cfg.trl field prior to calling PREPROCESSING and >skip preprocessing. The documentation of DEFINETRIAL explains what cfg.trl >means. I suggest that you try something like > >hdr = read_fcdc_header(headerfile); >cfg.trl = []; >for i=1:floor(hdr.nSamples/hdr.Fs) > cfg.trl(i,1) = (i-1)*hdr.Fs + 1; % begin sample of each trial > cfg.trl(i,2) = (i )*hdr.Fs; % end sample > cfg.trl(i,3) = 0; % offset, i.e. relative location of >the time axis >end >data = preprocessing(cfg); > >This segments your continuous data in trials of one second length. > >best, >Robert > > > >On 24-jan-2006, at 11:46, Muthuraman Muthuraman wrote: > >>hello >> >>I am beginner with field trip >>as in the previous mail i have asked about the query on loading CNT files >>and according to the reply i need to call the function DEFINETRAIL >>in the function DEFINETRAIL i have to use the READ_FCDC_EVENT to find the >>events in the data >>which gave warnings >> >>i have attached in the mail what were exactly the steps carried out for >>the EEG analysis >> >>'pd_mof_tr0_o_0307.cnt' is the file which contains the data >> >> >> >>headerfile='pd_mof_tr0_o_0307.cnt'; >>>>[hdr] = read_fcdc_header(headerfile); >>Loading file pd_mof_tr0_o_0307.cnt ... >>>>hdr >> >>hdr = >> >> Fs: 1000 >> nChans: 64 >> nSamples: 172040 >> nSamplesPre: 0 >> nTrials: 1 >> label: {1x64 cell} >> >>>>datafile='pd_mof_tr0_o_0307.cnt';begsample=1;endsample=172;chanindx= >>>>64;continuous=1; >>>>[dat] = read_fcdc_data(datafile, hdr, begsample, endsample, chanindx, >>>>continuous); >>Loading file pd_mof_tr0_o_0307.cnt ... >>done >>>>filename='pd_mof_tr0_o_0307.cnt'; >>>>[event] = read_fcdc_event(filename) >>Warning: handling of event structure has not been fully tested for >>Neuroscan *.cnt files >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 414 >>Loading file pd_mof_tr0_o_0307.cnt ... >>done >>Warning: no events found in pd_mof_tr0_o_0307.cnt >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 620 >> >>event = >> >> [] >> >> >>Thanking you >>with regards >>muthuraman >> >>>From: Robert Oostenveld >>>Reply-To: FieldTrip discussion list >>>To: FIELDTRIP at NIC.SURFNET.NL >>>Subject: Re: [FIELDTRIP] query on loading CNT files >>>Date: Wed, 18 Jan 2006 21:20:37 +0100 >>> >>>Dear Muthuraman >>> >>>All analyses start by calling the PREPROCESSING function, which reads >>>the data segments of interest into memory. Prior to that, you should >>>call DEFINETRIAL to determine the data segments of interest (usually >>>based on the triggers present in the datafile). Please see the help of >>>those two functions (type "help function_name" on the matlab command >>>line) or look at http:// www2.ru.nl/fcdonders/fieldtrip/ reference.html >>> >>>best regards >>>Robert >>> >>> >>>On 18-jan-2006, at 11:44, Muthuraman Muthuraman wrote: >>> >>>>hello >>>> >>>>I would like to use fieldtrip to analyse EEG recordings >>>>how to load CNT files which contains the data >>>>how can i load the data and do the analysis >>>> >>>> >>>>with regards >>>>muthuraman >>>> >>> >>> >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>>Robert Oostenveld, PhD >>>F.C. Donders Centre for Cognitive Neuroimaging >>>Radboud University Nijmegen >>>phone: +31-24-3619695 >>>http://www.ru.nl/fcdonders/ >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> From tomh at KURAGE.NIMH.NIH.GOV Tue Feb 21 15:41:18 2006 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Tue, 21 Feb 2006 09:41:18 -0500 Subject: cfg.channel needed? Message-ID: Hi; just exploring some of the recent changes, I noticed that if you let cfg.channel default in preprocessing, you'll get all the channels, MEG + junk, as expected. But then if I'm doing cross-power and specify channel combinations of all MEG by all MEG, strange things happen. I get an error saying "The cross-spectral-density matrix is not complete" from prepare_freq_matrices(). This is because there are more channels in cfg.channel than in the csd matrix. I was thinking it might be nice for it to default to only the channels specified in the csd, but it looks like there's too much going on previously, and it's better to use cfg.channel in preprocessing. But the error message could be nicer. If you leave the call to channelcombination() out, that is, omit cfg.channelcmb = channelcombination({'MEG' 'MEG'}, data.label); from freqanalysis(), does it default to 'all' by 'all' so that if you said cfg.channel = { 'MEG' }; to preprocessing() you'll get 'MEG' by 'MEG'? Basically I just want to ask if cfg.channel is now more-or-less required to preprocessing()? Thanks Dr. Tom Holroyd The 9th Amendment of the U.S. Constitution: "The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people." From r.oostenveld at FCDONDERS.RU.NL Wed Feb 22 10:23:11 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 22 Feb 2006 10:23:11 +0100 Subject: read_fcdc_event In-Reply-To: <003c01c633c3$23adcd70$1423b080@KAMTRANSTEC> Message-ID: Dear Kambiz, I was away for a few days, otherwise I would have pointed this out to you and JM before: I recently got a patch from Tom Holroyd which exactly fixes this problem in the low level trigger reading code. I have applied the patch to the inhouse version, however, the ftp version of fieldtrip is currently slightly lagging behind. I hope to have the ftp version up to date again by the end of the week. Please find attached an updated read_fcdc_event an a read_ctf_trigger (which goes into the private subdir). These should return the trigger information for your new electronics. best regards, Robert PS could you perhaps send me a dataset with the new trigger channels? I have not been able to test the code since I was not able to test the code since we don't have the new eelctronics. If you would not mind, please put it on ftp://ftp.fcdonders.nl/pub/incoming and/or send me a direct mail. -------------- next part -------------- A non-text attachment was scrubbed... Name: read_ctf_trigger.m Type: application/octet-stream Size: 3780 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: read_fcdc_event.m Type: application/octet-stream Size: 25723 bytes Desc: not available URL: -------------- next part -------------- On 17-feb-2006, at 14:07, Kambiz Tavabi wrote: > Dear Jan, > This is not a practical workaround! I have already too many datasets > extricated according to conditions from the raw continuous > datasets. What I > am trying to do with fcdc_event is an intermediary step in order to > implement the TF analysis capabilities in FieldTrip. As I understand > FIELDTRIP was written around the CTF format and considering > read_fcdc.... is > a low level operation I don't see why I need to use NewDs to meet a > demand > imposed by FIELDTRIP. > > Thanks, > Kambiz From r.oostenveld at FCDONDERS.RU.NL Wed Feb 22 10:50:06 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 22 Feb 2006 10:50:06 +0100 Subject: cfg.channel needed? In-Reply-To: Message-ID: Hi Tom, The default for freqanalysis is cfg.channelcmb='all', which means all- with-all. If you do cfg.channel='MEG' in preprocessing and use the default in freqanalysis, you'll hence get MEG-with-MEG. Alternatively, preprocessing with cfg.channel='all' should also work and you should be able to get MEG-with-MEG using cfg.channelcmb as you have specified it. I am not sure what the problem is in your case, but I can explain what is happening: The idea is that sourceanalysis (and the underlying prepare_freq_matrices) should not make assumptions on the configuration that was used in freqanlysis, but has to rely on the output freq structure. Freqanalysis computes powsctrm and crsspctrm seperately and store them in arrays. To prevent excess memory use, only one copy of each channel combinations is strored (i.e. ch1-ch2, but not ch2-ch1). When you do sourceanalysis (which triggers prepare_freq_matrices ), a selection along the time and frequency dimension is made. In the nchanXnchan CSD matrix that is constructed, the powspctrm should be on the diagonal and the crsspctrm should be assigned to both off-diagonal sides of the CSD matrix. This is a large reshuffling of numbers coming from the two (pow/csspctrm) arrays. Since there is no guarantee that all elements of the CSD matrix can be found somewhere in either of the arrays, the CSD matrix is first filled with nans and then all elements that can be found are copied in. If, at the end, there is still a nan somewhere in the CSD matrix, then that means that the output of freqanalysis was not complete enough for sourceanalysis. See prepare_freq_matrices lines 147-175. I hope that this provides enough information for you to find the underlying problem in your case. Robert PS The code is not very readible, and is pretty old. I would implement it differently (although with the same basic idea) if I had to do it again. All the string comparisons between all channel combinations make it very slow. I would now do it using the cmb2label and label2cmb subfunctions that are currently only used inside the prepare_timefreq_data function. On 21-feb-2006, at 15:41, Tom Holroyd wrote: > Hi; just exploring some of the recent changes, I noticed that if > you let cfg.channel default in preprocessing, you'll get all the > channels, MEG + junk, as expected. But then if I'm doing cross- > power and specify channel combinations of all MEG by all MEG, > strange things happen. I get an error saying "The cross-spectral- > density matrix is not complete" from prepare_freq_matrices(). This > is because there are more channels in cfg.channel than in the csd > matrix. I was thinking it might be nice for it to default to only > the channels specified in the csd, but it looks like there's too > much going on previously, and it's better to use cfg.channel in > preprocessing. But the error message could be nicer. > > If you leave the call to channelcombination() out, that is, omit > cfg.channelcmb = channelcombination({'MEG' 'MEG'}, data.label); > from freqanalysis(), does it default to 'all' by 'all' so that if > you said > cfg.channel = { 'MEG' }; > to preprocessing() you'll get 'MEG' by 'MEG'? > > Basically I just want to ask if cfg.channel is now more-or-less > required to preprocessing()? > > Thanks > > Dr. Tom Holroyd > The 9th Amendment of the U.S. Constitution: > "The enumeration in the Constitution, of certain rights, shall not be > construed to deny or disparage others retained by the people." > From kambiz.tavabi at UNI-MUENSTER.DE Wed Feb 22 11:44:41 2006 From: kambiz.tavabi at UNI-MUENSTER.DE (Kambiz Tavabi) Date: Wed, 22 Feb 2006 11:44:41 +0100 Subject: read_fcdc_event In-Reply-To: <447B33B1-57A1-43A8-A146-471161BAE753@fcdonders.ru.nl> Message-ID: Dear Robert, I received an email from Dr. Holroyd describing implementation of his patch; I just haven't gotten around to it. Nonetheless, I appreciate the updated function files! As per your request I have uploaded the 'A0132_Aud-Obj-Recognition_20051115_02.ds' dataset in the incoming folder in the Donders FTP. It is a passive auditory dataset with an acoustic trigger on parallel port 1 used for event timing and 4 different stimuli coded on port two; the data is recorded with 3rd order gradient balancing. I have attached a dsinfo output of the data for your convenience. All the best, Kambiz -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Robert Oostenveld Sent: Wednesday, February 22, 2006 10:23 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] read_fcdc_event Dear Kambiz, I was away for a few days, otherwise I would have pointed this out to you and JM before: I recently got a patch from Tom Holroyd which exactly fixes this problem in the low level trigger reading code. I have applied the patch to the inhouse version, however, the ftp version of fieldtrip is currently slightly lagging behind. I hope to have the ftp version up to date again by the end of the week. Please find attached an updated read_fcdc_event an a read_ctf_trigger (which goes into the private subdir). These should return the trigger information for your new electronics. best regards, Robert PS could you perhaps send me a dataset with the new trigger channels? I have not been able to test the code since I was not able to test the code since we don't have the new eelctronics. If you would not mind, please put it on ftp://ftp.fcdonders.nl/pub/incoming and/or send me a direct mail. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: dsinfo.txt URL: From tomh at KURAGE.NIMH.NIH.GOV Wed Feb 22 23:11:25 2006 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd (NIH/NIMH) [E]) Date: Wed, 22 Feb 2006 17:11:25 -0500 Subject: cfg.channel needed? In-Reply-To: <2A2BC392-0CAD-47C3-9DBE-F79612C285DA@fcdonders.ru.nl> Message-ID: Robert Oostenveld wrote: > Hi Tom, > > The default for freqanalysis is cfg.channelcmb='all', which means all- > with-all. If you do cfg.channel='MEG' in preprocessing and use the > default in freqanalysis, you'll hence get MEG-with-MEG. Alternatively, > preprocessing with cfg.channel='all' should also work and you should be > able to get MEG-with-MEG using cfg.channelcmb as you have specified it. However, you can't. :-) > PS The code is not very readible, and is pretty old. I would implement > it differently (although with the same basic idea) if I had to do it > again. All the string comparisons between all channel combinations make > it very slow. That's certainly true; with 275 channels there are over 37,000 pairs. In prepare_freq_matricies.m, on line 125, Nchan is 302. The problem is that size(freq.label) is 306. Somewhere it is dropping some channels, and the numbers don't match. I did this: I let cfg.channel default in preprocessing, and used cfg.channelcmb = channelcombination({'MEG' 'MEG'}, data.label); with freqanalysis. Then to examine the state in sourceanalysis: > dbstop('prepare_freq_matrices', '125'); At this point, cfg.channel has the MEG channels and the references ONLY (and the references have been moved to the end for some reason). freq.label includes everything. Because they don't match, the matrix is built to the wrong size. I tried pruning cfg.channel to just the MEGs, but that caused more problems downstream. FYI, the script I'm using uses prepare_leadfield, does that matter? -- Dr. Tom Holroyd The 9th Amendment of the U.S. Constitution: "The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people." From muthuraman10 at HOTMAIL.COM Thu Feb 23 11:32:13 2006 From: muthuraman10 at HOTMAIL.COM (Muthuraman Muthuraman) Date: Thu, 23 Feb 2006 10:32:13 +0000 Subject: query on channel arrangement In-Reply-To: <001101c636db$2b3fb150$902dae83@fcdonders.nl> Message-ID: hello Thanks Jan We have the data for EEG taken with 64-channel(Neuroscan) arrangement and i need to specify channel arrangement when i want to calculate the coherence between EEG and EMG so for example : in real data FPZ- 45 -in the EEG channel arrangement AF7-41 -in the EEG channel arrangement M1-29- EMG channel M2-30-EMG channel M3-63-EMG channel M4-64-EMG channel but when i calculate the coherence i want them in the 64-channel layout instead of 151 layout and to change the channels in the coherence plot as for example- FPZ-1 -in the coherence plot AF7-2 -in the coherence plot M1-52-in the coherence plot M2-53-in the coherence plot M3-54-in the coherence plot M4-55-in the coherence plot Like this i wanted to change the channel arrangement in the coherence plot for all the channels how can i change it, please can you give me some idea regarding this with regards muthu >From: Jan Mathijs Schoffelen >Reply-To: FieldTrip discussion list >To: FIELDTRIP at NIC.SURFNET.NL >Subject: Re: [FIELDTRIP] query on loading CNT files >Date: Tue, 21 Feb 2006 12:37:17 +0100 > >Dear Muthuraman, > >I guess that you should specify the files which the preprocessing-function >is going to read in. So you should specify a > >cfg.headerfile (which causes your crash, since you left it empty) > >and a > >cfg.datafile > >In your case I would try: > >cfg.headerfile = headerfile; >cfg.datafile = headerfile; (since as far as I know, these are one and the >same). > >Good luck, > >Jan-Mathijs > >PS: Since you already manually defined your trials, you do not need to call >Definetrial anymore (so the step: [cfg] = definetrial(cfg) can be omitted) > >-----Original Message----- >From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf >Of Muthuraman Muthuraman >Sent: Tuesday, February 21, 2006 11:27 AM >To: FIELDTRIP at NIC.SURFNET.NL >Subject: Re: [FIELDTRIP] query on loading CNT files > >hello > >I have tried what you have suggested me in the previous mail >and i have attached the steps i have performed in matlab and the error also > >if i skip the preprocessing step >and go for the calculation of coherence using freqanalysis >how to specify data in that case for the function >(freq=freqanalysis(cfg,data)); >please give me suggestion on this > > > > >>headerfile='pd_mof_tr0_o_0307.cnt'; > >>hdr = read_fcdc_header(headerfile); >Loading file pd_mof_tr0_o_0307.cnt ... > >>cfg.trl = []; >for i=1:floor(hdr.nSamples/hdr.Fs) > cfg.trl(i,1) = (i-1)*hdr.Fs + 1; > cfg.trl(i,2) = (i )*hdr.Fs; > cfg.trl(i,3) = 0; >end > >>cfg > >cfg = > > trl: [172x3 double] > >>[cfg] = definetrial(cfg); >retaining exist trial definition >found 0 events >created 172 trials > > >>data=preprocessing(cfg); >??? Error using ==> read_fcdc_header >file '' does not exist > >Error in ==> C:\muthu\work\fieldtrip-20060131\preprocessing.m >On line 236 ==> hdr = read_fcdc_header(cfg.headerfile); > > > > >with regards >muthuraman > > > > >From: Robert Oostenveld > >Reply-To: FieldTrip discussion list > >To: FIELDTRIP at NIC.SURFNET.NL > >Subject: Re: [FIELDTRIP] query on loading CNT files > >Date: Tue, 24 Jan 2006 13:54:16 +0100 > > > >The relevant warning seems to be > > > >>Warning: no events found in pd_mof_tr0_o_0307.cnt > > > >That means that the low level code used to read the CNT file does not >find > > >any triggers in your datafile. That either means that the low level > >reading function (private/read_ns_cnt.m) has a bug, or that your data >does > > >not contain any triggers. > > > >If it does not contain triggers (i.e. if there are no trials in the >data), > > >you should make your own cfg.trl field prior to calling PREPROCESSING >and > >skip preprocessing. The documentation of DEFINETRIAL explains what >cfg.trl > > >means. I suggest that you try something like > > > >hdr = read_fcdc_header(headerfile); > >cfg.trl = []; > >for i=1:floor(hdr.nSamples/hdr.Fs) > > cfg.trl(i,1) = (i-1)*hdr.Fs + 1; % begin sample of each trial > > cfg.trl(i,2) = (i )*hdr.Fs; % end sample > > cfg.trl(i,3) = 0; % offset, i.e. relative location of > >the time axis > >end > >data = preprocessing(cfg); > > > >This segments your continuous data in trials of one second length. > > > >best, > >Robert > > > > > > > >On 24-jan-2006, at 11:46, Muthuraman Muthuraman wrote: > > > >>hello > >> > >>I am beginner with field trip > >>as in the previous mail i have asked about the query on loading CNT >files > >>and according to the reply i need to call the function DEFINETRAIL > >>in the function DEFINETRAIL i have to use the READ_FCDC_EVENT to find >the > > >>events in the data > >>which gave warnings > >> > >>i have attached in the mail what were exactly the steps carried out for > >>the EEG analysis > >> > >>'pd_mof_tr0_o_0307.cnt' is the file which contains the data > >> > >> > >> >>headerfile='pd_mof_tr0_o_0307.cnt'; > >>>>[hdr] = read_fcdc_header(headerfile); > >>Loading file pd_mof_tr0_o_0307.cnt ... > >>>>hdr > >> > >>hdr = > >> > >> Fs: 1000 > >> nChans: 64 > >> nSamples: 172040 > >> nSamplesPre: 0 > >> nTrials: 1 > >> label: {1x64 cell} > >> > >>>>datafile='pd_mof_tr0_o_0307.cnt';begsample=1;endsample=172;chanindx= > >>>>64;continuous=1; > >>>>[dat] = read_fcdc_data(datafile, hdr, begsample, endsample, chanindx, > >>>>continuous); > >>Loading file pd_mof_tr0_o_0307.cnt ... > >>done > >>>>filename='pd_mof_tr0_o_0307.cnt'; > >>>>[event] = read_fcdc_event(filename) > >>Warning: handling of event structure has not been fully tested for > >>Neuroscan *.cnt files > >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 414 > >>Loading file pd_mof_tr0_o_0307.cnt ... > >>done > >>Warning: no events found in pd_mof_tr0_o_0307.cnt > >>>In C:\muthu\work\fieldtrip-20060118\read_fcdc_event.m at line 620 > >> > >>event = > >> > >> [] > >> > >> > >>Thanking you > >>with regards > >>muthuraman > >> > >>>From: Robert Oostenveld > >>>Reply-To: FieldTrip discussion list > >>>To: FIELDTRIP at NIC.SURFNET.NL > >>>Subject: Re: [FIELDTRIP] query on loading CNT files > >>>Date: Wed, 18 Jan 2006 21:20:37 +0100 > >>> > >>>Dear Muthuraman > >>> > >>>All analyses start by calling the PREPROCESSING function, which reads > >>>the data segments of interest into memory. Prior to that, you should > >>>call DEFINETRIAL to determine the data segments of interest (usually > >>>based on the triggers present in the datafile). Please see the help >of > >>>those two functions (type "help function_name" on the matlab command > >>>line) or look at http:// www2.ru.nl/fcdonders/fieldtrip/ reference.html > >>> > >>>best regards > >>>Robert > >>> > >>> > >>>On 18-jan-2006, at 11:44, Muthuraman Muthuraman wrote: > >>> > >>>>hello > >>>> > >>>>I would like to use fieldtrip to analyse EEG recordings > >>>>how to load CNT files which contains the data > >>>>how can i load the data and do the analysis > >>>> > >>>> > >>>>with regards > >>>>muthuraman > >>>> > >>> > >>> > >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >>>Robert Oostenveld, PhD > >>>F.C. Donders Centre for Cognitive Neuroimaging > >>>Radboud University Nijmegen > >>>phone: +31-24-3619695 > >>>http://www.ru.nl/fcdonders/ > >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >> From r.oostenveld at FCDONDERS.RU.NL Fri Feb 24 11:49:29 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 24 Feb 2006 11:49:29 +0100 Subject: new website+wiki Message-ID: Dear FieldTrip users, We have implemented a new layout of the fieldtrip homepage, and a new technical system behind it. The homepage is still available at the same place: http://www.ru.nl/fcdonders/fieldtrip and I'd like to invite you to have a look at the new website. The system behint it is a wiki, similar to that used for Wikipedia (www.wikipedia.org). From now on anyone cabn contribute to the documentation! That means that, if you want to share documentation or demo scripts with others, you can do it directly through the website. Also if you notice an error in the documentation or a typo somewhere, you can fix it yourself immediately. There are still some parts of the old website that need to be copied to the new website, but we are working on that. If you have ideas, suggestions or comments, please share them with us. best regards, the fieldtrip team. PS At the moment we did not implement accounts and passwords, so anyone can contribute. If it turns out that the website becomes too messy, we will make the edit function restricted to people with an account. From tomh at KURAGE.NIMH.NIH.GOV Fri Feb 24 13:46:16 2006 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd) Date: Fri, 24 Feb 2006 07:46:16 -0500 Subject: new website+wiki In-Reply-To: <99025CC8-DE48-4F40-BFD6-145A4D93CB84@fcdonders.ru.nl> Message-ID: On Fri, 24 Feb 2006, Robert Oostenveld wrote: > PS At the moment we did not implement accounts and passwords, so anyone can > contribute. If it turns out that the website becomes too messy, we will make > the edit function restricted to people with an account. Robert, I would recommend a default account/password that everybody knows. That'll limit attacks from spammers. A common attack is just to create huge lists of links (often in the sidebar) to be indexed by search engines. The NIMH MEG Core website is also a wiki. We've enjoyed it; it's very easy to modify (if you know the magic word, which is shrimp). There's also an RSS feed of the "changed pages page" so it's easy to keep track of when modifications are made. Wikipedea doesn't need passwords as much because they have high vigilance on the main pages... Did you see the article on Magnetoencephalography? It has grown a lot (I've contributed, as have several others). Dr. Tom Holroyd The 9th Amendment of the U.S. Constitution: "The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people." From r.oostenveld at FCDONDERS.RU.NL Fri Feb 24 18:09:14 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Fri, 24 Feb 2006 18:09:14 +0100 Subject: change in data structures, inside, dimord, foi and toi Message-ID: Dear FieldTrip users We have made two relatively large changes to FieldTrip that may lead to incompatibilities with your own scripts, therefore a word of warning: The changes affect the "home/common" version inside the Donders Centre from this moment on. The changes affect the daily released ftp version from version 20060224, i.e. today onward. That version does not exist yet, but will be uploaded to the ftp version this evening (CET). From today onward, a daily release will be made available again (which was not the case for the last 2 weeks). The first change is that of volumes. Previously source volumes could have an "inside" and an "outside" vector with indices, indicating the voxels that were scanned with the beamformer or not. Those two "inside" and "outside" vectors have been replaced by an locigal/ boolean "inside" volume, which is 1 if the voxel was inside the brain (i.e. beamed) and 0 if outside the brain (i.e. not beamed). The second change relates to the dimord field that most fieldtrip data structures have, and the freq.foi and freq.toi fields. The use of the dimord field has been made consistent between all functions, due to which some dimords had to be renamed. More importantly, the time and frequency axis in the output of the freqanalysis function have been renamed to freq.time (used to be freq.toi) and freq.freq (used to be freq.foi). This ensures that the dimord and the description of the axes in the data structure is consistent. The dimord also will specify "chan_freq_time" instead of "sgncmb_frq_tim", i.e. the dimord is in better correspondence with the data strucute. We have kept all FieldTrip functions backward compatible, i.e. old datastructures that you have previously computed and saved to disk in a mat file will still work with the new FieldTrip functions. Since the changes affected many fieldtrip functions, it could very well be that the changes introduced some bugs here and there. Please inform us about them, so that we can fix them. Sorry about the inconvenience that this may cause with respect to your analysis scripts. The change was required to ensure a further consistent development of the FieldTrip code. yours sincerely, Robert ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From litvak at TECHUNIX.TECHNION.AC.IL Mon Feb 27 09:23:50 2006 From: litvak at TECHUNIX.TECHNION.AC.IL (Vladimir Litvak) Date: Mon, 27 Feb 2006 10:23:50 +0200 Subject: Activation vs. baseline Message-ID: Dear Eric and all, I'm playing with 'Activation vs. baseline' option in clusterrandanalysis. The problem is that my baseline is about 100ms while the activation period is 300 ms. I cannot extend the baseline since the raw data I have is already segmented. What is the right thing to do in this situation? Should I divide the activation period into 3 segments and test them separately? Or maybe replicate the baseline 3 times, concatenate and use this as baseline for the whole period? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From pascal.fries at FCDONDERS.RU.NL Mon Feb 27 10:05:00 2006 From: pascal.fries at FCDONDERS.RU.NL (Pascal Fries) Date: Mon, 27 Feb 2006 10:05:00 +0100 Subject: Activation vs. baseline In-Reply-To: <000d01c63b77$26406820$90514484@dellgx240> Message-ID: Dear Vladimir, what aspect of the two data pieces are you comparing? Power? Coherence? Amplitude? At the sensor or at the source level? Best, Pascal Pascal Fries Principal Investigator Neuronal Coherence Group F. C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen Kapittelweg 29 6525 EN Nijmegen The Netherlands Phone: (+31) (0)24 36 10657 Fax: (+31) (0)24 36 10989 e-mail: pascal.fries at fcdonders.ru.nl website: www.ru.nl/fcdonders/ _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Monday, February 27, 2006 9:24 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Activation vs. baseline Dear Eric and all, I'm playing with 'Activation vs. baseline' option in clusterrandanalysis. The problem is that my baseline is about 100ms while the activation period is 300 ms. I cannot extend the baseline since the raw data I have is already segmented. What is the right thing to do in this situation? Should I divide the activation period into 3 segments and test them separately? Or maybe replicate the baseline 3 times, concatenate and use this as baseline for the whole period? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Mon Feb 27 10:05:56 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Feb 2006 10:05:56 +0100 Subject: query on channel arrangement In-Reply-To: Message-ID: Dear Muthu FieldTrip always works with channel labels, not with channel numbers. All functions, e.g. freqdescriptives (which computes coherence) or the plotting functions use the labels. The channel labels are read from the datafile, if the datafile does not include the correct channel labels, you have to fix them yourself. Do that after preprocessin, i.e. after preprocessing you can change the data.label cell array. From then on, FT will not look in the data file any more, so the channnel labels will remain as you have renamed them. The freqanalysis or freqdescriptives function do not care where each channel is, they only care about the channelcombiations that you specify between which to compute coherence. The plotting functions of course do need to know where each channel is, otherwise it cannot plot. The information about the channel locations is stored in the layout file, which is an ascii text file with the extension *.lay. You should have a look in the elec1010.lay file, which probably is already pretty close to teh layout that you want to use. best Robert On 23-feb-2006, at 11:32, Muthuraman Muthuraman wrote: > We have the data for EEG taken with 64-channel(Neuroscan) arrangement > and i need to specify channel arrangement > when i want to calculate the coherence between EEG and EMG > > so for example : in real data > > FPZ- 45 -in the EEG channel arrangement > AF7-41 -in the EEG channel arrangement > > M1-29- EMG channel > M2-30-EMG channel > M3-63-EMG channel > M4-64-EMG channel > > but when i calculate the coherence i want them in the 64-channel > layout > instead of 151 layout > > and to change the channels in the coherence plot as > for example- > FPZ-1 -in the coherence plot > AF7-2 -in the coherence plot > > M1-52-in the coherence plot > M2-53-in the coherence plot > M3-54-in the coherence plot > M4-55-in the coherence plot > > Like this i wanted to change the channel arrangement in the > coherence plot for all the channels > how can i change it, please can you give me some idea regarding this From litvak at TECHUNIX.TECHNION.AC.IL Mon Feb 27 10:13:18 2006 From: litvak at TECHUNIX.TECHNION.AC.IL (Vladimir Litvak) Date: Mon, 27 Feb 2006 11:13:18 +0200 Subject: Activation vs. baseline In-Reply-To: Message-ID: Amplitude at the sensor level. Vladimir -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Pascal Fries Sent: Monday, February 27, 2006 11:05 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Activation vs. baseline Dear Vladimir, what aspect of the two data pieces are you comparing? Power? Coherence? Amplitude? At the sensor or at the source level? Best, Pascal Pascal Fries Principal Investigator Neuronal Coherence Group F. C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen Kapittelweg 29 6525 EN Nijmegen The Netherlands Phone: (+31) (0)24 36 10657 Fax: (+31) (0)24 36 10989 e-mail: pascal.fries at fcdonders.ru.nl website: www.ru.nl/fcdonders/ _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Monday, February 27, 2006 9:24 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Activation vs. baseline Dear Eric and all, I'm playing with 'Activation vs. baseline' option in clusterrandanalysis. The problem is that my baseline is about 100ms while the activation period is 300 ms. I cannot extend the baseline since the raw data I have is already segmented. What is the right thing to do in this situation? Should I divide the activation period into 3 segments and test them separately? Or maybe replicate the baseline 3 times, concatenate and use this as baseline for the whole period? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From conrado.bosman at GMAIL.COM Mon Feb 27 10:05:12 2006 From: conrado.bosman at GMAIL.COM (Conrado Bosman) Date: Mon, 27 Feb 2006 10:05:12 +0100 Subject: Error in freqdescriptives ? Message-ID: Hi Robert, After analyze my data with freqanalysis, I use freqdescriptive to get the values of coherence and the power spectrum. In my script I use the foollowing functions, FRtemp = freqanalysis(cfg3,MSMA); FR = freqdescriptives([],FRtemp); and I get the following error: ??? Undefined function or variable "data". Error in ==> freqdescriptives at 113 data = fixdimord(data); If I use the dbstop command, you can see that data variable at that point doesn't exist. 113 data = fixdimord(data); K>> whos Name Size Bytes Class cfg 1x1 164 struct array freq 1x1 25792480 struct array It could be that there is a bug in the name of the variable? (using data instead of freq) Thanks for your attention, Conrado Bosman -------------- next part -------------- An HTML attachment was scrubbed... URL: From pascal.fries at FCDONDERS.RU.NL Mon Feb 27 10:46:56 2006 From: pascal.fries at FCDONDERS.RU.NL (Pascal Fries) Date: Mon, 27 Feb 2006 10:46:56 +0100 Subject: Activation vs. baseline In-Reply-To: <000201c63b7e$0c86b270$90514484@dellgx240> Message-ID: Dear Valdimir, OK. I had been asking, because coherence (and also power) have a bias that is sample size dependent. For those measures, particularly for coherence, I would suggest to use equal sample sizes. As far as I can judge, this problem is not there for amplitude. Then it is to the cluterrandanalysis experts to help you with that particular analysis. Best, Pascal _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Monday, February 27, 2006 10:13 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Activation vs. baseline Amplitude at the sensor level. Vladimir -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Pascal Fries Sent: Monday, February 27, 2006 11:05 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Activation vs. baseline Dear Vladimir, what aspect of the two data pieces are you comparing? Power? Coherence? Amplitude? At the sensor or at the source level? Best, Pascal Pascal Fries Principal Investigator Neuronal Coherence Group F. C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen Kapittelweg 29 6525 EN Nijmegen The Netherlands Phone: (+31) (0)24 36 10657 Fax: (+31) (0)24 36 10989 e-mail: pascal.fries at fcdonders.ru.nl website: www.ru.nl/fcdonders/ _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Monday, February 27, 2006 9:24 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Activation vs. baseline Dear Eric and all, I'm playing with 'Activation vs. baseline' option in clusterrandanalysis. The problem is that my baseline is about 100ms while the activation period is 300 ms. I cannot extend the baseline since the raw data I have is already segmented. What is the right thing to do in this situation? Should I divide the activation period into 3 segments and test them separately? Or maybe replicate the baseline 3 times, concatenate and use this as baseline for the whole period? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From maris at NICI.RU.NL Mon Feb 27 12:01:24 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Mon, 27 Feb 2006 12:01:24 +0100 Subject: Activation vs. baseline Message-ID: Dear Vladimir, I'm playing with 'Activation vs. baseline' option in clusterrandanalysis. The problem is that my baseline is about 100ms while the activation period is 300 ms. I cannot extend the baseline since the raw data I have is already segmented. What is the right thing to do in this situation? Should I divide the activation period into 3 segments and test them separately? Or maybe replicate the baseline 3 times, concatenate and use this as baseline for the whole period? My advice is to divide the activation period into 3 segments and test them separately. You can correct for multiple comparisons by using the Bonferroni-corrected alpha-level of alpha/3. Good luck, Eric Maris From r.oostenveld at FCDONDERS.RU.NL Mon Feb 27 12:23:34 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Feb 2006 12:23:34 +0100 Subject: Error in freqdescriptives ? In-Reply-To: Message-ID: Hi Conrado, Thanks for reporting the bug. I have fixed it in the release version of Fieldtrip. Robert On 27-feb-2006, at 10:05, Conrado Bosman wrote: > Hi Robert, > > After analyze my data with freqanalysis, I use freqdescriptive to > get the values of coherence and the power spectrum. In my script I > use the foollowing functions, > > FRtemp = freqanalysis(cfg3,MSMA); > FR = freqdescriptives([],FRtemp); > > and I get the following error: > > ??? Undefined function or variable "data". > > Error in ==> freqdescriptives at 113 > data = fixdimord(data); > > If I use the dbstop command, you can see that data variable at that > point doesn't exist. > > 113 data = fixdimord(data); > K>> whos > Name Size Bytes Class > > cfg 1x1 164 struct array > freq 1x1 25792480 struct array > > It could be that there is a bug in the name of the variable? (using > data instead of freq) > > Thanks for your attention, > > Conrado Bosman > > From conrado.bosman at GMAIL.COM Mon Feb 27 14:56:00 2006 From: conrado.bosman at GMAIL.COM (Conrado Bosman) Date: Mon, 27 Feb 2006 14:56:00 +0100 Subject: Another bug in freqdescriptives_pf Message-ID: Hi Robert, I find other bug in freqdescriptives_pf. This is the error message ??? Undefined function or variable "output". Error in ==> freqdescriptives>freqdescriptives_pf at 318 output.powspctrm = output.pow; Best, Conrado -- Conrado -------------- next part -------------- An HTML attachment was scrubbed... URL: From tomh at KURAGE.NIMH.NIH.GOV Mon Feb 27 16:57:31 2006 From: tomh at KURAGE.NIMH.NIH.GOV (Tom Holroyd (NIH/NIMH) [E]) Date: Mon, 27 Feb 2006 10:57:31 -0500 Subject: Activation vs. baseline In-Reply-To: <2612D6C3714742A58C75AE68696B27FE@fcdonders.nl> Message-ID: Pascal Fries wrote: > OK. I had been asking, because coherence (and also power) have a bias > that is sample size dependent. For those measures, particularly for > coherence, I would suggest to use equal sample sizes. Correct me if I am wrong, but this bias is due to the slow convergence of the covariance; with more samples, the covariance converges more (assuming it converges at all). Furthermore it probably converges 'up', so if you have more samples, you'll see (apparently) more power. I have sometimes dealt with this problem in the past by simply z-scoring the volumes afterwards, thus shifting the means back to zero. But perhaps there are skewness issues as well? I've mostly done that when playing around with things like overlapping windows; for example, using an active window of 0 to 300 ms and a control window of 0 to 250 ms, you expect a slightly higher power in the active state because of the increase convergence, but then normalizing that spatially can give you an estimate of active areas for that 250-300 ms window. There may also be problematic beamformer overlap in this case, though, but that can be dealt with too. Just a thought. -- Dr. Tom Holroyd The 9th Amendment of the U.S. Constitution: "The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people." From r.oostenveld at FCDONDERS.RU.NL Mon Feb 27 17:28:56 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Feb 2006 17:28:56 +0100 Subject: Another bug in freqdescriptives_pf In-Reply-To: Message-ID: Hi Conrado, That also has been fixed. Robert On 27-feb-2006, at 14:56, Conrado Bosman wrote: > Hi Robert, > > I find other bug in freqdescriptives_pf. This is the error message > > ??? Undefined function or variable "output". > > Error in ==> freqdescriptives>freqdescriptives_pf at 318 > output.powspctrm = output.pow; > > Best, > Conrado > > -- > Conrado From pascal.fries at FCDONDERS.RU.NL Mon Feb 27 17:57:10 2006 From: pascal.fries at FCDONDERS.RU.NL (Pascal Fries) Date: Mon, 27 Feb 2006 17:57:10 +0100 Subject: Activation vs. baseline In-Reply-To: <4403216B.4030209@kurage.nimh.nih.gov> Message-ID: Hi Tom, > Pascal Fries wrote: > > OK. I had been asking, because coherence (and also power) > have a bias > > that is sample size dependent. For those measures, particularly for > > coherence, I would suggest to use equal sample sizes. > > Correct me if I am wrong, but this bias is due to the slow > convergence of the covariance; with more samples, the > covariance converges more (assuming it converges at all). > Furthermore it probably converges 'up', so if you have more > samples, you'll see (apparently) more power. I still haven't fully understood the sample size bias of power. For coherence, the issue is simple to understand. As you write, it has to do with the slow convergence towards the true value as the sample increases. But in the coherence case, values will converge "down" towards the true value, not 'up'. For one trial, coherence is numerically always one and will then decrease as you add more trials. In the case of a true coherence of one, it will not decrease and in the case of a true coherence zero, it will rapidly decrease. This is one of the most important things on the agenda for the basic spectral analysis in FieldTrip: To get a good estimate of the coherence bias and subtract it. Until this is finalized, the safest approach is to trim datasets before comparison to equal size. > I have sometimes dealt with this problem in the past by > simply z-scoring the volumes afterwards, thus shifting the > means back to zero. But perhaps there are skewness issues as > well? I've mostly done that when playing around with things > like overlapping windows; for example, using an active window > of 0 to 300 ms and a control window of 0 to 250 ms, you > expect a slightly higher power in the active state because of > the increase convergence, but then normalizing that spatially > can give you an estimate of active areas for that 250-300 ms > window. There may also be problematic beamformer overlap in > this case, though, but that can be dealt with too. Just a thought. I agree: If sample sizes are not orders of magnitude different, then a z-transformation can take care of most of the bias. Best, Pascal From litvak at TECHUNIX.TECHNION.AC.IL Mon Feb 27 18:14:16 2006 From: litvak at TECHUNIX.TECHNION.AC.IL (Vladimir Litvak) Date: Mon, 27 Feb 2006 19:14:16 +0200 Subject: Activation vs. baseline In-Reply-To: <13C2688B7C044C179AE9843BC0334507@fcdonders.nl> Message-ID: Dear Pascal, At the last SFN meeting Partha Mitra presented a poster with a method for dealing with exactly this problem. He told me he would put an implementation on his website. It would be nice if you could incorporate that into Fieldtrip. Although it has nothing to do with my original problem it can be helpful for me in other contexts. The abstract is below. Best, Vladimir -------------------------------------- Abstract View COMPARING SPECTRA AND COHERENCES FOR SAMPLES OF UNEQUAL SIZE H.S.Bokil1*; K.Purpura2; D.Thomson3; P.P.Mitra1 1. Cold Spring Harbor Laboratory, Cold Spring Harbor, NY, USA 2. Weill Med. Col. of Cornell Univ., New York, NY, USA 3. Mathematics, Queens Univ., Kingston, ON, Canada The spectrum and the coherency are classical measures of temporal structure of and association between time series. The multitaper method provides robust estimates of these quantities for noisy and non-stationary time series that are characteristic of neurophysiological recordings. This method has recently been shown to be useful in studying working memory and selective visual attention. However, these studies have raised the important technical issue of comparison of spectra or coherences from two samples of unequal sizes, for example when comparing estimates from different experimental conditions. This is difficult with existing statistical tests since the bias in the estimates depends on the sample size. Here we propose a set of procedures to resolve this issue. Our procedure for the coherence is based on the previously described quantity z=(tanh(c)-tanh(d))/sqrt(1/(2m-2)+1/(2n-2)), where c and d are coherence estimates from 2m and 2n samples respectively. When the number of samples is large, then under the null hypothesis of equal population coherence, z is distributed as N(0,1) for a stationary stochastic process. By applying the two sample Jackknife procedure to z, we derive expressions for the mean and variance of z, and declare the coherences to be equal if the Jackknife estimates are consistent with N(0,1). Interestingly, strong inconsistency between the Jackknife and the normal estimates is therefore diagnostic for the presence of non-Gaussian behavior. A similar analysis is also derived for two sample spectra. Finally, we provide application of these methods to experimental data. Support Contributed By: R01 MH62528-03, Cold Spring Harbor Laboratory Citation:H.S. Bokil, K. Purpura, D. Thomson, P.P. Mitra. COMPARING SPECTRA AND COHERENCES FOR SAMPLES OF UNEQUAL SIZE Program No. 689.22. 2005 Abstract Viewer/Itinerary Planner. Washington, DC: Society for Neuroscience, 2005. Online. 2005 Copyright by the Society for Neuroscience all rights reserved. Permission to republish any abstract or part of any abstract in any form must be obtained in writing from the SfN office prior to publication -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Pascal Fries Sent: Monday, February 27, 2006 6:57 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Activation vs. baseline Hi Tom, > Pascal Fries wrote: > > OK. I had been asking, because coherence (and also power) > have a bias > > that is sample size dependent. For those measures, particularly for > > coherence, I would suggest to use equal sample sizes. > > Correct me if I am wrong, but this bias is due to the slow > convergence of the covariance; with more samples, the > covariance converges more (assuming it converges at all). > Furthermore it probably converges 'up', so if you have more > samples, you'll see (apparently) more power. I still haven't fully understood the sample size bias of power. For coherence, the issue is simple to understand. As you write, it has to do with the slow convergence towards the true value as the sample increases. But in the coherence case, values will converge "down" towards the true value, not 'up'. For one trial, coherence is numerically always one and will then decrease as you add more trials. In the case of a true coherence of one, it will not decrease and in the case of a true coherence zero, it will rapidly decrease. This is one of the most important things on the agenda for the basic spectral analysis in FieldTrip: To get a good estimate of the coherence bias and subtract it. Until this is finalized, the safest approach is to trim datasets before comparison to equal size. > I have sometimes dealt with this problem in the past by > simply z-scoring the volumes afterwards, thus shifting the > means back to zero. But perhaps there are skewness issues as > well? I've mostly done that when playing around with things > like overlapping windows; for example, using an active window > of 0 to 300 ms and a control window of 0 to 250 ms, you > expect a slightly higher power in the active state because of > the increase convergence, but then normalizing that spatially > can give you an estimate of active areas for that 250-300 ms > window. There may also be problematic beamformer overlap in > this case, though, but that can be dealt with too. Just a thought. I agree: If sample sizes are not orders of magnitude different, then a z-transformation can take care of most of the bias. Best, Pascal From Daniel.Jokisch at FCDONDERS.RU.NL Mon Feb 27 18:35:18 2006 From: Daniel.Jokisch at FCDONDERS.RU.NL (Daniel Jokisch) Date: Mon, 27 Feb 2006 18:35:18 +0100 Subject: Bug in multiplotTFR? Message-ID: Hi, after analyzing my MEG-data with freqanalysis I wanted to plot the data with multiplotTFR. It does not work and I get the following error message: ??? Reference to non-existent field 'zparam'. Error in ==> multiplotTFR at 123 if (strcmp(cfg.zparam,'cohspctrm')) & (~isfield(data, 'labelcmb')) I have used exactly the same parameters as last time (before the change in Fieltrip). When I define zparam in the configuration, I get the following error message: ??? Error using ==> freqbaseline unsupported data dimensions, dimord should be "chan_freq_time" Error in ==> multiplotTFR at 139 data = freqbaseline(cfg, data); I guess there is a bug in the new version of multiplotTFR. Best, Daniel -- Daniel Jokisch, PhD F.C. Donders Centre for Cognitive Neuroimaging P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Phone: +31 24 36 68294 Fax : +31 24 36 10989 http://www.ru.nl/fcdonders/ From r.oostenveld at FCDONDERS.RU.NL Mon Feb 27 20:50:58 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Feb 2006 20:50:58 +0100 Subject: new plotting functionality Message-ID: Dear all, Dennis has implemented new plotting functions, they have been committed to CVS this afternoon. The most important difference is that of adding the option cfg.interactive='yes' or 'no' (default) If you specify interactive-yes, you can make a selection, click on it, and that selection will be plotted in a new figure. I.e. if you start with a topoplotTFR, you can make a selection of channels, and the average TFR of that channels will be plotted in the next figure as a singleplotTFR. If you select a time-frequency window in that singgleplotTFR, that selection will be plotted in a topoplotTFR. A similar selection is possible in multiplotTFR, and the same interactive sequence of plotting is possible for topo/multi/ singleplotER. In case of 3D (TFR) data, the default xparam is 'time', the yparam is 'freq' and the zparam is powspctrm or cohspctrm. In case of 2D data (event-related field or power spectra), the xparam is either 'time' or 'freq', and the zparam is 'avg' or 'powspctrm'. Please read the documentation of each of the functions for the new options. best regards, Robert & Dennis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Robert Oostenveld, PhD F.C. Donders Centre for Cognitive Neuroimaging Radboud University Nijmegen phone: +31-24-3619695 http://www.ru.nl/fcdonders/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~